SubagentPanel(
self,
**kwargs: Any = {},
)VerticalDocked two-pane panel visualizing js_eval subagent fan-out by phase.
Hidden until the first spawn event. Phases (one per js_eval) list on the
left and the selected phase's subagents render as a scrollable table on the
right. Focus the panel and use up/down to revisit finished phases. Expands
while any phase runs, collapses to the header when the turn goes idle, and
re-expands when a new phase starts.
Yield the header line and the two-pane body (phases | agents).
Apply one validated subagent lifecycle event.
The caller (textual adapter) has already checked type == "subagent"
and that this is the main-agent namespace. We defensively re-validate
every field here so malformed payloads can never corrupt panel state.
Click the header to toggle; click a phase row to select it.
Navigate phases with up/down (or j/k) while the panel is focused.
Arm a deferred clear for a new turn without touching the panel yet.
The visible fan-out persists across turns; it is cleared lazily when the
next workflow actually starts a subagent (see _handle_start), so a turn
that spawns none leaves the previous results on screen. Refreshes the
session model used to label rows.
Clear all phases and hide the panel immediately (e.g. on /clear).
Mark any still-running subagents as cancelled and stop ticking.
Called when a turn is interrupted: the QuickJS bridge does not emit
terminal events for asyncio.CancelledError (a BaseException, so it
bypasses the bridge's except Exception), which would otherwise leave
rows spinning forever. Freezes each affected row's elapsed time.
Toggle the body open/closed. This is the only thing that changes it.
Show/hide the body when the expanded state changes.
Re-render so width-dependent column alignment tracks the new size.