/** * What assures a DELIVERY (wicked-core#850, codex audit EX-03 / EX-04) — pure helpers the deliver * paths in `routes.ts` share. * * EX-03: a run whose assurance contract requires `qe_acceptance` (a workflow's * `required_instruments`; the engine carries it on `AgentSession.assurance.required` and leaves the * enforcement to the launcher) delivers ONLY on a QE verdict that is a PASS attributed to the run. * A FAIL, any other verdict, no verdict, an unattributed verdict or an unreadable ledger refuses the * delivery — at the deliver gate's approve, at a gated resume, and at a post-hoc lift. Nothing is * pushed, and a deliver gate stays open for the approve to be retried once the PASS is recorded. * * QE-IN-APP-WORKFLOWS (wicked-core-ts >= 0.7.49): the contract also carries the run's DECISION * (`assurance.qe`): `required`, `waived` (the run's diff scored in the lowest band on every * dimension) or `skipped` (the operator's explicit word at launch, with a reason). Only `required` * reads the ledger; a waived or skipped delivery is not refused, and its check says which and why. * A contract with no decision (an older engine) that requires `qe_acceptance` is `required`. * * EX-04: a post-hoc lift (`POST /runs/:id/deliver`) has no engine verification behind the tree it * pushes, so it is labelled UNVERIFIED with the run's tree before and after the lift — in the PR * body (the deliver script, `DELIVER_UNVERIFIED_MARKER`) and in the run record * (`AgentSession.delivery_assurance`, rehydrated from the `run.delivered` audit entry). */ import type { QeAcceptanceDecision, AssuranceReceipt, DeliveryAssurance, QeAcceptanceCheck, QeAcceptanceRefusal, SessionView, WorkUnit } from '../core/types.js'; import type { AcceptanceView } from '../qe/acceptance.js'; export { QE_ACCEPTANCE, QE_PRESETS } from '../core/qe-acceptance-setting.js'; /** `QeAcceptanceRefusal.code`. */ export declare const QE_ACCEPTANCE_REQUIRED_CODE: "qe_acceptance_required"; /** Whether the run's persisted contract requires a QE acceptance PASS before delivery. A run from an * engine without the contract carries none and requires nothing here (its gate is the old one). */ export declare function requiresQeAcceptance(view: SessionView): boolean; /** The run's QE decision when its contract requires `qe_acceptance` (else `null`): the engine's * `assurance.qe`, or — on an engine that records no decision — a plain `required`. */ export declare function qeDecisionOf(view: SessionView): QeAcceptanceDecision | null; /** Whether a decision lets a delivery go WITHOUT a ledger PASS: only a waiver the engine made from * the run's diff (`waived` + `basis: 'diff'`) or the operator's explicit skip (`skipped` + `basis: * 'operator'`, with a reason). Anything else — `required`, an unknown status, a mismatched basis, a * malformed record — reads the ledger (codex r1 on the crew PR: fail closed). */ export declare function qeDecisionBypasses(decision: QeAcceptanceDecision): boolean; /** A delivery's check when the decision is NOT `required`: satisfied, no verdict read, and it says * which (`waived` by the score, `skipped` by the operator) in the decision's own words. */ export declare function qeAcceptanceNotRequired(decision: QeAcceptanceDecision): QeAcceptanceCheck; /** The check a delivery ran, from the acceptance view resolved with the requirement FORCED on (a * contract that requires QE acceptance owes a verdict even when no phase raises `verified_evidence`). */ export declare function qeAcceptanceFromView(view: AcceptanceView): QeAcceptanceCheck; /** (j4-gates) The check of a delivery the operator approved WITH a QE skip at the deliver gate * (`action: 'skip_qe'`): satisfied, no verdict read, in the engine's own words for the skip. */ export declare function qeAcceptanceSkippedAtGate(reason: string): QeAcceptanceCheck; /** A check that could not be read at all is a refusal, naming why (deny-dominates). */ export declare function unreadableQeAcceptance(err: unknown): QeAcceptanceCheck; /** The 409 body of a delivery the QE acceptance requirement refused. */ export declare function qeAcceptanceRefusal(runId: string, check: QeAcceptanceCheck, assurance: AssuranceReceipt | null, where: 'gate' | 'post_hoc'): QeAcceptanceRefusal; /** A unit's persisted receipt (`WorkUnit.assurance`), or `null`. */ export declare function receiptOf(unit: WorkUnit | undefined): AssuranceReceipt | null; /** * The run's receipts aggregated for a delivery no engine lift preceded (a post-hoc one): the * contract from the session (else the first receipt), every instrument any gate ran, every skip * (first reason per instrument), the delivered `tree`. The who-fields are per-gate facts with no * single answer across a run, so they are `null` here — each unit's receipt keeps its own. * `null` when the run carries neither a contract nor a receipt (an engine before the contract). */ export declare function aggregateReceipt(view: SessionView, tree: string | null): AssuranceReceipt | null; /** The post-hoc delivery's assurance (EX-04): never verified, both trees named. */ export declare function postHocDeliveryAssurance(view: SessionView, trees: { treeBefore: string | null; treeAfter: string | null; } | null, qeAcceptance: QeAcceptanceCheck | null): DeliveryAssurance; //# sourceMappingURL=delivery-assurance.d.ts.map