fix: improve tool summaries
This commit is contained in:
1 parent
51a9053387
commit
52b6bf04af
10 files changed
+134
-17
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { formatToolDetail, resolveToolDisplay } from "./tool-display.js";
|
||||
|
||||
describe("tool display details", () => {
|
||||
it("skips zero/false values for optional detail fields", () => {
|
||||
const detail = formatToolDetail(
|
||||
resolveToolDisplay({
|
||||
name: "sessions_spawn",
|
||||
args: {
|
||||
task: "double-message-bug-gpt",
|
||||
label: 0,
|
||||
runTimeoutSeconds: 0,
|
||||
timeoutSeconds: 0,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(detail).toBe("double-message-bug-gpt");
|
||||
});
|
||||
|
||||
it("includes only truthy boolean details", () => {
|
||||
const detail = formatToolDetail(
|
||||
resolveToolDisplay({
|
||||
name: "message",
|
||||
args: {
|
||||
action: "react",
|
||||
provider: "discord",
|
||||
to: "chan-1",
|
||||
remove: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(detail).toContain("provider discord");
|
||||
expect(detail).toContain("to chan-1");
|
||||
expect(detail).not.toContain("remove");
|
||||
});
|
||||
|
||||
it("keeps positive numbers and true booleans", () => {
|
||||
const detail = formatToolDetail(
|
||||
resolveToolDisplay({
|
||||
name: "sessions_history",
|
||||
args: {
|
||||
sessionKey: "agent:main:main",
|
||||
limit: 20,
|
||||
includeTools: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(detail).toContain("session agent:main:main");
|
||||
expect(detail).toContain("limit 20");
|
||||
expect(detail).toContain("tools true");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user