feat(tui): add agent interaction workflows

This commit is contained in:
Xubin Ren
2026-08-17 20:56:10 +08:00
parent e77eed76c9
commit 4391bbf4da
28 changed files with 1275 additions and 87 deletions
+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, test } from "bun:test"
import { mergeToolEvent, renderToolEvent } from "./tool-renderers"
describe("tool renderers", () => {
test("retains start arguments when an end frame only carries output", () => {
const event = mergeToolEvent(
{ call_id: "exec-1", phase: "start", name: "exec", arguments: { cmd: "git status" } },
{ call_id: "exec-1", phase: "end", name: "exec", result: { output: "clean" } },
)
expect(renderToolEvent(event)).toBe(" ✓ Command git status")
})
test("uses stable task language for common file and web tools", () => {
expect(renderToolEvent({ phase: "end", name: "read_file", arguments: { path: "README.md" } }))
.toBe(" ✓ Read README.md")
expect(renderToolEvent({ phase: "start", name: "web_search", arguments: { query: "nanobot" } }))
.toBe(" Search web nanobot")
expect(renderToolEvent({ phase: "error", name: "web_fetch", error: "timeout" }))
.toBe(" × Fetch timeout")
})
})