Co-authored-by: codex <[email protected]> Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { deriveToolActivityPresentation } from "./toolActivity.ts";
|
|
|
|
describe("toolActivity", () => {
|
|
it("normalizes command tools to a stable ran-command label", () => {
|
|
expect(
|
|
deriveToolActivityPresentation({
|
|
itemType: "command_execution",
|
|
title: "Terminal",
|
|
detail: "Terminal",
|
|
data: {
|
|
command: "bun run lint",
|
|
},
|
|
fallbackSummary: "Terminal",
|
|
}),
|
|
).toEqual({
|
|
summary: "Ran command",
|
|
detail: "bun run lint",
|
|
});
|
|
});
|
|
|
|
it("uses structured file paths for read-file tools when available", () => {
|
|
expect(
|
|
deriveToolActivityPresentation({
|
|
itemType: "dynamic_tool_call",
|
|
title: "Read File",
|
|
detail: "Read File",
|
|
data: {
|
|
kind: "read",
|
|
locations: [{ path: "/tmp/app.ts" }],
|
|
},
|
|
fallbackSummary: "Read File",
|
|
}),
|
|
).toEqual({
|
|
summary: "Read file",
|
|
detail: "/tmp/app.ts",
|
|
});
|
|
});
|
|
|
|
it("drops duplicated generic read-file detail when no path is available", () => {
|
|
expect(
|
|
deriveToolActivityPresentation({
|
|
itemType: "dynamic_tool_call",
|
|
title: "Read File",
|
|
detail: "Read File",
|
|
data: {
|
|
kind: "read",
|
|
rawInput: {},
|
|
},
|
|
fallbackSummary: "Read File",
|
|
}),
|
|
).toEqual({
|
|
summary: "Read file",
|
|
});
|
|
});
|
|
});
|