@tokenfactory/acc-runner 0.44.0 → 0.44.2
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 +43 -1
- package/dist/bin-resolve.d.ts +39 -3
- package/dist/bin-resolve.d.ts.map +1 -1
- package/dist/bin-resolve.js +176 -12
- package/dist/bin-resolve.js.map +1 -1
- package/dist/build-fingerprint.d.ts +66 -0
- package/dist/build-fingerprint.d.ts.map +1 -0
- package/dist/build-fingerprint.js +70 -0
- package/dist/build-fingerprint.js.map +1 -0
- package/dist/build-info.generated.d.ts +3 -0
- package/dist/build-info.generated.d.ts.map +1 -0
- package/dist/build-info.generated.js +3 -0
- package/dist/build-info.generated.js.map +1 -0
- package/dist/capacity/resume-controller.d.ts +5 -3
- package/dist/capacity/resume-controller.d.ts.map +1 -1
- package/dist/capacity/resume-controller.js +9 -0
- package/dist/capacity/resume-controller.js.map +1 -1
- package/dist/chat-delegation-guard.d.ts +23 -0
- package/dist/chat-delegation-guard.d.ts.map +1 -0
- package/dist/chat-delegation-guard.js +62 -0
- package/dist/chat-delegation-guard.js.map +1 -0
- package/dist/chat-lane.d.ts +17 -6
- package/dist/chat-lane.d.ts.map +1 -1
- package/dist/chat-lane.js +29 -8
- package/dist/chat-lane.js.map +1 -1
- package/dist/companion-identity.d.ts +37 -0
- package/dist/companion-identity.d.ts.map +1 -1
- package/dist/companion-identity.js +98 -29
- package/dist/companion-identity.js.map +1 -1
- package/dist/companion-run.d.ts +1 -50
- package/dist/companion-run.d.ts.map +1 -1
- package/dist/companion-run.js +48 -105
- package/dist/companion-run.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -3
- package/dist/config.js.map +1 -1
- package/dist/conformance.d.ts +49 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +121 -0
- package/dist/conformance.js.map +1 -0
- package/dist/cost-pricing.d.ts +91 -0
- package/dist/cost-pricing.d.ts.map +1 -1
- package/dist/cost-pricing.js +115 -1
- package/dist/cost-pricing.js.map +1 -1
- package/dist/credential-identity.d.ts +70 -0
- package/dist/credential-identity.d.ts.map +1 -0
- package/dist/credential-identity.js +128 -0
- package/dist/credential-identity.js.map +1 -0
- package/dist/doctor.d.ts +37 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +300 -41
- package/dist/doctor.js.map +1 -1
- package/dist/engines/chat-stream.d.ts +71 -1
- package/dist/engines/chat-stream.d.ts.map +1 -1
- package/dist/engines/chat-stream.js +126 -8
- package/dist/engines/chat-stream.js.map +1 -1
- package/dist/engines/claude-code-chat.d.ts +11 -1
- package/dist/engines/claude-code-chat.d.ts.map +1 -1
- package/dist/engines/claude-code-chat.js +69 -5
- package/dist/engines/claude-code-chat.js.map +1 -1
- package/dist/engines/claude-code.d.ts.map +1 -1
- package/dist/engines/claude-code.js +30 -6
- package/dist/engines/claude-code.js.map +1 -1
- package/dist/engines/codex.d.ts.map +1 -1
- package/dist/engines/codex.js +18 -5
- package/dist/engines/codex.js.map +1 -1
- package/dist/engines/registry.d.ts +26 -0
- package/dist/engines/registry.d.ts.map +1 -1
- package/dist/engines/registry.js +37 -0
- package/dist/engines/registry.js.map +1 -1
- package/dist/engines/types.d.ts +5 -0
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/failure-classifier.d.ts +1 -1
- package/dist/failure-classifier.d.ts.map +1 -1
- package/dist/failure-classifier.js +65 -12
- package/dist/failure-classifier.js.map +1 -1
- package/dist/gh.d.ts +15 -0
- package/dist/gh.d.ts.map +1 -1
- package/dist/gh.js +18 -0
- package/dist/gh.js.map +1 -1
- package/dist/git.d.ts +6 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +27 -1
- package/dist/git.js.map +1 -1
- package/dist/instance.d.ts +30 -0
- package/dist/instance.d.ts.map +1 -0
- package/dist/instance.js +51 -0
- package/dist/instance.js.map +1 -0
- package/dist/keychain.d.ts +20 -7
- package/dist/keychain.d.ts.map +1 -1
- package/dist/keychain.js +40 -4
- package/dist/keychain.js.map +1 -1
- package/dist/loc-advisory.d.ts +70 -0
- package/dist/loc-advisory.d.ts.map +1 -0
- package/dist/loc-advisory.js +196 -0
- package/dist/loc-advisory.js.map +1 -0
- package/dist/locks/claim-lock-policy.d.ts +67 -0
- package/dist/locks/claim-lock-policy.d.ts.map +1 -0
- package/dist/locks/claim-lock-policy.js +132 -0
- package/dist/locks/claim-lock-policy.js.map +1 -0
- package/dist/login.d.ts +63 -2
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +93 -8
- package/dist/login.js.map +1 -1
- package/dist/mcp-spawn.d.ts +54 -0
- package/dist/mcp-spawn.d.ts.map +1 -1
- package/dist/mcp-spawn.js +88 -4
- package/dist/mcp-spawn.js.map +1 -1
- package/dist/memory-context.d.ts +106 -0
- package/dist/memory-context.d.ts.map +1 -0
- package/dist/memory-context.js +220 -0
- package/dist/memory-context.js.map +1 -0
- package/dist/memory-curation.d.ts +172 -0
- package/dist/memory-curation.d.ts.map +1 -0
- package/dist/memory-curation.js +277 -0
- package/dist/memory-curation.js.map +1 -0
- package/dist/migration-seq-guard.d.ts +28 -1
- package/dist/migration-seq-guard.d.ts.map +1 -1
- package/dist/migration-seq-guard.js +111 -6
- package/dist/migration-seq-guard.js.map +1 -1
- package/dist/output-diagnostics.d.ts +15 -0
- package/dist/output-diagnostics.d.ts.map +1 -0
- package/dist/output-diagnostics.js +95 -0
- package/dist/output-diagnostics.js.map +1 -0
- package/dist/pr-open-guard.d.ts +67 -0
- package/dist/pr-open-guard.d.ts.map +1 -0
- package/dist/pr-open-guard.js +79 -0
- package/dist/pr-open-guard.js.map +1 -0
- package/dist/prepr-gate.d.ts +229 -1
- package/dist/prepr-gate.d.ts.map +1 -1
- package/dist/prepr-gate.js +406 -3
- package/dist/prepr-gate.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +43 -5
- package/dist/program.js.map +1 -1
- package/dist/provider-auth.d.ts +27 -0
- package/dist/provider-auth.d.ts.map +1 -1
- package/dist/provider-auth.js +33 -0
- package/dist/provider-auth.js.map +1 -1
- package/dist/runtime/cache-dir.d.ts.map +1 -1
- package/dist/runtime/cache-dir.js +8 -3
- package/dist/runtime/cache-dir.js.map +1 -1
- package/dist/runtime/decision-provenance.d.ts +63 -0
- package/dist/runtime/decision-provenance.d.ts.map +1 -0
- package/dist/runtime/decision-provenance.js +107 -0
- package/dist/runtime/decision-provenance.js.map +1 -0
- package/dist/runtime/prompt-substitute.d.ts +100 -0
- package/dist/runtime/prompt-substitute.d.ts.map +1 -0
- package/dist/runtime/prompt-substitute.js +124 -0
- package/dist/runtime/prompt-substitute.js.map +1 -0
- package/dist/runtime/quarantine.d.ts +11 -0
- package/dist/runtime/quarantine.d.ts.map +1 -1
- package/dist/runtime/quarantine.js +16 -1
- package/dist/runtime/quarantine.js.map +1 -1
- package/dist/runtime/review-cost-cap.d.ts +167 -0
- package/dist/runtime/review-cost-cap.d.ts.map +1 -0
- package/dist/runtime/review-cost-cap.js +182 -0
- package/dist/runtime/review-cost-cap.js.map +1 -0
- package/dist/runtime/reviewer-abstain.d.ts +101 -0
- package/dist/runtime/reviewer-abstain.d.ts.map +1 -0
- package/dist/runtime/reviewer-abstain.js +138 -0
- package/dist/runtime/reviewer-abstain.js.map +1 -0
- package/dist/runtime/reviewer.d.ts +165 -2
- package/dist/runtime/reviewer.d.ts.map +1 -1
- package/dist/runtime/reviewer.js +752 -111
- package/dist/runtime/reviewer.js.map +1 -1
- package/dist/runtime/running-build.d.ts +24 -0
- package/dist/runtime/running-build.d.ts.map +1 -0
- package/dist/runtime/running-build.js +62 -0
- package/dist/runtime/running-build.js.map +1 -0
- package/dist/runtime/singleton.d.ts.map +1 -1
- package/dist/runtime/singleton.js +9 -1
- package/dist/runtime/singleton.js.map +1 -1
- package/dist/runtime/worktree.d.ts +45 -0
- package/dist/runtime/worktree.d.ts.map +1 -1
- package/dist/runtime/worktree.js +174 -5
- package/dist/runtime/worktree.js.map +1 -1
- package/dist/serving-auth/index.d.ts +79 -0
- package/dist/serving-auth/index.d.ts.map +1 -0
- package/dist/serving-auth/index.js +169 -0
- package/dist/serving-auth/index.js.map +1 -0
- package/dist/task-runner.d.ts +134 -5
- package/dist/task-runner.d.ts.map +1 -1
- package/dist/task-runner.js +1255 -129
- package/dist/task-runner.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/watch-chat/wire.d.ts +80 -0
- package/dist/watch-chat/wire.d.ts.map +1 -1
- package/dist/watch-chat/wire.js +203 -43
- package/dist/watch-chat/wire.js.map +1 -1
- package/dist/watch.d.ts +70 -16
- package/dist/watch.d.ts.map +1 -1
- package/dist/watch.js +548 -108
- package/dist/watch.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S15-FU/REVIEW-1 (AC2) — reviewer FAULT ⇒ explicit abstain, never a verdict.
|
|
3
|
+
*
|
|
4
|
+
* THE RULE. A reviewer fault is a statement about the HARNESS, not about the
|
|
5
|
+
* code. When the reviewer cannot render a faithful prompt, cannot parse its own
|
|
6
|
+
* output, or cites content it never actually read, the only sound outcome is
|
|
7
|
+
* "I did not review this — a human must": an explicit ABSTAIN that routes the PR
|
|
8
|
+
* to needs-review. It must NEVER be a confident reject, and it must never carry
|
|
9
|
+
* a defect reason, because on a fault path there is no evidence for one.
|
|
10
|
+
*
|
|
11
|
+
* WHY THIS MODULE EXISTS. The #1933 episode produced 0.75–0.85-confidence
|
|
12
|
+
* rejects naming a "prose spliced into the SQL literal" corruption that did not
|
|
13
|
+
* exist — the reviewer was reporting, in good faith, the harness's own prompt
|
|
14
|
+
* text that a `replace()` bug had spliced into the diff (see
|
|
15
|
+
* `./prompt-substitute.ts`). Two of those sessions even self-logged the fault and
|
|
16
|
+
* still emitted a reject. Fixing the splice (AC1) removes THAT trigger; this
|
|
17
|
+
* module removes the whole CLASS, by making every fault path structurally
|
|
18
|
+
* incapable of producing a defect claim.
|
|
19
|
+
*
|
|
20
|
+
* MECHANISM, and why the decision string is unchanged. `decision` stays
|
|
21
|
+
* `reviewer_error`, which downstream ALREADY treats as "never merges, retry or
|
|
22
|
+
* hold" — introducing a new decision value would silently fall through every
|
|
23
|
+
* classifier that switches on it. What is new is that the outcome is explicitly
|
|
24
|
+
* MARKED as an abstain, its confidence is pinned to 0, and any model-authored
|
|
25
|
+
* text is QUARANTINED behind a prefix that the finding classifiers skip, so it
|
|
26
|
+
* can be read as context by an operator and never scored as a defect.
|
|
27
|
+
*
|
|
28
|
+
* Pure. No I/O, no DB, no throw.
|
|
29
|
+
* Mirrored from `api/_lib/reviewer/abstain.ts`; the runner ships as a published
|
|
30
|
+
* npm package and cannot import from `api/_lib`.
|
|
31
|
+
* // keep in sync with api/_lib/reviewer/abstain.ts
|
|
32
|
+
*/
|
|
33
|
+
/** What faulted. Recorded verbatim on the outcome so the trail is diagnosable. */
|
|
34
|
+
export type ReviewerFaultKind =
|
|
35
|
+
/** The rendered prompt did not carry the PR content verbatim (#1933 class). */
|
|
36
|
+
"prompt_render"
|
|
37
|
+
/** The reviewer's own JSON verdict could not be parsed, even after repair. */
|
|
38
|
+
| "verdict_parse"
|
|
39
|
+
/** The CLI/API envelope around the verdict could not be parsed. */
|
|
40
|
+
| "envelope_parse"
|
|
41
|
+
/** The verdict cited a file/diff the verification tooling never read (RR-3). */
|
|
42
|
+
| "tooling_read";
|
|
43
|
+
/**
|
|
44
|
+
* Stable marker for cheap row detection — mirrors TOOLING_FAILURE_MARKER /
|
|
45
|
+
* ACCOUNT_CAP_MARKER in `api/_lib/review-retry.ts`, so ONLY rows we classified
|
|
46
|
+
* are ever treated as abstentions.
|
|
47
|
+
*/
|
|
48
|
+
export declare const REVIEWER_ABSTAIN_MARKER = "reviewer abstained:";
|
|
49
|
+
/** The headline stamped on every abstain outcome. Explicit by design: an
|
|
50
|
+
* operator reading the row must not have to infer that nothing was judged. */
|
|
51
|
+
export declare const REVIEWER_ABSTAIN_REASON: string;
|
|
52
|
+
/**
|
|
53
|
+
* Prefix applied to every model-authored / fault-detail line carried alongside an
|
|
54
|
+
* abstain. Deliberately leads with "advisory" so the RR-3 severity classifiers
|
|
55
|
+
* and the calibration reason-matchers read it as non-blocking context.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ABSTAIN_DETAIL_PREFIX = "abstain_context (advisory, not a finding):";
|
|
58
|
+
/** A one-line, machine-greppable statement of which fault kind fired. */
|
|
59
|
+
export declare function abstainFaultLine(kind: ReviewerFaultKind): string;
|
|
60
|
+
/**
|
|
61
|
+
* Quarantine fault detail behind ABSTAIN_DETAIL_PREFIX. Empty/blank lines are
|
|
62
|
+
* dropped, each line is capped, and the list is bounded so a runaway model
|
|
63
|
+
* response cannot bloat the stored row.
|
|
64
|
+
*/
|
|
65
|
+
export declare function quarantineAbstainDetail(lines: ReadonlyArray<string | null | undefined>, opts?: {
|
|
66
|
+
maxLines?: number;
|
|
67
|
+
maxChars?: number;
|
|
68
|
+
}): string[];
|
|
69
|
+
/**
|
|
70
|
+
* The full `reasons` array for an abstain outcome: the explicit headline, the
|
|
71
|
+
* fault kind, then quarantined detail. Callers pin `confidence: 0` and keep
|
|
72
|
+
* `decision: 'reviewer_error'`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function abstainReasons(kind: ReviewerFaultKind, detail?: ReadonlyArray<string | null | undefined>): string[];
|
|
75
|
+
/**
|
|
76
|
+
* A short operator-facing stderr line for an abstain. Names the fault kind and
|
|
77
|
+
* the abstain routing, never the model's text (which may be corrupted content).
|
|
78
|
+
*/
|
|
79
|
+
export declare function describeAbstainForLog(kind: ReviewerFaultKind, detail?: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* True when a completed review outcome/row is an ABSTAIN. Marker-based and
|
|
82
|
+
* defensive: a non-`reviewer_error` decision or absent reasons ⇒ false, so a
|
|
83
|
+
* legacy row that merely mentions abstaining is never reclassified.
|
|
84
|
+
*/
|
|
85
|
+
export declare function isAbstainReviewerOutcome(decision: string | null | undefined, reasons: string[] | null | undefined): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Reason prefixes that are STRUCTURAL — emitted by the harness, describing the
|
|
88
|
+
* review itself rather than the code. Anything not in this set is a finding.
|
|
89
|
+
*
|
|
90
|
+
* `"review diff coverage:"` is REVIEW_DIFF_COVERAGE_MARKER from
|
|
91
|
+
* `./absence-claims.ts`; it is inlined (and pinned by a test) so this module
|
|
92
|
+
* stays dependency-free and trivially mirrorable into the runner package.
|
|
93
|
+
*/
|
|
94
|
+
export declare const ABSTAIN_STRUCTURAL_PREFIXES: readonly string[];
|
|
95
|
+
/**
|
|
96
|
+
* True when `reasons` carries NO unquarantined, model-authored finding — the
|
|
97
|
+
* invariant an abstain must satisfy. Used by the AC2 test to prove that a
|
|
98
|
+
* simulated fault cannot smuggle a fabricated defect reason through.
|
|
99
|
+
*/
|
|
100
|
+
export declare function abstainCarriesNoFinding(reasons: string[] | null | undefined): boolean;
|
|
101
|
+
//# sourceMappingURL=reviewer-abstain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-abstain.d.ts","sourceRoot":"","sources":["../../src/runtime/reviewer-abstain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,kFAAkF;AAClF,MAAM,MAAM,iBAAiB;AAC3B,+EAA+E;AAC7E,eAAe;AACjB,8EAA8E;GAC5E,eAAe;AACjB,mEAAmE;GACjE,gBAAgB;AAClB,gFAAgF;GAC9E,cAAc,CAAC;AAEnB;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAE7D;+EAC+E;AAC/E,eAAO,MAAM,uBAAuB,QAI2C,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,+CAA+C,CAAC;AAElF,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAC/C,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,MAAM,EAAE,CAeV;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,iBAAiB,EACvB,MAAM,GAAE,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAM,GACpD,MAAM,EAAE,CAMV;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,iBAAiB,EACvB,MAAM,GAAE,MAAW,GAClB,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GACnC,OAAO,CAKT;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAOxD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMrF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S15-FU/REVIEW-1 (AC2) — reviewer FAULT ⇒ explicit abstain, never a verdict.
|
|
3
|
+
*
|
|
4
|
+
* THE RULE. A reviewer fault is a statement about the HARNESS, not about the
|
|
5
|
+
* code. When the reviewer cannot render a faithful prompt, cannot parse its own
|
|
6
|
+
* output, or cites content it never actually read, the only sound outcome is
|
|
7
|
+
* "I did not review this — a human must": an explicit ABSTAIN that routes the PR
|
|
8
|
+
* to needs-review. It must NEVER be a confident reject, and it must never carry
|
|
9
|
+
* a defect reason, because on a fault path there is no evidence for one.
|
|
10
|
+
*
|
|
11
|
+
* WHY THIS MODULE EXISTS. The #1933 episode produced 0.75–0.85-confidence
|
|
12
|
+
* rejects naming a "prose spliced into the SQL literal" corruption that did not
|
|
13
|
+
* exist — the reviewer was reporting, in good faith, the harness's own prompt
|
|
14
|
+
* text that a `replace()` bug had spliced into the diff (see
|
|
15
|
+
* `./prompt-substitute.ts`). Two of those sessions even self-logged the fault and
|
|
16
|
+
* still emitted a reject. Fixing the splice (AC1) removes THAT trigger; this
|
|
17
|
+
* module removes the whole CLASS, by making every fault path structurally
|
|
18
|
+
* incapable of producing a defect claim.
|
|
19
|
+
*
|
|
20
|
+
* MECHANISM, and why the decision string is unchanged. `decision` stays
|
|
21
|
+
* `reviewer_error`, which downstream ALREADY treats as "never merges, retry or
|
|
22
|
+
* hold" — introducing a new decision value would silently fall through every
|
|
23
|
+
* classifier that switches on it. What is new is that the outcome is explicitly
|
|
24
|
+
* MARKED as an abstain, its confidence is pinned to 0, and any model-authored
|
|
25
|
+
* text is QUARANTINED behind a prefix that the finding classifiers skip, so it
|
|
26
|
+
* can be read as context by an operator and never scored as a defect.
|
|
27
|
+
*
|
|
28
|
+
* Pure. No I/O, no DB, no throw.
|
|
29
|
+
* Mirrored from `api/_lib/reviewer/abstain.ts`; the runner ships as a published
|
|
30
|
+
* npm package and cannot import from `api/_lib`.
|
|
31
|
+
* // keep in sync with api/_lib/reviewer/abstain.ts
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Stable marker for cheap row detection — mirrors TOOLING_FAILURE_MARKER /
|
|
35
|
+
* ACCOUNT_CAP_MARKER in `api/_lib/review-retry.ts`, so ONLY rows we classified
|
|
36
|
+
* are ever treated as abstentions.
|
|
37
|
+
*/
|
|
38
|
+
export const REVIEWER_ABSTAIN_MARKER = "reviewer abstained:";
|
|
39
|
+
/** The headline stamped on every abstain outcome. Explicit by design: an
|
|
40
|
+
* operator reading the row must not have to infer that nothing was judged. */
|
|
41
|
+
export const REVIEWER_ABSTAIN_REASON = `${REVIEWER_ABSTAIN_MARKER} the reviewer harness faulted, so NO code judgement ` +
|
|
42
|
+
"was formed — this is NOT a defect finding and NOT a reject. The PR needs " +
|
|
43
|
+
"HUMAN VERIFICATION: route to needs-review and have an operator read the diff. " +
|
|
44
|
+
"Any reviewer text below is quarantined diagnostic context, never a finding.";
|
|
45
|
+
/**
|
|
46
|
+
* Prefix applied to every model-authored / fault-detail line carried alongside an
|
|
47
|
+
* abstain. Deliberately leads with "advisory" so the RR-3 severity classifiers
|
|
48
|
+
* and the calibration reason-matchers read it as non-blocking context.
|
|
49
|
+
*/
|
|
50
|
+
export const ABSTAIN_DETAIL_PREFIX = "abstain_context (advisory, not a finding):";
|
|
51
|
+
/** A one-line, machine-greppable statement of which fault kind fired. */
|
|
52
|
+
export function abstainFaultLine(kind) {
|
|
53
|
+
return `abstain_fault_kind: ${kind}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Quarantine fault detail behind ABSTAIN_DETAIL_PREFIX. Empty/blank lines are
|
|
57
|
+
* dropped, each line is capped, and the list is bounded so a runaway model
|
|
58
|
+
* response cannot bloat the stored row.
|
|
59
|
+
*/
|
|
60
|
+
export function quarantineAbstainDetail(lines, opts = {}) {
|
|
61
|
+
const maxLines = opts.maxLines ?? 6;
|
|
62
|
+
const maxChars = opts.maxChars ?? 300;
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const raw of lines ?? []) {
|
|
65
|
+
const text = (raw ?? "").trim();
|
|
66
|
+
if (!text)
|
|
67
|
+
continue;
|
|
68
|
+
// Already quarantined (or already the headline) → pass through untouched.
|
|
69
|
+
const prefixed = text.startsWith(ABSTAIN_DETAIL_PREFIX) || text.startsWith(REVIEWER_ABSTAIN_MARKER)
|
|
70
|
+
? text
|
|
71
|
+
: `${ABSTAIN_DETAIL_PREFIX} ${text}`;
|
|
72
|
+
out.push(prefixed.slice(0, maxChars));
|
|
73
|
+
if (out.length >= maxLines)
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The full `reasons` array for an abstain outcome: the explicit headline, the
|
|
80
|
+
* fault kind, then quarantined detail. Callers pin `confidence: 0` and keep
|
|
81
|
+
* `decision: 'reviewer_error'`.
|
|
82
|
+
*/
|
|
83
|
+
export function abstainReasons(kind, detail = []) {
|
|
84
|
+
return [
|
|
85
|
+
REVIEWER_ABSTAIN_REASON,
|
|
86
|
+
abstainFaultLine(kind),
|
|
87
|
+
...quarantineAbstainDetail(detail),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A short operator-facing stderr line for an abstain. Names the fault kind and
|
|
92
|
+
* the abstain routing, never the model's text (which may be corrupted content).
|
|
93
|
+
*/
|
|
94
|
+
export function describeAbstainForLog(kind, detail = "") {
|
|
95
|
+
const tail = detail.trim() ? ` — ${detail.trim().slice(0, 200)}` : "";
|
|
96
|
+
return (`[reviewer] ABSTAIN (${kind}): harness fault, no code judgement formed; ` +
|
|
97
|
+
`routing to needs-review for human verification${tail}\n`);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* True when a completed review outcome/row is an ABSTAIN. Marker-based and
|
|
101
|
+
* defensive: a non-`reviewer_error` decision or absent reasons ⇒ false, so a
|
|
102
|
+
* legacy row that merely mentions abstaining is never reclassified.
|
|
103
|
+
*/
|
|
104
|
+
export function isAbstainReviewerOutcome(decision, reasons) {
|
|
105
|
+
if (decision !== "reviewer_error")
|
|
106
|
+
return false;
|
|
107
|
+
return (reasons ?? []).some((r) => typeof r === "string" && r.includes(REVIEWER_ABSTAIN_MARKER));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Reason prefixes that are STRUCTURAL — emitted by the harness, describing the
|
|
111
|
+
* review itself rather than the code. Anything not in this set is a finding.
|
|
112
|
+
*
|
|
113
|
+
* `"review diff coverage:"` is REVIEW_DIFF_COVERAGE_MARKER from
|
|
114
|
+
* `./absence-claims.ts`; it is inlined (and pinned by a test) so this module
|
|
115
|
+
* stays dependency-free and trivially mirrorable into the runner package.
|
|
116
|
+
*/
|
|
117
|
+
export const ABSTAIN_STRUCTURAL_PREFIXES = [
|
|
118
|
+
REVIEWER_ABSTAIN_MARKER,
|
|
119
|
+
ABSTAIN_DETAIL_PREFIX,
|
|
120
|
+
"abstain_fault_kind:",
|
|
121
|
+
// Read-coverage telemetry stamped on every outcome: it states how MUCH was
|
|
122
|
+
// read, never what is wrong. // keep in sync with REVIEW_DIFF_COVERAGE_MARKER
|
|
123
|
+
"review diff coverage:",
|
|
124
|
+
];
|
|
125
|
+
/**
|
|
126
|
+
* True when `reasons` carries NO unquarantined, model-authored finding — the
|
|
127
|
+
* invariant an abstain must satisfy. Used by the AC2 test to prove that a
|
|
128
|
+
* simulated fault cannot smuggle a fabricated defect reason through.
|
|
129
|
+
*/
|
|
130
|
+
export function abstainCarriesNoFinding(reasons) {
|
|
131
|
+
return (reasons ?? []).every((r) => {
|
|
132
|
+
const text = (r ?? "").trim();
|
|
133
|
+
if (!text)
|
|
134
|
+
return true;
|
|
135
|
+
return ABSTAIN_STRUCTURAL_PREFIXES.some((p) => text.startsWith(p));
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=reviewer-abstain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-abstain.js","sourceRoot":"","sources":["../../src/runtime/reviewer-abstain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAaH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;+EAC+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAClC,GAAG,uBAAuB,sDAAsD;IAChF,2EAA2E;IAC3E,gFAAgF;IAChF,6EAA6E,CAAC;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,4CAA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|
|
19
|
+
import type { AgentEngine } from "../engines/types.js";
|
|
19
20
|
import { type ReviewChunk } from "./review-chunking.js";
|
|
21
|
+
import { type DecisionProvenance } from "./decision-provenance.js";
|
|
22
|
+
import { type PromptRenderBleed } from "./prompt-substitute.js";
|
|
23
|
+
import { type ReviewCostCapDecision, type ReviewCostLedger } from "./review-cost-cap.js";
|
|
20
24
|
import { type TolerantRemoveResult } from "../review-worktree-cleanup.js";
|
|
21
25
|
import type { RunnerSupabaseClient } from "../supabase.js";
|
|
22
26
|
export interface ReviewAssignment {
|
|
@@ -28,6 +32,11 @@ export interface ReviewerPolicy {
|
|
|
28
32
|
model_id: string;
|
|
29
33
|
confidence_threshold: number;
|
|
30
34
|
max_cost_usd_per_review: number;
|
|
35
|
+
/**
|
|
36
|
+
* Org setting: how review chooses an engine independently from the authoring
|
|
37
|
+
* engine. Missing/malformed defaults to `prefer_different_family`.
|
|
38
|
+
*/
|
|
39
|
+
reviewer_engine_policy?: ReviewerEngineSelectionPolicy;
|
|
31
40
|
}
|
|
32
41
|
export type ReviewerDecision = "approve" | "reject" | "cost_cap_exceeded" | "reviewer_error" | "reviewer_capacity" | "review_fetch_failed";
|
|
33
42
|
export interface ReviewerOutcome {
|
|
@@ -36,6 +45,17 @@ export interface ReviewerOutcome {
|
|
|
36
45
|
confidence: number;
|
|
37
46
|
session_id: string | null;
|
|
38
47
|
cost_usd: number;
|
|
48
|
+
/**
|
|
49
|
+
* RUNNER-DISCARDS-STDOUT-ON-FAILURE-1: the end-truncated, credential-scrubbed
|
|
50
|
+
* child stdout/stderr tails captured on a genuine `reviewer_error` (task_error
|
|
51
|
+
* / usage_limit), so the real failure is preserved and not thrown away with
|
|
52
|
+
* only the banner. Mirrors the task-runner's `claude_exit` event fields.
|
|
53
|
+
* `submit_review` is a frozen RPC (reasons-only), so these are recorded
|
|
54
|
+
* durably through the additive `task.reviewer_error` `log_activity` verb in
|
|
55
|
+
* `runReview`, never sent to `submit_review`. In-memory otherwise.
|
|
56
|
+
*/
|
|
57
|
+
stdout_tail?: string;
|
|
58
|
+
stderr_tail?: string;
|
|
39
59
|
/**
|
|
40
60
|
* v0.56 (T-56-1): set only on `reviewer_capacity` — the stated reset
|
|
41
61
|
* instant (ISO-8601) parsed from claude's "...resets <time>" message, or
|
|
@@ -43,6 +63,16 @@ export interface ReviewerOutcome {
|
|
|
43
63
|
* this.
|
|
44
64
|
*/
|
|
45
65
|
resume_at?: string | null;
|
|
66
|
+
/** Coding engine that produced a reviewer capacity outcome. */
|
|
67
|
+
engine?: string | null;
|
|
68
|
+
/**
|
|
69
|
+
* REVIEW-DECISION-PROVENANCE: set only when the decision was SYNTHESIZED (the
|
|
70
|
+
* prose fallback inferred it from a keyword) rather than asserted by a
|
|
71
|
+
* structured verdict. In-memory until the submit seam, which renders it into
|
|
72
|
+
* `reasons` — carrying it as a field keeps it out of every reason classifier
|
|
73
|
+
* (coverage-claim partitioning, severity calibration) on the way there.
|
|
74
|
+
*/
|
|
75
|
+
decision_provenance?: DecisionProvenance;
|
|
46
76
|
/**
|
|
47
77
|
* RVU-2 (FU-RVU2R): the model that actually produced (or, on capacity/env
|
|
48
78
|
* failure, was last attempted for) this verdict. On a capacity fallback this
|
|
@@ -67,8 +97,49 @@ export interface ReviewerOutcome {
|
|
|
67
97
|
* for reviews) before ever pausing reviews. In-memory only.
|
|
68
98
|
*/
|
|
69
99
|
capacity_degraded?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* REV-COST: the SIZE-SCALED cap this review was actually judged against
|
|
102
|
+
* (`effectiveReviewCostCap(policy.max_cost_usd_per_review, diff.length)`),
|
|
103
|
+
* mirroring the server outcome field of the same name. Present on every
|
|
104
|
+
* outcome that reached the spawn loop. In-memory only — never sent to
|
|
105
|
+
* submit_review (frozen RPC).
|
|
106
|
+
*/
|
|
107
|
+
cost_cap?: ReviewCostCapDecision;
|
|
108
|
+
/**
|
|
109
|
+
* REV-COST: the per-attempt cost ledger. `chargeable_usd` (productive
|
|
110
|
+
* attempts only) is what the cap is checked against; `infra_usd`
|
|
111
|
+
* (capacity/auth faults) is reported but NEVER charged. `cost_usd` above stays
|
|
112
|
+
* the honest TOTAL, so the queue row and the org daily/cycle budgets still see
|
|
113
|
+
* every dollar spent.
|
|
114
|
+
*/
|
|
115
|
+
cost_breakdown?: ReviewCostLedger;
|
|
116
|
+
/**
|
|
117
|
+
* REV-COST: the chargeable spend exceeded the effective cap but stayed
|
|
118
|
+
* inside the runaway tolerance band, so the verdict was KEPT rather than
|
|
119
|
+
* discarded (the money was already spent; throwing the verdict away only
|
|
120
|
+
* stranded the PR and re-charged the same review on the next tick — #1937 at
|
|
121
|
+
* $18 against an $8 flat cap). The verdict is real and mergeable; the overrun
|
|
122
|
+
* is an operator signal, carried as an advisory reason.
|
|
123
|
+
*/
|
|
124
|
+
cost_overrun?: boolean;
|
|
70
125
|
}
|
|
71
126
|
export declare const REVIEWER_PROMPT_TEMPLATE: string;
|
|
127
|
+
export declare function isLocCapAdvisoryReason(reason: string): boolean;
|
|
128
|
+
/** Render the machine tag into an operator-legible advisory line (measured/limit kept
|
|
129
|
+
* visible), or return the reason unchanged when it is not a cap tag. */
|
|
130
|
+
export declare function renderLocCapAdvisory(reason: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* D-7: reduce a reviewer verdict under the cap-advisory rule. A `reject` whose EVERY
|
|
133
|
+
* substantive reason is the pure `loc_cap:` tag is not a rejection — it becomes an
|
|
134
|
+
* `approve` that STILL carries the measured overrun (rendered) in `reasons`. Any reason
|
|
135
|
+
* that is not exactly the tag — a defect, forbidden file, unmet AC, body mismatch, scope
|
|
136
|
+
* creep, or even a cap stated in free prose — keeps the reject (fail-closed). A
|
|
137
|
+
* non-reject verdict is returned untouched.
|
|
138
|
+
*/
|
|
139
|
+
export declare function applyLocCapAdvisory<T extends {
|
|
140
|
+
decision: string;
|
|
141
|
+
reasons: string[];
|
|
142
|
+
}>(verdict: T): T;
|
|
72
143
|
/** Report sections whose prose IS a delivery claim — the rule may fire here. */
|
|
73
144
|
export declare const COMPLETION_SIGNAL_SECTIONS: readonly ["implemented", "verification"];
|
|
74
145
|
/**
|
|
@@ -198,6 +269,39 @@ export declare function classifyCapacityRetry(opts: {
|
|
|
198
269
|
export declare function resolveCapacityRetries(raw: string | undefined | null): number;
|
|
199
270
|
/** Returns true when a claude stderr string indicates a transient API error that is safe to retry. */
|
|
200
271
|
export declare function isRetriableError(stderr: string): boolean;
|
|
272
|
+
/** S15-FU/REVIEW-1 (AC1): a rendered prompt plus its integrity verdict. */
|
|
273
|
+
export interface ReviewerPromptRender {
|
|
274
|
+
prompt: string;
|
|
275
|
+
/**
|
|
276
|
+
* Values that did NOT survive substitution verbatim. Non-empty means the render
|
|
277
|
+
* mangled PR content (the #1933 class) and the review MUST NOT proceed on this
|
|
278
|
+
* prompt — the review seam degrades to an abstain instead.
|
|
279
|
+
*/
|
|
280
|
+
bleed: PromptRenderBleed[];
|
|
281
|
+
}
|
|
282
|
+
export declare function renderReviewerPromptChecked(args: {
|
|
283
|
+
task_description: string;
|
|
284
|
+
acceptance_criteria: string[];
|
|
285
|
+
pr_title: string;
|
|
286
|
+
pr_body: string;
|
|
287
|
+
pr_diff: string;
|
|
288
|
+
}): ReviewerPromptRender;
|
|
289
|
+
/**
|
|
290
|
+
* S15-FU/REVIEW-1 (AC1): the ORDERED placeholder/value pairs a reviewer prompt
|
|
291
|
+
* substitutes, so the render-integrity check (and its test) can assert that every
|
|
292
|
+
* one of these values survived into the prompt VERBATIM.
|
|
293
|
+
* // keep in sync with reviewerPlaceholderPairs in api/_lib/reviewer-agent.ts
|
|
294
|
+
*/
|
|
295
|
+
export declare function reviewerPlaceholderPairs(args: {
|
|
296
|
+
task_description: string;
|
|
297
|
+
pr_title: string;
|
|
298
|
+
pr_body: string;
|
|
299
|
+
}, diff: string, acceptance: string): ReadonlyArray<readonly [string, string]>;
|
|
300
|
+
/**
|
|
301
|
+
* String façade over `renderReviewerPromptChecked` — the signature every existing
|
|
302
|
+
* caller and the RF-3 parity tests use. Integrity is enforced at the review seam,
|
|
303
|
+
* which needs the `bleed` list to build its abstain.
|
|
304
|
+
*/
|
|
201
305
|
export declare function renderReviewerPrompt(args: {
|
|
202
306
|
task_description: string;
|
|
203
307
|
acceptance_criteria: string[];
|
|
@@ -247,6 +351,12 @@ export declare function extractReviewerDecision(text: string): {
|
|
|
247
351
|
decision: "approve" | "reject";
|
|
248
352
|
reasons: string[];
|
|
249
353
|
confidence: number;
|
|
354
|
+
/**
|
|
355
|
+
* REVIEW-DECISION-PROVENANCE: present only on the prose fallback, where the
|
|
356
|
+
* decision is INFERRED from a keyword instead of asserted (the PR #1913
|
|
357
|
+
* shape). The submit seam renders it into the persisted reasons.
|
|
358
|
+
*/
|
|
359
|
+
decision_provenance?: DecisionProvenance;
|
|
250
360
|
} | null;
|
|
251
361
|
/**
|
|
252
362
|
* R0-D-REVIEWER-WORKSPACE-INTEGRITY — the verified review tree. Produced by
|
|
@@ -287,12 +397,17 @@ export interface RunReviewDeps {
|
|
|
287
397
|
reviewId: string;
|
|
288
398
|
prNumber: number;
|
|
289
399
|
}) => Promise<ReviewTreeResult>;
|
|
290
|
-
/** Override for tests. Defaults to
|
|
291
|
-
spawnClaude?: (modelId: string) => ExecaChildProcess;
|
|
400
|
+
/** Override for tests. Defaults to the selected engine on stdin. */
|
|
401
|
+
spawnClaude?: (modelId: string | null) => ExecaChildProcess;
|
|
292
402
|
/** Override the policy resolver (defaults to org_settings.automerge_policy.reviewer). */
|
|
293
403
|
loadPolicy?: (orgId: string) => Promise<ReviewerPolicy | null>;
|
|
294
404
|
/** Override for tests. Defaults to real setTimeout-based sleep. */
|
|
295
405
|
sleep?: (ms: number) => Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* CAPS-ENGINES-STALE-KEYCHAIN-1: watcher-supplied repair hook for a review
|
|
408
|
+
* whose task was routed to an engine this live process cannot resolve.
|
|
409
|
+
*/
|
|
410
|
+
onUnknownAdvertisedEngine?: (engineId: string, err: Error) => Promise<void>;
|
|
296
411
|
/**
|
|
297
412
|
* RVU-2 (FU-RVU2R): optional env-broken CLI-auth PREFLIGHT canary. When
|
|
298
413
|
* provided, it is run ONCE before the review spawn; if its probe results match
|
|
@@ -305,7 +420,49 @@ export interface RunReviewDeps {
|
|
|
305
420
|
authCanary?: () => Promise<ReviewerProbeResult[]>;
|
|
306
421
|
/** RVU-2: cap on capacity-fallback-chain tiers (default 4 = all catalog tiers). */
|
|
307
422
|
modelChainMax?: number;
|
|
423
|
+
/**
|
|
424
|
+
* CROSS-ENGINE-REVIEW-1 (AC3): the assigned runner's advertised `caps.engines`
|
|
425
|
+
* — the engines THIS runner can actually spawn. Reviewer-engine selection is
|
|
426
|
+
* constrained to this set so a claude-only runner is never asked to review with
|
|
427
|
+
* codex (and vice-versa). The production caller (watch.ts) threads the exact
|
|
428
|
+
* list it published into `acc.runners.caps.engines` at register time
|
|
429
|
+
* (`detectCapableEngines()`), so selection reflects REAL runner capability, not
|
|
430
|
+
* the full local registry. When neither this nor `detectEngines` is supplied,
|
|
431
|
+
* driveReview falls back to the local registry (`engineIds()`) — a
|
|
432
|
+
* test/direct-caller safety net only; the production path always injects.
|
|
433
|
+
*/
|
|
434
|
+
advertisedEngineIds?: string[];
|
|
435
|
+
/**
|
|
436
|
+
* CROSS-ENGINE-REVIEW-1: async override for `advertisedEngineIds` resolution
|
|
437
|
+
* (e.g. a live `detectCapableEngines()` probe). Preferred over the registry
|
|
438
|
+
* fallback when `advertisedEngineIds` is absent. Tests inject a stub.
|
|
439
|
+
*/
|
|
440
|
+
detectEngines?: () => Promise<string[]>;
|
|
308
441
|
}
|
|
442
|
+
export type ReviewerEngineSelectionPolicy = "prefer_different_family" | "prefer_same_family" | "capacity_first";
|
|
443
|
+
export declare const DEFAULT_REVIEWER_ENGINE_SELECTION_POLICY: ReviewerEngineSelectionPolicy;
|
|
444
|
+
export interface ReviewerEngineSelection {
|
|
445
|
+
engineIds: string[];
|
|
446
|
+
policy: ReviewerEngineSelectionPolicy;
|
|
447
|
+
}
|
|
448
|
+
export declare function resolveReviewerEngineSelectionPolicy(policy: ReviewerPolicy | null | undefined): ReviewerEngineSelectionPolicy;
|
|
449
|
+
export declare function selectReviewerEngineIds(authorEngine: string | null | undefined, policy: ReviewerPolicy | null | undefined, availableEngineIds?: string[]): ReviewerEngineSelection;
|
|
450
|
+
/**
|
|
451
|
+
* CROSS-ENGINE-REVIEW-1 (AC10): map the org policy's single reviewer `model_id`
|
|
452
|
+
* onto the engine actually chosen for THIS review. The policy historically
|
|
453
|
+
* carries a Claude id (default 'claude-sonnet-4-6'). Cross-engine selection now
|
|
454
|
+
* routes a review to codex even when the PR was authored by Claude — so that
|
|
455
|
+
* Claude model id is meaningless to the reviewer engine and MUST NOT be pinned:
|
|
456
|
+
*
|
|
457
|
+
* - codex → run UNPINNED (model_id → `null`) unless an OpenAI-valid id is
|
|
458
|
+
* explicitly configured on an api-key channel (a Claude id is never valid
|
|
459
|
+
* for codex and is always dropped to `null`).
|
|
460
|
+
* - claude-family → keep the existing catalog fallback chain unchanged.
|
|
461
|
+
*
|
|
462
|
+
* Returning `null` tells `engine.spawn` to omit `--model`, so codex never sees
|
|
463
|
+
* `claude-sonnet-4-6` on argv.
|
|
464
|
+
*/
|
|
465
|
+
export declare function reviewerModelChain(engine: AgentEngine, policyModelId: string | null | undefined, modelChainMax: number): Array<string | null>;
|
|
309
466
|
/**
|
|
310
467
|
* Drive one review end-to-end: fetch task spec + PR meta + diff →
|
|
311
468
|
* render prompt → spawn claude → parse decision → submit_review.
|
|
@@ -313,4 +470,10 @@ export interface RunReviewDeps {
|
|
|
313
470
|
* the cron's poll-merge loop can advance.
|
|
314
471
|
*/
|
|
315
472
|
export declare function runReview(assignment: ReviewAssignment, deps: RunReviewDeps): Promise<ReviewerOutcome>;
|
|
473
|
+
/** REVIEWER-SPEND-TO-COST-PIPE: the runner's thin mirror of the api-side
|
|
474
|
+
* emitReviewCostEvent — a call site of the shared acc.record_cost_event RPC
|
|
475
|
+
* (model='reviewer', zero-cost skipped, best-effort), NOT shared logic (the
|
|
476
|
+
* runner cannot import api/_lib). Exactly-once HALTed per AC7. Returns the
|
|
477
|
+
* outcome for the runner-package test (which root CI does NOT run — see PR body). */
|
|
478
|
+
export declare function recordReviewCost(supabase: RunnerSupabaseClient, taskId: string, costUsd: number): Promise<"emitted" | "skipped_zero" | "error">;
|
|
316
479
|
//# sourceMappingURL=reviewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/runtime/reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/runtime/reviewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAStD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAMvD,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAOL,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA6B3D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAI,MAAM,CAAC;IAClB,SAAS,EA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