fix(tui): reduce redundant runtime chrome

This commit is contained in:
chengyongru
2026-08-21 17:11:01 +08:00
committed by chengyongru
parent d28687e2e1
commit e9ac83d03f
6 changed files with 183 additions and 30 deletions
+24
View File
@@ -26,4 +26,28 @@ describe("tool renderers", () => {
expect(renderToolEvent({ phase: "end", name: "apply_patch", arguments: { path: "app.ts" } }))
.toBe(" ✓ Edited app.ts")
})
test("shortens file paths relative to the workspace while preserving the useful tail", () => {
const workspace = String.raw`C:\workspace\nanobot`
expect(renderToolEvent({
phase: "end",
name: "read_file",
arguments: { path: String.raw`C:\workspace\nanobot\tui\src\app.ts` },
}, { workspace })).toBe(" ✓ Read tui/src/app.ts")
expect(renderToolEvent({
phase: "end",
name: "read_file",
arguments: {
path: String.raw`C:\workspace\nanobot\.worktrees\feature\nanobot\providers\fallback_provider.py`,
},
}, { workspace })).toBe(" ✓ Read …/feature/nanobot/providers/fallback_provider.py")
})
test("summarizes subagent delegation without exposing raw argument JSON", () => {
expect(renderToolEvent({
phase: "end",
name: "spawn",
arguments: { task: "Simplify the fallback provider implementation" },
})).toBe(" ✓ Delegated Simplify the fallback provider implementation")
})
})