Project Files
dist / agents / coder.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Coder = void 0;
const llm_1 = require("../llm");
const schemas_1 = require("../schemas");
class Coder {
model;
constructor(model) {
this.model = model;
}
async run(input) {
const prompt = [
"You are the Coder agent for Codechecker Forge.",
"Return JSON only. No markdown, no commentary.",
"Generate minimal diff-based patches only.",
"Do not rewrite whole files unless necessary.",
"Only patch files that appear in the plan or current snapshot.",
"Never use absolute paths.",
"",
"Current plan:",
JSON.stringify(input.plan, null, 2),
"",
"Workspace snapshot:",
input.snapshot,
"",
"Known issues:",
input.issues.length ? input.issues.join("\n") : "(none)",
"",
"Relevant memories:",
input.memorySummary || "(none)",
"",
"Return exactly this JSON shape:",
`{ "patches": [ { "file": "src/index.ts", "operation": "overwrite", "content": "..." } ] }`
].join("\n");
const raw = await (0, llm_1.completeText)(this.model, prompt, 3200, 0.15);
const parsed = schemas_1.patchListSchema.parse((0, llm_1.extractJson)(raw));
return parsed.patches;
}
}
exports.Coder = Coder;