Skip to content

feat(tui): Show Agent nodes instead of Tool names in FlowMap with parallel/single indicators #550

@JeremyDev87

Description

@JeremyDev87

Summary

The TUI FlowMap currently displays codingbuddy tool names (search_rules, analyze_task, dispatch_agents, etc.) as nodes alongside real Agent nodes. This creates visual noise and confusion. This issue tracks the work to:

  1. Remove Tool name nodes from FlowMap — only show real Agents
  2. Visually distinguish Primary Agent vs. Specialist Agents
  3. Indicate parallel vs. single execution at the progress bar row

Current Behavior

When codingbuddy MCP tools are called, parse-agent.ts maps them via TOOL_AGENT_MAP and emits AGENT_ACTIVATED, which causes tool names to appear as nodes in the FlowMap:

╭──────────────────╮   ← "search_rules" tool node (unwanted)
│ search_rules ○   │
│ ░░░░░░░░░░       │
╰──────────────────╯

╭──────────────────╮   ← "analyze_task" tool node (unwanted)
│ analyze_task ○   │
│ ░░░░░░░░░░       │
╰──────────────────╯

There is also no visual indicator to distinguish whether Specialist Agents are running in parallel or as single agents.


Desired Behavior

╔══════════════════╗   Primary Agent (double-box, unchanged)
║ solution-arch ●  ║
║ ████░░░░░░       ║   ← progress bar kept
╚══════════════════╝

╭──────────────────╮   Parallel Specialist
│ security ●       │
│ ⫸ parallel       │   ← replaces progress bar row
╰──────────────────╯

╭──────────────────╮   Single Specialist
│ code-reviewer ●  │
│ → single         │   ← replaces progress bar row
╰──────────────────╯

╭──────────────────╮   Mode node (plan-mode, act-mode — kept as-is)
│ plan-mode ○      │
│ ░░░░░░░░░░       │
╰──────────────────╯

Implementation Plan

Step 1 — dashboard-types.ts: Add isParallel field

export interface DashboardNode {
  id: string;
  name: string;
  stage: Mode;
  status: DashboardNodeStatus;
  isPrimary: boolean;
  progress: number;
  isParallel: boolean;  // NEW: true when agent is part of a parallel dispatch
}
  • Update createDefaultDashboardNode to default isParallel: false

Step 2 — parse-agent.ts: Remove TOOL_AGENT_MAP

Remove the TOOL_AGENT_MAP constant and its usage. Tool calls continue to be tracked via TOOL_INVOKED (visible in ActivityVisualizer) but no longer emit AGENT_ACTIVATED.

Keep the following parsers (they represent real semantic agents, not tool nodes):

  • parse_mode → emits mode nodes (plan-mode, act-mode, etc.) — KEEP
  • get_agent_system_prompt → emits real specialist agent — KEEP
  • prepare_parallel_agents → emits parallel-dispatch node — KEEP

Step 3 — use-dashboard-state.ts: Set isParallel: true on PARALLEL_STARTED

case 'PARALLEL_STARTED': {
  const { specialists, mode } = action.payload;
  const agents = cloneAgents(state.agents);
  for (const name of specialists) {
    const id = `specialist:${name}`;
    if (agents.has(id)) continue;
    agents.set(id, {
      id, name, stage: mode,
      status: 'idle',
      isPrimary: false,
      progress: 0,
      isParallel: true,  // NEW
    });
  }
  return { ...state, agents };
}

Step 4 — response-event-extractor.ts: Add Primary→Specialist relationship edges

extractFromPrepareParallelAgents: After emitting PARALLEL_STARTED, also emit AGENT_RELATIONSHIP edges from the current Primary Agent to each specialist.

extractFromParseMode (parallelAgentsRecommendation section): After emitting PARALLEL_STARTED, emit AGENT_RELATIONSHIP edges from primary:${delegateName} to each specialist:${name} with label: 'parallel'.

Step 5 — flow-map.pure.ts: Visual rendering change

In drawAgentNode, change the progress bar row (row 2) logic:

// Row 2: progress bar OR execution mode indicator
if (agent.isPrimary) {
  // Primary: keep progress bar as-is
  const bar = buildProgressBar(agent.progress, barWidth);
  // ... existing progress bar drawing
} else if (agent.isParallel) {
  // Parallel specialist: show ⫸ parallel
  buf.writeText(x + 2, y + 2, '⫸ parallel', PARALLEL_STYLES.parallel);
} else {
  // Single specialist: show → single
  buf.writeText(x + 2, y + 2, '→ single', PARALLEL_STYLES.single);
}

Add PARALLEL_STYLES constants for coloring.

Step 6 — Update spec files

File Changes
dashboard-types.spec.ts Add isParallel: false to default node assertions
parse-agent.spec.ts Assert TOOL_AGENT_MAP tools no longer return AgentActivatedEvent
use-dashboard-state.spec.ts Assert PARALLEL_STARTED sets isParallel: true
flow-map.pure.spec.ts Assert ⫸ parallel / → single text in rendered output
response-event-extractor.spec.ts Assert AGENT_RELATIONSHIP edges emitted from prepare_parallel_agents and parse_mode

Files to Change

apps/mcp-server/src/tui/
├── dashboard-types.ts
├── dashboard-types.spec.ts
├── events/
│   ├── parse-agent.ts
│   ├── parse-agent.spec.ts
│   ├── response-event-extractor.ts
│   └── response-event-extractor.spec.ts
├── hooks/
│   ├── use-dashboard-state.ts
│   └── use-dashboard-state.spec.ts
└── components/
    ├── flow-map.pure.ts
    └── flow-map.pure.spec.ts

Acceptance Criteria

  • Tool name nodes (search_rules, analyze_task, etc.) no longer appear in FlowMap
  • Mode nodes (plan-mode, act-mode) still appear in FlowMap
  • isParallel: true is set on all Specialist nodes added via PARALLEL_STARTED
  • Parallel Specialist nodes display ⫸ parallel at the progress bar row
  • Single Specialist nodes display → single at the progress bar row
  • Primary Agent nodes continue to display the progress bar
  • AGENT_RELATIONSHIP edges are emitted from Primary to each Parallel Specialist
  • All existing tests pass; new tests added for each changed file

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions