import type { AuthoredControlsDeps, GroundTruthLabel, MinerLedgers, ResolvedPrDiff, ReviewThreadContent, Stage4VerifierDeps, WindtunnelLock } from '@mmnto/totem'; /** Local alias for the core git exec port (mirrors spine-windtunnel.ts / spine-cert-materialize.ts). */ type SafeExecFn = typeof import('@mmnto/totem').safeExec; import { type ReplayArtifact } from './spine-llm-replay.js'; import type { CertifyingCorpus, CertifyingCorpusProvider, ResolvedCertifyingRun } from './spine-windtunnel.js'; /** The frozen llm-replay fixture — produced by `record` (A2), sealed into the lock by `freeze`. */ export declare const REPLAY_FILE = "llm-replay.v1.json"; export declare const PR_DIFFS_FILE = "pr-diffs.json"; /** The cert-run answer key — produced by `derive-labels` (5d-iii), read by the run. */ export declare const GROUND_TRUTH_FILE = "ground-truth-labels.json"; /** The frozen held-out disposition provenance — produced by `fetch-dispositions` (5d-ii). */ export declare const CORPUS_DISPOSITIONS_FILE = "corpus-dispositions.json"; export interface CertRunFixtureInputs { split: import('@mmnto/totem').SplitArtifact; artifact: ReplayArtifact; content: ReviewThreadContent[]; prDiffs: ResolvedPrDiff[]; groundTruth: Map; } /** * The producer-independent **scoring substrate** read by BOTH the mined and authored * cert-run loaders: the frozen split + pr-diffs + ground-truth answer key, each carrying * the verify-then-parse-on-a-SINGLE-read integrity discipline (#2225/#709 fold-2). The * gate-critical SHA checks live here ONCE so the mined and authored paths cannot drift * (gemini Tenet-9 ruling 2026-06-30: this is a singular, cohesive job — shared, not a * forced merge of disjoint jobs; duplicating the SHA/CRLF integrity invites the drift * that is a worse failure mode than a shared helper). Mining-only fixtures (`llm-replay`, * `review-content`) are NOT read here — they belong to `loadCertRunFixtures` alone. */ export interface ScoringSubstrate { split: import('@mmnto/totem').SplitArtifact; prDiffs: ResolvedPrDiff[]; groundTruth: Map; } export declare function readAndVerifyScoringSubstrate(gate1Dir: string, opts?: { expectedPrDiffsSha?: string; expectedGroundTruthSha?: string; skipGroundTruth?: boolean; }): Promise; /** * Load + validate the committed MINED cert-run fixture inputs from the gate-1 dir: the * shared scoring substrate (`readAndVerifyScoringSubstrate`) PLUS the mining-only * `llm-replay` artifact + raw `review-content`. Async so the `@mmnto/totem` runtime * values (schema + error class) are dynamically imported per the CLI lazy-import * convention, not pulled in at module load. */ export declare function loadCertRunFixtures(gate1Dir: string, opts?: { expectedPrDiffsSha?: string; expectedGroundTruthSha?: string; skipGroundTruth?: boolean; }): Promise; /** * ADR-112 §5/§6 Slice D2 — load the AUTHORED cert-run scoring substrate from the gate-1 * dir: the SIBLING of `loadCertRunFixtures` minus the mining-only `llm-replay` + * `review-content` legs (an authored run has neither). Delegates to the shared * `readAndVerifyScoringSubstrate` so the split/pr-diffs/ground-truth integrity discipline * is byte-identical to the mined path (gemini Tenet-9 ruling: shared helper, not a * duplicated SHA check). The authored producer supplies the rules; this supplies the * producer-independent scoring substrate (split for the §5 leakage gate, prDiffs as the * scoring corpus, groundTruth as the frozen answer key). The same hard preconditions as * mined apply at the caller (prDiffsSha/groundTruthSha MUST be present on a certifying * run). The DERIVER passes `skipGroundTruth` (D2.6) — see the opts note below. */ export declare function loadAuthoredCertRunFixtures(gate1Dir: string, opts?: { expectedPrDiffsSha?: string; expectedGroundTruthSha?: string; skipGroundTruth?: boolean; }): Promise; /** * Build the Stage-4 verifier deps (listFiles/readFile over the frozen post-image * at `asOf`) — the SHARED constructor both the certifying run and the 5d-iii * deriver use, so the archived-rule exclusion (hence the scored rule set, hence * the firing labelIds) is identical. With an lc clone, files resolve via * `git ls-tree`/`git show` at `asOf` (a local clone — zero network); without one, * Stage-4 sees no files (rules read as untested, NOT archived). Tests inject a * fake `Stage4VerifierDeps` into `assembleCertifyingCorpus` directly instead. */ export declare function buildGate1Stage4Deps(lcDir: string | undefined, asOf: string, safeExec: SafeExecFn): Stage4VerifierDeps; export interface ReplayCorpusProviderOptions { /** The `.totem/spine/gate-1` dir holding the committed cert-run fixtures. */ gate1Dir: string; /** Stage-4 verifier deps (listFiles/readFile) — injected so the run is testable. */ stage4: Stage4VerifierDeps; /** Injected timestamp (Tenet 15 determinism). */ now: string; /** Seed-blindness attestation (fold-I §7). */ seedClassesProvided?: boolean; /** Optional sink for the fold-I miner ledgers (defaults to gate1Dir/miner-ledgers.json). */ onLedgers?: (ledgers: MinerLedgers) => void; } /** * Assemble the REPLAY-mode `CertifyingCorpus` (rules + prDiffs + provenance) from * the committed gate-1 fixtures — the SHARED path both the certifying run (via * `buildReplayCorpusProvider`) and the 5d-iii label-deriver call, so the corpus * they enumerate firings over is byte-identical (the answer-key labelIds the * deriver mints are the ones the run looks up). The deriver passes * `skipGroundTruth: true` — it PRODUCES `ground-truth-labels.json`, so it must * not read it (circularity guard); the run omits the flag and loads the frozen * answer key. Returns the fold-I ledgers too; the caller decides whether to emit * them (the run does; the deriver discards — they belong to the run artifact). */ export declare function assembleCertifyingCorpus(opts: ReplayCorpusProviderOptions & { skipGroundTruth?: boolean; }, lock: WindtunnelLock): Promise<{ corpus: CertifyingCorpus; ledgers: MinerLedgers; }>; /** * Build the REPLAY-mode `CertifyingCorpusProvider` the certifying run injects: a thin * wrapper over `assembleCertifyingCorpus` (fixture-load + replay adapters + the * `buildCertifyingCorpus` composition) that also emits the fold-I miner ledgers * (default: `miner-ledgers.json`) for §7 observability. The deriver calls * `assembleCertifyingCorpus` directly instead (it skips ground-truth + discards the * ledgers, which belong to the run artifact). */ export declare function buildReplayCorpusProvider(opts: ReplayCorpusProviderOptions): CertifyingCorpusProvider; /** Injected inputs for the AUTHORED window-wide answer-key deriver's assembly (D2.6). */ export interface AuthoredCorpusAssemblyOptions { /** The `.totem/spine/gate-1` dir holding the committed authored scoring substrate. */ gate1Dir: string; /** The `.totem` dir holding the authored producer's `spine/authored-rules.yaml` + ledger. */ totemDir: string; /** Stage-4 verifier deps (listFiles/readFile) for the compile stage. */ stage4: Stage4VerifierDeps; /** Injected timestamp (Tenet 15 determinism). */ now: string; /** Optional §4 differential-evaluator injection (defaults to the real one). */ authoredControlsDeps?: AuthoredControlsDeps; /** Repo root + exec for the R1 freeze-binding resolve+prove (REQUIRED when the lock's * expectedSplitRef is content-addressed; a content-addressed run without them fails loud — * the proof is never skipped). */ repoRoot?: string; safeExec?: SafeExecFn; /** The lc clone — needed for the §5.2 pre-window ancestry proof when a fixture PR is * out-of-window; without it such a fixture stays unproven and the intake gate fails loud. */ lcDir?: string; } export declare function assembleAuthoredCertifyingCorpus(opts: AuthoredCorpusAssemblyOptions, lock: WindtunnelLock): Promise<{ corpus: CertifyingCorpus; }>; /** The raw run-context the SINGLE dispatch home consumes to assemble EITHER provider — * kind-agnostic, so the caller never branches on `producerKind` (gemini §8 single-home * ruling 2026-06-30: a caller `if (producerKind)` would leak the dispatch out of the * resolver). The resolver alone reads `lock.producerKind` and uses the inputs each * branch needs (mined: gate1Dir/stage4/now/ledger sink; authored: + totemDir + the * lock's `authored` block + the authored substrate it loads). */ export interface ResolveCorpusProviderInputs { /** The `.totem/spine/gate-1` dir holding the committed cert-run fixtures (mined replay OR authored substrate). */ gate1Dir: string; /** Stage-4 verifier deps (listFiles/readFile) — shared by both producers. */ stage4: Stage4VerifierDeps; /** Injected run timestamp (Tenet 15 determinism). */ now: string; /** The `.totem` dir holding the authored producer's `spine/authored-rules.yaml` + ledger (authored path only). */ totemDir: string; /** fold-I seed-blindness attestation (mined replay path; §7). */ seedClassesProvided?: boolean; /** Optional sink for the fold-I miner ledgers (mined replay path; defaults to gate1Dir/miner-ledgers.json). */ onLedgers?: (ledgers: MinerLedgers) => void; /** Optional §4 differential-evaluator injection for the authored controls (authored path; defaults to the real one). */ authoredControlsDeps?: AuthoredControlsDeps; /** Repo root + exec for the R1 freeze-binding resolve+prove (REQUIRED when the lock's * expectedSplitRef is content-addressed; a content-addressed run without them fails loud — * the proof is never skipped). */ repoRoot?: string; safeExec?: SafeExecFn; /** The lc clone — needed for the §5.2 pre-window ancestry proof when a fixture PR is * out-of-window; without it such a fixture stays unproven and the intake gate fails loud. */ lcDir?: string; } /** * ADR-112 §8 Slice D1/D2 — the SINGLE dispatch home: resolve the right * `CertifyingCorpusProvider` from the lock's `producerKind` (absent ⇒ 'mined', the * canonical default mirroring `provenanceKind`). The generic provider is passed * downstream; NO `if (kind==='authored')` is scattered into the caller, engine, or * persist path — the caller passes raw `inputs` unconditionally and this is the ONE * place that reads the kind (gemini §8 single-home ruling). * * - **Mined** (absent ⇒ mined): byte-unchanged behavior — returns `buildReplayCorpusProvider`. * - **Authored** (D2): require the lock's `authored` run-input block (codex require-when- * authored ruling — the schema only enforces the *reject-unless* direction), apply the * SAME hard integrity preconditions as mined (`prDiffsSha` + `groundTruthSha` MUST be * present on a certifying run — a tampered/stale scoring source or answer key must fail * loud), load the authored scoring substrate via `loadAuthoredCertRunFixtures`, and * assemble `BuildAuthoredCertifyingCorpusDeps` (lock-sourced `expectedSplitRef`; `judgedBy` * is the §8 single source derived from the ledger INSIDE the assembler, never the lock — * strategy (iii)) + the loaded split/prDiffs/groundTruth + totemDir/stage4/now). Async because the * authored substrate load is IO — the dispatch stays single-homed by owning that load * here rather than pushing a kind-branch up to the caller. * * NOTE (D2.5, ADR-112 §6): under `producerKind:'authored'` the answer key * (`ground-truth-labels.json`) MUST be derived WINDOW-WIDE (train + held-out), not * held-out-only. Authored positive controls are train-side, so a held-out-only answer * key leaves their firings unlabeled → `needsAdjudication` → a run that can never PASS * (permanent HONEST-NEGATIVE; totem-agy's D2 mechanical proof). D2 wires the input path * (test-lock-only — no production authored lock exists yet) and tracks the window-wide * deriver as a follow-on; a production authored run is NOT ready until D2.5 lands. */ export declare function resolveCertifyingCorpusProvider(lock: WindtunnelLock, inputs: ResolveCorpusProviderInputs): Promise; export {}; //# sourceMappingURL=spine-cert-run-corpus.d.ts.map