import { z } from 'zod'; import { type CandidateRuleRecord, type ClassifierDisposition } from './candidate-rule.js'; import type { DraftCandidate, ExtractStageResult } from './extract.js'; import { type ClassifierLedger, type EmissionLedger, type MinerLedgers, type Routing, type SplitLedger } from './ledgers.js'; /** * The classifier's verdict on one draft. `disposition` is the structural/behavioral * call; `dispositionSource` distinguishes a genuine judgment from the safe-default * on classifier failure (see below). Parsed at the core boundary (a non-enum value * from a buggy adapter fails loud here, BEFORE routing/mint). */ export declare const ClassifierResultSchema: z.ZodEffects; dispositionSource: z.ZodEnum<["classified", "error-default", "authored-whitelist"]>; }, "strip", z.ZodTypeAny, { disposition: "structural" | "behavioral"; dispositionSource: "classified" | "error-default" | "authored-whitelist"; }, { disposition: "structural" | "behavioral"; dispositionSource: "classified" | "error-default" | "authored-whitelist"; }>, { disposition: "structural" | "behavioral"; dispositionSource: "classified" | "error-default" | "authored-whitelist"; }, { disposition: "structural" | "behavioral"; dispositionSource: "classified" | "error-default" | "authored-whitelist"; }>; export type ClassifierResult = z.infer; /** * Injected draft-classifier port (ADR-111 §4). Core-defined, CLI-implemented — * the live LLM lives behind this at the CLI layer (draft-only, Tenet-15); a * deterministic fixture impl drives tests. The miner is BLIND to seed classes * (§7 / FM(f)): the port is handed ONLY a slice-2 `DraftCandidate` (provenance + * dslSource) — the signature itself carries no seed channel (the structural * backstop; the emission-ledger attestation is its CI-observable witness). * * Error contract (mirrors `DraftExtractor`'s `[]`-on-failure): on its own * internal/transient failure (LLM/network), the adapter catches it and returns * the SAFE DEFAULT `{ disposition: 'behavioral', dispositionSource: 'error-default' }` * — the conservative low-privilege route (RAG-only, never compile; Tenet 9), * Stage-4-backstopped. It MUST NOT throw for a per-candidate failure; a * contract-violating throw propagates loudly (core adds no swallowing catch — * Tenet 4). */ export interface DraftClassifier { classify(draft: DraftCandidate): Promise; } /** Dependencies for a single Classify-stage run. */ export interface ClassifyStageDeps { classifier: DraftClassifier; } /** The Classify stage's output: the minted candidates + the two ledgers Classify owns. */ export interface ClassifyStageResult { /** The miner's SOLE output (ADR-111 §3); 1:1 with `emissionLedger.entries`. */ candidates: CandidateRuleRecord[]; /** Emission ledger — per-candidate routing + the run-level seed-blindness attestation (§8 / FM f). */ emissionLedger: EmissionLedger; /** Classifier ledger — structural/behavioral split + Stage-4 confirmation + disposition source (§8). */ classifierLedger: ClassifierLedger; } /** * Derive routing from the classifier disposition — the ONLY place routing is set, * never accepted as caller input, so emission `routing`, emission * `classifierDisposition`, and the classifier-ledger `disposition` can never drift * (the desync FM(c) guards against). Exhaustive over the 2-value enum. */ export declare function dispositionToRouting(disposition: ClassifierDisposition): Routing; /** * Run the deterministic Stage-2 Classify over slice-2's Extract output against the * frozen split ledger. Deterministic given its deps: identical drafts + a fixed * classifier → identical candidates, refs, and ledgers (drafts are classified * SEQUENTIALLY, so ordinal assignment + ledger order follow the stable input order). * * Per draft (in input order): re-validate provenance against the frozen split * (fail loud on a forged draft — never a drop) → classify (parse the result at the * boundary) → derive routing → mint the `CandidateRuleRecord` → record one emission * + one classifier ledger row. Drafts are NEVER de-duplicated (duplicate `dslSource` * → distinct candidates with distinct refs); any dedup is a downstream concern. * * @throws if a draft's provenance PR is not in the frozen train slice, or its * `commitSha` ≠ that PR's frozen merge commit (producer-integrity violation), if * the classifier returns a non-enum result, or if the 1:1/uniqueness invariants * break — all fail-loud (Tenet 4), distinct from a content drop (Extract-only). */ export declare function runClassifyStage(extract: ExtractStageResult, splitLedger: SplitLedger, deps: ClassifyStageDeps): Promise; /** * Combine the five §8 ledgers into the harness's `MinerLedgers` — a thin, pure * struct assembly (no orchestration; the fetch→extract→classify DRIVING is slice * 5). Lets the §8 falsification harness run end-to-end on REAL producer output * now: split (slice 1) + drop/apiUsage (slice 2 Extract) + emission/classifier * (slice 3 Classify). The schema parse validates the combined shape. */ export declare function assembleMinerLedgers(splitLedger: SplitLedger, extract: ExtractStageResult, classify: ClassifyStageResult): MinerLedgers; //# sourceMappingURL=classify.d.ts.map