feat: add dedicated subagent view to TUI
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #1371 di @avoidwork — integrata
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, nodejs
- Ambito
- cli
Direzione di ricerca
Start in callProvider in index.js (around line 228), where _namespace from agent.stream() is currently discarded, and confirm how the root graph and subagent namespaces differ. Then read createStreamingHandler in src/tui/conversationArea.js and src/tui/panels.js to see how events and panels are routed. Done means subagent events reach a separate store and a SUBAGENTS panel renders them, with tests in tests/unit/tui/subagentsPanel.test.js. The issue says the design must be approved first, so confirm with maintainers before writing code.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add a dedicated SUBAGENTS panel to the TUI that captures and renders each subagent's reasoning and message segments separately from the orchestrator's conversation, including subagent tool calls.
Motivation
When the orchestrator delegates work via the task tool, the subagent's reasoning and message segments are currently flattened into the same assistant bubble as the orchestrator's own output. The stream namespace that identifies which subgraph produced each event is discarded in callProvider, so there is no way to distinguish what the orchestrator said from what each subagent did. This makes multi-agent runs hard to follow and audit.
Proposed Solution
Capture the stream namespace in callProvider (index.js) to distinguish subagent subgraphs from the root graph. With subgraphs: true, the stream yields [namespace, mode, payload] where the root graph has an empty namespace and each subagent subgraph has a populated namespace (e.g. ["task:<uuid>"]). Emit new event types for subagent reasoning, message, and tool activity, and route them to a dedicated SUBAGENTS panel instead of the main assistant bubble.
Alternatives Considered
- Inline collapsible sections — subagent activity renders in the conversation as collapsible/indented blocks. Keeps everything in context, but the conversation gets busier and harder to scan.
- Second message list in the conversation area — a dedicated subagent stream always visible alongside the main one. More complex layout, but always visible.
- Dedicated SUBAGENTS panel (chosen) — consistent with the existing panel system (SKILLS/MEMORIES/SETTINGS/SESSIONS/PROJECTS). Clean separation; tab to it to see what each subagent did.
Dependencies
- None — this uses the existing LangGraph stream namespace (
subgraphs: true) and the existing TUI panel system. No new npm packages required.
Testing Strategy
- Unit tests: Verify namespace discrimination (root graph empty namespace vs subagent populated namespace), event routing to the subagent store, and that subagent tool calls are redirected.
- Integration test: Run a multi-agent turn and confirm subagent reasoning/message segments land in the SUBAGENTS panel, not the main conversation.
- Edge cases: Multiple subagents in one turn, nested subagent delegation, subagent with reasoning-only output, subagent tool calls with errors.
Security Considerations
- Credential storage: No new credentials — this is a TUI rendering change.
- Input validation: No new user input surface.
- OWASP: No new attack surface; existing URL allowlist and tool validation rules still apply.
Environment
- OS: Linux 7.0.14-17-pve
- Node.js: v25.8.1
- madz version: 1.107.0
- LLM provider: Unknown — user to confirm
OpenSpec Note
This project uses OpenSpec for feature development. If this request is approved, I will:
- Run
/opsx:proposeto generate a full proposal with specs and tasks - Iterate on the design before any code is written
- Follow the task-driven implementation workflow
Additional Context
The key interception point is callProvider in index.js (around line 208), where the _namespace from agent.stream() is currently discarded. The TUI streaming handler in src/tui/conversationArea.js (createStreamingHandler) folds all events into a single assistant bubble via streamingMsgIdRef. The capture must happen in callProvider because the namespace is lost by the time events reach the TUI.
Audit Findings (for Issue #1360)
- index.js:228 —
callProvideriteratesagent.stream(input, { streamMode: ["messages", "tools"], subgraphs: true })and destructures[_namespace, mode, payload]. The_namespaceis discarded — this is the single interception point. Withsubgraphs: true, the root graph yields an empty namespace[]and each subagent subgraph yields a populated namespace (e.g.["task:<uuid>"]).namespace.length > 0discriminates subagent activity. - index.js:228-300 — The
messagesmode handler emits{ type: "message" }and{ type: "reasoning" }; thetoolsmode handler emitson_tool_start/on_tool_end. All of these are emitted regardless of namespace, so subagent events are indistinguishable from orchestrator events. - src/tui/conversationArea.js:370 —
streamingMsgIdRef.current = messageListRef.current.addMessage("assistant", "", ...)creates the single assistant bubble that all stream events fold into viacreateStreamingHandler. - src/tui/conversationArea.js:createStreamingHandler — Handles
message,reasoning,on_chat_model_stream,on_tool_start,on_tool_end,tool,on_tool_error. All updatestreamingMsgIdRef.current. Subagent events must be routed to a separate store instead. - src/tui/panels.js:4 —
PANELSenum. Add aSUBAGENTSpanel here and register it ingetPanelOrder()for tab navigation. - src/tui/app.js — Panel routing in the render switch (
currentView === PANELS.SKILLSetc.). Add aSUBAGENTSbranch rendering the new panel. - src/tui/messageBubble.js — Reusable
MessageBubblecomponent; the subagent panel can reuse it (or a variant) to render each subagent's reasoning/message segments.
Fix Steps
- Capture the namespace — In
callProvider(index.js:228), stop discarding_namespace. Whennamespace.length > 0, emit new event types (subagent_message,subagent_reasoning,subagent_tool_start,subagent_tool_end) carrying the namespace, instead of the flatmessage/reasoning/on_tool_*events. Keep the root graph (empty namespace) emitting the existing event types. - Route subagent events in the TUI — In
createStreamingHandler(src/tui/conversationArea.js), handle the newsubagent_*event types by routing them to a dedicated subagent store (e.g. a ref keyed by namespace), not tostreamingMsgIdRef.current. - Add the SUBAGENTS panel — Add
SUBAGENTStoPANELS(src/tui/panels.js) and register it ingetPanelOrder(). Createsrc/tui/subagentsPanel.jsrendering each subagent's reasoning/message segments and tool calls, reusingMessageBubbleor a variant. - Wire the panel into App — Add a
currentView === PANELS.SUBAGENTSbranch in the App render switch (src/tui/app.js) rendering the new panel, passing the subagent store. - Write unit tests — Add
tests/unit/tui/subagentsPanel.test.jscovering namespace discrimination, event routing, and tool-call redirection. - Verify — Run
npm run test,npm run lint, andnpm run coverageto confirm everything passes.
- Lingua principale
- JavaScript
- Stelle
- 2
- Fork
- 0
- Merge medio
- 1h 34m
- PR unite (30g)
- 231
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di avoidwork/madz
-
fix: show file picker empty message below the input lineForse già presa @avoidwork l’ha presa oggi. Apertaapproved bug in progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
avoidwork/madz#1412 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di avoidwork/madz
Issue simili
-
internal os specific
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
frostney/GocciaScript#1688 ·
I maintainer di solito rispondono entro 1 giorno
-
🐞 bug pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
CircuitVerse/CircuitVerse#8031 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 8 giorni
-
docs(stream-protocol): document messageMetatadata on start/finish and the message-metadata chunkForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertafactory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vercel/ai#23375 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 7 giorni