diff --git a/ui-tui/src/components/Message.tsx b/ui-tui/src/components/Message.tsx index b271024ff..78ba71094 100644 --- a/ui-tui/src/components/Message.tsx +++ b/ui-tui/src/components/Message.tsx @@ -161,6 +161,21 @@ export function Message({ entry }: { entry: TranscriptEntry }): React.ReactEleme if (entry.todos) { return } + // Agent/Task (subagent spawn) renders as a Task card. + if (entry.agent) { + const a = entry.agent + const label = a.name ? `${a.description} (@${a.name})` : a.description + return ( + + + Task + ( + {label} + ) + {a.subagentType ? {` · ${a.subagentType}`} : null} + + ) + } // Collapsed summary of several same-kind calls (e.g. "Read 4 files"). if (entry.count && entry.count > 1) { const noun = TOOL_VERB[entry.toolName ?? '']?.noun || 'files' diff --git a/ui-tui/src/sdkMessageAdapter.ts b/ui-tui/src/sdkMessageAdapter.ts index 8eff5b919..46117068b 100644 --- a/ui-tui/src/sdkMessageAdapter.ts +++ b/ui-tui/src/sdkMessageAdapter.ts @@ -72,6 +72,8 @@ export interface TranscriptEntry { todos?: TodoItem[] /** /context entries: the context-window usage breakdown to visualize. */ contextData?: ContextData + /** Agent/Task tool calls: the spawned subagent's task + type. */ + agent?: { description: string; subagentType: string; name: string } /** banner only: the session info snapshot, captured once at init. */ bannerData?: { model: string; mode: string; tools: number; cwd?: string } } @@ -171,6 +173,22 @@ export function messageToEntries(msg: ServerMessage): TranscriptEntry[] { string, unknown > + // Agent/Task (subagent spawn) renders as a Task card. + if (toolName === 'Agent' || toolName === 'Task') { + out.push({ + id: nextId(), + kind: 'tool', + text: '', + toolName, + agent: { + description: String(tinput['description'] ?? ''), + subagentType: String(tinput['subagent_type'] ?? ''), + name: String(tinput['name'] ?? ''), + }, + toolUseId: String((block as { id?: string }).id ?? ''), + }) + continue + } // TodoWrite renders as a checklist, not a generic tool call. if (toolName === 'TodoWrite' && Array.isArray(tinput['todos'])) { out.push({