Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __tests__/hooks/copilot-canonicalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe("Copilot tool-input canonicalization (verified 1.0.71 captures)", () =>
// permissionRequest delivers `toolName: "bash"` (lowercase) even on 1.0.71.
expect(canonicalizeToolName("bash", "copilot")).toBe("Bash");
expect(canonicalizeToolName("view", "copilot")).toBe("Read");
expect(canonicalizeToolName("task", "copilot")).toBe("Task");
expect(canonicalizeToolName("web_search", "copilot")).toBe("WebSearch");
});

it("only maps the three file tools (no accidental key rewrites elsewhere)", () => {
Expand Down
2 changes: 2 additions & 0 deletions __tests__/hooks/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ describe("hooks/handler", () => {
["rg", "Grep"],
["ls", "LS"],
["web_fetch", "WebFetch"],
["task", "Task"],
["web_search", "WebSearch"],
];
for (const [raw, canonical] of cases) {
vi.mocked(evaluatePolicies).mockResolvedValueOnce({
Expand Down
6 changes: 6 additions & 0 deletions src/hooks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ export const COPILOT_TOOL_MAP: Record<string, string> = {
rg: "Grep",
ls: "LS",
web_fetch: "WebFetch",
// Copilot CLI documents `task` and `web_search`. Unmapped names pass
// through raw, so a policy matching toolName === "Task" silently never
// fires. `ask_user` is left unmapped: it has no filesystem or shell
// reach, so treating it as a no-op canonicalization is the safer call.
task: "Task",
web_search: "WebSearch",
};

/**
Expand Down