Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import { describe, expect, it } from "vite-plus/test";
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",
});
});
});