import type { ToolCallRequest } from './provider-base.js'; import type { ApprovalGate } from './agent-loop.js'; /** * Approval mode. Defaults to 'allow-list' which is the safest sane * default — operators must explicitly enumerate tools the agent may * call without an external approver. */ export type ApprovalMode = 'allow-all' | 'read-only' | 'allow-list' | 'deny-all'; export interface PolicyApprovalGateConfig { /** Selection rule. Default 'allow-list'. */ mode?: ApprovalMode; /** Tools that are always allowed regardless of mode (except 'deny-all' * where nothing passes). Names can be either built-in tool names * (`native_echo`) or MCP namespaced names (`mcp_filesystem_read_file`). */ autoAllow?: string[]; /** Tools that are always denied regardless of mode (even in * 'allow-all'). Use this as the operator's emergency brake. */ denyList?: string[]; /** * v1.2.60 — optional human-in-the-loop callback. When the policy would * otherwise return 'deny' (mode='allow-list' and tool not in autoAllow; * or mode='read-only' and tool isn't read-shaped), call this callback * to ask the user via IM. The callback should send an IM approval card * and await the user's reply, then resolve to 'allow' or 'deny'. * * If `askUser` is NOT provided, the gate falls back to the legacy * silent-deny behavior (preserves the v1.2.59 / earlier contract for * tests + callers that haven't wired the bus yet). * * Tools on `denyList` are NEVER routed through askUser — the denylist * is an operator-controlled emergency brake. */ askUser?: (call: ToolCallRequest, signal?: AbortSignal) => Promise<'allow' | 'deny'>; } /** * Build an ApprovalGate based on the supplied policy. The returned gate * is synchronous-fast (no IO) and always resolves — it never throws. */ export declare function buildPolicyApprovalGate(cfg?: PolicyApprovalGateConfig): ApprovalGate; /** * Describe a policy decision for logs / future IM "approval requested" * preview cards. Returned as a one-liner; the gate itself doesn't log * (logging belongs to the agent loop's `toolCalls` report). */ export declare function describePolicy(cfg: PolicyApprovalGateConfig): string; //# sourceMappingURL=policy-approval-gate.d.ts.map