/** * Agent tool-call gate: model-router escalation, autonomy gating, extension tool hooks, and the * untrusted-content output boundary. * * Extracted verbatim from agent-session.ts (god-file decomposition). Provides the two agent-core * hooks (`beforeToolCall`/`afterToolCall`) as bound arrow-field members the session installs onto its * agent. `beforeToolCall` runs the router escalation, then the autonomy tool gate (recording the * outcome when a capability envelope is active), then extension `tool_call` handlers. `afterToolCall` * runs extension `tool_result` handlers and structurally fences output from untrusted-content sources. */ import type { Agent } from "@caupulican/pi-agent-core"; import type { CapabilityEnvelope, GateOutcome } from "./autonomy/contracts.ts"; import type { ExtensionRunner } from "./extensions/index.ts"; import type { ToolSelectionController } from "./tool-selection/tool-selection-controller.ts"; type BeforeToolCall = NonNullable; type AfterToolCall = NonNullable; export interface ToolGateControllerDeps { /** Router escalation: block a tool the active cheap route is not allowed to run. */ maybeEscalateToolCall(toolName: string, args: unknown): { block: true; reason: string; } | undefined; getCwd(): string; /** Active foreground capability envelope, if any — presence enables gate-outcome recording. */ getCapabilityEnvelope(): CapabilityEnvelope | undefined; /** Record an autonomy gate outcome (only when a capability envelope is active). */ recordGateOutcome(outcome: GateOutcome): void; getExtensionRunner(): ExtensionRunner; /** Observe an execution only after all pre-execution gates and extension hooks allow it. */ getToolSelectionController?(): ToolSelectionController | undefined; } export declare class ToolGateController { private readonly deps; constructor(deps: ToolGateControllerDeps); readonly beforeToolCall: BeforeToolCall; readonly afterToolCall: AfterToolCall; } export {}; //# sourceMappingURL=tool-gate-controller.d.ts.map