/** MCP 工具的通用安全门。领域验证由 VerificationService 负责。 */ import { createToolTrace } from "./contracts/tool_invocation_contract_registry.js"; import type { ToolInvocationViolation, SideEffect, ToolAuthorization, ToolBypass } from "../types/pipeline_types.js"; import type { TaskContext, ProjectConfig } from "../types/index.js"; import type { TaskContextManager } from "../core/task_context.js"; export interface MiddlewareGateContext { toolName: string; args: Record; invocationId: string; taskId: string | undefined; tCtx: TaskContext | null; hasWriteEffect: boolean; effectiveSideEffects: SideEffect[]; sceneExtension: { forbidden_path_patterns: string[]; scene_id?: string; }; projectPath: string; config: ProjectConfig; taskContextMgr: TaskContextManager; contract: { default_next_tools: string[]; forbidden_next_tools: string[]; }; authorization: ToolAuthorization; bypass: ToolBypass | undefined; } export interface MiddlewareGateResult { allowed: boolean; violation?: ToolInvocationViolation; trace?: ReturnType; extraResponseFields?: Record; } export declare function runMiddlewareGates(ctx: MiddlewareGateContext): Promise;