

























@@ -1,5 +1,5 @@
11import { describe, expect, it } from "vitest";
2-import { formatToolDetail, resolveToolDisplay } from "./tool-display.js";
2+import { formatToolDetail, formatToolSummary, resolveToolDisplay } from "./tool-display.js";
3344describe("tool display details", () => {
55it("skips zero/false values for optional detail fields", () => {
@@ -128,7 +128,7 @@ describe("tool display details", () => {
128128);
129129130130expect(detail).toContain("check git status -> show first 3 lines");
131-expect(detail).toContain(".openclaw/workspace)");
131+expect(detail).toContain("(agent)");
132132});
133133134134it("summarizes bash commands with the same command explainer", () => {
@@ -166,6 +166,49 @@ describe("tool display details", () => {
166166expect(detail).toBe("install dependencies (in ~/my-project)");
167167});
168168169+it("uses compact workspace markers for common workspace paths", () => {
170+expect(
171+formatToolDetail(
172+resolveToolDisplay({
173+name: "bash",
174+args: { command: "git fetch", workdir: "/Users/peter/mantis-workspace/openclaw" },
175+detailMode: "explain",
176+}),
177+),
178+).toBe("fetch git changes (agent)");
179+180+expect(
181+formatToolDetail(
182+resolveToolDisplay({
183+name: "bash",
184+args: { command: "git status", workdir: "/Users/peter/Projects/openclaw" },
185+detailMode: "explain",
186+}),
187+),
188+).toBe("check git status (repo)");
189+});
190+191+it("omits bash and exec names from compact tool summaries", () => {
192+expect(
193+formatToolSummary(
194+resolveToolDisplay({
195+name: "bash",
196+args: { command: "git fetch", workdir: "/Users/peter/mantis-workspace/openclaw" },
197+detailMode: "explain",
198+}),
199+),
200+).toBe("🛠️ fetch git changes (agent)");
201+202+expect(
203+formatToolSummary(
204+resolveToolDisplay({
205+name: "web_search",
206+args: { query: "OpenClaw docs" },
207+}),
208+),
209+).toBe('🔎 Web Search: for "OpenClaw docs"');
210+});
211+169212it("moves cd path to context suffix with multiple stages and raw command", () => {
170213const detail = formatToolDetail(
171214resolveToolDisplay({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。