Each tool type has specialized rendering logic that displays the most relevant information for that tool. This matches the TUI's approach of providing context-specific displays rather than generic input/output dumps.
- Title:
Read {filename} - Body: Preview of file content (first 6 lines) from
metadata.preview - Use case: Shows what file content the assistant is reading
- Title:
Edit {filename} - Body: Diff/patch showing changes from
metadata.diff - Special: Shows diagnostics if available in metadata
- Use case: Shows what changes are being made to files
- Title:
Write {filename} - Body: File content being written (first 10 lines)
- Special: Shows diagnostics if available in metadata
- Use case: Shows new file content being created
- Title:
Shell {description}(or command if no description) - Body: Console-style display with
$ commandand output
$ npm install vitest
added 50 packages...
- Output from:
metadata.output - Use case: Shows command execution and results
- Title:
Fetch {url} - Body: Fetched content (first 10 lines)
- Use case: Shows web content being retrieved
- Title: Dynamic based on todo phase:
- All pending: "Creating plan"
- All completed: "Completing plan"
- Mixed: "Updating plan"
- Body: Formatted todo list:
- [x] Completed task- [ ] Pending task- [ ] ~~Cancelled task~~- [ ] In progress task(highlighted)
- Use case: Shows the AI's task planning
- Title:
Task[subagent_type] {description} - Body: List of delegated tool calls with icons:
⚡ bash: npm install
📖 read package.json
✏️ edit src/app.ts
- Special: In TUI, includes navigation hints for session tree
- Use case: Shows what the delegated agent is doing
- Special: Hidden in TUI, returns empty string
- Use case: Internal tool, not displayed to user
- Title:
Glob {pattern} - Use case: Shows file search patterns
- Title:
Grep "{pattern}" - Use case: Shows what content is being searched
- Title:
List - Use case: Shows directory operations
- Title:
Patch - Use case: Shows patch operations
- Title: Name of the actual tool attempted
- Use case: Shows validation errors
- Title: Capitalized tool name
- Body: Output truncated to 10 lines
- Use case: Fallback for any new or custom tools
- Icon: ⏸ (pause symbol)
- Title: Action text (e.g., "Writing command...", "Preparing edit...")
- Border: Accent color
- Animation: Shimmer effect on title
- Expandable: Shows "Waiting for permission..." message
- Icon: ⏳ (hourglass)
- Title: Same as completed state
- Border: Warning color (yellow/orange)
- Animation: Pulse on status icon
- Icon: ✓ (checkmark)
- Title: Tool-specific title with arguments
- Border: Success color (green)
- Body: Tool-specific rendered content
- Icon: ✗ (X mark)
- Title: Same format but in error color
- Border: Error color (red)
- Body: Error message in highlighted box
The title follows this pattern:
- Pending state: Show action text
"Writing command..."
"Preparing edit..."
"Delegating..."
- Completed/Running/Error: Show specific info
"Shell npm install"
"Edit src/app.ts"
"Read package.json"
"Task[general] Search for files"
- Special cases:
todowrite: Shows plan phasetodoread: Just "Plan"bash: Uses description if available, otherwise shows command
Tool calls use metadata for rich content:
- read:
metadata.preview- file preview content - edit:
metadata.diff- patch/diff text - bash:
metadata.output- command output - todowrite:
metadata.todos[]- todo items with status - task:
metadata.summary[]- delegated tool calls - edit/write:
metadata.diagnostics- LSP diagnostics
- Context-specific: Each tool shows the most relevant information
- Progressive disclosure: Collapsed by default, expand for details
- Visual hierarchy: Icons, colors, and borders indicate status
- Truncation: Long content is truncated (6-10 lines) to prevent overwhelming
- Consistency: All tools follow same header/body/error structure
<div class="tool-call tool-call-status-{status}">
<button class="tool-call-header" onClick={toggle}>
<span class="tool-call-icon">▶/▼</span>
<span class="tool-call-emoji">{icon}</span>
<span class="tool-call-summary">{title}</span>
<span class="tool-call-status">{statusIcon}</span>
</button>
{expanded && (
<div class="tool-call-details">
{/* Tool-specific body content */}
{error && <div class="tool-call-error-content">{error}</div>}
</div>
)}
</div>
.tool-call- Base container.tool-call-status-{pending|running|completed|error}- Status-specific styling.tool-call-header- Clickable header with expand/collapse.tool-call-emoji- Tool type icon.tool-call-summary- Tool title/description.tool-call-details- Expanded content area.tool-call-content- Code/output content (monospace).tool-call-todos- Todo list container.tool-call-task-summary- Delegated task list.tool-call-error-content- Error message display