feat: surface sub-agent lifecycle events in chat#41
Open
chetan-guevara wants to merge 1 commit intomoazbuilds:masterfrom
Open
feat: surface sub-agent lifecycle events in chat#41chetan-guevara wants to merge 1 commit intomoazbuilds:masterfrom
chetan-guevara wants to merge 1 commit intomoazbuilds:masterfrom
Conversation
Builds on the chat tab feature by adding real-time visibility into sub-agent spawning and completion. The stream-json parser detects Agent tool_use blocks (spawn) and their matching tool_result blocks (done), forwarding typed AgentStreamEvent objects through the SSE pipeline to the browser, where they render as transient activity bubbles between conversation turns. - runner.ts: AgentStreamEvent interface; streamClaude() tracks pending Agent tool calls via tool_use_id map, emits spawn/done events to optional onAgentEvent callback; streamUserMessage() passes it through - ui/types.ts: re-exports AgentStreamEvent; onChat callback gains onAgentEvent parameter - ui/server.ts: idleTimeout:0; /api/chat SSE endpoint forwards agent_spawn and agent_done events alongside chunk/unblock/done/error - commands/start.ts: wires onAgentEvent through to streamUserMessage - ui/page/template.ts: tab nav, dashboard-panel wrapper, chat-panel with messages container and chat form - ui/page/script.ts: handles agent_spawn/agent_done SSE events, renders agent activity bubbles, filters running agents from localStorage persistence - ui/page/styles.ts: [hidden] override, tab nav, chat panel, and agent bubble CSS (.chat-msg-agent, -running, -done, .chat-agent-spinner)
6 tasks
Fenrur
added a commit
to Fenrur/claudeclaw
that referenced
this pull request
Mar 17, 2026
- AgentStreamEvent type for spawn/done events - Sub-agent cards in chat UI with descriptions - onAgentEvent callback through streaming pipeline Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Claude uses the
Agenttool to spawn a sub-agent, the chat UI now shows real-time activity bubbles tracking the spawn and completion of those agents.Depends on: #40 (chat tab)
🤖 Sub-agent started: [description]bubble appears immediately when an Agent tool call is detected in the stream, so you know a background task was dispatchedArchitecture
The
stream-jsonevent stream is parsed for two new event types:assistantevents withcontent[].type === "tool_use"andname === "Agent"→ spawnuserevents withcontent[].type === "tool_result"matching a trackedtool_use_id→ doneThese are surfaced as new SSE event types from
/api/chat:{ type: "agent_spawn", id, description }{ type: "agent_done", id, description, result }A
Map<tool_use_id, description>tracks pending agents across events instreamClaude.New types
Test plan
🤖 Sub-agent started: ...bubble appears immediately in chat✅ Sub-agent done: ...bubble appears when complete, followed by the result