Part of #3104
When several transfer_task calls happen in one turn (they run sequentially), the transcript is one undifferentiated stream and the sidebar shows only a single working agent, so the delegation structure is lost.
Proposed changes
- Transcript delegation brackets. On child stream start/stop, render theme-styled delimiter lines, e.g.
── root → librarian ───── on entry and a matching completion marker on exit. Drive these from AgentSwitchingEvent (carries FromAgent/ToAgent) and by handling SubSessionCompletedEvent in pkg/tui/page/chat/runtime_events.go (currently unhandled). Reconcile with messages.needsSeparator (which already special-cases transfer_task).
- Sidebar delegation breadcrumb + background count. In
pkg/tui/components/sidebar/sidebar.go, extend the single workingAgent notion to show a short chain (e.g. root ⏵ librarian) when streamDepth > 1, plus a count badge when ≥1 background agents are active. Reuse AgentAccentStyleFor for per-agent color.
Acceptance criteria
- Sequential delegations render as distinct, labeled sections.
- Returning control to the parent is visually marked.
- The sidebar shows the active delegation chain, not just the deepest single agent.
Validation
task build && task test && task lint green.
- Test that
SubSessionCompletedEvent produces the completion delimiter and keeps streamDepth balanced.
- Integrate new transcript lines with existing separator/scroll/selection logic (extend
pkg/tui/components/messages tests).
Part of #3104
When several
transfer_taskcalls happen in one turn (they run sequentially), the transcript is one undifferentiated stream and the sidebar shows only a single working agent, so the delegation structure is lost.Proposed changes
── root → librarian ─────on entry and a matching completion marker on exit. Drive these fromAgentSwitchingEvent(carriesFromAgent/ToAgent) and by handlingSubSessionCompletedEventinpkg/tui/page/chat/runtime_events.go(currently unhandled). Reconcile withmessages.needsSeparator(which already special-casestransfer_task).pkg/tui/components/sidebar/sidebar.go, extend the singleworkingAgentnotion to show a short chain (e.g.root ⏵ librarian) whenstreamDepth > 1, plus a count badge when ≥1 background agents are active. ReuseAgentAccentStyleForfor per-agent color.Acceptance criteria
Validation
task build && task test && task lintgreen.SubSessionCompletedEventproduces the completion delimiter and keepsstreamDepthbalanced.pkg/tui/components/messagestests).