feat(desktop): running agents section in workspace sidebar

Merged
KI
4mo ago
+326-11

What

Adds a running agents row beneath each workspace in the v2 dashboard sidebar, mirroring the inline ports row.

  • Lists every agent bound to the workspace's terminals (via useTerminalAgentBindings), not just those currently working/permission — idle agents show too.
  • Each badge resolves name + preset icon from the binding's agentId (BUILTIN_AGENT_LABELS + usePresetIcon), the same resolver the terminal pane icon uses.
  • State: the leading glyph is the live StatusIndicator when the agent is working/permission/review, and the agent's icon when idle — held in a fixed-size slot so the row doesn't shift as state changes. No trailing status element.
  • Click opens the agent's terminal pane (terminalId + focusRequestId), same as the port badge.
  • Agents are ordered by startedAt for stable positioning; the details toggle summary counts all bound agents.

Layout / decoupling

  • The agents row is decoupled from the experimental inlineWorkspacePortsEnabled flag — the details container renders whenever it has content; only the ports section stays gated by the flag (so ports don't double-render against the bottom ports list).
  • Both the agents and ports rows now use flex flex-wrap — a single row that wraps to a second only when needed (previously a forced 2-row horizontal-scroll grid), with tighter spacing.

Notes

  • This row is terminal-agent bindings only; the built-in "Superset" chat agent is not listed. Easy to add chat sources alongside if we want it.

Test plan

  • Bind an agent in a workspace terminal → it appears in the sidebar with icon + name.
  • While the agent is working / awaiting permission / ready for review, the leading glyph reflects state; idle shows the agent icon; no layout shift on transitions.
  • Clicking a badge opens the workspace and focuses that agent's terminal pane.
  • Rows wrap to a second line only when they overflow; ports behavior unchanged.

Open in Stage

Summary by cubic

Adds a running agents row under each workspace in the v2 dashboard sidebar, showing all terminal-bound agents with live status and one-click focus to the agent’s terminal. The feature is behind an experimental “Workspace agents” toggle (off by default).

  • New Features

    • Lists all agents bound via useTerminalAgentBindings (includes idle); label and icon resolved via BUILTIN_AGENT_LABELS/usePresetIcon.
    • Badge shows StatusIndicator when active, agent icon when idle; fixed icon slot to avoid layout shift; tooltip with name and status; click focuses the agent’s terminal (terminalId/focusRequestId).
    • Stable order by startedAt; summary count reflects all bound agents.
  • Refactors

    • Agents row gated by useWorkspaceAgentsRowEnabled with an Experimental Settings switch and search entry; bindings query supports { enabled } to skip when off.
    • Workspace details container renders when it has content; ports remain behind inlineWorkspacePortsEnabled.
    • Agents and ports rows use flex flex-wrap and wrap only when needed.

Summary by CodeRabbit

  • New Features
    • Added a new “Workspace agents” section to the dashboard sidebar with clickable agent badges that open the workspace view.
    • Introduced an experimental “Workspace agents” toggle to enable the inline agents row in the sidebar.
  • Bug Fixes
    • Improved dashboard sidebar workspace details so the agents section renders more reliably when agents are available (reduced unnecessary gating).
  • UI Updates
    • Updated the ports list layout to a more compact, wrap-friendly presentation.
    • Enhanced agent badge visuals with status indicators and clearer hover tooltips.