import { z } from "zod"; import { type DecisionEvidence, type AuditRecorder, type CapturedIntent, type DecionisGate, type DecisionAuthority, type DecisionGate, type PresenceApprovalClient } from "@decionis/agent-safe-pipeline"; import type { EscalationConfig } from "../config/ExecutorConfig.js"; import type { FetchLike } from "../handlers/HandlerRegistration.js"; /** * What the caller is handed on an `ESCALATE`, and presents back verbatim to * resume. It carries the exact intent, so the process keeps nothing between * the two calls, and only what the mode needs: a Presence request id in * direct mode, the authority's escalation state in managed mode. Neither is * authority; a grant exists only after the authority evaluates again. */ export declare const EscalationHandoffSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ mode: z.ZodLiteral<"DIRECT">; intent: z.ZodRecord; request_id: z.ZodString; approval_url: z.ZodNullable; expires_at: z.ZodNullable; }, z.core.$strict>, z.ZodObject<{ mode: z.ZodLiteral<"MANAGED">; intent: z.ZodRecord; escalation: z.ZodObject<{ escalationId: z.ZodString; intentId: z.ZodString; status: z.ZodEnum<{ FAILED: "FAILED"; REJECTED: "REJECTED"; EXPIRED: "EXPIRED"; PENDING_PRESENCE: "PENDING_PRESENCE"; PRESENCE_REQUESTED: "PRESENCE_REQUESTED"; AWAITING_APPROVER: "AWAITING_APPROVER"; PRESENCE_VERIFIED: "PRESENCE_VERIFIED"; REAUTHORIZING: "REAUTHORIZING"; GRANT_READY: "GRANT_READY"; BLOCKED: "BLOCKED"; CANCELLED: "CANCELLED"; }>; outcome: z.ZodEnum<{ ALLOW: "ALLOW"; BLOCK: "BLOCK"; ERROR: "ERROR"; ESCALATE_PENDING: "ESCALATE_PENDING"; }>; expiresAt: z.ZodString; reasonCodes: z.ZodReadonly>; }, z.core.$strict>; }, z.core.$strict>], "mode">; export type EscalationHandoff = z.infer; /** * A presence provider's attestation presented for an open escalation: the * exact intent, and the compact JWS the provider signed over it (a * cardholder's tap, for instance). It is evidence for a fresh evaluation, * never authority; this process shapes and bounds it, sends it to the * authority, which verifies it, and keeps nothing of it. */ export declare const AttestationResumeSchema: z.ZodObject<{ mode: z.ZodLiteral<"ATTESTATION">; intent: z.ZodRecord; attestation: z.ZodString; requirement: z.ZodOptional; }, z.core.$strict>; /** What `/v1/escalations` accepts: a handoff it was given, or an attestation for the intent. */ export declare const EscalationResumeSchema: z.ZodUnion; intent: z.ZodRecord; request_id: z.ZodString; approval_url: z.ZodNullable; expires_at: z.ZodNullable; }, z.core.$strict>, z.ZodObject<{ mode: z.ZodLiteral<"MANAGED">; intent: z.ZodRecord; escalation: z.ZodObject<{ escalationId: z.ZodString; intentId: z.ZodString; status: z.ZodEnum<{ FAILED: "FAILED"; REJECTED: "REJECTED"; EXPIRED: "EXPIRED"; PENDING_PRESENCE: "PENDING_PRESENCE"; PRESENCE_REQUESTED: "PRESENCE_REQUESTED"; AWAITING_APPROVER: "AWAITING_APPROVER"; PRESENCE_VERIFIED: "PRESENCE_VERIFIED"; REAUTHORIZING: "REAUTHORIZING"; GRANT_READY: "GRANT_READY"; BLOCKED: "BLOCKED"; CANCELLED: "CANCELLED"; }>; outcome: z.ZodEnum<{ ALLOW: "ALLOW"; BLOCK: "BLOCK"; ERROR: "ERROR"; ESCALATE_PENDING: "ESCALATE_PENDING"; }>; expiresAt: z.ZodString; reasonCodes: z.ZodReadonly>; }, z.core.$strict>; }, z.core.$strict>], "mode">, z.ZodObject<{ mode: z.ZodLiteral<"ATTESTATION">; intent: z.ZodRecord; attestation: z.ZodString; requirement: z.ZodOptional; }, z.core.$strict>]>; export type EscalationResume = z.infer; /** * Where the authority sent the hold, as its decision carried it: the policy's * selector (kind and role, never a person) and who proves the person, by * which method. A third-party provider here (`koard`, method `CARD_TAP`) * means that provider's attestation alone resumes the hold; `decionis` means * Decionis Presence. Routing for whoever asks the person, never authority. */ export interface AttestationRequirement { readonly requirement_id: string | null; readonly expires_at: string; readonly selector: { readonly kind: "ROLE" | "PRINCIPAL"; readonly role_id?: string; } | null; readonly verification: { readonly provider: string; readonly methods: readonly string[]; readonly level: "STANDARD" | "HIGH_CONFIDENCE"; } | null; } /** * What the caller is handed when an escalation can be resumed with an * attestation and nothing else: the exact intent, to present back with it, * and where the authority sent the hold when it said. */ export interface AttestationHandoff { readonly mode: "ATTESTATION"; readonly intent: Record; readonly requirement: AttestationRequirement | null; } type DistributiveOmit = T extends unknown ? Omit : never; /** The handoff without the intent: what a mode knows, and what is echoed while pending. */ export type EscalationState = DistributiveOmit; /** One step of a resumption: either a decision to run, or a state to report. */ export type EscalationResolution = { readonly kind: "DECISION"; readonly decision: DecisionGate; } | { readonly kind: "PENDING"; readonly handoff: EscalationState; readonly reasonCodes: readonly string[]; } | { readonly kind: "REFUSED"; readonly reasonCodes: readonly string[]; readonly failClosed: boolean; }; export interface EscalationDependencies { readonly presence?: PresenceApprovalClient; /** The fetch the Presence transport uses; the guarded one in the process. */ readonly fetch?: FetchLike; } /** * Resolves an `ESCALATE` in the shape the adopter configured. Both shapes * are stateless on this side: the handoff the caller presents is validated * by the authority against the exact intent, so a request id or an * escalation id that belongs to another intent cannot produce a grant here. */ export declare class EscalationResolver { private readonly config; private readonly gate; /** * What makes the first decision: the gate, unless an edge authority * decides in front of it. Resumption is always the gate's: a ceremony's * status and the re-evaluation with its receipt are hosted. */ private readonly first; private readonly coordinator; private readonly presence; constructor(config: EscalationConfig, gate: DecionisGate, audit: AuditRecorder, dependencies?: EscalationDependencies, /** The Presence credential for `DIRECT`, read from its handle by the caller for this build. */ presenceApiKey?: string | null, /** * What makes the first decision: the gate, unless an edge authority * decides in front of it. Resumption is always the gate's: a ceremony's * status and the re-evaluation with its receipt are hosted. */ first?: DecisionAuthority); get mode(): EscalationConfig["mode"]; /** * The first evaluation, with the signed signals the proposal carried as * evidence; in managed mode it also asks the authority to orchestrate. */ evaluate(captured: CapturedIntent, evidence?: DecisionEvidence): Promise; /** * What the caller is handed after an `ESCALATE`. In direct mode this opens * the Presence request, bound to the intent hash the person will see. */ handoff(captured: CapturedIntent, decision: DecisionGate): Promise; /** * A fresh evaluation of the same intent with a presence attestation as the * approval evidence. Whatever the escalation shape, this asks for no * orchestration: the authority verifies the attestation against the * intent hash and decides, and a refusal is a fail-closed `BLOCK`. */ attest(captured: CapturedIntent, attestation: string): Promise; /** One bounded lookup, then either a fresh decision or the state to report. */ resume(captured: CapturedIntent, handoff: EscalationHandoff): Promise; private resumeManaged; private resumeDirect; } export {}; //# sourceMappingURL=EscalationResolver.d.ts.map