feat(server): support Grep tool in Claude tool-call mapping
This commit is contained in:
@@ -96,6 +96,12 @@ const ClaudeToolDetailPass2Schema = z.union([
|
||||
toolDetailBranchByName("search", ToolSearchInputSchema, z.unknown(), (input) =>
|
||||
toSearchToolDetail(input)
|
||||
),
|
||||
toolDetailBranchByName("Grep", ToolSearchInputSchema, z.unknown(), (input) =>
|
||||
toSearchToolDetail(input)
|
||||
),
|
||||
toolDetailBranchByName("grep", ToolSearchInputSchema, z.unknown(), (input) =>
|
||||
toSearchToolDetail(input)
|
||||
),
|
||||
toolDetailBranchByName("Glob", ToolSearchInputSchema, z.unknown(), (input) =>
|
||||
toSearchToolDetail(input)
|
||||
),
|
||||
|
||||
@@ -245,6 +245,30 @@ describe("claude tool-call mapper", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("maps Grep calls as search detail using pattern input", () => {
|
||||
const item = expectMapped(
|
||||
mapClaudeCompletedToolCall({
|
||||
callId: "claude-grep-1",
|
||||
name: "Grep",
|
||||
input: {
|
||||
pattern: '\\\\\\"cli\\\\\\""',
|
||||
path: "/Users/moboudra/dev/paseo/packages/desktop/src-tauri/src",
|
||||
output_mode: "content",
|
||||
"-n": true,
|
||||
},
|
||||
output: { output: "No matches found" },
|
||||
})
|
||||
);
|
||||
|
||||
expect(item.status).toBe("completed");
|
||||
expect(item.error).toBeNull();
|
||||
expect(item.name).toBe("Grep");
|
||||
expect(item.detail).toEqual({
|
||||
type: "search",
|
||||
query: '\\\\\\"cli\\\\\\""',
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes claude speak tool names through schema transforms", () => {
|
||||
const item = expectMapped(
|
||||
mapClaudeCompletedToolCall({
|
||||
|
||||
@@ -75,6 +75,8 @@ const ClaudeSearchToolNameSchema = z.union([
|
||||
z.literal("WebSearch"),
|
||||
z.literal("web_search"),
|
||||
z.literal("search"),
|
||||
z.literal("Grep"),
|
||||
z.literal("grep"),
|
||||
z.literal("Glob"),
|
||||
z.literal("glob"),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user