xonecas.io
64875
Mc

mini-coder / commit 5dbad98

fix: remove brackets from tool label pills

xonecas2026-04-11 5dbad9880131f431fdedf24e1f3bf42f8f3aea85 parent 0cb837f

5 files changed

TODO.md+1−0
@@ -7,6 +7,7 @@ The spec.md and code are the sources of truth, not this file, don't assume anyth
77
88 ## Open items
99
10+- [ ] **ESC doesn't interrupt during tool call** This is a spec violation, ESC should interrupt at any time during a turn.
1011 - [ ] **If git is not installed the app breaks** we should check before we use git, and ensure robustness.
1112 - [ ] **Emit a terminal `aborted` event for tool-phase interrupts** (`agent.ts`, `headless.ts`) — interrupting during tool execution currently returns `stopReason: "aborted"` without emitting the terminal `aborted` event required by the headless NDJSON spec.
1213
spec.md+16−16
@@ -395,17 +395,17 @@ Three zones, top to bottom:
395395 │ │
396396 │ I'll check the test suite first. │ agent: default bg
397397 │ │
398-│ │ [shell ->] bun test │ tool call
399-│ │ [shell <-] │ tool result
398+│ │ shell -> bun test │ tool call
399+│ │ shell <- │ tool result
400400 │ │ 3 passed, 1 failed │ dimmed text
401401 │ │ FAIL src/agent.test.ts > handles error │
402402 │ │ exit 1 │
403403 │ │ │
404-│ │ [edit ->] │ edit preview
404+│ │ edit -> │ edit preview
405405 │ │ src/agent.ts │
406406 │ │ expect(result).toBe("error"); │
407407 │ │ │
408-│ │ [edit <-] │ compact result
408+│ │ edit <- │ compact result
409409 │ │ ~ src/agent.ts │
410410 │ │ │
411411 │ Fixed the assertion. Tests pass now. │
@@ -531,13 +531,13 @@ Scrollable area that shows the full conversation history. Stick-to-bottom by def
531531
532532 Message types and their rendering:
533533
534-Tool blocks share a common frame: a left border (`│`) plus a compact header pill naming the tool and direction (`[tool ->]` for assistant tool calls, `[tool <-]` for tool results). The body renders tool-specific content rather than raw JSON.
534+Tool blocks share a common frame: a left border (`│`) plus a compact header pill naming the tool and direction (`tool ->` for assistant tool calls, `tool <-` for tool results). The body renders tool-specific content rather than raw JSON.
535535
536536 - **User messages**: displayed as plain text with a subtle background color to distinguish them from agent responses. No prefix or role indicator.
537537 - **Assistant messages**: streamed markdown rendered via cel-tui's `Markdown` component on the default background. Thinking/reasoning content is collapsible (shown or hidden according to the user's persisted `/reasoning` preference; defaults to shown when no setting exists).
538-- **Tool calls — shell**: rendered in the shared tool frame. The assistant tool call streams the command as it arrives. The command preview and shell tool result body use [verbose tool rendering](#verbose-tool-rendering). Shell tool results render the tool output content below a `[shell <-]` header.
539-- **Tool calls — edit**: rendered in the shared tool frame. The in-progress tool-call preview shows the target path plus the streamed replacement content, preserving whitespace. The preview body uses [verbose tool rendering](#verbose-tool-rendering). Successful results render a compact confirmation block (`[edit <-]` plus the file path); errors render the returned error text.
540-- **Tool calls — readImage**: rendered in the shared tool frame. The assistant tool call streams the path as it arrives. Successful results render a compact result block (`[read image <-]` plus the file path) rather than rendering the image itself.
538+- **Tool calls — shell**: rendered in the shared tool frame. The assistant tool call streams the command as it arrives. The command preview and shell tool result body use [verbose tool rendering](#verbose-tool-rendering). Shell tool results render the tool output content below a `shell <-` header.
539+- **Tool calls — edit**: rendered in the shared tool frame. The in-progress tool-call preview shows the target path plus the streamed replacement content, preserving whitespace. The preview body uses [verbose tool rendering](#verbose-tool-rendering). Successful results render a compact confirmation block (`edit <-` plus the file path); errors render the returned error text.
540+- **Tool calls — readImage**: rendered in the shared tool frame. The assistant tool call streams the path as it arrives. Successful results render a compact result block (`read image <-` plus the file path) rather than rendering the image itself.
541541 - **Tool calls — plugin tools**: rendered in the shared tool frame, prefixed with plugin/tool name when available.
542542 - **UI messages**: internal app messages such as `/help` output, OAuth progress, and other session-local notices. They are rendered in the conversation log, persisted with the session, excluded from model context, and do not participate in conversational turn numbering.
543543 - **Errors**: one-line summary, styled distinctly.
@@ -586,13 +586,13 @@ Representative entry shapes:
586586 **Shell tool call**
587587
588588 ```text
589- │ [shell ->] bun test src/session.test.ts
589+ │ shell -> bun test src/session.test.ts
590590 ```
591591
592592 **Shell tool result (`/verbose` off)**
593593
594594 ```text
595- │ [shell <-]
595+ │ shell <-
596596 │ src/session.test.ts:
597597 │ ✓ loads persisted turns
598598 │ ✓ undoes the latest turn
@@ -606,7 +606,7 @@ Representative entry shapes:
606606 **Shell tool result (`/verbose` on)**
607607
608608 ```text
609- │ [shell <-]
609+ │ shell <-
610610 │ src/session.test.ts:
611611 │ ✓ loads persisted turns
612612 │ ✓ undoes the latest turn
@@ -620,7 +620,7 @@ Representative entry shapes:
620620 **Edit tool call preview (`/verbose` off)**
621621
622622 ```text
623- │ [edit ->]
623+ │ edit ->
624624 │ src/session.ts
625625 │ const turn = getCurrentTurn(sessionId);
626626 │ saveMessage(sessionId, turn, message);
@@ -630,7 +630,7 @@ Representative entry shapes:
630630 **Edit tool call preview (`/verbose` on)**
631631
632632 ```text
633- │ [edit ->]
633+ │ edit ->
634634 │ src/session.ts
635635 │ const turn = getNextTurn(sessionId);
636636 │ saveMessage(sessionId, turn, message);
@@ -640,21 +640,21 @@ Representative entry shapes:
640640 **Edit tool result**
641641
642642 ```text
643- │ [edit <-]
643+ │ edit <-
644644 │ ~ src/session.ts
645645 ```
646646
647647 **ReadImage tool**
648648
649649 ```text
650- │ [read image <-]
650+ │ read image <-
651651 │ screenshots/failing-layout.png
652652 ```
653653
654654 **Plugin tool**
655655
656656 ```text
657- │ [mcp/search <-]
657+ │ mcp/search <-
658658 │ session persistence sqlite turn numbering
659659 ```
660660
src/ui.test.ts+5−5
@@ -1176,7 +1176,7 @@ describe("ui rendering", () => {
11761176 });
11771177 return (
11781178 state.running &&
1179- logText.includes("[shell ->]") &&
1179+ logText.includes("shell ->") &&
11801180 logText.includes("echo tool-output; sleep 0.2") &&
11811181 logText.includes("tool-output")
11821182 );
@@ -1189,7 +1189,7 @@ describe("ui rendering", () => {
11891189 });
11901190
11911191 expect(logText).toContain("I'll inspect the command output first.");
1192- expect(logText.filter((line) => line === "[shell ->]")).toHaveLength(1);
1192+ expect(logText.filter((line) => line === "shell ->")).toHaveLength(1);
11931193 expect(
11941194 logText.filter((line) => line === "echo tool-output; sleep 0.2"),
11951195 ).toHaveLength(1);
@@ -1402,7 +1402,7 @@ describe("ui rendering", () => {
14021402 });
14031403 return (
14041404 state.running &&
1405- logText.includes("[shell ->]") &&
1405+ logText.includes("shell ->") &&
14061406 logText.includes("echo staged-command")
14071407 );
14081408 });
@@ -1413,7 +1413,7 @@ describe("ui rendering", () => {
14131413 children: buildConversationLog(state),
14141414 });
14151415
1416- expect(logText.filter((line) => line === "[shell ->]")).toHaveLength(1);
1416+ expect(logText.filter((line) => line === "shell ->")).toHaveLength(1);
14171417 expect(
14181418 logText.filter((line) => line === "echo staged-command"),
14191419 ).toHaveLength(1);
@@ -1570,7 +1570,7 @@ describe("ui rendering", () => {
15701570 children: buildConversationLog(state),
15711571 });
15721572
1573- expect(logText.filter((line) => line === "[shell ->]")).toHaveLength(1);
1573+ expect(logText.filter((line) => line === "shell ->")).toHaveLength(1);
15741574 expect(
15751575 logText.filter((line) => line === "echo tool-output"),
15761576 ).toHaveLength(1);
src/ui/conversation.test.ts+49−14
@@ -250,9 +250,9 @@ describe("ui/conversation", () => {
250250
251251 // Assert
252252 expect(text).toContain("Working...");
253- expect(text.filter((line) => line === "[shell ->]")).toHaveLength(1);
253+ expect(text.filter((line) => line === "shell ->")).toHaveLength(1);
254254 expect(text).toContain("echo hi");
255- expect(text).toContain("[shell <-]");
255+ expect(text).toContain("shell <-");
256256 expect(text).toContain("partial output");
257257 expect(text).not.toContain("Exit code: 0");
258258 });
@@ -301,7 +301,7 @@ describe("ui/conversation", () => {
301301 });
302302
303303 // Assert
304- expect(text).toContain("[edit <-]");
304+ expect(text).toContain("edit <-");
305305 expect(text).toContain("~ src/app.ts");
306306 expect(text).not.toContain("before");
307307 expect(text).not.toContain("after");
@@ -513,7 +513,7 @@ describe("ui/conversation", () => {
513513 expect(text).toContain("Thinking... 1 line.");
514514 });
515515
516- test("renderAssistantMessage for a shell tool call shows the command under the new header pill", () => {
516+ test("renderAssistantMessage for a shell tool call renders an unbracketed header inside the pill", () => {
517517 // Arrange
518518 const assistant = {
519519 content: [
@@ -522,12 +522,47 @@ describe("ui/conversation", () => {
522522 };
523523
524524 // Act
525- const text = collectText(renderAssistantMessage(assistant, RENDER_OPTS));
525+ const node = renderAssistantMessage(assistant, RENDER_OPTS);
526+ const text = collectText(node);
526527
527528 // Assert
528- expect(text).toContain("[shell ->]");
529+ expect(text).toContain("shell ->");
530+ expect(text).not.toContain("[shell ->]");
529531 expect(text).toContain("echo hi");
530532 expect(text).not.toContain('"command": "echo hi"');
533+
534+ expect(node?.type).toBe("vstack");
535+ if (!node || node.type !== "vstack") {
536+ throw new Error("Expected the assistant node to be a vstack");
537+ }
538+
539+ const toolBlock = node.children[0];
540+ expect(toolBlock?.type).toBe("hstack");
541+ if (!toolBlock || toolBlock.type !== "hstack") {
542+ throw new Error("Expected the tool block to be an hstack");
543+ }
544+
545+ const contentColumn = toolBlock.children[1];
546+ expect(contentColumn?.type).toBe("vstack");
547+ if (!contentColumn || contentColumn.type !== "vstack") {
548+ throw new Error("Expected the tool content column to be a vstack");
549+ }
550+
551+ const headerRow = contentColumn.children[0];
552+ expect(headerRow?.type).toBe("hstack");
553+ if (!headerRow || headerRow.type !== "hstack") {
554+ throw new Error("Expected the tool header row to be an hstack");
555+ }
556+
557+ const headerPill = headerRow.children[0];
558+ expect(headerPill?.type).toBe("hstack");
559+ if (!headerPill || headerPill.type !== "hstack") {
560+ throw new Error("Expected the tool header pill to be an hstack");
561+ }
562+
563+ expect(headerPill.props.bgColor).toBe(DEFAULT_THEME.toolBorder);
564+ expect(headerPill.props.padding).toEqual({ x: 1 });
565+ expect(collectText(headerPill)).toEqual(["shell ->"]);
531566 });
532567
533568 test("renderAssistantMessage for a shell tool call syntax-highlights bash tokens", async () => {
@@ -795,7 +830,7 @@ describe("ui/conversation", () => {
795830 const text = collectText(renderAssistantMessage(assistant, RENDER_OPTS));
796831
797832 // Assert
798- expect(text).toContain("[read image ->]");
833+ expect(text).toContain("read image ->");
799834 expect(text).toContain("assets/preview.png");
800835 expect(text).not.toContain("{");
801836 });
@@ -820,7 +855,7 @@ describe("ui/conversation", () => {
820855 const text = collectText(renderAssistantMessage(assistant, RENDER_OPTS));
821856
822857 // Assert
823- expect(text).toContain("[edit ->]");
858+ expect(text).toContain("edit ->");
824859 expect(text).toContain("src/file.ts");
825860 expect(text).toContain("old line");
826861 expect(text).toContain("new line");
@@ -883,7 +918,7 @@ describe("ui/conversation", () => {
883918 );
884919
885920 // Assert
886- expect(text).toContain("[shell <-]");
921+ expect(text).toContain("shell <-");
887922 expect(text).toContain("line 18");
888923 expect(text).toContain("line 25");
889924 expect(text).toContain("And 17 lines more");
@@ -927,7 +962,7 @@ describe("ui/conversation", () => {
927962 );
928963
929964 // Assert
930- expect(text).toContain("[shell <-]");
965+ expect(text).toContain("shell <-");
931966 expect(text).toContain("exit 42");
932967 expect(text).toContain("boom");
933968 expect(text).not.toContain("Exit code: 42");
@@ -944,7 +979,7 @@ describe("ui/conversation", () => {
944979 );
945980
946981 // Assert
947- expect(text).toContain("[read image <-]");
982+ expect(text).toContain("read image <-");
948983 expect(text).toContain("diagram.png");
949984 expect(text).not.toContain("Read image.");
950985 });
@@ -993,7 +1028,7 @@ describe("ui/conversation", () => {
9931028 );
9941029
9951030 // Assert
996- expect(previewText).toContain("[edit <-]");
1031+ expect(previewText).toContain("edit <-");
9971032 expect(previewText).toContain("~ src/file.ts");
9981033 expect(previewText).not.toContain("before");
9991034 expect(previewText).not.toContain("after");
@@ -1026,7 +1061,7 @@ describe("ui/conversation", () => {
10261061 );
10271062
10281063 // Assert
1029- expect(text).toContain("[edit <-]");
1064+ expect(text).toContain("edit <-");
10301065 expect(text).toContain("error 18");
10311066 expect(text).toContain("error 25");
10321067 expect(text).toContain("And 17 lines more");
@@ -1049,7 +1084,7 @@ describe("ui/conversation", () => {
10491084 );
10501085
10511086 // Assert
1052- expect(text).toContain("[mcp/search <-]");
1087+ expect(text).toContain("mcp/search <-");
10531088 expect(text).toContain("session persistence sqlite turn numbering");
10541089 expect(text).not.toContain('"query"');
10551090 });
src/ui/conversation.ts+1−1
@@ -606,7 +606,7 @@ function renderToolHeaderPill(
606606 theme: Theme,
607607 ): Node {
608608 return HStack({ bgColor: theme.toolBorder, padding: { x: 1 } }, [
609- Text(`[${getToolHeaderName(toolName)} ${direction}]`, {
609+ Text(`${getToolHeaderName(toolName)} ${direction}`, {
610610 fgColor: getToolHeaderColor(toolName, theme),
611611 bold: true,
612612 }),