import { type WrittenWorkflowPack } from "./write-pack.ts"; export declare const DEEP_REVIEW_WORKFLOW_ID = "deep-review"; export declare const DEEP_REVIEW_TRIGGER = "/deep-review"; /** * The /deep-review workflow body: discover changed files, review each one, * adversarially verify every finding, and return only the confirmed ones. * Fixed orchestration — the script holds the control flow; child agents do * the reading and judging. */ export declare const DEEP_REVIEW_WORKFLOW_BODY = "\nconst FILES_SCHEMA = {\n\ttype: \"object\",\n\trequired: [\"files\"],\n\tproperties: { files: { type: \"array\", items: { type: \"string\" } } },\n};\nconst FINDINGS_SCHEMA = {\n\ttype: \"object\",\n\trequired: [\"findings\"],\n\tproperties: {\n\t\tfindings: {\n\t\t\ttype: \"array\",\n\t\t\titems: {\n\t\t\t\ttype: \"object\",\n\t\t\t\trequired: [\"summary\", \"severity\"],\n\t\t\t\tproperties: {\n\t\t\t\t\tsummary: { type: \"string\" },\n\t\t\t\t\tseverity: { enum: [\"low\", \"medium\", \"high\"] },\n\t\t\t\t\tline: { type: \"integer\" },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\nconst VERDICT_SCHEMA = {\n\ttype: \"object\",\n\trequired: [\"confirmed\"],\n\tproperties: { confirmed: { type: \"boolean\" }, reason: { type: \"string\" } },\n};\n\nrunWorkflow(async ({ args }) => {\n\tconst scope = typeof args.text === \"string\" && args.text.trim() ? args.text.trim() : \"the current working tree\";\n\tconst discovered = await agent(\n\t\t\"List the source files with pending changes in \" +\n\t\t\tscope +\n\t\t\t\". Run 'git diff --name-only HEAD' (fall back to 'git status --porcelain') in the workspace and report the changed source files. Exclude lockfiles and generated output.\",\n\t\t{ schema: FILES_SCHEMA },\n\t);\n\tconst reviews = await pipeline(\n\t\tdiscovered.files,\n\t\t(file) =>\n\t\t\tagent(\n\t\t\t\t\"Review the file \" +\n\t\t\t\t\tfile +\n\t\t\t\t\t\" strictly for correctness bugs in its pending changes: logic errors, broken edge cases, wrong conditions, unsafe assumptions. Read the file before judging. Report only defects you are confident about; do not report style issues.\",\n\t\t\t\t{ schema: FINDINGS_SCHEMA },\n\t\t\t),\n\t\tasync (review, file) => {\n\t\t\tconst verified = await parallel(\n\t\t\t\treview.findings.map((finding) => async () => {\n\t\t\t\t\tconst verdict = await agent(\n\t\t\t\t\t\t\"Adversarially verify this code-review finding for \" +\n\t\t\t\t\t\t\tfile +\n\t\t\t\t\t\t\t': \"' +\n\t\t\t\t\t\t\tfinding.summary +\n\t\t\t\t\t\t\t'\". Read the file and try to REFUTE the finding. Confirm it only if you can point to the concrete failure; default to refuted when uncertain.',\n\t\t\t\t\t\t{ schema: VERDICT_SCHEMA },\n\t\t\t\t\t);\n\t\t\t\t\treturn verdict.confirmed ? { ...finding, file, reason: verdict.reason ?? \"\" } : null;\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn verified.filter(Boolean);\n\t\t},\n\t);\n\tconst findings = reviews\n\t\t.filter(Boolean)\n\t\t.flat()\n\t\t.sort((left, right) => {\n\t\t\tconst rank = { high: 0, medium: 1, low: 2 };\n\t\t\treturn (rank[left.severity] ?? 3) - (rank[right.severity] ?? 3);\n\t\t});\n\tlog(\"deep-review: \" + findings.length + \" confirmed finding(s)\");\n\treturn { scope, findings };\n});\n"; /** The composed single-file component entrypoint (SDK prelude + body). */ export declare function composeDeepReviewEntrypoint(): Promise; /** Write a complete, importable /deep-review optimization pack into `directory`. */ export declare function writeDeepReviewPack(directory: string): Promise; //# sourceMappingURL=deep-review.d.ts.map