fix: normalize exec tool alias naming

This commit is contained in:
Peter Steinberger
2026-01-17 18:14:43 +00:00
parent 5304a8c2d1
commit 3df2dc0b15
4 changed files with 32 additions and 69 deletions

View File

@@ -25,4 +25,25 @@ describe("pi tool definition adapter", () => {
expect(result.details).toMatchObject({ error: "nope" });
expect(JSON.stringify(result.details)).not.toContain("\n at ");
});
it("normalizes exec tool aliases in error results", async () => {
const tool = {
name: "bash",
label: "Bash",
description: "throws",
parameters: {},
execute: async () => {
throw new Error("nope");
},
} satisfies AgentTool<unknown, unknown>;
const defs = toToolDefinitions([tool]);
const result = await defs[0].execute("call2", {}, undefined, undefined);
expect(result.details).toMatchObject({
status: "error",
tool: "exec",
error: "nope",
});
});
});