refactor!: drop clawdis_ tool prefix
This commit is contained in:
@@ -24,6 +24,7 @@ describe("tool meta formatting", () => {
|
||||
vi.stubEnv("HOME", "/Users/test");
|
||||
expect(shortenMeta("/Users/test/a.txt")).toBe("~/a.txt");
|
||||
expect(shortenMeta("/Users/test/a.txt:12")).toBe("~/a.txt:12");
|
||||
expect(shortenMeta("cd /Users/test/dir && ls")).toBe("cd ~/dir && ls");
|
||||
expect(shortenMeta("")).toBe("");
|
||||
});
|
||||
|
||||
@@ -35,7 +36,7 @@ describe("tool meta formatting", () => {
|
||||
"note",
|
||||
"a→b",
|
||||
]);
|
||||
expect(out).toMatch(/^🛠️ fs/);
|
||||
expect(out).toMatch(/^🧩 fs/);
|
||||
expect(out).toContain("~/dir/{a.txt, b.txt}");
|
||||
expect(out).toContain("note");
|
||||
expect(out).toContain("a→b");
|
||||
@@ -43,8 +44,8 @@ describe("tool meta formatting", () => {
|
||||
|
||||
it("formats prefixes with default labels", () => {
|
||||
vi.stubEnv("HOME", "/Users/test");
|
||||
expect(formatToolPrefix(undefined, undefined)).toBe("🛠️ tool");
|
||||
expect(formatToolPrefix("x", "/Users/test/a.txt")).toBe("🛠️ x: ~/a.txt");
|
||||
expect(formatToolPrefix(undefined, undefined)).toBe("🧩 tool");
|
||||
expect(formatToolPrefix("x", "/Users/test/a.txt")).toBe("🧩 x: ~/a.txt");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ export const TOOL_RESULT_DEBOUNCE_MS = 500;
|
||||
export const TOOL_RESULT_FLUSH_COUNT = 5;
|
||||
|
||||
const TOOL_EMOJI_BY_NAME: Record<string, string> = {
|
||||
bash: "💻",
|
||||
bash: "🛠️",
|
||||
process: "🧰",
|
||||
read: "📖",
|
||||
write: "✍️",
|
||||
edit: "📝",
|
||||
attach: "📎",
|
||||
clawdis_browser: "🌐",
|
||||
clawdis_canvas: "🖼️",
|
||||
clawdis_nodes: "📱",
|
||||
clawdis_cron: "⏰",
|
||||
clawdis_gateway: "🔌",
|
||||
browser: "🌐",
|
||||
canvas: "🖼️",
|
||||
nodes: "📱",
|
||||
cron: "⏰",
|
||||
gateway: "🔌",
|
||||
whatsapp_login: "🟢",
|
||||
discord: "💬",
|
||||
};
|
||||
@@ -20,7 +20,13 @@ const TOOL_EMOJI_BY_NAME: Record<string, string> = {
|
||||
function resolveToolEmoji(toolName?: string): string {
|
||||
const key = toolName?.trim().toLowerCase();
|
||||
if (key && TOOL_EMOJI_BY_NAME[key]) return TOOL_EMOJI_BY_NAME[key];
|
||||
return "🛠️";
|
||||
return "🧩";
|
||||
}
|
||||
|
||||
function shortenHomeInString(input: string): string {
|
||||
const home = process.env.HOME;
|
||||
if (!home) return input;
|
||||
return input.split(home).join("~");
|
||||
}
|
||||
|
||||
export function shortenPath(p: string): string {
|
||||
@@ -33,10 +39,10 @@ export function shortenPath(p: string): string {
|
||||
export function shortenMeta(meta: string): string {
|
||||
if (!meta) return meta;
|
||||
const colonIdx = meta.indexOf(":");
|
||||
if (colonIdx === -1) return shortenPath(meta);
|
||||
if (colonIdx === -1) return shortenHomeInString(meta);
|
||||
const base = meta.slice(0, colonIdx);
|
||||
const rest = meta.slice(colonIdx);
|
||||
return `${shortenPath(base)}${rest}`;
|
||||
return `${shortenHomeInString(base)}${rest}`;
|
||||
}
|
||||
|
||||
export function formatToolAggregate(
|
||||
|
||||
Reference in New Issue
Block a user