/** * Decision reading for the guard — envelope-first, fail-closed. * * Differs from the SDK ladder in one critical respect: a PRESENT execution_action outside the * closed set is NOT treated as missing. Mapping from `decision` at that point reinvents * permission from the governance label and makes reconciliation impossible (there is nothing * known to reconcile against). Future restrictive actions (e.g. QUARANTINE) would be silently * ignored the same way. (@coderifts/sdk <= 3.14.1 did exactly this on a bare body; 3.14.2 gates * its legacy arm the same way this reader does. 1565/1585.) * * THE CALLER MUST READ `reason`. On EXECUTION_ACTION_UNRECOGNISED this function returns the RAW * present string as `executionAction` — deliberately, so a caller can log or reconcile what * actually arrived. That value is NOT a control-set action, and a caller that branches only on * `executionAction !== 'STOP'` will proceed on it. Branch on the closed set, or check `reason` * first. This reader does not normalise an unrecognised action to STOP: doing so would erase * the arrived value, which is the one piece of evidence the reconciliation needs. * * - PRESENT + closed set → use that action * - PRESENT + not closed → halt reason EXECUTION_ACTION_UNRECOGNISED (do not map from decision) * - MISSING → legacy decision→action map ONLY when decision_spec_version === "1.0" * explicitly AND the body is not v2 (no decision_result, no preflight_mode, * spec_version does not start "2."). Otherwise STOP + UNREADABLE_DECISION. * - nothing readable → STOP + UNREADABLE_DECISION */ import type { DecisionResultEnvelope, DecisionReceipt, ExecutionAction } from '@coderifts/sdk'; /** Closed control set — must match well-known recommended_usage.execution_action. */ declare const CLOSED_ACTIONS: Set; /** Pure decision → execution-action map (mirrors the server's deriveExecutionAction). Missing-action only. */ declare const DECISION_TO_ACTION: Record; export type ReadDecisionReason = 'UNREADABLE_DECISION' | 'EXECUTION_ACTION_UNRECOGNISED'; export interface ReadDecisionResult { /** * Action to honour when known. On EXECUTION_ACTION_UNRECOGNISED this is the raw present string * (when string-typed) so callers can distinguish it from a mapped STOP — never invent CONTINUE. * On UNREADABLE_DECISION this is STOP. */ executionAction: ExecutionAction | string; decision: string | null; envelope?: DecisionResultEnvelope; receipt?: DecisionReceipt; reason?: ReadDecisionReason; } declare function isClosedAction(v: unknown): v is ExecutionAction; /** Absent / empty — nothing to read (legacy map may apply). null/undefined/'' only. */ declare function isMissingAction(v: unknown): boolean; /** * Classify a field value. A non-empty value outside the closed set is PRESENT unknown — * including wrong types (number/object). That is not the same fact as missing. */ declare function classifyAction(v: unknown): 'missing' | 'known' | 'unknown'; /** * Read a governance decision from ANY CodeRifts response, fail-closed. * Never throws. */ export declare function readDecision(response: unknown): ReadDecisionResult; export { CLOSED_ACTIONS, DECISION_TO_ACTION, isClosedAction, isMissingAction, classifyAction }; //# sourceMappingURL=read-decision.d.ts.map