import type { PermissionPromptDecision, PermissionPromptRequest } from '../../permissions/prompt.js'; import { type SandboxJudgmentProvider, type SandboxJudgmentConfig, type SandboxJudgmentReceipt } from './sandbox-judgment.js'; /** A sandbox escalation ask, before it becomes a broker request. */ export interface SandboxEscalationRequest { /** The sandbox raising the escalation (e.g. 'exec-sandbox'). */ readonly sandbox: string; /** The command that needs the escalation. */ readonly command: string; /** The named host-access escalations (e.g. 'wants-network'). */ readonly escalations: readonly string[]; /** One-line human summary of the sandbox boundary for this command. */ readonly boundary: string; /** The policy reasons that produced the ask. */ readonly policyReasons: readonly string[]; /** The command's working directory, when known. */ readonly workingDirectory?: string | undefined; /** Optional workspace context passed to the judgment tier. */ readonly workspaceContext?: string | undefined; } /** The result of brokering a sandbox escalation. */ export interface SandboxEscalationOutcome { readonly approved: boolean; /** The judgment receipt, when the judgment tier ran. */ readonly judgmentReceipt?: SandboxJudgmentReceipt | undefined; } /** Resolves a sandbox escalation ask to an approve/deny outcome. */ export type SandboxEscalationHandler = (request: SandboxEscalationRequest) => Promise; /** The broker `requestApproval` seam this handler routes through. */ export type EscalationApprovalRequester = (input: { readonly request: PermissionPromptRequest; readonly routeId?: string | undefined; readonly metadata?: Record | undefined; }) => Promise; /** Wiring for the optional model-judgment tier. */ export interface SandboxEscalationJudgment { readonly provider: SandboxJudgmentProvider; readonly config: SandboxJudgmentConfig; /** Called with every judgment receipt (a judgment always leaves a receipt). */ readonly onReceipt?: ((receipt: SandboxJudgmentReceipt) => void) | undefined; } /** * Build the broker-backed sandbox-escalation handler. Every escalation becomes a * `PermissionPromptRequest` in the `execute` category, attributed to the sandbox * + escalations, and is resolved by `requestApproval`. Approve → true; * deny/cancel/expire → false. * * When a judgment tier is wired AND enabled, the proposed verdict either * auto-approves the ask (opt-in, `looks-safe` only) or annotates the reasons the * human sees; either way a receipt is emitted. A judgment failure degrades to a * plain ask. */ export declare function createSandboxEscalationApprovalHandler(requestApproval: EscalationApprovalRequester, judgment?: SandboxEscalationJudgment): SandboxEscalationHandler; //# sourceMappingURL=sandbox-escalation.d.ts.map