/** * The fusion orchestration: gate design (FU-3, when asked) → panel (FU-1) → * synthesis (FU-2) → gate evaluation → telemetry (FU-5 shape). One `fuse` * call = one task fused. */ import type { Api, Model, StreamFunction } from "@earendil-works/pi-ai"; import type { FusionRunRecord, GateCheck, GateRun, RoleOutput, SynthesisArtifact } from "./types.js"; export interface FuseOptions { task: string; architectModel: Model; builderModel: Model; /** Synthesis + gate-validator model (defaults to the architect model). */ judgeModel?: Model; /** Wrap the run in the FU-3 gate. */ gate?: boolean; /** * Operator consent for the designed gate (E001 §2, cole's re-review): the * checks are MODEL-AUTHORED shell, run with operator privileges. Called * with the designed checks before any execution; a false return refuses * the gate (outcome "refused") and nothing runs. * * **Required whenever `gate` is true.** Absent is a REFUSAL, not consent * (E001 finding F9): a caller that designs a gate but wires no consent * channel cannot silently run model-authored shell. */ approveGate?: (checks: GateCheck[]) => boolean | Promise; /** * Materialise the builder's current output into the workspace between gate * rounds. **Required when `gate` is true**: without it the baseline RED * state can never change, the gate is unwinnable, and {@link fuse} throws * {@link UnwinnableGateError} at entry rather than burn panel/synthesis * tokens on a run that can only halt. */ applyWork?: (builderText: string) => void; cwd?: string; maxRounds?: number; } export interface FuseResult { runId: string; outputs: RoleOutput[]; synthesis: SynthesisArtifact; gate: FusionRunRecord["gate"]; gateRuns: GateRun[]; record: FusionRunRecord; } /** * Run one fusion. A gated run REQUIRES `applyWork`: completion-only roles * cannot change the workspace, so without a materialisation path the * baseline RED state can never flip and the gate is unwinnable — fuse() * throws {@link UnwinnableGateError} at entry, before the validator, panel, * or synthesis burn a single token. */ export declare function fuse(streamFn: StreamFunction, options: FuseOptions): Promise; //# sourceMappingURL=fuse.d.ts.map