From ce244decd06d6213c1f4931d93fcf2505593043e Mon Sep 17 00:00:00 2001 From: Simon Kim Date: Sat, 21 Mar 2026 04:13:06 +0900 Subject: [PATCH] Include tool aliases in conformance snapshot --- src/agents/tool-policy-shared.ts | 2 +- src/agents/tool-policy.conformance.ts | 6 ++---- src/agents/tool-policy.test.ts | 5 +++++ src/agents/tool-policy.ts | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/agents/tool-policy-shared.ts b/src/agents/tool-policy-shared.ts index e28c623de44..0ee61818373 100644 --- a/src/agents/tool-policy-shared.ts +++ b/src/agents/tool-policy-shared.ts @@ -9,7 +9,7 @@ type ToolProfilePolicy = { deny?: string[]; }; -const TOOL_NAME_ALIASES: Record = { +export const TOOL_NAME_ALIASES: Record = { bash: "exec", "apply-patch": "apply_patch", }; diff --git a/src/agents/tool-policy.conformance.ts b/src/agents/tool-policy.conformance.ts index f26e83f5db8..4a5817bc2af 100644 --- a/src/agents/tool-policy.conformance.ts +++ b/src/agents/tool-policy.conformance.ts @@ -7,11 +7,9 @@ * the formal models/extractors. */ -import { TOOL_GROUPS } from "./tool-policy.js"; - -// Tool name aliases are intentionally not exported from tool-policy today. -// Keep the conformance snapshot focused on exported policy constants. +import { TOOL_GROUPS, TOOL_NAME_ALIASES } from "./tool-policy.js"; export const TOOL_POLICY_CONFORMANCE = { toolGroups: TOOL_GROUPS, + toolNameAliases: TOOL_NAME_ALIASES, } as const; diff --git a/src/agents/tool-policy.test.ts b/src/agents/tool-policy.test.ts index 963c703a409..1a2bd775c70 100644 --- a/src/agents/tool-policy.test.ts +++ b/src/agents/tool-policy.test.ts @@ -136,6 +136,11 @@ describe("TOOL_POLICY_CONFORMANCE", () => { expect(TOOL_POLICY_CONFORMANCE.toolGroups).toEqual(TOOL_GROUPS); }); + it("includes all exported policy constants needed for drift detection", async () => { + const { TOOL_NAME_ALIASES } = await import("./tool-policy.js"); + expect(TOOL_POLICY_CONFORMANCE.toolNameAliases).toEqual(TOOL_NAME_ALIASES); + }); + it("is JSON-serializable", () => { expect(() => JSON.stringify(TOOL_POLICY_CONFORMANCE)).not.toThrow(); }); diff --git a/src/agents/tool-policy.ts b/src/agents/tool-policy.ts index 5538fb765ce..53921b25c31 100644 --- a/src/agents/tool-policy.ts +++ b/src/agents/tool-policy.ts @@ -4,6 +4,7 @@ import { normalizeToolName, resolveToolProfilePolicy, TOOL_GROUPS, + TOOL_NAME_ALIASES, } from "./tool-policy-shared.js"; import type { AnyAgentTool } from "./tools/common.js"; export { @@ -12,6 +13,7 @@ export { normalizeToolName, resolveToolProfilePolicy, TOOL_GROUPS, + TOOL_NAME_ALIASES, } from "./tool-policy-shared.js"; export type { ToolProfileId } from "./tool-policy-shared.js";