Skip to content
1 change: 0 additions & 1 deletion packages/software-factory/prompts/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ inspect existing state before making changes — do not guess.
# Realms

- Target realm: {{targetRealmUrl}}
- Test realm: {{testRealmUrl}}

{{#each skills}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ async function main(): Promise<void> {
skills: [],
tools: [],
targetRealmUrl: 'https://example.test/user/target/',
testRealmUrl: 'https://example.test/user/target-tests/',
};

log.info('Sending plan() request...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { parseArgs } from 'node:util';
import { logger } from '../../src/logger';

import type {
KnowledgeArticle,
ProjectCard,
IssueCard,
KnowledgeArticleData,
ProjectData,
IssueData,
} from '../../src/factory-agent';
import { ContextBuilder } from '../../src/factory-context-builder';
import {
Expand Down Expand Up @@ -50,12 +50,12 @@ function check(label: string, ok: boolean, detail?: string): void {
// Fixtures
// ---------------------------------------------------------------------------

const SAMPLE_PROJECT: ProjectCard = {
const SAMPLE_PROJECT: ProjectData = {
id: 'Projects/sticky-notes',
name: 'Sticky Notes MVP',
};

const SAMPLE_KNOWLEDGE: KnowledgeArticle[] = [
const SAMPLE_KNOWLEDGE: KnowledgeArticleData[] = [
{
id: 'Knowledge/card-basics',
title: 'Boxel Card Development Basics',
Expand All @@ -68,7 +68,7 @@ const SAMPLE_KNOWLEDGE: KnowledgeArticle[] = [
},
];

const SAMPLE_ISSUES: { label: string; issue: IssueCard }[] = [
const SAMPLE_ISSUES: { label: string; issue: IssueData }[] = [
{
label: 'Card definition (.gts work)',
issue: {
Expand Down Expand Up @@ -152,7 +152,6 @@ async function main(): Promise<void> {
issue,
knowledge: SAMPLE_KNOWLEDGE,
targetRealmUrl: 'https://example.test/user/target/',
testRealmUrl: 'https://example.test/user/target-test-artifacts/',
});

log.info(' First pass (no test results):');
Expand All @@ -172,10 +171,6 @@ async function main(): Promise<void> {
'targetRealmUrl set',
ctx.targetRealmUrl === 'https://example.test/user/target/',
);
check(
'testRealmUrl set',
ctx.testRealmUrl === 'https://example.test/user/target-test-artifacts/',
);

let totalTokens = ctx.skills.reduce((s, sk) => s + estimateTokens(sk), 0);
log.info(` Skill breakdown (~${totalTokens} total tokens):`);
Expand All @@ -195,7 +190,6 @@ async function main(): Promise<void> {
issue,
knowledge: SAMPLE_KNOWLEDGE,
targetRealmUrl: 'https://example.test/user/target/',
testRealmUrl: 'https://example.test/user/target-test-artifacts/',
testResults: {
status: 'failed',
passedCount: 2,
Expand Down Expand Up @@ -254,7 +248,6 @@ async function main(): Promise<void> {
issue: SAMPLE_ISSUES[0].issue,
knowledge: [],
targetRealmUrl: 'https://example.test/user/target/',
testRealmUrl: 'https://example.test/user/target-test-artifacts/',
});

let totalTokens = ctx.skills.reduce((s, sk) => s + estimateTokens(sk), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { logger } from '../../src/logger';

import type {
AgentContext,
KnowledgeArticle,
ProjectCard,
KnowledgeArticleData,
ProjectData,
TestResult,
IssueCard,
IssueData,
} from '../../src/factory-agent';

import type {
Expand Down Expand Up @@ -118,11 +118,10 @@ class MockLoopAgent implements LoopAgent {

class StubContextBuilder implements ContextBuilderLike {
async build(params: {
project: ProjectCard;
issue: IssueCard;
knowledge: KnowledgeArticle[];
project: ProjectData;
issue: IssueData;
knowledge: KnowledgeArticleData[];
targetRealmUrl: string;
testRealmUrl: string;
testResults?: TestResult;
}): Promise<AgentContext> {
return {
Expand All @@ -131,7 +130,6 @@ class StubContextBuilder implements ContextBuilderLike {
knowledge: params.knowledge,
skills: [],
targetRealmUrl: params.targetRealmUrl,
testRealmUrl: params.testRealmUrl,
testResults: params.testResults,
};
}
Expand All @@ -141,18 +139,18 @@ class StubContextBuilder implements ContextBuilderLike {
// Fixtures
// ---------------------------------------------------------------------------

const PROJECT: ProjectCard = {
const PROJECT: ProjectData = {
id: 'Projects/sticky-notes',
name: 'Sticky Notes MVP',
};

const ISSUE: IssueCard = {
const ISSUE: IssueData = {
id: 'Issues/define-sticky-note',
title: 'Define StickyNote card',
description: 'Create a .gts card definition for StickyNote.',
};

const KNOWLEDGE: KnowledgeArticle[] = [
const KNOWLEDGE: KnowledgeArticleData[] = [
{ id: 'Knowledge/card-basics', title: 'Boxel Card Development Basics' },
];

Expand Down Expand Up @@ -198,7 +196,6 @@ function makeBaseConfig(
issue: ISSUE,
knowledge: KNOWLEDGE,
targetRealmUrl: 'https://example.test/target/',
testRealmUrl: 'https://example.test/target-test-artifacts/',
...overrides,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ const SAMPLE_CONTEXT: AgentContext = {
},
],
targetRealmUrl: 'http://localhost:4201/user/personal/',
testRealmUrl: 'http://localhost:4201/user/personal-tests/',
};

const SAMPLE_PREVIOUS_ACTIONS: AgentAction[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
enforceSkillBudget,
estimateTokens,
} from '../../src/factory-skill-loader';
import type { ProjectCard, IssueCard } from '../../src/factory-agent';
import type { ProjectData, IssueData } from '../../src/factory-agent';

const SAMPLE_ISSUES: { label: string; issue: IssueCard }[] = [
const SAMPLE_ISSUES: { label: string; issue: IssueData }[] = [
{
label: 'Generic card work (base case)',
issue: {
Expand Down Expand Up @@ -94,7 +94,7 @@ async function main(): Promise<void> {

let resolver = new DefaultSkillResolver();
let loader = new SkillLoader();
let project: ProjectCard = { id: 'Projects/smoke-test' };
let project: ProjectData = { id: 'Projects/smoke-test' };

log.info('=== Skill Loader & Resolver Smoke Test ===\n');

Expand All @@ -107,7 +107,7 @@ async function main(): Promise<void> {
id: 'Issues/custom',
title: customIssueText,
description: customIssueText,
} as IssueCard,
} as IssueData,
},
]
: SAMPLE_ISSUES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ async function main(): Promise<void> {
let executor = new ToolExecutor(registry, {
packageRoot: process.cwd(),
targetRealmUrl: 'https://realms.example.test/user/target/',
testRealmUrl: 'https://realms.example.test/user/target-tests/',
sourceRealmUrl: 'https://realms.example.test/user/source/',
allowedRealmPrefixes: ['https://realms.example.test/user/scratch-'],
});
Expand Down Expand Up @@ -184,7 +183,6 @@ async function main(): Promise<void> {
let mockExecutor = new ToolExecutor(registry, {
packageRoot: process.cwd(),
targetRealmUrl: 'https://realms.example.test/user/target/',
testRealmUrl: 'https://realms.example.test/user/target-tests/',
fetch: (async (input: RequestInfo | URL, init?: RequestInit) => {
mockCallCount++;
let url = String(input);
Expand Down Expand Up @@ -251,7 +249,6 @@ async function main(): Promise<void> {
let toolBuilderExecutor = new ToolExecutor(registry, {
packageRoot: process.cwd(),
targetRealmUrl: 'https://realms.example.test/user/target/',
testRealmUrl: 'https://realms.example.test/user/target-tests/',
fetch: toolBuilderFetch,
});

Expand Down
1 change: 0 additions & 1 deletion packages/software-factory/src/factory-agent-tool-use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ export class ToolUseFactoryAgent implements LoopAgent {

return this.promptLoader.load('system', {
targetRealmUrl: context.targetRealmUrl,
testRealmUrl: context.testRealmUrl,
skills,
});
}
Expand Down
49 changes: 42 additions & 7 deletions packages/software-factory/src/factory-agent-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ export interface FactoryAgentConfig {
debug?: boolean;
}

export interface ProjectCard {
export interface ProjectData {
id: string;
[key: string]: unknown;
}

export interface IssueCard {
export interface IssueData {
id: string;
[key: string]: unknown;
}

export interface KnowledgeArticle {
export interface KnowledgeArticleData {
id: string;
[key: string]: unknown;
}
Expand Down Expand Up @@ -111,6 +111,38 @@ export interface TestResult {
durationMs: number;
}

// ---------------------------------------------------------------------------
// Validation types (broader than TestResult)
// ---------------------------------------------------------------------------

/** Steps in the post-iteration validation pipeline. */
export type ValidationStep =
| 'parse'
| 'lint'
| 'evaluate'
| 'instantiate'
| 'test';

export interface ValidationError {
file?: string;
message: string;
stackTrace?: string;
}

/** Result of a single validation step. */
export interface ValidationStepResult {
step: ValidationStep;
passed: boolean;
files?: string[];
errors: ValidationError[];
}

/** Aggregated results from a full validation run (all steps). */
export interface ValidationResults {
passed: boolean;
steps: ValidationStepResult[];
}

export interface ToolResult {
tool: string;
exitCode: number;
Expand All @@ -119,9 +151,9 @@ export interface ToolResult {
}

export interface AgentContext {
project: ProjectCard;
issue: IssueCard;
knowledge: KnowledgeArticle[];
project: ProjectData;
issue: IssueData;
knowledge: KnowledgeArticleData[];
skills: ResolvedSkill[];
/** @deprecated Tools are now provided separately as FactoryTool[] to agent.run(). */
tools?: ToolManifest[];
Expand All @@ -133,7 +165,10 @@ export interface AgentContext {
/** @deprecated Iteration tracking is now owned by the orchestrator. */
iteration?: number;
targetRealmUrl: string;
testRealmUrl: string;
/** Validation results from the prior inner-loop iteration. */
validationResults?: ValidationResults;
/** Brief URL for bootstrap issues. */
briefUrl?: string;
}

export interface AgentAction {
Expand Down
Loading
Loading