/** * Tool Invocation Contract Registry — 契约层模块。 * * 职责边界: * - 负责:工具调用契约的注册与查询 * - 不负责:不属于本模块的职责由对应模块承担 * * 被谁调用:契约验证、注册表查询 * 调用谁:pipeline、logger * * 数据流:契约定义 → 验证逻辑 → 通过/拒绝结果 * 持久化:无持久化(纯计算/内存态) */ import type { SideEffect, ToolTrace, ToolAuthorization, ToolBypass, ToolInvocationViolation, ToolInvocationContract } from "../../types/pipeline_types.js"; /** 列出所有已注册的工具调用契约 */ export declare function listToolInvocationContracts(): ToolInvocationContract[]; /** 按工具名称查找对应的调用契约 */ export declare function findToolInvocationContractByName(toolName: string): ToolInvocationContract | undefined; /** 检查副作用列表是否包含写入类副作用 */ export declare function hasWriteSideEffect(effects: SideEffect[]): boolean; /** 是否可能改变用户工作区;内部派生状态写入不需要工作区覆盖保护。 */ export declare function mutatesWorkspace(effects: SideEffect[]): boolean; /** 创建工具调用追踪记录 */ export declare function createToolTrace(params: { tool_name: string; invocation_id: string; task_id?: string; workflow_id?: string; contract_ids?: string[]; capability_ids?: string[]; guard_report_id?: string; degraded?: boolean; warnings?: string[]; actual_side_effects: SideEffect[]; next_allowed_tools?: string[]; forbidden_tools?: string[]; authorization?: ToolAuthorization; bypass?: ToolBypass; }): ToolTrace; export interface ValidateToolInvocationParams { tool_name: string; authorization?: { granted: boolean; reason?: string; }; bypass?: { allowed: boolean; reason: string; }; actual_side_effects: SideEffect[]; workflow_id?: string; /** @internal Override contract lookup for dynamic category tools */ _contractOverride?: ToolInvocationContract; } /** 验证工具调用是否符合契约约束,返回违规列表 */ export declare function validateToolInvocation(params: ValidateToolInvocationParams): ToolInvocationViolation[];