Project Files
dist / agents / planner.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Planner = void 0;
const llm_1 = require("../llm");
const schemas_1 = require("../schemas");
class Planner {
model;
memory;
constructor(model, memory) {
this.model = model;
this.memory = memory;
}
async run(spec, workspaceRoot, memorySummary) {
const prompt = [
"You are the Planner agent for Codechecker Forge.",
"Return JSON only. No markdown, no commentary.",
"Your job is to create a plugin scaffold plan for LM Studio.",
"The plugin must export async function main(context).",
"Prefer files for toolsProvider, orchestrator, workspace, memory, and promptPreprocessor.",
"Never invent external dependencies unless required.",
"",
`Workspace root: ${workspaceRoot}`,
"",
"Relevant memories:",
memorySummary || "(none)",
"",
"User goal:",
spec,
"",
"Return exactly this JSON shape:",
`{ "pluginName": "...", "summary": "...", "targetDir": ".forge-generated/<slug>", "files": [{"path": "src/index.ts", "purpose": "..." }], "notes": ["..."] }`
].join("\n");
const raw = await (0, llm_1.completeText)(this.model, prompt, 2600, 0.2);
const plan = schemas_1.buildPlanSchema.parse((0, llm_1.extractJson)(raw));
plan.notes = plan.notes ?? [];
return plan;
}
}
exports.Planner = Planner;