agent-bober 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/agents/bober-evaluator.md +10 -0
- package/dist/contracts/eval-result.d.ts +339 -0
- package/dist/contracts/eval-result.d.ts.map +1 -1
- package/dist/contracts/eval-result.js +36 -0
- package/dist/contracts/eval-result.js.map +1 -1
- package/dist/evaluators/builtin/playwright.d.ts.map +1 -1
- package/dist/evaluators/builtin/playwright.js +50 -15
- package/dist/evaluators/builtin/playwright.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/orchestrator/agent-loader.d.ts +26 -0
- package/dist/orchestrator/agent-loader.d.ts.map +1 -0
- package/dist/orchestrator/agent-loader.js +125 -0
- package/dist/orchestrator/agent-loader.js.map +1 -0
- package/dist/orchestrator/agentic-loop.d.ts +53 -0
- package/dist/orchestrator/agentic-loop.d.ts.map +1 -0
- package/dist/orchestrator/agentic-loop.js +145 -0
- package/dist/orchestrator/agentic-loop.js.map +1 -0
- package/dist/orchestrator/evaluator-agent.d.ts +4 -1
- package/dist/orchestrator/evaluator-agent.d.ts.map +1 -1
- package/dist/orchestrator/evaluator-agent.js +107 -84
- package/dist/orchestrator/evaluator-agent.js.map +1 -1
- package/dist/orchestrator/generator-agent.d.ts +14 -2
- package/dist/orchestrator/generator-agent.d.ts.map +1 -1
- package/dist/orchestrator/generator-agent.js +96 -73
- package/dist/orchestrator/generator-agent.js.map +1 -1
- package/dist/orchestrator/model-resolver.d.ts +9 -0
- package/dist/orchestrator/model-resolver.d.ts.map +1 -0
- package/dist/orchestrator/model-resolver.js +21 -0
- package/dist/orchestrator/model-resolver.js.map +1 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -1
- package/dist/orchestrator/pipeline.js +21 -4
- package/dist/orchestrator/pipeline.js.map +1 -1
- package/dist/orchestrator/planner-agent.d.ts +3 -2
- package/dist/orchestrator/planner-agent.d.ts.map +1 -1
- package/dist/orchestrator/planner-agent.js +39 -75
- package/dist/orchestrator/planner-agent.js.map +1 -1
- package/dist/orchestrator/tools/handlers.d.ts +9 -0
- package/dist/orchestrator/tools/handlers.d.ts.map +1 -0
- package/dist/orchestrator/tools/handlers.js +279 -0
- package/dist/orchestrator/tools/handlers.js.map +1 -0
- package/dist/orchestrator/tools/index.d.ts +21 -0
- package/dist/orchestrator/tools/index.d.ts.map +1 -0
- package/dist/orchestrator/tools/index.js +33 -0
- package/dist/orchestrator/tools/index.js.map +1 -0
- package/dist/orchestrator/tools/schemas.d.ts +16 -0
- package/dist/orchestrator/tools/schemas.d.ts.map +1 -0
- package/dist/orchestrator/tools/schemas.js +138 -0
- package/dist/orchestrator/tools/schemas.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,58 +3,19 @@ import { serializeHandoff } from "./context-handoff.js";
|
|
|
3
3
|
import { createDefaultRegistry, runEvaluation, } from "../evaluators/registry.js";
|
|
4
4
|
import { getChangedFiles } from "../utils/git.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return "claude-sonnet-4-20250514";
|
|
13
|
-
case "haiku":
|
|
14
|
-
return "claude-haiku-4-20250414";
|
|
15
|
-
default:
|
|
16
|
-
return "claude-sonnet-4-20250514";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// ── Agent Evaluation System Prompt ─────────────────────────────────
|
|
20
|
-
const EVALUATOR_SYSTEM_PROMPT = `You are the Bober Evaluator agent. Your job is to qualitatively assess whether a sprint's implementation meets its contract criteria.
|
|
21
|
-
|
|
22
|
-
You will receive:
|
|
23
|
-
- The sprint contract with success criteria
|
|
24
|
-
- The context handoff with implementation notes
|
|
25
|
-
- Results from automated checks (typecheck, lint, tests, etc.)
|
|
26
|
-
|
|
27
|
-
For each success criterion that cannot be automatically verified, assess whether it has been met based on the implementation description and changed files.
|
|
28
|
-
|
|
29
|
-
Output format — respond with a JSON object:
|
|
30
|
-
{
|
|
31
|
-
"evaluator": "Agent Evaluation",
|
|
32
|
-
"passed": true/false,
|
|
33
|
-
"score": 0-100,
|
|
34
|
-
"details": [
|
|
35
|
-
{
|
|
36
|
-
"criterion": "criterion id or description",
|
|
37
|
-
"passed": true/false,
|
|
38
|
-
"message": "explanation",
|
|
39
|
-
"severity": "error" | "warning" | "info"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"summary": "Overall assessment",
|
|
43
|
-
"feedback": "Actionable feedback for the generator if anything needs fixing",
|
|
44
|
-
"timestamp": "<ISO datetime>"
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Guidelines:
|
|
48
|
-
- Be thorough but fair. If the implementation reasonably meets a criterion, mark it as passed.
|
|
49
|
-
- If automated checks already cover a criterion, you can defer to their results.
|
|
50
|
-
- Focus on criteria that require human-like judgment: code quality, architectural decisions, completeness.
|
|
51
|
-
- Provide specific, actionable feedback when something fails.
|
|
52
|
-
|
|
53
|
-
Output ONLY the JSON object. No markdown fences, no explanation.`;
|
|
6
|
+
import { resolveModel } from "./model-resolver.js";
|
|
7
|
+
import { loadAgentDefinition } from "./agent-loader.js";
|
|
8
|
+
import { buildToolSet } from "./tools/index.js";
|
|
9
|
+
import { runAgenticLoop } from "./agentic-loop.js";
|
|
10
|
+
// ── Constants ──────────────────────────────────────────────────────
|
|
11
|
+
const EVALUATOR_MAX_TURNS = 25;
|
|
54
12
|
// ── Main ───────────────────────────────────────────────────────────
|
|
55
13
|
/**
|
|
56
14
|
* Run the evaluator agent, combining programmatic evaluation (plugins)
|
|
57
|
-
* with agent-based qualitative evaluation.
|
|
15
|
+
* with agent-based qualitative evaluation using tools.
|
|
16
|
+
*
|
|
17
|
+
* The evaluator agent can read files, run bash commands (tests, dev server,
|
|
18
|
+
* screenshots), and search the codebase — but CANNOT write or edit files.
|
|
58
19
|
*
|
|
59
20
|
* @param handoff Context handoff for the current sprint.
|
|
60
21
|
* @param projectRoot Absolute path to the project.
|
|
@@ -73,9 +34,10 @@ export async function runEvaluatorAgent(handoff, projectRoot, config) {
|
|
|
73
34
|
const registry = await createDefaultRegistry(config);
|
|
74
35
|
let changedFiles;
|
|
75
36
|
try {
|
|
76
|
-
changedFiles =
|
|
77
|
-
|
|
78
|
-
|
|
37
|
+
changedFiles =
|
|
38
|
+
handoff.changedFiles.length > 0
|
|
39
|
+
? handoff.changedFiles
|
|
40
|
+
: await getChangedFiles(projectRoot);
|
|
79
41
|
}
|
|
80
42
|
catch {
|
|
81
43
|
changedFiles = handoff.changedFiles;
|
|
@@ -85,10 +47,10 @@ export async function runEvaluatorAgent(handoff, projectRoot, config) {
|
|
|
85
47
|
const icon = result.passed ? "PASS" : "FAIL";
|
|
86
48
|
logger.debug(` [${icon}] ${result.evaluator}: ${result.summary}`);
|
|
87
49
|
}
|
|
88
|
-
// 2. Agent evaluation — qualitative assessment via
|
|
50
|
+
// 2. Agent evaluation — qualitative assessment via agentic loop with tools
|
|
89
51
|
logger.info("Running agent evaluation...");
|
|
90
|
-
const agentResult = await runAgentEvaluation(handoff, programmaticEval.results, config);
|
|
91
|
-
// 3. Combine results
|
|
52
|
+
const agentResult = await runAgentEvaluation(handoff, programmaticEval.results, projectRoot, config);
|
|
53
|
+
// 3. Combine results
|
|
92
54
|
const allResults = [...programmaticEval.results, agentResult];
|
|
93
55
|
const scoredResults = allResults.filter((r) => r.score !== undefined);
|
|
94
56
|
const avgScore = scoredResults.length > 0
|
|
@@ -111,45 +73,105 @@ export async function runEvaluatorAgent(handoff, projectRoot, config) {
|
|
|
111
73
|
logger.sprint(sprintId, `Evaluation ${statusLabel}`);
|
|
112
74
|
return evaluation;
|
|
113
75
|
}
|
|
76
|
+
// ── Agent evaluation with tools ────────────────────────────────────
|
|
114
77
|
/**
|
|
115
|
-
* Run the agent-based qualitative evaluation
|
|
78
|
+
* Run the agent-based qualitative evaluation using a multi-turn agentic
|
|
79
|
+
* loop with bash, read_file, glob, and grep tools.
|
|
80
|
+
*
|
|
81
|
+
* The evaluator can run commands, take screenshots, inspect code, start
|
|
82
|
+
* dev servers, and curl endpoints — but CANNOT write or edit files.
|
|
116
83
|
*/
|
|
117
|
-
async function runAgentEvaluation(handoff, programmaticResults, config) {
|
|
118
|
-
const model = resolveModel(config.evaluator.model);
|
|
119
|
-
const client = new Anthropic();
|
|
84
|
+
async function runAgentEvaluation(handoff, programmaticResults, projectRoot, config) {
|
|
120
85
|
const timestamp = new Date().toISOString();
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
86
|
+
try {
|
|
87
|
+
// Load agent definition (system prompt from .md file)
|
|
88
|
+
const agentDef = await loadAgentDefinition("bober-evaluator", projectRoot);
|
|
89
|
+
const model = resolveModel(config.evaluator.model);
|
|
90
|
+
// Build tool set (evaluator: bash, read_file, glob, grep — NO write/edit)
|
|
91
|
+
const toolSet = buildToolSet("evaluator", projectRoot);
|
|
92
|
+
const client = new Anthropic();
|
|
93
|
+
const handoffJson = serializeHandoff(handoff);
|
|
94
|
+
// Format programmatic results for context
|
|
95
|
+
const programmaticSummary = programmaticResults
|
|
96
|
+
.map((r) => {
|
|
97
|
+
const lines = [`[${r.passed ? "PASS" : "FAIL"}] ${r.evaluator}: ${r.summary}`];
|
|
98
|
+
if (!r.passed && r.feedback) {
|
|
99
|
+
lines.push(` Feedback: ${r.feedback}`);
|
|
100
|
+
}
|
|
101
|
+
for (const detail of r.details) {
|
|
102
|
+
if (!detail.passed) {
|
|
103
|
+
const loc = detail.file
|
|
104
|
+
? ` at ${detail.file}${detail.line !== undefined ? `:${detail.line}` : ""}`
|
|
105
|
+
: "";
|
|
106
|
+
lines.push(` [${detail.severity.toUpperCase()}] ${detail.message}${loc}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return lines.join("\n");
|
|
110
|
+
})
|
|
111
|
+
.join("\n\n");
|
|
112
|
+
const contract = handoff.currentContract;
|
|
113
|
+
const criteriaList = contract?.successCriteria
|
|
114
|
+
?.map((c, i) => `${i + 1}. [${c.id}] ${c.description} (verification: ${c.verificationMethod})`)
|
|
115
|
+
.join("\n") ?? "No criteria found.";
|
|
116
|
+
const userMessage = `# Context Handoff
|
|
126
117
|
${handoffJson}
|
|
127
118
|
|
|
128
|
-
#
|
|
119
|
+
# Project Root
|
|
120
|
+
${projectRoot}
|
|
121
|
+
|
|
122
|
+
# Automated Check Results (already completed)
|
|
129
123
|
${programmaticSummary}
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
# Success Criteria to Verify
|
|
126
|
+
${criteriaList}
|
|
132
127
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
# Your Task
|
|
129
|
+
Evaluate whether the sprint contract criteria have been met. Use your tools to:
|
|
130
|
+
1. Read the relevant source files to verify implementation
|
|
131
|
+
2. Run the dev server and test the application if applicable
|
|
132
|
+
3. Take Playwright screenshots if applicable: \`npx playwright screenshot http://localhost:3000 /tmp/bober-eval.png --full-page\`
|
|
133
|
+
4. Run any additional verification commands
|
|
134
|
+
5. Check for regressions
|
|
135
|
+
|
|
136
|
+
Be skeptical. Verify independently. Do not trust the generator's self-report alone.
|
|
137
|
+
|
|
138
|
+
Your final response must contain ONLY a JSON object matching this schema (no markdown fences):
|
|
139
|
+
{
|
|
140
|
+
"evaluator": "Agent Evaluation",
|
|
141
|
+
"passed": true/false,
|
|
142
|
+
"score": 0-100,
|
|
143
|
+
"details": [
|
|
144
|
+
{
|
|
145
|
+
"criterion": "criterion id or description",
|
|
146
|
+
"passed": true/false,
|
|
147
|
+
"message": "explanation with evidence",
|
|
148
|
+
"severity": "error" | "warning" | "info",
|
|
149
|
+
"file": "file path if applicable",
|
|
150
|
+
"line": 123
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"summary": "Overall assessment",
|
|
154
|
+
"feedback": "Actionable feedback for the generator if anything needs fixing",
|
|
155
|
+
"timestamp": "${timestamp}"
|
|
156
|
+
}`;
|
|
157
|
+
logger.info(`Calling evaluator model (${config.evaluator.model} → ${model})...`);
|
|
158
|
+
const result = await runAgenticLoop({
|
|
159
|
+
client,
|
|
136
160
|
model,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
161
|
+
systemPrompt: agentDef.systemPrompt,
|
|
162
|
+
userMessage,
|
|
163
|
+
tools: toolSet.schemas,
|
|
164
|
+
toolHandlers: toolSet.handlers,
|
|
165
|
+
maxTurns: EVALUATOR_MAX_TURNS,
|
|
166
|
+
maxTokens: 16384,
|
|
167
|
+
onToolUse: (name, input) => {
|
|
168
|
+
const inp = input;
|
|
169
|
+
const inputStr = JSON.stringify(inp).slice(0, 120);
|
|
170
|
+
logger.debug(` [evaluator] ${name}(${inputStr})`);
|
|
171
|
+
},
|
|
145
172
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (block.type === "text") {
|
|
149
|
-
responseText += block.text;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return parseEvalResult(responseText, timestamp);
|
|
173
|
+
logger.debug(`Evaluator completed in ${result.turnsUsed} turns (${result.toolsCalled.length} tool calls)`);
|
|
174
|
+
return parseEvalResult(result.finalText, timestamp);
|
|
153
175
|
}
|
|
154
176
|
catch (err) {
|
|
155
177
|
logger.warn(`Agent evaluation failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -164,6 +186,7 @@ Output ONLY a JSON object matching the EvalResult schema. No markdown fences.`;
|
|
|
164
186
|
};
|
|
165
187
|
}
|
|
166
188
|
}
|
|
189
|
+
// ── JSON parser ────────────────────────────────────────────────────
|
|
167
190
|
/**
|
|
168
191
|
* Parse the evaluator agent's response into an EvalResult.
|
|
169
192
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/evaluator-agent.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"evaluator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/evaluator-agent.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAInD,sEAAsE;AAEtE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,sEAAsE;AAEtE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAuB,EACvB,WAAmB,EACnB,MAAmB;IAEnB,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CA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ult {
|
|
|
5
5
|
notes: string;
|
|
6
6
|
filesChanged: string[];
|
|
7
7
|
commitHash?: string;
|
|
8
|
+
/** Number of agentic loop turns used. */
|
|
9
|
+
turnsUsed?: number;
|
|
10
|
+
/** Tools called during generation. */
|
|
11
|
+
toolsCalled?: string[];
|
|
12
|
+
/** Token usage. */
|
|
13
|
+
usage?: {
|
|
14
|
+
inputTokens: number;
|
|
15
|
+
outputTokens: number;
|
|
16
|
+
};
|
|
8
17
|
}
|
|
9
18
|
/**
|
|
10
19
|
* Run the generator agent to implement changes for a sprint.
|
|
11
20
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
21
|
+
* Uses a multi-turn agentic loop with full tool access (bash, read/write/edit
|
|
22
|
+
* files, glob, grep). The agent actually reads the codebase, writes code,
|
|
23
|
+
* runs tests, and commits — all via tools.
|
|
24
|
+
*
|
|
25
|
+
* The system prompt is loaded from `agents/bober-generator.md`.
|
|
14
26
|
*/
|
|
15
27
|
export declare function runGenerator(handoff: ContextHandoff, projectRoot: string, config: BoberConfig): Promise<GeneratorResult>;
|
|
16
28
|
//# sourceMappingURL=generator-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-agent.d.ts","sourceRoot":"","sources":["../../src/orchestrator/generator-agent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"generator-agent.d.ts","sourceRoot":"","sources":["../../src/orchestrator/generator-agent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAU3D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB;IACnB,KAAK,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AAID;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,eAAe,CAAC,CAyE1B"}
|
|
@@ -1,61 +1,30 @@
|
|
|
1
1
|
import Anthropic from "@anthropic-ai/sdk";
|
|
2
2
|
import { serializeHandoff } from "./context-handoff.js";
|
|
3
3
|
import { logger } from "../utils/logger.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return "claude-sonnet-4-20250514";
|
|
9
|
-
case "sonnet":
|
|
10
|
-
return "claude-sonnet-4-20250514";
|
|
11
|
-
case "haiku":
|
|
12
|
-
return "claude-haiku-4-20250414";
|
|
13
|
-
default:
|
|
14
|
-
return "claude-sonnet-4-20250514";
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// ── System prompt ──────────────────────────────────────────────────
|
|
18
|
-
const GENERATOR_SYSTEM_PROMPT = `You are the Bober Generator agent. Your job is to implement code changes according to a sprint contract.
|
|
19
|
-
|
|
20
|
-
You will receive a context handoff document containing:
|
|
21
|
-
- The overall plan specification
|
|
22
|
-
- The current sprint contract with success criteria
|
|
23
|
-
- History of completed sprints
|
|
24
|
-
- Any feedback from prior evaluation rounds
|
|
25
|
-
|
|
26
|
-
Your responsibilities:
|
|
27
|
-
1. Implement the changes described in the sprint contract.
|
|
28
|
-
2. Follow the success criteria exactly — each criterion must be met.
|
|
29
|
-
3. Work incrementally: make small, testable changes.
|
|
30
|
-
4. Self-verify before reporting completion.
|
|
31
|
-
5. If you received evaluation feedback, address every issue mentioned.
|
|
32
|
-
|
|
33
|
-
Output format — respond with a JSON object:
|
|
34
|
-
{
|
|
35
|
-
"success": true/false,
|
|
36
|
-
"notes": "Description of what was implemented and any issues encountered",
|
|
37
|
-
"filesChanged": ["list", "of", "changed", "file", "paths"]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Guidelines:
|
|
41
|
-
- Follow existing code style and conventions in the project.
|
|
42
|
-
- Do not break existing functionality.
|
|
43
|
-
- If a task cannot be completed, set success to false and explain why in notes.
|
|
44
|
-
- List ALL files that were created, modified, or deleted.
|
|
45
|
-
|
|
46
|
-
Output ONLY the JSON object. No markdown fences, no explanation.`;
|
|
4
|
+
import { resolveModel } from "./model-resolver.js";
|
|
5
|
+
import { loadAgentDefinition } from "./agent-loader.js";
|
|
6
|
+
import { buildToolSet } from "./tools/index.js";
|
|
7
|
+
import { runAgenticLoop } from "./agentic-loop.js";
|
|
47
8
|
// ── Main ───────────────────────────────────────────────────────────
|
|
48
9
|
/**
|
|
49
10
|
* Run the generator agent to implement changes for a sprint.
|
|
50
11
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
12
|
+
* Uses a multi-turn agentic loop with full tool access (bash, read/write/edit
|
|
13
|
+
* files, glob, grep). The agent actually reads the codebase, writes code,
|
|
14
|
+
* runs tests, and commits — all via tools.
|
|
15
|
+
*
|
|
16
|
+
* The system prompt is loaded from `agents/bober-generator.md`.
|
|
53
17
|
*/
|
|
54
18
|
export async function runGenerator(handoff, projectRoot, config) {
|
|
55
19
|
const contractId = handoff.currentContract?.id ?? "unknown";
|
|
56
20
|
const feature = handoff.currentContract?.feature ?? "unknown";
|
|
57
21
|
logger.sprint(contractId, `Generating: ${feature}`);
|
|
22
|
+
// Load agent definition (system prompt from .md file)
|
|
23
|
+
const agentDef = await loadAgentDefinition("bober-generator", projectRoot);
|
|
58
24
|
const model = resolveModel(config.generator.model);
|
|
25
|
+
const maxTurns = config.generator.maxTurnsPerSprint;
|
|
26
|
+
// Build tool set (generator gets full access)
|
|
27
|
+
const toolSet = buildToolSet("generator", projectRoot);
|
|
59
28
|
const client = new Anthropic();
|
|
60
29
|
const handoffJson = serializeHandoff(handoff);
|
|
61
30
|
const userMessage = `# Context Handoff
|
|
@@ -65,34 +34,55 @@ ${handoffJson}
|
|
|
65
34
|
${projectRoot}
|
|
66
35
|
|
|
67
36
|
Implement the changes described in the sprint contract. Follow every success criterion.
|
|
68
|
-
|
|
37
|
+
Use your tools to read the codebase, write code, run tests, and verify your work.
|
|
38
|
+
${handoff.issues.length > 0 ? `\n# Previous Issues to Fix\n${handoff.issues.join("\n\n")}` : ""}
|
|
69
39
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
40
|
+
When you are done, your final response must contain ONLY a JSON object with this structure (no markdown fences):
|
|
41
|
+
{
|
|
42
|
+
"contractId": "${contractId}",
|
|
43
|
+
"status": "complete | partial | blocked",
|
|
44
|
+
"criteriaResults": [
|
|
45
|
+
{"criterionId": "sc-X-Y", "met": true/false, "evidence": "<how you verified>"}
|
|
46
|
+
],
|
|
47
|
+
"filesChanged": [
|
|
48
|
+
{"path": "<file path>", "action": "created | modified | deleted", "description": "<what changed>"}
|
|
49
|
+
],
|
|
50
|
+
"testsAdded": ["<test file paths>"],
|
|
51
|
+
"commits": ["<hash> - <message>"],
|
|
52
|
+
"blockers": ["<any unresolved issues>"],
|
|
53
|
+
"notes": "<additional context for the evaluator>"
|
|
54
|
+
}`;
|
|
55
|
+
logger.info(`Calling generator model (${config.generator.model} → ${model})...`);
|
|
56
|
+
// Track which files were written/edited via tools
|
|
57
|
+
const filesWritten = new Set();
|
|
58
|
+
const result = await runAgenticLoop({
|
|
59
|
+
client,
|
|
73
60
|
model,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
systemPrompt: agentDef.systemPrompt,
|
|
62
|
+
userMessage,
|
|
63
|
+
tools: toolSet.schemas,
|
|
64
|
+
toolHandlers: toolSet.handlers,
|
|
65
|
+
maxTurns,
|
|
66
|
+
maxTokens: 16384,
|
|
67
|
+
onToolUse: (name, input) => {
|
|
68
|
+
const inp = input;
|
|
69
|
+
if (name === "write_file" || name === "edit_file") {
|
|
70
|
+
const path = inp.file_path;
|
|
71
|
+
if (path)
|
|
72
|
+
filesWritten.add(path);
|
|
73
|
+
}
|
|
74
|
+
const inputStr = JSON.stringify(inp).slice(0, 120);
|
|
75
|
+
logger.debug(` [generator] ${name}(${inputStr})`);
|
|
76
|
+
},
|
|
82
77
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (block.type === "text") {
|
|
86
|
-
responseText += block.text;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
logger.debug("Generator response received, parsing...");
|
|
90
|
-
return parseGeneratorResult(responseText);
|
|
78
|
+
logger.debug(`Generator completed in ${result.turnsUsed} turns (${result.toolsCalled.length} tool calls)`);
|
|
79
|
+
return parseGeneratorResult(result.finalText, filesWritten, result);
|
|
91
80
|
}
|
|
81
|
+
// ── JSON parser ────────────────────────────────────────────────────
|
|
92
82
|
/**
|
|
93
83
|
* Parse the generator response text into a GeneratorResult.
|
|
94
84
|
*/
|
|
95
|
-
function parseGeneratorResult(text) {
|
|
85
|
+
function parseGeneratorResult(text, filesWritten, loopResult) {
|
|
96
86
|
let parsed;
|
|
97
87
|
// Try direct parse
|
|
98
88
|
try {
|
|
@@ -126,22 +116,55 @@ function parseGeneratorResult(text) {
|
|
|
126
116
|
if (parsed &&
|
|
127
117
|
typeof parsed === "object" &&
|
|
128
118
|
parsed !== null &&
|
|
129
|
-
"success" in parsed) {
|
|
119
|
+
("success" in parsed || "status" in parsed)) {
|
|
130
120
|
const obj = parsed;
|
|
121
|
+
// Support both old format (success: bool) and new format (status: string)
|
|
122
|
+
const success = "success" in obj
|
|
123
|
+
? Boolean(obj.success)
|
|
124
|
+
: obj.status === "complete";
|
|
125
|
+
// Merge file paths from tool tracking and from the report
|
|
126
|
+
const reportFiles = Array.isArray(obj.filesChanged)
|
|
127
|
+
? obj.filesChanged
|
|
128
|
+
.map((f) => {
|
|
129
|
+
if (typeof f === "string")
|
|
130
|
+
return f;
|
|
131
|
+
if (typeof f === "object" && f !== null && "path" in f)
|
|
132
|
+
return String(f.path);
|
|
133
|
+
return null;
|
|
134
|
+
})
|
|
135
|
+
.filter((f) => f !== null)
|
|
136
|
+
: [];
|
|
137
|
+
const allFiles = [...new Set([...filesWritten, ...reportFiles])];
|
|
131
138
|
return {
|
|
132
|
-
success
|
|
133
|
-
notes: typeof obj.notes === "string"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
success,
|
|
140
|
+
notes: typeof obj.notes === "string"
|
|
141
|
+
? obj.notes
|
|
142
|
+
: "No notes provided.",
|
|
143
|
+
filesChanged: allFiles,
|
|
137
144
|
commitHash: typeof obj.commitHash === "string" ? obj.commitHash : undefined,
|
|
145
|
+
turnsUsed: loopResult.turnsUsed,
|
|
146
|
+
toolsCalled: loopResult.toolsCalled,
|
|
147
|
+
usage: loopResult.usage,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// If parsing failed entirely, check if we at least wrote files
|
|
151
|
+
if (filesWritten.size > 0) {
|
|
152
|
+
return {
|
|
153
|
+
success: true,
|
|
154
|
+
notes: `Generator wrote ${filesWritten.size} files but did not produce a structured report. Files: ${[...filesWritten].join(", ")}`,
|
|
155
|
+
filesChanged: [...filesWritten],
|
|
156
|
+
turnsUsed: loopResult.turnsUsed,
|
|
157
|
+
toolsCalled: loopResult.toolsCalled,
|
|
158
|
+
usage: loopResult.usage,
|
|
138
159
|
};
|
|
139
160
|
}
|
|
140
|
-
// If parsing failed entirely, return a failure result
|
|
141
161
|
return {
|
|
142
162
|
success: false,
|
|
143
163
|
notes: `Failed to parse generator response. Raw output:\n${text.slice(0, 500)}`,
|
|
144
164
|
filesChanged: [],
|
|
165
|
+
turnsUsed: loopResult.turnsUsed,
|
|
166
|
+
toolsCalled: loopResult.toolsCalled,
|
|
167
|
+
usage: loopResult.usage,
|
|
145
168
|
};
|
|
146
169
|
}
|
|
147
170
|
//# sourceMappingURL=generator-agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/generator-agent.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"generator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/generator-agent.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiBnD,sEAAsE;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAuB,EACvB,WAAmB,EACnB,MAAmB;IAEnB,MAAM,UAAU,GAAG,OAAO,CAAC,eAAe,EAAE,EAAE,IAAI,SAAS,CAAC;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,EAAE,OAAO,IAAI,SAAS,CAAC;IAE9D,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,eAAe,OAAO,EAAE,CAAC,CAAC;IAEpD,s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
|
|
3
|
+
*
|
|
4
|
+
* Maps user-friendly model names (from bober.config.json) to
|
|
5
|
+
* actual Anthropic model IDs. Also accepts exact model IDs
|
|
6
|
+
* as pass-through.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveModel(choice: string): string;
|
|
9
|
+
//# sourceMappingURL=model-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-resolver.d.ts","sourceRoot":"","sources":["../../src/orchestrator/model-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAYnD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized model name resolution.
|
|
3
|
+
*
|
|
4
|
+
* Maps user-friendly model names (from bober.config.json) to
|
|
5
|
+
* actual Anthropic model IDs. Also accepts exact model IDs
|
|
6
|
+
* as pass-through.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveModel(choice) {
|
|
9
|
+
switch (choice) {
|
|
10
|
+
case "opus":
|
|
11
|
+
return "claude-opus-4-6";
|
|
12
|
+
case "sonnet":
|
|
13
|
+
return "claude-sonnet-4-6";
|
|
14
|
+
case "haiku":
|
|
15
|
+
return "claude-haiku-4-5-20251001";
|
|
16
|
+
default:
|
|
17
|
+
// Pass through exact model IDs (e.g. "claude-sonnet-4-6")
|
|
18
|
+
return choice;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=model-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-resolver.js","sourceRoot":"","sources":["../../src/orchestrator/model-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,iBAAiB,CAAC;QAC3B,KAAK,QAAQ;YACX,OAAO,mBAAmB,CAAC;QAC7B,KAAK,OAAO;YACV,OAAO,2BAA2B,CAAC;QACrC;YACE,0DAA0D;YAC1D,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/orchestrator/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA0BtE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/orchestrator/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA0BtE,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAsRD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAuHzB"}
|