import { type AiFinding, type ContractLapse } from "../judge/engine.js"; import { type DroppedCriterion, type RepairedFinding, type VerifiedFinding } from "../judge/verify.js"; import type { JudgePlan, PanelWork } from "./plan.js"; import type { ResolvedConfig, ShotRecord } from "../types.js"; import { type Parsed } from "../util.js"; export interface RunCheckOptions { /** Called once the cache partition is known, before any judging begins. */ onStart?: (toJudge: ShotRecord[]) => Promise; /** * Invoked after each batch is judged AND verified, in order, never * concurrently. Findings are narrated to the event log as they land, so the * UI shows them while the rest of the app is still being judged. */ onBatch?: (e: { index: number; total: number; shots: ShotRecord[]; findings: VerifiedFinding[]; shotsById: Map; }) => Promise; } export interface JudgePass { confirmed: VerifiedFinding[]; refuted: (AiFinding & { verifierNote: string; })[]; /** * The (group, panel) pairs no verdict can be claimed for, as * `${groupId}|${panel}`: the panel's call failed, or its reply skipped a * shot. The sibling panels of the same group still cache. */ uncacheable: Set; /** * Shots a panel answered about but ruled on in neither list. * * The count of them has always been reported (as `unjudged`), which says a * verdict is missing without saying whose or about what. A panel that keeps * dropping the same kind of shot is a panel whose instructions are not * landing, and that is a lesson `skills improve` can act on only if the * panel and the shots are written down. */ unaccounted: { panel: string; groupId: string; shotIds: string[]; }[]; failedBatches: { panel: string; shots: number; message: string; }[]; rejected: number; costUsd: number; /** Planned panel calls, which is what makes "all of them failed" decidable. */ batchCount: number; /** Findings whose plain half the refuter supplied, with the panel that skipped it. */ repaired: RepairedFinding[]; /** Acceptance criteria dropped or rewritten at filing time, with their panel. */ droppedCriteria: DroppedCriterion[]; /** Findings filed with a problem written for one reader, with the panel that wrote it. */ degraded: ContractLapse[]; /** * Each successful panel call's reply, whole, as a file under the capture * workspace, keyed like `uncacheable`. The ledger entry for the verdict * points at it, so the reasoning a finding was distilled from can be read * back by whoever wants more than the distillate. */ replies: Map; } /** The uncacheable-set member for one unit of panel work. */ export declare function workKey(item: Pick & { panel: { def: { name: string; }; }; }): string; export declare function judgeInBatches(args: { resolved: ResolvedConfig; plan: JudgePlan; shotsById: Map; parsed: Parsed; log: (line: string) => void; opts: RunCheckOptions; }): Promise;