import { type ToolPermissionConfig } from './permissions.js'; import { type SuspectedLoopWindow } from './suspected-loop-detector.js'; import { RepeatFailureGuard } from './repeat-failure-guard.js'; import type { HookRegistry } from '../hooks.js'; import type { ToolCall, ToolResult } from '../providers/anthropic-direct/types.js'; import type { CanUseTool } from '../types/sdk-types.js'; import type { TraceSink } from '../trace/index.js'; import type { GrantManager } from './grant-manager.js'; export interface PreDispatchGateMutableState { repeatBreaker: { fingerprint: string; count: number; } | null; suspectedLoopWindow: SuspectedLoopWindow | null; denialBreaker: { count: number; deniedPaths: string[]; } | null; } export interface PreDispatchGateDeps { state: PreDispatchGateMutableState; hookRegistry: HookRegistry | undefined; permissions: ToolPermissionConfig | undefined; canUseTool: CanUseTool | undefined; readOnlyBash: boolean; repeatFailureGuard: RepeatFailureGuard; sessionId: string | undefined; parentSessionId: string | undefined; subagentId: string | undefined; sessionGrantManager: GrantManager | undefined; resolveBase: string | undefined; traceWriter: TraceSink | undefined; isRegisteredTool: (toolName: string) => boolean; denialReason: (toolName: string, permissionReason: string | undefined) => string; } export declare function emitPreToolUseBlock(blockedTool: string, reason: string, deps: PreDispatchGateDeps): Promise; export declare function resetDenialBreaker(state: PreDispatchGateMutableState): void; export declare function accountDenialBreakerPostGate(call: ToolCall, blockReason: string | undefined, blockResult: ToolResult, deps: PreDispatchGateDeps): ToolResult; export declare function replayObserveSuspectedLoopPostGate(call: ToolCall, deps: PreDispatchGateDeps): void; export interface RunPreDispatchGatesOpts { parallelSafe?: boolean; } export declare function runPreDispatchGates(call: ToolCall, deps: PreDispatchGateDeps, repeatBreakerExemptTools: ReadonlySet, repeatCircuitBreakerThreshold: number, opts?: RunPreDispatchGatesOpts): Promise;