import type { ExecApprovalDecision } from "../../infra/exec-approvals.js"; import type { ExecApprovalManager, ExecApprovalRecord } from "../exec-approval-manager.js"; import { ErrorCodes } from "../protocol/index.js"; import type { GatewayClient, GatewayRequestContext, RespondFn } from "./types.js"; type PendingApprovalLookupError = "missing" | { code: (typeof ErrorCodes)["INVALID_REQUEST"]; message: string; }; type ApprovalTurnSourceFields = { turnSourceChannel?: string | null; turnSourceAccountId?: string | null; }; type RequestedApprovalEvent = { id: string; request: TPayload; createdAtMs: number; expiresAtMs: number; }; export declare function isApprovalDecision(value: string): value is ExecApprovalDecision; export declare function isApprovalRecordVisibleToClient(params: { record: ExecApprovalRecord; client: GatewayClient | null; }): boolean; export declare function resolveApprovalRequestRecipientConnIds(params: { context: GatewayRequestContext; record: ExecApprovalRecord; excludeConnId?: string; }): ReadonlySet | null; export declare function resolvePendingApprovalRecord(params: { manager: ExecApprovalManager; inputId: string; client?: GatewayClient | null; exposeAmbiguousPrefixError?: boolean; }): { ok: true; approvalId: string; snapshot: ExecApprovalRecord; } | { ok: false; response: PendingApprovalLookupError; }; export declare function respondPendingApprovalLookupError(params: { respond: RespondFn; response: PendingApprovalLookupError; }): void; export declare function handleApprovalWaitDecision(params: { manager: ExecApprovalManager; inputId: unknown; client?: GatewayClient | null; respond: RespondFn; }): Promise; export declare function handlePendingApprovalRequest(params: { manager: ExecApprovalManager; record: ExecApprovalRecord; decisionPromise: Promise; respond: RespondFn; context: GatewayRequestContext; clientConnId?: string; requestEventName: string; requestEvent: RequestedApprovalEvent; twoPhase: boolean; deliverRequest: () => boolean | Promise; afterDecision?: (decision: ExecApprovalDecision | null, requestEvent: RequestedApprovalEvent) => Promise | void; afterDecisionErrorLabel?: string; }): Promise; export declare function handleApprovalResolve(params: { manager: ExecApprovalManager; inputId: string; decision: ExecApprovalDecision; respond: RespondFn; context: GatewayRequestContext; client: GatewayClient | null; exposeAmbiguousPrefixError?: boolean; validateDecision?: (snapshot: ExecApprovalRecord) => { message: string; details?: Record; } | null | undefined; resolvedEventName: string; buildResolvedEvent: (params: { approvalId: string; decision: ExecApprovalDecision; resolvedBy: string | null; snapshot: ExecApprovalRecord; nowMs: number; }) => TResolvedEvent; forwardResolved?: (event: TResolvedEvent) => Promise | void; forwardResolvedErrorLabel?: string; extraResolvedHandlers?: Array<{ run: (event: TResolvedEvent) => Promise | void; errorLabel: string; }>; }): Promise; export {};