Project Files
dist / agents / reviewer.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Reviewer = void 0;
const llm_1 = require("../llm");
const schemas_1 = require("../schemas");
class Reviewer {
model;
constructor(model) {
this.model = model;
}
async run(input) {
const prompt = [
"You are the Reviewer agent for Codechecker Forge.",
"Return JSON only. No markdown, no commentary.",
"Check for correctness, entrypoint export, plugin manifest consistency, and obvious loop or safety issues.",
"",
"Plan:",
JSON.stringify(input.plan, null, 2),
"",
"Workspace snapshot:",
input.snapshot,
"",
"Return exactly this JSON shape:",
`{ "passed": true, "issues": [] }`
].join("\n");
const raw = await (0, llm_1.completeText)(this.model, prompt, 2200, 0.15);
try {
const review = schemas_1.buildReviewSchema.parse((0, llm_1.extractJson)(raw));
review.passed = Boolean(review.passed) && review.issues.length === 0;
return review;
}
catch {
return {
passed: false,
issues: ["Reviewer produced invalid JSON"],
};
}
}
}
exports.Reviewer = Reviewer;