diff --git a/apps/x/apps/renderer/src/components/sub-agent-block.tsx b/apps/x/apps/renderer/src/components/sub-agent-block.tsx index 14deb928..71a81a41 100644 --- a/apps/x/apps/renderer/src/components/sub-agent-block.tsx +++ b/apps/x/apps/renderer/src/components/sub-agent-block.tsx @@ -1,5 +1,4 @@ import { useEffect, useState } from 'react' -import { Bot } from 'lucide-react' import { Tool, ToolContent, ToolHeader } from '@/components/ai-elements/tool' import { CompactConversation } from '@/components/compact-conversation' import { fetchAgentRunTranscript, type AgentRunTranscript } from '@/lib/agent-transcript' @@ -42,6 +41,12 @@ function useChildTranscript( return transcript } +// "london-weather" / "meeting_prep" → "London weather" / "Meeting prep". +function humanizeName(name: string): string { + const words = name.replace(/[-_]+/g, ' ').trim() + return words ? words.charAt(0).toUpperCase() + words.slice(1) : '' +} + export function SubAgentBlock({ item, open, @@ -54,27 +59,24 @@ export function SubAgentBlock({ const input = item.input as | { name?: string; agent_id?: string; task?: string } | undefined - const agentName = item.subAgent?.agentName ?? input?.agent_id ?? input?.name ?? 'subagent' - const task = item.subAgent?.task ?? input?.task ?? '' + const rawName = item.subAgent?.agentName || input?.agent_id || input?.name || '' + const name = rawName === 'subagent' ? '' : humanizeName(rawName) + const task = (item.subAgent?.task || input?.task || '').trim() + // The collapsed row must say what is happening, not just that an agent + // exists: lead with the name when the model gave one, then the task (the + // header truncates with a hover tooltip carrying the full text). + const title = task ? `${name || 'Agent'}: ${task}` : name || 'Agent' const running = item.status === 'pending' || item.status === 'running' const transcript = useChildTranscript(item.subAgent?.childTurnId, running, open) return ( - +
- {task && ( -
- - {task} -
- )} {transcript ? ( + // The transcript opens with the child's user message — the task — + // so no separate task chip is rendered here. ) : (