Display subagent names instead of generic "Task" label

Parse and display the subagent_type field from Claude Code's Task tool
calls to show specific agent names (e.g., "codebase-analyzer") instead
of the generic "Task" label. This brings the WUI display in line with
how Claude Code presents named subagents.

- Show subagent_type in main event display when available
- Display subagent names in task group headers
- Include subagent names in collapsed task previews
- Maintain backward compatibility for tasks without subagent_type

Fixes ENG-1893
This commit is contained in:
samdickson22
2025-08-19 13:52:12 -07:00
parent 8c1b2d85c3
commit c087a1cb84
2 changed files with 11 additions and 4 deletions

View File

@@ -128,9 +128,10 @@ export function eventToDisplayObject(
if (event.toolName === 'Task') {
const toolInput = JSON.parse(event.toolInputJson!)
const displayName = toolInput.subagent_type || 'Task'
subject = (
<span>
<span className="font-bold">{event.toolName} </span>
<span className="font-bold">{displayName} </span>
<span className="font-mono text-sm text-muted-foreground">{toolInput.description}</span>
</span>
)

View File

@@ -54,7 +54,9 @@ export function TaskGroup({
shouldIgnoreMouseEvent,
}: TaskGroupProps) {
const { parentTask, toolCallCount, latestEvent, hasPendingApproval } = group
const description = JSON.parse(parentTask.toolInputJson || '{}').description || 'Task'
const taskInput = JSON.parse(parentTask.toolInputJson || '{}')
const displayName = taskInput.subagent_type || 'Task'
const description = taskInput.description || 'Task'
const isCompleted = parentTask.isCompleted
return (
@@ -95,7 +97,10 @@ export function TaskGroup({
<div className="flex-1">
<div className="flex items-center gap-2">
<Wrench className="w-4 h-4 text-accent" />
<span className="font-medium">{truncate(description, 80)}</span>
<div className="text-sm text-muted-foreground">
<span className="font-semibold">{displayName}: </span>
{description}
</div>
{!isCompleted && <CircleDashed className="w-4 h-4 animate-spin text-muted-foreground" />}
{hasPendingApproval && (
<span className="text-xs bg-warning/20 text-warning px-2 py-0.5 rounded">
@@ -126,7 +131,8 @@ export function TaskGroup({
} else if (latestEvent.toolName === 'Bash' && toolInput.command) {
previewText = `$ ${truncate(toolInput.command, 50)}`
} else if (latestEvent.toolName === 'Task' && toolInput.description) {
previewText = truncate(toolInput.description, 80)
const taskName = toolInput.subagent_type ? toolInput.subagent_type + ': ' : ''
previewText = taskName + truncate(toolInput.description, 80 - taskName.length)
}
} catch {
// Keep default preview text if JSON parsing fails