import { type CompiledRule, type ProvenanceRecord } from '../compiler-schema.js'; import { type Stage4Baseline, type Stage4VerificationResult, type Stage4VerifierDeps } from '../stage4-verifier.js'; import type { CompileInputCandidate } from './candidate-rule.js'; import type { ClassifierLedger } from './ledgers.js'; /** * The slice-4 output: a compiled, Stage-4-verified candidate. Carries `provenance` * UN-PROJECTED (slice 5 projects it into `legitimacy.provenance` when it stamps the * wind-tunnel verdict) and the full `stage4` payload (so the `no-matches` vs * `out-of-scope` distinction survives downstream — codex). The `rule` is * `unverified: true`, `legitimacy`/`ruleClass`-free, never `manual`. */ export interface CompiledCandidate { provenance: ProvenanceRecord; classifierLedgerRef: string; rule: CompiledRule; stage4: Stage4VerificationResult; } /** * ADR-112 §2 — the minimal input `runCompileStage` consumes: the candidates + the * classifier ledger. A miner `ClassifyStageResult` satisfies it structurally (its * extra `emissionLedger` is never read here); the authored producer's * `toCompileFeed` builds it WITHOUT a mining emission ledger (an authored rule has * no review-thread emission to attest, and the classifier ledger carries * `dispositionSource: 'authored-whitelist'`, not a fabricated `'classified'`). One * compiler, two producers — neither masquerading as the other. */ export interface CompileStageInput { candidates: readonly CompileInputCandidate[]; classifierLedger: ClassifierLedger; } /** Pure compile outcome (no IO): a compiled rule, or a loud per-engine validation rejection. */ export type CompileOutcome = { kind: 'compiled'; rule: CompiledRule; } | { kind: 'rejected'; reason: string; }; export interface CompileStageDeps { stage4: Stage4VerifierDeps; /** Injected timestamp — no `new Date()` in core (Tenet 15 determinism, OQ1). */ now: string; /** Stage-4 baseline; defaults to `getDefaultBaseline()` (test/fixture globs). */ baseline?: Stage4Baseline; } export interface CompileStageResult { compiled: CompiledCandidate[]; /** The classifier ledger with `stage4Confirmed` + `stage4Outcome` filled on every compile-routed entry. */ classifierLedger: ClassifierLedger; } /** * Compile a single compile-routed candidate's rule CARRIER into a `CompiledRule`. * A candidate carries exactly one: the mined producer's lesson-markdown `dslSource` * (parsed here by `extractManualPattern`) or the authored producer's already-parsed * Prop 310 `record` (lowered by `compileRuleRecord`). Both/neither throws up front. * PURE (no IO). Throws — fail loud, never a silent skip — on a behavioral candidate * (FM(c) code backstop) or a structural candidate whose `dslSource` yields no usable * pattern (a producer-contract violation: slice-2's `isUsableDsl` preflight should * have prevented emission, so this surfaces a preflight↔parser desync). Returns a * `rejected` outcome (NOT a throw) when the pattern parses but fails per-engine * safety validation (e.g. ReDoS) — a counted, reported `compile-rejected` state. */ export declare function compileCandidate(candidate: CompileInputCandidate, opts: { now: string; }): CompileOutcome; /** * Run the Stage-3 Compile + Stage-4 Verify stage over a classify result. Selects * ONLY compile-routed (structural) candidates and compiles them SEQUENTIALLY in * stable classify-output order (deterministic ordinals before any async reorder). * Returns the `CompiledCandidate[]` + the classifier ledger with `stage4Confirmed` * and `stage4Outcome` filled on every compile-routed entry (behavioral/rag-only * entries are left untouched). Mutates nothing: returns a new ledger object with a * new entries array — updated entries are spread copies, unmodified entries share * the original reference (a structural copy, not a deep copy). */ export declare function runCompileStage(classify: CompileStageInput, deps: CompileStageDeps): Promise; //# sourceMappingURL=compile.d.ts.map