/** * Automation Tier Matrix — 受控自动化权限矩阵(单一真相源)。 * * 职责边界: * - 负责:把每个 (tool, action) 映射到 automation tier(L0-L3),回答"能否无需 confirm 自动执行" * - 不负责:运行时拦截(middleware.checkAuth 仍是最终拦截点)、工具实现、schema 校验 * * - L0 只读诊断:纯读,不写任何状态。 * - L1 生命周期动作:创建任务、推进或交付,只写任务状态。 * - L2 受控执行:写验证或审查派生记录,不写用户业务产物。 * - L3 人类确认写入:清状态、应用升级、豁免或知识写入。 * * 边界: * - L3 动作永远不可自动执行,高风险确认不可绕过。 * - 不删 tool_actions.ts 的 action 枚举(它是 schema 真相源;本矩阵是权限真相源,二者职责不同) * - 不在本文件加运行时副作用(纯常量 + 纯函数,便于单测与变更影响分析) * * 被谁调用:发布检查和授权策略 * 调用谁:无(纯常量) * * 数据流:(tool, action) → getAutomationTier → AutomationTier;isAutoExecutable / requiresConfirmation 派生 * 持久化:无 */ /** 自动化层级 */ export type AutomationTier = "L0_READONLY" | "L1_SUGGEST" | "L2_CONTROLLED_AUTO" | "L3_CONFIRM_REQUIRED"; /** * (tool, action) → tier 权威映射表。 * * 覆盖 tool_actions.ts 声明的全部 action 枚举,并为无枚举参数工具提供默认动作。 * 缺省(未列出 action)= L3_CONFIRM_REQUIRED(保守 fail-closed:未知动作按需确认)。 * * 同步约束:新增工具 action 必须在此登记 tier,否则 checkAutomationTierMatrix 发布门禁阻断。 */ declare const TIER_MATRIX: Readonly>>>; /** * 查询 (tool, action) 的自动化层级。 * * 未知工具或未知 action → L3_CONFIRM_REQUIRED(保守 fail-closed:未知按需确认,不自动放行)。 * * @param tool 工具名 * @param action action 名;无 action 概念的工具传 undefined * @returns AutomationTier */ export declare function getAutomationTier(tool: string, action?: string): AutomationTier; /** * 是否允许自动执行(无需 confirm=true)。 * L0/L1/L2 可自动;L3 必须 confirm。 */ export declare function isAutoExecutable(tool: string, action?: string): boolean; /** * 是否必须用户确认(写用户业务产物 / 清状态 / apply / waiver / knowledge write)。 * 本矩阵是确认要求的单一真相源。 */ export declare function requiresConfirmation(tool: string, action?: string): boolean; export { TIER_MATRIX };