@zhixuan92/multi-model-agent-core 4.0.3 → 4.0.5
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 +10 -12
- package/dist/events/cloud-events.d.ts +1 -3
- package/dist/events/cloud-events.d.ts.map +1 -1
- package/dist/events/event-builder.d.ts +1 -1
- package/dist/events/event-builder.d.ts.map +1 -1
- package/dist/events/observability-events.d.ts +3 -111
- package/dist/events/observability-events.d.ts.map +1 -1
- package/dist/events/observability-events.js +0 -58
- package/dist/events/observability-events.js.map +1 -1
- package/dist/events/telemetry-types.d.ts +3 -3
- package/dist/events/telemetry-types.js +1 -1
- package/dist/events/telemetry-types.js.map +1 -1
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/intake/brief-compiler-slots/debug.d.ts +0 -26
- package/dist/intake/brief-compiler-slots/debug.d.ts.map +1 -1
- package/dist/intake/brief-compiler-slots/debug.js +5 -44
- package/dist/intake/brief-compiler-slots/debug.js.map +1 -1
- package/dist/intake/brief-compiler-slots/delegate.d.ts +0 -24
- package/dist/intake/brief-compiler-slots/delegate.d.ts.map +1 -1
- package/dist/intake/brief-compiler-slots/delegate.js +2 -45
- package/dist/intake/brief-compiler-slots/delegate.js.map +1 -1
- package/dist/intake/brief-compiler-slots/research.d.ts +18 -0
- package/dist/intake/brief-compiler-slots/research.d.ts.map +1 -0
- package/dist/intake/brief-compiler-slots/research.js +43 -0
- package/dist/intake/brief-compiler-slots/research.js.map +1 -0
- package/dist/intake/brief-compiler-slots/review.d.ts +0 -23
- package/dist/intake/brief-compiler-slots/review.d.ts.map +1 -1
- package/dist/intake/brief-compiler-slots/review.js +0 -62
- package/dist/intake/brief-compiler-slots/review.js.map +1 -1
- package/dist/lifecycle/diff-tracker.d.ts +72 -0
- package/dist/lifecycle/diff-tracker.d.ts.map +1 -0
- package/dist/lifecycle/diff-tracker.js +316 -0
- package/dist/lifecycle/diff-tracker.js.map +1 -0
- package/dist/lifecycle/handlers/prepare-execution-context-handler.d.ts +1 -1
- package/dist/lifecycle/handlers/prepare-execution-context-handler.d.ts.map +1 -1
- package/dist/lifecycle/handlers/prepare-execution-context-handler.js +23 -1
- package/dist/lifecycle/handlers/prepare-execution-context-handler.js.map +1 -1
- package/dist/lifecycle/handlers/quality-chain-handlers.d.ts.map +1 -1
- package/dist/lifecycle/handlers/quality-chain-handlers.js +57 -6
- package/dist/lifecycle/handlers/quality-chain-handlers.js.map +1 -1
- package/dist/lifecycle/handlers/review-diff-handler.d.ts.map +1 -1
- package/dist/lifecycle/handlers/review-diff-handler.js +38 -12
- package/dist/lifecycle/handlers/review-diff-handler.js.map +1 -1
- package/dist/lifecycle/handlers/spec-chain-handlers.d.ts.map +1 -1
- package/dist/lifecycle/handlers/spec-chain-handlers.js +38 -10
- package/dist/lifecycle/handlers/spec-chain-handlers.js.map +1 -1
- package/dist/lifecycle/handlers/terminal-handlers.d.ts.map +1 -1
- package/dist/lifecycle/handlers/terminal-handlers.js +17 -2
- package/dist/lifecycle/handlers/terminal-handlers.js.map +1 -1
- package/dist/lifecycle/merge-stage-stats.d.ts +27 -0
- package/dist/lifecycle/merge-stage-stats.d.ts.map +1 -1
- package/dist/lifecycle/merge-stage-stats.js +56 -0
- package/dist/lifecycle/merge-stage-stats.js.map +1 -1
- package/dist/lifecycle/stage-plan-types.d.ts +15 -0
- package/dist/lifecycle/stage-plan-types.d.ts.map +1 -1
- package/dist/lifecycle/stage-progression.d.ts.map +1 -1
- package/dist/lifecycle/stage-progression.js +1 -0
- package/dist/lifecycle/stage-progression.js.map +1 -1
- package/dist/lifecycle/task-runner.js +1 -1
- package/dist/lifecycle/task-runner.js.map +1 -1
- package/dist/providers/provider-factory.d.ts.map +1 -1
- package/dist/providers/provider-factory.js +6 -0
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/reporting/headline-templates/audit.d.ts.map +1 -1
- package/dist/reporting/headline-templates/audit.js +17 -8
- package/dist/reporting/headline-templates/audit.js.map +1 -1
- package/dist/reporting/headline-templates/debug.d.ts +22 -3
- package/dist/reporting/headline-templates/debug.d.ts.map +1 -1
- package/dist/reporting/headline-templates/debug.js +38 -8
- package/dist/reporting/headline-templates/debug.js.map +1 -1
- package/dist/reporting/headline-templates/delegate.d.ts.map +1 -1
- package/dist/reporting/headline-templates/delegate.js +14 -3
- package/dist/reporting/headline-templates/delegate.js.map +1 -1
- package/dist/reporting/headline-templates/execute-plan.d.ts.map +1 -1
- package/dist/reporting/headline-templates/execute-plan.js +17 -8
- package/dist/reporting/headline-templates/execute-plan.js.map +1 -1
- package/dist/reporting/headline-templates/research.d.ts +3 -0
- package/dist/reporting/headline-templates/research.d.ts.map +1 -0
- package/dist/reporting/headline-templates/research.js +23 -0
- package/dist/reporting/headline-templates/research.js.map +1 -0
- package/dist/reporting/headline-templates/review.d.ts.map +1 -1
- package/dist/reporting/headline-templates/review.js +23 -6
- package/dist/reporting/headline-templates/review.js.map +1 -1
- package/dist/reporting/headline-templates/verify.d.ts.map +1 -1
- package/dist/reporting/headline-templates/verify.js +23 -6
- package/dist/reporting/headline-templates/verify.js.map +1 -1
- package/dist/reporting/headline-text.d.ts +5 -0
- package/dist/reporting/headline-text.d.ts.map +1 -1
- package/dist/reporting/headline-text.js +36 -5
- package/dist/reporting/headline-text.js.map +1 -1
- package/dist/reporting/report-parser-slots/research-report.d.ts +30 -0
- package/dist/reporting/report-parser-slots/research-report.d.ts.map +1 -0
- package/dist/reporting/report-parser-slots/research-report.js +94 -0
- package/dist/reporting/report-parser-slots/research-report.js.map +1 -0
- package/dist/reporting/report-parser-slots/verify-report.d.ts +17 -0
- package/dist/reporting/report-parser-slots/verify-report.d.ts.map +1 -1
- package/dist/reporting/report-parser-slots/verify-report.js +45 -3
- package/dist/reporting/report-parser-slots/verify-report.js.map +1 -1
- package/dist/reporting/severity.d.ts +22 -0
- package/dist/reporting/severity.d.ts.map +1 -1
- package/dist/reporting/severity.js +36 -0
- package/dist/reporting/severity.js.map +1 -1
- package/dist/review/annotator-output-parser.d.ts.map +1 -1
- package/dist/review/annotator-output-parser.js +94 -14
- package/dist/review/annotator-output-parser.js.map +1 -1
- package/dist/review/annotator-prompt-builder.d.ts +20 -0
- package/dist/review/annotator-prompt-builder.d.ts.map +1 -1
- package/dist/review/annotator-prompt-builder.js +54 -3
- package/dist/review/annotator-prompt-builder.js.map +1 -1
- package/dist/review/reviewer-engine.d.ts +15 -1
- package/dist/review/reviewer-engine.d.ts.map +1 -1
- package/dist/review/reviewer-engine.js.map +1 -1
- package/dist/review/reviewer-output-parser.d.ts.map +1 -1
- package/dist/review/reviewer-output-parser.js +171 -16
- package/dist/review/reviewer-output-parser.js.map +1 -1
- package/dist/review/reviewer-prompt-builder.d.ts +5 -13
- package/dist/review/reviewer-prompt-builder.d.ts.map +1 -1
- package/dist/review/reviewer-prompt-builder.js.map +1 -1
- package/dist/review/templates/annotator-audit.d.ts.map +1 -1
- package/dist/review/templates/annotator-audit.js +13 -0
- package/dist/review/templates/annotator-audit.js.map +1 -1
- package/dist/review/templates/annotator-debug.d.ts.map +1 -1
- package/dist/review/templates/annotator-debug.js +11 -1
- package/dist/review/templates/annotator-debug.js.map +1 -1
- package/dist/review/templates/annotator-investigate.d.ts.map +1 -1
- package/dist/review/templates/annotator-investigate.js +10 -1
- package/dist/review/templates/annotator-investigate.js.map +1 -1
- package/dist/review/templates/annotator-review.d.ts.map +1 -1
- package/dist/review/templates/annotator-review.js +10 -0
- package/dist/review/templates/annotator-review.js.map +1 -1
- package/dist/review/templates/annotator-shared.d.ts +7 -1
- package/dist/review/templates/annotator-shared.d.ts.map +1 -1
- package/dist/review/templates/annotator-shared.js +18 -29
- package/dist/review/templates/annotator-shared.js.map +1 -1
- package/dist/review/templates/annotator-verify.d.ts.map +1 -1
- package/dist/review/templates/annotator-verify.js +11 -1
- package/dist/review/templates/annotator-verify.js.map +1 -1
- package/dist/review/templates/diff-review.d.ts +8 -0
- package/dist/review/templates/diff-review.d.ts.map +1 -1
- package/dist/review/templates/diff-review.js +34 -2
- package/dist/review/templates/diff-review.js.map +1 -1
- package/dist/review/templates/finding-criteria.d.ts +15 -0
- package/dist/review/templates/finding-criteria.d.ts.map +1 -0
- package/dist/review/templates/finding-criteria.js +39 -0
- package/dist/review/templates/finding-criteria.js.map +1 -0
- package/dist/review/templates/quality-review-artifact.d.ts +13 -0
- package/dist/review/templates/quality-review-artifact.d.ts.map +1 -1
- package/dist/review/templates/quality-review-artifact.js +41 -3
- package/dist/review/templates/quality-review-artifact.js.map +1 -1
- package/dist/review/templates/quality-review-audit.d.ts.map +1 -1
- package/dist/review/templates/quality-review-audit.js +3 -2
- package/dist/review/templates/quality-review-audit.js.map +1 -1
- package/dist/review/templates/quality-review-debug.d.ts.map +1 -1
- package/dist/review/templates/quality-review-debug.js +3 -2
- package/dist/review/templates/quality-review-debug.js.map +1 -1
- package/dist/review/templates/quality-review-investigate.d.ts.map +1 -1
- package/dist/review/templates/quality-review-investigate.js +3 -2
- package/dist/review/templates/quality-review-investigate.js.map +1 -1
- package/dist/review/templates/quality-review-review.d.ts.map +1 -1
- package/dist/review/templates/quality-review-review.js +3 -2
- package/dist/review/templates/quality-review-review.js.map +1 -1
- package/dist/review/templates/quality-review-verify.d.ts.map +1 -1
- package/dist/review/templates/quality-review-verify.js +3 -2
- package/dist/review/templates/quality-review-verify.js.map +1 -1
- package/dist/review/templates/shared.d.ts +22 -5
- package/dist/review/templates/shared.d.ts.map +1 -1
- package/dist/review/templates/spec-review.d.ts +15 -0
- package/dist/review/templates/spec-review.d.ts.map +1 -1
- package/dist/review/templates/spec-review.js +43 -3
- package/dist/review/templates/spec-review.js.map +1 -1
- package/dist/stores/file-backed-context-block-store.d.ts +5 -1
- package/dist/stores/file-backed-context-block-store.d.ts.map +1 -1
- package/dist/stores/file-backed-context-block-store.js +16 -19
- package/dist/stores/file-backed-context-block-store.js.map +1 -1
- package/dist/stores/project-context-registry.d.ts +5 -3
- package/dist/stores/project-context-registry.d.ts.map +1 -1
- package/dist/stores/project-context-registry.js.map +1 -1
- package/dist/tool-surface/openapi-generator.d.ts.map +1 -1
- package/dist/tool-surface/openapi-generator.js +4 -4
- package/dist/tool-surface/openapi-generator.js.map +1 -1
- package/dist/tool-surface/register-all-tools.js +3 -3
- package/dist/tool-surface/register-all-tools.js.map +1 -1
- package/dist/tools/audit/implementer-criteria.d.ts +17 -0
- package/dist/tools/audit/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/audit/implementer-criteria.js +36 -0
- package/dist/tools/audit/implementer-criteria.js.map +1 -0
- package/dist/tools/audit/tool-config.d.ts.map +1 -1
- package/dist/tools/audit/tool-config.js +24 -6
- package/dist/tools/audit/tool-config.js.map +1 -1
- package/dist/tools/debug/implementer-criteria.d.ts +12 -0
- package/dist/tools/debug/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/debug/implementer-criteria.js +29 -0
- package/dist/tools/debug/implementer-criteria.js.map +1 -0
- package/dist/tools/debug/tool-config.d.ts.map +1 -1
- package/dist/tools/debug/tool-config.js +18 -4
- package/dist/tools/debug/tool-config.js.map +1 -1
- package/dist/tools/execute-plan/tool-config.d.ts.map +1 -1
- package/dist/tools/execute-plan/tool-config.js +5 -1
- package/dist/tools/execute-plan/tool-config.js.map +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/investigate/implementer-criteria.d.ts +17 -0
- package/dist/tools/investigate/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/investigate/implementer-criteria.js +33 -0
- package/dist/tools/investigate/implementer-criteria.js.map +1 -0
- package/dist/tools/investigate/tool-config.d.ts +13 -1
- package/dist/tools/investigate/tool-config.d.ts.map +1 -1
- package/dist/tools/investigate/tool-config.js +34 -4
- package/dist/tools/investigate/tool-config.js.map +1 -1
- package/dist/tools/research/implementer-criteria.d.ts +15 -0
- package/dist/tools/research/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/research/implementer-criteria.js +37 -0
- package/dist/tools/research/implementer-criteria.js.map +1 -0
- package/dist/tools/{explore → research}/schema.d.ts +2 -3
- package/dist/tools/research/schema.d.ts.map +1 -0
- package/dist/tools/{explore → research}/schema.js +10 -16
- package/dist/tools/research/schema.js.map +1 -0
- package/dist/tools/research/tool-config.d.ts +20 -0
- package/dist/tools/research/tool-config.d.ts.map +1 -0
- package/dist/tools/research/tool-config.js +51 -0
- package/dist/tools/research/tool-config.js.map +1 -0
- package/dist/tools/retry/tool-config.d.ts.map +1 -1
- package/dist/tools/retry/tool-config.js +27 -4
- package/dist/tools/retry/tool-config.js.map +1 -1
- package/dist/tools/review/implementer-criteria.d.ts +11 -0
- package/dist/tools/review/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/review/implementer-criteria.js +27 -0
- package/dist/tools/review/implementer-criteria.js.map +1 -0
- package/dist/tools/review/tool-config.d.ts.map +1 -1
- package/dist/tools/review/tool-config.js +43 -4
- package/dist/tools/review/tool-config.js.map +1 -1
- package/dist/tools/verify/implementer-criteria.d.ts +12 -0
- package/dist/tools/verify/implementer-criteria.d.ts.map +1 -0
- package/dist/tools/verify/implementer-criteria.js +29 -0
- package/dist/tools/verify/implementer-criteria.js.map +1 -0
- package/dist/tools/verify/tool-config.d.ts.map +1 -1
- package/dist/tools/verify/tool-config.js +18 -4
- package/dist/tools/verify/tool-config.js.map +1 -1
- package/dist/types/enums.d.ts +1 -11
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/enums.js +2 -4
- package/dist/types/enums.js.map +1 -1
- package/package.json +12 -40
- package/dist/intake/brief-compiler-slots/audit.d.ts +0 -23
- package/dist/intake/brief-compiler-slots/audit.d.ts.map +0 -1
- package/dist/intake/brief-compiler-slots/audit.js +0 -61
- package/dist/intake/brief-compiler-slots/audit.js.map +0 -1
- package/dist/intake/brief-compiler-slots/explore.d.ts +0 -43
- package/dist/intake/brief-compiler-slots/explore.d.ts.map +0 -1
- package/dist/intake/brief-compiler-slots/explore.js +0 -116
- package/dist/intake/brief-compiler-slots/explore.js.map +0 -1
- package/dist/intake/brief-compiler-slots/investigate.d.ts +0 -26
- package/dist/intake/brief-compiler-slots/investigate.d.ts.map +0 -1
- package/dist/intake/brief-compiler-slots/investigate.js +0 -42
- package/dist/intake/brief-compiler-slots/investigate.js.map +0 -1
- package/dist/intake/brief-compiler-slots/verify.d.ts +0 -21
- package/dist/intake/brief-compiler-slots/verify.d.ts.map +0 -1
- package/dist/intake/brief-compiler-slots/verify.js +0 -62
- package/dist/intake/brief-compiler-slots/verify.js.map +0 -1
- package/dist/reporting/compose-explore-headline.d.ts +0 -14
- package/dist/reporting/compose-explore-headline.d.ts.map +0 -1
- package/dist/reporting/compose-explore-headline.js +0 -14
- package/dist/reporting/compose-explore-headline.js.map +0 -1
- package/dist/reporting/derive-explore-status.d.ts +0 -18
- package/dist/reporting/derive-explore-status.d.ts.map +0 -1
- package/dist/reporting/derive-explore-status.js +0 -15
- package/dist/reporting/derive-explore-status.js.map +0 -1
- package/dist/reporting/headline-templates/explore.d.ts +0 -3
- package/dist/reporting/headline-templates/explore.d.ts.map +0 -1
- package/dist/reporting/headline-templates/explore.js +0 -13
- package/dist/reporting/headline-templates/explore.js.map +0 -1
- package/dist/reporting/parse-explore-report.d.ts +0 -38
- package/dist/reporting/parse-explore-report.d.ts.map +0 -1
- package/dist/reporting/parse-explore-report.js +0 -185
- package/dist/reporting/parse-explore-report.js.map +0 -1
- package/dist/reporting/report-parser-slots/explore-report.d.ts +0 -17
- package/dist/reporting/report-parser-slots/explore-report.d.ts.map +0 -1
- package/dist/reporting/report-parser-slots/explore-report.js +0 -9
- package/dist/reporting/report-parser-slots/explore-report.js.map +0 -1
- package/dist/research/explore-orchestrator.d.ts +0 -14
- package/dist/research/explore-orchestrator.d.ts.map +0 -1
- package/dist/research/explore-orchestrator.js +0 -362
- package/dist/research/explore-orchestrator.js.map +0 -1
- package/dist/tools/explore/schema.d.ts.map +0 -1
- package/dist/tools/explore/schema.js.map +0 -1
- package/dist/tools/explore/tool-config.d.ts +0 -7
- package/dist/tools/explore/tool-config.d.ts.map +0 -1
- package/dist/tools/explore/tool-config.js +0 -36
- package/dist/tools/explore/tool-config.js.map +0 -1
|
@@ -2,20 +2,164 @@ function extractSummarySection(text) {
|
|
|
2
2
|
const match = text.match(/##\s*Summary\s*\n([\s\S]*?)(?=\n##\s|$)/i);
|
|
3
3
|
return match ? match[1].trim() : null;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Extract the verdict from a JSON block in the reviewer's output.
|
|
7
|
+
* Two acceptable shapes:
|
|
8
|
+
* 1. Fenced: ```json {"verdict":"...","concerns":[...]} ```
|
|
9
|
+
* 2. Bare: {"verdict":"...","concerns":[...]} (no fence)
|
|
10
|
+
*
|
|
11
|
+
* Some models freelance the format and skip the ```json``` wrapper —
|
|
12
|
+
* the fenced-only parser would then drop a perfectly valid verdict
|
|
13
|
+
* and fall through to the markdown-section path, which also fails
|
|
14
|
+
* (since the JSON template doesn't emit `## Summary`), causing the
|
|
15
|
+
* spurious "missing structured verdict" meta-concern that triggered
|
|
16
|
+
* spec_rework spirals.
|
|
17
|
+
*
|
|
18
|
+
* Recognized verdict values (case-insensitive):
|
|
19
|
+
* - "approved" / "approve" → ReviewerVerdict.approved
|
|
20
|
+
* - "changes_required" / "changes-required" → changes_required
|
|
21
|
+
* - "concerns" → mapped to approved (parser convention: concerns
|
|
22
|
+
* ≠ blocking; use changes_required for blocking).
|
|
23
|
+
*/
|
|
24
|
+
function extractJsonVerdict(text) {
|
|
25
|
+
// Pass 1: fenced ```json ... ``` block.
|
|
26
|
+
const fenced = text.match(/```json\s*\n([\s\S]*?)\n```/i);
|
|
27
|
+
const fencedVerdict = fenced ? tryReadVerdict(fenced[1]) : null;
|
|
28
|
+
if (fencedVerdict)
|
|
29
|
+
return fencedVerdict;
|
|
30
|
+
// Pass 2: scan for the first balanced `{...}` that parses as a JSON
|
|
31
|
+
// object containing a "verdict" key. Pre-fix the parser only tried
|
|
32
|
+
// FIRST `{` to LAST `}` — that fails when the text has prose with
|
|
33
|
+
// its own `{...}` (e.g., "the diff matches {file} criteria...
|
|
34
|
+
// {"verdict":"approved",...}"). We now walk each `{` left-to-right
|
|
35
|
+
// and find its matching `}` via balanced-brace counting (string-
|
|
36
|
+
// literal aware) so prose braces and JSON braces don't collide.
|
|
37
|
+
return findFirstParseableJsonVerdict(text);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Walk every `{` in `text` from left to right, find its balanced `}`
|
|
41
|
+
* (respecting strings + escapes), and try to parse the slice as JSON
|
|
42
|
+
* with a "verdict" field. Returns the first successful match, or null.
|
|
43
|
+
*/
|
|
44
|
+
function findFirstParseableJsonVerdict(text) {
|
|
45
|
+
const len = text.length;
|
|
46
|
+
for (let start = text.indexOf('{'); start !== -1; start = text.indexOf('{', start + 1)) {
|
|
47
|
+
const end = matchingBrace(text, start);
|
|
48
|
+
if (end === -1)
|
|
49
|
+
continue;
|
|
50
|
+
const candidate = text.slice(start, end + 1);
|
|
51
|
+
if (!/"verdict"\s*:/i.test(candidate))
|
|
52
|
+
continue;
|
|
53
|
+
const v = tryReadVerdict(candidate);
|
|
54
|
+
if (v)
|
|
55
|
+
return v;
|
|
56
|
+
// Bound the scan: don't try crazy-large prefixes from the same
|
|
57
|
+
// position. matchingBrace already returns at most `len`.
|
|
58
|
+
if (end >= len - 1)
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Return the index of the `}` that balances the `{` at `openPos`,
|
|
65
|
+
* accounting for nested objects and string literals. Returns -1 when
|
|
66
|
+
* unbalanced (don't try to parse).
|
|
67
|
+
*/
|
|
68
|
+
function matchingBrace(text, openPos) {
|
|
69
|
+
let depth = 0;
|
|
70
|
+
let inString = false;
|
|
71
|
+
let escape = false;
|
|
72
|
+
for (let i = openPos; i < text.length; i++) {
|
|
73
|
+
const ch = text[i];
|
|
74
|
+
if (inString) {
|
|
75
|
+
if (escape) {
|
|
76
|
+
escape = false;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (ch === '\\') {
|
|
80
|
+
escape = true;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (ch === '"') {
|
|
84
|
+
inString = false;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (ch === '"') {
|
|
90
|
+
inString = true;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (ch === '{')
|
|
94
|
+
depth++;
|
|
95
|
+
else if (ch === '}') {
|
|
96
|
+
depth--;
|
|
97
|
+
if (depth === 0)
|
|
98
|
+
return i;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return -1;
|
|
102
|
+
}
|
|
103
|
+
function readConcernsFromJsonText(text) {
|
|
104
|
+
const tryParse = (s) => {
|
|
9
105
|
try {
|
|
10
|
-
const
|
|
11
|
-
if (Array.isArray(
|
|
12
|
-
concerns.
|
|
106
|
+
const obj = JSON.parse(s);
|
|
107
|
+
if (Array.isArray(obj.concerns)) {
|
|
108
|
+
return obj.concerns.filter((x) => typeof x === 'string');
|
|
13
109
|
}
|
|
14
110
|
}
|
|
15
111
|
catch {
|
|
16
|
-
|
|
112
|
+
/* not parseable */
|
|
17
113
|
}
|
|
114
|
+
return [];
|
|
115
|
+
};
|
|
116
|
+
const fenced = text.match(/```json\s*\n([\s\S]*?)\n```/i);
|
|
117
|
+
if (fenced) {
|
|
118
|
+
const out = tryParse(fenced[1]);
|
|
119
|
+
if (out.length > 0)
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
// Bare JSON fallback — same balanced-brace walk as extractJsonVerdict
|
|
123
|
+
// so the two helpers stay in sync. Pre-fix used a fragile first-`{`-
|
|
124
|
+
// to-last-`}` slice that broke when prose contained `{}`.
|
|
125
|
+
for (let start = text.indexOf('{'); start !== -1; start = text.indexOf('{', start + 1)) {
|
|
126
|
+
const end = matchingBrace(text, start);
|
|
127
|
+
if (end === -1)
|
|
128
|
+
continue;
|
|
129
|
+
const candidate = text.slice(start, end + 1);
|
|
130
|
+
if (!/"concerns"\s*:/i.test(candidate))
|
|
131
|
+
continue;
|
|
132
|
+
const out = tryParse(candidate);
|
|
133
|
+
if (out.length > 0)
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
function tryReadVerdict(jsonText) {
|
|
139
|
+
let parsed;
|
|
140
|
+
try {
|
|
141
|
+
parsed = JSON.parse(jsonText);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return null;
|
|
18
145
|
}
|
|
146
|
+
const obj = parsed;
|
|
147
|
+
const v = typeof obj.verdict === 'string' ? obj.verdict.toLowerCase().trim() : '';
|
|
148
|
+
if (v === 'approved' || v === 'approve')
|
|
149
|
+
return 'approved';
|
|
150
|
+
if (v === 'changes_required' || v === 'changes-required')
|
|
151
|
+
return 'changes_required';
|
|
152
|
+
if (v === 'concerns')
|
|
153
|
+
return 'approved';
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
function extractDeviationsAndUnresolved(text) {
|
|
157
|
+
const concerns = [];
|
|
158
|
+
// Try fenced ```json``` first, then bare JSON (same lenient pattern
|
|
159
|
+
// as extractJsonVerdict — keeps both helpers in sync so a parser
|
|
160
|
+
// that recognizes the verdict also recognizes the concerns).
|
|
161
|
+
const fromJson = readConcernsFromJsonText(text);
|
|
162
|
+
concerns.push(...fromJson);
|
|
19
163
|
const devMatch = text.match(/##\s*Deviations from brief\s*\n([\s\S]*?)(?=\n##\s|$)/i);
|
|
20
164
|
if (devMatch) {
|
|
21
165
|
const lines = devMatch[1].trim().split('\n').filter(l => l.trim().startsWith('-'));
|
|
@@ -40,19 +184,30 @@ function extractDiffVerdict(text) {
|
|
|
40
184
|
}
|
|
41
185
|
export class ReviewerOutputParser {
|
|
42
186
|
parse(text) {
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
// `
|
|
48
|
-
//
|
|
49
|
-
|
|
187
|
+
// Source priority:
|
|
188
|
+
// 1. JSON block ```json ... ``` containing {"verdict":"...","concerns":[...]}
|
|
189
|
+
// — what spec/quality templates actually instruct the LLM to emit
|
|
190
|
+
// (tool sweep #6 rewrite). The pre-fix parser only looked at
|
|
191
|
+
// `## Summary` markdown sections, defaulted every JSON-only
|
|
192
|
+
// response to `changes_required` with a meta-concern, and
|
|
193
|
+
// triggered exactly the spec_rework spirals we're trying to
|
|
194
|
+
// eliminate.
|
|
195
|
+
// 2. `## Summary` markdown section (back-compat for any reviewer
|
|
196
|
+
// that still emits the older format).
|
|
197
|
+
// 3. Fall through to changes_required with a meta-concern when
|
|
198
|
+
// neither path produced a verdict — keeps malformed output
|
|
199
|
+
// from crashing the run.
|
|
200
|
+
const jsonVerdict = extractJsonVerdict(text);
|
|
50
201
|
const concerns = extractDeviationsAndUnresolved(text);
|
|
202
|
+
if (jsonVerdict) {
|
|
203
|
+
return { verdict: jsonVerdict, concerns };
|
|
204
|
+
}
|
|
205
|
+
const summary = extractSummarySection(text);
|
|
51
206
|
if (!summary) {
|
|
52
207
|
return {
|
|
53
208
|
verdict: 'changes_required',
|
|
54
209
|
concerns: [
|
|
55
|
-
'reviewer output missing `## Summary` section — defaulting
|
|
210
|
+
'reviewer output missing structured verdict (no JSON block, no `## Summary` section) — defaulting to changes_required',
|
|
56
211
|
...concerns,
|
|
57
212
|
],
|
|
58
213
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer-output-parser.js","sourceRoot":"","sources":["../../src/review/reviewer-output-parser.ts"],"names":[],"mappings":"AAYA,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,K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AAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,8BAA8B,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,UAAU;gBACnB,QAAQ,EAAE;oBACR,oGAAoG;oBACpG,GAAG,QAAQ;iBACZ;aACF,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC;CACnF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReviewTemplate } from './templates/shared.js';
|
|
2
|
-
export type QualityReviewRoute = 'delegate' | 'execute-plan' | 'audit' | 'review' | 'verify' | 'investigate' | 'debug' | '
|
|
1
|
+
import type { ReviewTemplate, ReviewTemplateContext } from './templates/shared.js';
|
|
2
|
+
export type QualityReviewRoute = 'delegate' | 'execute-plan' | 'audit' | 'review' | 'verify' | 'investigate' | 'debug' | 'research';
|
|
3
3
|
export declare class ReviewerPromptBuilder {
|
|
4
4
|
private templates;
|
|
5
5
|
private qualityTemplates;
|
|
@@ -8,25 +8,17 @@ export declare class ReviewerPromptBuilder {
|
|
|
8
8
|
qualityForAP: ReviewTemplate;
|
|
9
9
|
diff: ReviewTemplate;
|
|
10
10
|
}, qualityTemplates?: Partial<Record<QualityReviewRoute, ReviewTemplate>>);
|
|
11
|
-
buildSpec(ctx: {
|
|
12
|
-
workerOutput: string;
|
|
13
|
-
brief: string;
|
|
14
|
-
}): {
|
|
11
|
+
buildSpec(ctx: ReviewTemplateContext): {
|
|
15
12
|
systemPrompt: string;
|
|
16
13
|
userPrompt: string;
|
|
17
14
|
};
|
|
18
|
-
buildQualityAP(ctx: {
|
|
19
|
-
workerOutput: string;
|
|
20
|
-
brief: string;
|
|
15
|
+
buildQualityAP(ctx: ReviewTemplateContext & {
|
|
21
16
|
route?: QualityReviewRoute;
|
|
22
17
|
}): {
|
|
23
18
|
systemPrompt: string;
|
|
24
19
|
userPrompt: string;
|
|
25
20
|
};
|
|
26
|
-
buildDiff(ctx: {
|
|
27
|
-
workerOutput: string;
|
|
28
|
-
brief: string;
|
|
29
|
-
}): {
|
|
21
|
+
buildDiff(ctx: ReviewTemplateContext): {
|
|
30
22
|
systemPrompt: string;
|
|
31
23
|
userPrompt: string;
|
|
32
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer-prompt-builder.d.ts","sourceRoot":"","sources":["../../src/review/reviewer-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"reviewer-prompt-builder.d.ts","sourceRoot":"","sources":["../../src/review/reviewer-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,CAAC;AAEpI,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,gBAAgB;gBALhB,SAAS,EAAE;QACjB,IAAI,EAAE,cAAc,CAAC;QACrB,YAAY,EAAE,cAAc,CAAC;QAC7B,IAAI,EAAE,cAAc,CAAC;KACtB,EACO,gBAAgB,GAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAM;IAGpF,SAAS,CAAC,GAAG,EAAE,qBAAqB,GAAG;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAOnF,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG;QAAE,KAAK,CAAC,EAAE,kBAAkB,CAAA;KAAE,GAAG;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAQzH,SAAS,CAAC,GAAG,EAAE,qBAAqB,GAAG;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAMpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer-prompt-builder.js","sourceRoot":"","sources":["../../src/review/reviewer-prompt-builder.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,qBAAqB;IAEtB;IAKA;IANV,YACU,SAIP,EACO,mBAAwE,EAAE;QAL1E,cAAS,GAAT,SAAS,CAIhB;QACO,qBAAgB,GAAhB,gBAAgB,CAA0D;IACjF,CAAC;IAEJ,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"reviewer-prompt-builder.js","sourceRoot":"","sources":["../../src/review/reviewer-prompt-builder.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,qBAAqB;IAEtB;IAKA;IANV,YACU,SAIP,EACO,mBAAwE,EAAE;QAL1E,cAAS,GAAT,SAAS,CAIhB;QACO,qBAAgB,GAAhB,gBAAgB,CAA0D;IACjF,CAAC;IAEJ,SAAS,CAAC,GAA0B;QAClC,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY;YAC9C,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;SACrD,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,GAA2D;QACxE,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QAC9G,OAAO;YACL,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,UAAU,EAAE,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC;SAC1C,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,GAA0B;QAClC,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY;YAC9C,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;SACrD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-audit.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-audit.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,EAAE,iBAgBpC,CAAC"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
export const annotatorAuditTemplate = {
|
|
2
2
|
role: 'audit',
|
|
3
3
|
onBriefCheck: 'For each finding, ask: is this the kind of issue the audit asked for? A security audit should produce security findings, not style nits.',
|
|
4
|
+
evidenceRule: [
|
|
5
|
+
'- Audit findings come in three valid shapes:',
|
|
6
|
+
' 1. Doc quote: a verbatim passage from the document showing the issue.',
|
|
7
|
+
' 2. Absence-reference: a precise pointer to where the doc *should* address something but doesn\'t (e.g. "Section 3.2 lists failure modes but is silent on queue overflow").',
|
|
8
|
+
' 3. Claim + contradiction: the doc\'s claim plus a quote from the source it contradicts.',
|
|
9
|
+
'- A finding without one of these three forms is speculation; downgrade to low or drop.',
|
|
10
|
+
].join('\n'),
|
|
11
|
+
scopeRule: [
|
|
12
|
+
'- The document and what it directly references are in scope.',
|
|
13
|
+
'- Cross-section / cross-doc reasoning IS the value of an audit — do not penalize as speculation.',
|
|
14
|
+
'- Repository-wide enumeration / globbing is out of scope; flag findings whose evidence depends on broad enumeration.',
|
|
15
|
+
'- Coding-style nits on inline examples belong in a code review, not an audit; flag as off-brief.',
|
|
16
|
+
].join('\n'),
|
|
4
17
|
};
|
|
5
18
|
//# sourceMappingURL=annotator-audit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-audit.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-audit.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,0IAA0I;
|
|
1
|
+
{"version":3,"file":"annotator-audit.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-audit.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,IAAI,EAAE,OAAO;IACb,YAAY,EAAE,0IAA0I;IACxJ,YAAY,EAAE;QACZ,8CAA8C;QAC9C,yEAAyE;QACzE,8KAA8K;QAC9K,2FAA2F;QAC3F,wFAAwF;KACzF,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,SAAS,EAAE;QACT,8DAA8D;QAC9D,kGAAkG;QAClG,sHAAsH;QACtH,kGAAkG;KACnG,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-debug.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-debug.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,sBAAsB,EAAE,iBAapC,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export const annotatorDebugTemplate = {
|
|
2
2
|
role: 'debugging hypothesis',
|
|
3
|
-
onBriefCheck: 'Each finding should be a hypothesis, root-cause claim, or evidence (reproducer, error pattern, code path).
|
|
3
|
+
onBriefCheck: 'Each finding should be a hypothesis, root-cause claim, or evidence (reproducer, error pattern, code path).',
|
|
4
|
+
evidenceRule: [
|
|
5
|
+
'- Debug findings are hypotheses with reasoning chains.',
|
|
6
|
+
'- Evidence: reproducer + traced code path (file:line) + observed output.',
|
|
7
|
+
'- Hypothesis-level findings with PARTIAL evidence are valid — that is debugging.',
|
|
8
|
+
'- Severity reflects evidence strength: confirmed root cause = high; plausible = medium; ruled out = low or drop.',
|
|
9
|
+
].join('\n'),
|
|
10
|
+
scopeRule: [
|
|
11
|
+
'- Cross-file tracing is in scope and required to follow the failure path.',
|
|
12
|
+
'- Out of scope: applied fixes (the worker should propose, not apply); unrelated code-review remarks.',
|
|
13
|
+
].join('\n'),
|
|
4
14
|
};
|
|
5
15
|
//# sourceMappingURL=annotator-debug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-debug.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-debug.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,IAAI,EAAE,sBAAsB;IAC5B,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-debug.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-debug.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAsB;IACvD,IAAI,EAAE,sBAAsB;IAC5B,YAAY,EAAE,4GAA4G;IAC1H,YAAY,EAAE;QACZ,wDAAwD;QACxD,0EAA0E;QAC1E,kFAAkF;QAClF,kHAAkH;KACnH,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,SAAS,EAAE;QACT,2EAA2E;QAC3E,sGAAsG;KACvG,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-investigate.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-investigate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,4BAA4B,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-investigate.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-investigate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,4BAA4B,EAAE,iBAY1C,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export const annotatorInvestigateTemplate = {
|
|
2
2
|
role: 'codebase investigation',
|
|
3
|
-
onBriefCheck: 'Each finding should be relevant to the question.
|
|
3
|
+
onBriefCheck: 'Each finding should be relevant to the question.',
|
|
4
|
+
evidenceRule: [
|
|
5
|
+
'- Present-thing citations: real `file:line` from files actually read, with a quote or summary.',
|
|
6
|
+
'- Absent-thing citations: explicit "searched <pattern> in <path>, no matches" — negative findings are legitimate answers and must NOT be downgraded for lacking a code quote.',
|
|
7
|
+
'- Synthesis findings: cite each link in the reasoning chain by file:line.',
|
|
8
|
+
].join('\n'),
|
|
9
|
+
scopeRule: [
|
|
10
|
+
'- Wherever the question leads is in scope; the question may not name files.',
|
|
11
|
+
'- Drift into unrelated code-review remarks is out of scope.',
|
|
12
|
+
].join('\n'),
|
|
4
13
|
};
|
|
5
14
|
//# sourceMappingURL=annotator-investigate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-investigate.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-investigate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,IAAI,EAAE,wBAAwB;IAC9B,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-investigate.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-investigate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,IAAI,EAAE,wBAAwB;IAC9B,YAAY,EAAE,kDAAkD;IAChE,YAAY,EAAE;QACZ,gGAAgG;QAChG,+KAA+K;QAC/K,2EAA2E;KAC5E,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,SAAS,EAAE;QACT,6EAA6E;QAC7E,6DAA6D;KAC9D,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-review.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-review.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,uBAAuB,EAAE,iBAarC,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export const annotatorReviewTemplate = {
|
|
2
2
|
role: 'code review',
|
|
3
3
|
onBriefCheck: 'For each finding, ask: is this within the requested focus area? A security review should produce security findings, not formatting nits.',
|
|
4
|
+
evidenceRule: [
|
|
5
|
+
'- Code-review findings must cite `file:line` from the named files.',
|
|
6
|
+
'- Evidence must include a verbatim code quote, not paraphrase.',
|
|
7
|
+
'- Findings without a quotable code excerpt are speculation; downgrade or drop.',
|
|
8
|
+
].join('\n'),
|
|
9
|
+
scopeRule: [
|
|
10
|
+
'- Only the named files are in scope. Behavior of direct callers/callees may be referenced when visible in the named files.',
|
|
11
|
+
'- Speculation about untouched files is out of scope.',
|
|
12
|
+
'- Doc/spec issues belong in an audit, not a review — flag as off-brief.',
|
|
13
|
+
].join('\n'),
|
|
4
14
|
};
|
|
5
15
|
//# sourceMappingURL=annotator-review.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-review.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-review.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,0IAA0I;
|
|
1
|
+
{"version":3,"file":"annotator-review.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-review.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,0IAA0I;IACxJ,YAAY,EAAE;QACZ,oEAAoE;QACpE,gEAAgE;QAChE,gFAAgF;KACjF,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,SAAS,EAAE;QACT,4HAA4H;QAC5H,sDAAsD;QACtD,yEAAyE;KAC1E,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC"}
|
|
@@ -5,6 +5,12 @@ export interface AnnotatorPromptContext {
|
|
|
5
5
|
export interface AnnotatorTemplate {
|
|
6
6
|
role: string;
|
|
7
7
|
onBriefCheck: string;
|
|
8
|
+
/** Per-tool evidence rule. Tells the annotator what counts as
|
|
9
|
+
* grounded evidence for findings from this tool. */
|
|
10
|
+
evidenceRule: string;
|
|
11
|
+
/** Per-tool scope rule. Tells the annotator what is in/out of scope
|
|
12
|
+
* for findings from this tool. */
|
|
13
|
+
scopeRule: string;
|
|
8
14
|
}
|
|
9
|
-
export declare
|
|
15
|
+
export declare function buildAnnotatorRubric(template: AnnotatorTemplate): string;
|
|
10
16
|
//# sourceMappingURL=annotator-shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-shared.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-shared.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"annotator-shared.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-shared.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB;yDACqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB;uCACmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CA+CxE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Data shared by all 5 annotator templates. The actual prompt assembly
|
|
2
2
|
// happens in review/annotator-prompt-builder.ts.
|
|
3
|
-
export
|
|
3
|
+
export function buildAnnotatorRubric(template) {
|
|
4
|
+
return String.raw `
|
|
4
5
|
## Output format (REQUIRED)
|
|
5
6
|
|
|
6
7
|
Respond with exactly one fenced JSON code block AS THE LAST BLOCK in your
|
|
@@ -16,47 +17,35 @@ the worker presented them. Example:
|
|
|
16
17
|
"suggestion": "Use a parameterized API or escape input",
|
|
17
18
|
"annotatorConfidence": 90,
|
|
18
19
|
"category": "security"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"id": "F2",
|
|
22
|
-
"severity": "medium",
|
|
23
|
-
"claim": "Auth check missing on /admin endpoint",
|
|
24
|
-
"evidence": "router.get('/admin', adminHandler) — no auth middleware applied",
|
|
25
|
-
"annotatorConfidence": 60,
|
|
26
|
-
"category": "security"
|
|
27
20
|
}
|
|
28
21
|
]
|
|
29
22
|
` + '```' + `
|
|
30
23
|
|
|
31
24
|
Field rules:
|
|
32
|
-
- ` + '`id`' + `: assign sequentially F1, F2, F3, ... (
|
|
25
|
+
- ` + '`id`' + `: assign sequentially F1, F2, F3, ... (must be unique).
|
|
33
26
|
- ` + '`severity`' + `: one of "critical" | "high" | "medium" | "low" — YOUR
|
|
34
|
-
final judgment
|
|
35
|
-
dial it up or down based on actual impact (workers tend to inflate).
|
|
36
|
-
- critical: must fix before any other work (RCE, auth bypass, data loss)
|
|
37
|
-
- high: serious bug / security issue, blocks release
|
|
38
|
-
- medium: real issue, should fix soon
|
|
39
|
-
- low: minor issue, nice to fix
|
|
40
|
-
Map worker-said "mid" -> "medium". When the worker omitted severity, judge.
|
|
27
|
+
final judgment. The worker's value is a hint; calibrate to actual impact.
|
|
41
28
|
- ` + '`claim`' + `: one-sentence summary.
|
|
42
29
|
- ` + '`evidence`' + `: REQUIRED, ≥20 chars, MUST be a verbatim quote from the
|
|
43
|
-
worker's output.
|
|
30
|
+
worker's output.
|
|
44
31
|
- ` + '`suggestion`' + `: optional; quote or paraphrase the worker's recommended fix.
|
|
45
|
-
- ` + '`annotatorConfidence`' + `: integer 0-100. How confident YOU
|
|
46
|
-
that the finding is correct, on-brief, and well-grounded
|
|
47
|
-
80-100: defend without hesitation
|
|
48
|
-
60-79: plausible, minor gaps
|
|
49
|
-
40-59: thin evidence
|
|
50
|
-
20-39: weak / off-brief
|
|
51
|
-
0-19: unsupported / fabricated
|
|
32
|
+
- ` + '`annotatorConfidence`' + `: integer 0-100. How confident YOU are
|
|
33
|
+
that the finding is correct, on-brief, and well-grounded.
|
|
52
34
|
- ` + '`category`' + `: optional, one of: "missing_test" | "scope_creep" |
|
|
53
35
|
"incomplete_impl" | "style_lint" | "security" | "performance" |
|
|
54
36
|
"maintainability" | "doc_gap" | "doc_drift" | "contract_violation" |
|
|
55
37
|
"coverage_gap" | "dead_code" | "queue_hygiene" | "other".
|
|
56
|
-
When omitted, the parser will infer from the claim text. Prefer to emit
|
|
57
|
-
it when the category is unambiguous from your reading.
|
|
58
38
|
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
## Tool-specific evidence rule (apply when judging "well-grounded")
|
|
40
|
+
|
|
41
|
+
` + template.evidenceRule + `
|
|
42
|
+
|
|
43
|
+
## Tool-specific scope rule (apply when judging "on-brief")
|
|
44
|
+
|
|
45
|
+
` + template.scopeRule + `
|
|
46
|
+
|
|
47
|
+
If the worker raised NO issues, return ` + '`[]`' + `. Surrounding prose is
|
|
48
|
+
allowed but ignored by the parser — only the LAST ` + '```json' + ` block is read.
|
|
61
49
|
`.trim();
|
|
50
|
+
}
|
|
62
51
|
//# sourceMappingURL=annotator-shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-shared.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-shared.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,iDAAiD;
|
|
1
|
+
{"version":3,"file":"annotator-shared.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-shared.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,iDAAiD;AAkBjD,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,OAAO,MAAM,CAAC,GAAG,CAAA;;;;;;;CAOlB,GAAG,WAAW,GAAG;;;;;;;;;;;CAWjB,GAAG,KAAK,GAAG;;;GAGT,GAAG,MAAM,GAAG;GACZ,GAAG,YAAY,GAAG;;GAElB,GAAG,SAAS,GAAG;GACf,GAAG,YAAY,GAAG;;GAElB,GAAG,cAAc,GAAG;GACpB,GAAG,uBAAuB,GAAG;;GAE7B,GAAG,YAAY,GAAG;;;;;;;CAOpB,GAAG,QAAQ,CAAC,YAAY,GAAG;;;;CAI3B,GAAG,QAAQ,CAAC,SAAS,GAAG;;wCAEe,GAAG,MAAM,GAAG;mDACD,GAAG,SAAS,GAAG;CACjE,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-verify.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-verify.d.ts","sourceRoot":"","sources":["../../../src/review/templates/annotator-verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,eAAO,MAAM,uBAAuB,EAAE,iBAarC,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export const annotatorVerifyTemplate = {
|
|
2
2
|
role: 'verification report',
|
|
3
|
-
onBriefCheck: 'Each finding should map to one checklist item with evidence the criterion was met or unmet.
|
|
3
|
+
onBriefCheck: 'Each finding should map to one checklist item with evidence the criterion was met or unmet.',
|
|
4
|
+
evidenceRule: [
|
|
5
|
+
'- Each Finding must map 1:1 to a checklist item.',
|
|
6
|
+
'- Evidence is execution output (test/build/command output) OR a code reference (`file:line`).',
|
|
7
|
+
'- A claimed PASS without evidence is speculation; downgrade or drop.',
|
|
8
|
+
'- Severity binding: PASS = low; FAIL = medium or high based on impact.',
|
|
9
|
+
].join('\n'),
|
|
10
|
+
scopeRule: [
|
|
11
|
+
'- Only checklist items are in scope. Findings not tied to a checklist item are off-brief.',
|
|
12
|
+
'- All checklist items should be covered (one Finding per item, in order).',
|
|
13
|
+
].join('\n'),
|
|
4
14
|
};
|
|
5
15
|
//# sourceMappingURL=annotator-verify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotator-verify.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-verify.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,IAAI,EAAE,qBAAqB;IAC3B,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"annotator-verify.js","sourceRoot":"","sources":["../../../src/review/templates/annotator-verify.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,IAAI,EAAE,qBAAqB;IAC3B,YAAY,EAAE,6FAA6F;IAC3G,YAAY,EAAE;QACZ,kDAAkD;QAClD,+FAA+F;QAC/F,sEAAsE;QACtE,wEAAwE;KACzE,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,SAAS,EAAE;QACT,2FAA2F;QAC3F,2EAA2E;KAC5E,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { ReviewTemplate } from './shared.js';
|
|
2
|
+
/**
|
|
3
|
+
* Diff reviewer — the final cross-check that looks at the cumulative
|
|
4
|
+
* diff in isolation and decides if it's acceptable as a whole.
|
|
5
|
+
*
|
|
6
|
+
* Tool sweep #6 fix: the template name was a misnomer pre-fix —
|
|
7
|
+
* the reviewer received only the worker's text summary, never the
|
|
8
|
+
* actual diff. Now it sees the diff (matches the name).
|
|
9
|
+
*/
|
|
2
10
|
export declare const diffTemplate: ReviewTemplate;
|
|
3
11
|
//# sourceMappingURL=diff-review.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-review.d.ts","sourceRoot":"","sources":["../../../src/review/templates/diff-review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"diff-review.d.ts","sourceRoot":"","sources":["../../../src/review/templates/diff-review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,cAgC1B,CAAC"}
|
|
@@ -1,7 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff reviewer — the final cross-check that looks at the cumulative
|
|
3
|
+
* diff in isolation and decides if it's acceptable as a whole.
|
|
4
|
+
*
|
|
5
|
+
* Tool sweep #6 fix: the template name was a misnomer pre-fix —
|
|
6
|
+
* the reviewer received only the worker's text summary, never the
|
|
7
|
+
* actual diff. Now it sees the diff (matches the name).
|
|
8
|
+
*/
|
|
1
9
|
export const diffTemplate = {
|
|
2
|
-
systemPrompt:
|
|
10
|
+
systemPrompt: [
|
|
11
|
+
'You are reviewing the cumulative diff produced by all rework rounds. Decide whether the overall change is acceptable.',
|
|
12
|
+
'',
|
|
13
|
+
'Reply with EXACTLY one of these single-line verdicts:',
|
|
14
|
+
'- `APPROVE` — the diff is acceptable as-is.',
|
|
15
|
+
'- `CONCERNS: <one-line summary of concerns>` — the diff has flaws but is on the right track.',
|
|
16
|
+
'- `REJECT: <one-line reason>` — the diff is wrong enough that it should not be applied.',
|
|
17
|
+
'',
|
|
18
|
+
'Decision criteria:',
|
|
19
|
+
'- Is the diff scoped to what the brief asked for? Out-of-scope edits are a CONCERN at minimum.',
|
|
20
|
+
'- Are the changes internally consistent (e.g., a renamed symbol updated everywhere it appears in the diff)?',
|
|
21
|
+
'- Does the diff introduce obvious correctness or security issues that the spec/quality reviews missed?',
|
|
22
|
+
'',
|
|
23
|
+
'Do NOT re-litigate the brief itself — that is the spec reviewer\'s job. Focus on the diff as a whole.',
|
|
24
|
+
].join('\n'),
|
|
3
25
|
buildUserPrompt(ctx) {
|
|
4
|
-
|
|
26
|
+
const parts = [];
|
|
27
|
+
parts.push(`# Task brief\n${ctx.brief}`);
|
|
28
|
+
parts.push(`# Worker's most recent summary\n${ctx.workerOutput || '(no summary)'}`);
|
|
29
|
+
if (ctx.diff && ctx.diff.length > 0) {
|
|
30
|
+
parts.push(`# Cumulative diff (what you are reviewing)\n\n\`\`\`diff\n${ctx.diff}\n\`\`\``);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
parts.push(`# Cumulative diff\n(no file changes detected — APPROVE only if the brief requested a no-op)`);
|
|
34
|
+
}
|
|
35
|
+
parts.push(`# Decide\nReply with one of APPROVE, CONCERNS: <text>, or REJECT: <text>.`);
|
|
36
|
+
return parts.join('\n\n');
|
|
5
37
|
},
|
|
6
38
|
};
|
|
7
39
|
//# sourceMappingURL=diff-review.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-review.js","sourceRoot":"","sources":["../../../src/review/templates/diff-review.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,YAAY,EAAE,wGAAwG;
|
|
1
|
+
{"version":3,"file":"diff-review.js","sourceRoot":"","sources":["../../../src/review/templates/diff-review.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,YAAY,EAAE;QACZ,uHAAuH;QACvH,EAAE;QACF,uDAAuD;QACvD,6CAA6C;QAC7C,8FAA8F;QAC9F,yFAAyF;QACzF,EAAE;QACF,oBAAoB;QACpB,gGAAgG;QAChG,6GAA6G;QAC7G,wGAAwG;QACxG,EAAE;QACF,uGAAuG;KACxG,CAAC,IAAI,CAAC,IAAI,CAAC;IAEZ,eAAe,CAAC,GAAG;QACjB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,KAAK,CAAC,IAAI,CAAC,mCAAmC,GAAG,CAAC,YAAY,IAAI,cAAc,EAAE,CAAC,CAAC;QAEpF,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,6DAA6D,GAAG,CAAC,IAAI,UAAU,CAAC,CAAC;QAC9F,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,6FAA6F,CAAC,CAAC;QAC5G,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QAExF,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truly-shared finding criteria — the constants that apply *identically*
|
|
3
|
+
* across every consumer. Per-tool blocks live next to each tool, not here.
|
|
4
|
+
*
|
|
5
|
+
* - SEVERITY_LADDER: same severity ladder, same anti-inflation hint, same
|
|
6
|
+
* impact-anchored definitions for all 5 read-only tools.
|
|
7
|
+
* - REVIEWER_AWARENESS_AP: same spec+quality reviewer expectation across
|
|
8
|
+
* delegate / execute-plan / retry implementer prompts.
|
|
9
|
+
*
|
|
10
|
+
* Evidence + scope + annotator-awareness are calibrated per-tool; see
|
|
11
|
+
* tools/<tool>/implementer-criteria.ts for each tool's blocks.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SEVERITY_LADDER: string;
|
|
14
|
+
export declare const REVIEWER_AWARENESS_AP: string;
|
|
15
|
+
//# sourceMappingURL=finding-criteria.d.ts.map
|