feat(cli): inline compact tree for live agents - #3904
Conversation
Add a header + per-agent row tree that renders inline while a tool group containing agent calls is still pending. Each agent row shows the live tool count, token total, and last activity, with `├─ / └─ / ⎿` connectors that match the existing dialog's tree style. Approval banner placement is preserved: when the focus-holding agent has a pending confirmation, the existing confirmation prompt renders above the tree, and queued siblings surface a `· ⏳ Queued approval` suffix on their row. Replaces the previously empty live area for foreground subagents, where users had to open the footer pill to see what their agents were doing. Tree height stays fixed per agent (1 row for backgrounded agents, 2 rows for foreground), so the live frame doesn't churn as new tools fire. The committed scrollback path is unchanged — the existing display still renders terminal groups. This is the first of four PRs in the inline-agent display refactor; later PRs will unify the two paths once foreground retention lands. Refactors the background-task registry's per-tool activity callback from a single-slot setter to a multi-listener subscribe API so the inline tree and the detail dialog can both subscribe independently.
E2E Test ReportVerified against Summary
After all agents finish, the existing display commits to scrollback unchanged. A1 — Single foreground agent (live frame)Row 2 transitions from B1 — Three parallel foreground agents (live frame)Captured a mixed-state frame: two agents have already completed (row 2 = C1 — Mixed agent + non-agent calls (live frame)Notes:
Methodology / reproducibility
Unit tests
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
Closing — not pursuing this approach. |
Summary
├─ / └─ / ⎿connectors), replacing the previously empty live area while a tool group containing agents is still pending.· ⏳ Queued approvalsuffix. Confirm that direct tool-level confirmations still take priority — the tree's banner is suppressed while a tool-level prompt is active.Validation
node dist/cli.js --approval-mode yolo, prompted the model to (1) spawn one subagent, (2) spawn three subagents in parallel, (3) read a file then spawn two parallel subagents then run a shell command. Captured the live-area frame mid-run.tmux new-session -d -s test -x 200 -y 50 \"cd \$(mktemp -d) && node \$PWD/dist/cli.js --approval-mode yolo\", prompt the model to spawn three subagents in parallel, and watch the live area mid-run.Scope / Risk
Testing Matrix
Testing matrix notes:
npm runflow. macOS / Windows not covered locally; the change is pure UI (Ink rendering + a TS-only registry refactor) so platform risk is low, but maintainer verification on at least one other platform would be welcome.Linked Issues / Bugs
None.