/** * Tournament Regeneration (Phase 2) — verifier-selected candidate selection. * * Inspired by AlphaProof Nexus (DeepMind, May 2026): generate K candidates, score * each by RE-VERIFICATION (the verifier is the fitness function — verifier-selected, * not LLM-judge-selected), keep the best. The doc pipeline has no sound oracle, so the * fitness here is an LLM-derived compliance score: a variance-reducing proxy, not proof. * * This module is pure orchestration with injected `generate`/`score` so it is fully * unit-testable without any LLM calls. The real wiring (streamRegeneration, extract, * verify) lives in src/commands/regenerate.ts. * * Spec: docs/plans/2026-06-04-lemma-decomposition-tournament-regeneration.md */ export interface Verdicts { pass: number; partial: number; fail: number; na: number; unverifiable: number; } export interface RegenCandidate { index: number; content: string; inputTokens: number; outputTokens: number; } export interface CandidateScore { /** Compliance %, identical formula to `assay verify`. */ score: number; verdicts: Verdicts; /** Tie-break signal: Σ severity-weight over FAIL verdicts (lower is better). */ severityWeightedFails: number; } export type ScoredCandidate = RegenCandidate & CandidateScore; export interface TournamentResult { winner: ScoredCandidate; /** All K candidates, sorted best-first by the selection order. */ candidates: ScoredCandidate[]; selectionReason: string; } export interface TournamentDeps { /** Produce candidate `index` (diversity is the caller's concern, e.g. temperature by index). */ generate: (index: number) => Promise; /** Score a candidate by re-verification. Pure of selection logic. */ score: (candidate: RegenCandidate) => Promise; } /** Compliance score — same formula as `assay verify` (verify.ts). */ export declare function complianceScore(v: Verdicts): number; /** Σ severity-weight over FAIL verdicts. Unknown severity defaults to 'low'. */ export declare function severityWeightedFails(verifications: ReadonlyArray<{ claimId: string; verdict: string; }>, severityOf: (claimId: string) => string | undefined): number; /** * Selection order (deterministic, no RNG): * 1. highest compliance score * 2. fewest severity-weighted fails * 3. lowest candidate index (stable) */ export declare function sortBySelection(scored: ScoredCandidate[]): ScoredCandidate[]; export declare function runTournament(k: number, deps: TournamentDeps): Promise;