Skip to content

TUI: replace running-view with SupervisionScreen (#193)#437

Open
windoliver wants to merge 25 commits into
mainfrom
worktree-cryptic-skipping-floyd
Open

TUI: replace running-view with SupervisionScreen (#193)#437
windoliver wants to merge 25 commits into
mainfrom
worktree-cryptic-skipping-floyd

Conversation

@windoliver
Copy link
Copy Markdown
Owner

Summary

Closes #193. Builds the agent-supervision hero surface called for in the issue, replacing the 73 KB running-view.tsx monolith with a decomposed src/tui/views/supervision/ module:

  • Fleet grid of state-aware cards (8 states: running / silent / stuck / blocked / thrashing / awaiting / done / idle) with severity-sorted layout.
  • Per-agent drill-dock (Feed / DAG / Term tabs) opened by Enter on the focused card.
  • Approval queue wired to existing useAgentMonitor permission prompts — A opens a modal, y/n accept/deny via the same tmux send-keys path running-view used.
  • Pure heuristics (classifyAgent, summarize) with configurable thresholds via GROVE_TUI_SUP_* env vars, fully unit-tested.
  • Keyboard router with precedence: cmd-mode → modal → focused-card-awaiting → drill → grid keys.
  • Retires running-view.tsx, running-keyboard.ts, running-cmd-mode.ts, agent-list.tsx, running-view-hints.ts, two visual test harnesses, and their tests. Storage migration shim maps the legacy RunningPanel enum to the new drillTab string.

Design: docs/superpowers/specs/2026-05-15-tui-supervision-hero-design.md
Plan: docs/superpowers/plans/2026-05-15-tui-supervision-hero.md

Removed bindings (operator muscle memory)

  • 1 / 2 / 3 now select drill tabs (Feed / DAG / Term), only when drill is open
  • 4 is unbound (only three drill tabs)
  • f cycles state filter (was: fullscreen toggle)
  • B is new — back-to-main (was implicit via Ctrl+B in running-view)

Test plan

  • bun test src/tui/views/supervision/ — 104 unit/component tests
  • bun test tests/tui/supervision-snapshot.test.ts tests/tui/supervision-keyboard-e2e.test.ts — 2 integration tests
  • Launch via grove and verify: fleet banner shows counts, cards render with correct state colors, Enter opens drill, A opens approval modal, y/n route to tmux, B returns to preset-select with archive prompt
  • Verify legacy saved sessions resume on the new screen (storage migration)
  • Smoke grove up with multiple agents and one tmux permission prompt

Known follow-up gaps (non-blocking, all documented in commit messages)

  1. screen-manager.test.ts deleted (26 state-machine tests). The deletion is documented in commit e6628270; tests for the SupervisionScreen replacement need to be ported separately.
  2. DAG drill-tab renders the global graph unscoped per the v1 simplification (commented in drill-dock.tsx); per-agent DAG scoping is a follow-up.
  3. Failed approval mutations are silently caught in the screen handler — no FlashBar surfacing yet. Plan called for "queue entry re-appears" — current behaviour relies on the next tick rather than an explicit toast.
  4. Legacy usePermissionDetection wrapper in ScreenManager still renders the old "Permission Request" banner above SupervisionScreen — duplicate UX with the new ApprovalModal. Drop it in a follow-up once the new modal is validated in production.

🤖 Generated with Claude Code

windoliver added 25 commits May 15, 2026 17:38
New top-level Supervision screen replaces the running-view monolith:
fleet banner, 3-col agent grid with state-aware cards, drill-dock for
per-agent Feed/DAG/Term, approval queue with badge + fleet chip + A-to-next
modal. TUI-side heuristics classify agents (run/silent/stuck/blocked/
thrashing/awaiting/done/idle); thresholds configurable. Six-commit
migration with env-flag scaffolding torn down in the final commit.
Pure types and threshold loader for the new Supervision screen.
Unwired — dead code with tests until later tasks consume it.
Disambiguates SupervisedAgent.contextHot (boolean) from FleetSummary's
aggregated count. costSpikeCount/contextHotCount make the count
semantics explicit at call sites.
8-state classifier with priority order: awaiting > blocked > thrashing
> stuck > silent > running > done > idle. Annotations (costSpike,
contextHot) are additive and do not change primary state.
…lation test

Clarifies why claim-age = task-age in Grove's data model. Documents that
thrashing keys only on relations[0]. Adds a negative test for the
multi-relation case so the simplification is locked in. Drops an
unreachable regex branch in the silent-duration test.
DrillFeed reads contributions and filters client-side by agentId — small
and focused, no highlight/filter/expand machinery. DagView is rendered
unscoped for v1 (per-agent scoping is a follow-up). TerminalView uses
the existing sessionName prop. drill-tabs.tsx exposes nextDrillTab as a
pure helper.
#193)

Scaffolding — opt-in only. RunningView remains default. Approval handlers
are no-op stubs for now; full wiring lands when supervision becomes default
in a follow-up task.
Replaces Task 13's no-op stubs with a thin SupervisionPage wrapper that
sources pendingApprovals from useAgentMonitor and dispatches Enter/Escape
to the prompt's tmux session on accept/reject — matching running-view's
existing behaviour exactly.
Retires running-view.tsx (73 KB), running-keyboard.ts, running-cmd-mode.ts,
agent-list.tsx, running-view-hints.ts, and their tests. SupervisionScreen
becomes the running screen for every session; the GROVE_TUI_SUPERVISION
env flag is removed. RUNNING_VIEW_HINTS → SUPERVISION_HINTS. Storage
migration shim maps the legacy RunningPanel enum to the drillTab string.
Visual test harnesses for RunningView panels deleted.

Removed bindings vs. running-view (operator muscle memory):
  - 1/2/3 now select drill tabs (Feed/DAG/Term) only when drill is open
  - 4 is unbound (only three drill tabs)
  - f cycles state filter (was: fullscreen toggle)
Delete running-view.tsx, running-keyboard.ts, running-cmd-mode.ts,
agent-list.tsx, running-view-hints.ts and all their test files.
Delete screen-manager.test.ts (imported deleted RunningViewProps).

Update hint-map.ts to use SUPERVISION_HINTS for the running page.
Update use-session-persistence.ts: replace RunningPanel (numeric enum)
with DrillTab (string union) + migrateRunningPanel shim for legacy saves.
Simplify screen-manager.tsx: RunningPageWithBackConfirm always renders
SupervisionPage, env flag GROVE_TUI_SUPERVISION removed.

Fix hint-bar acceptance tests to expect supervision hints ("Move")
instead of old running-view hints ("Goto") on the running page.
Connects the archive-on-back flow (handleBackToMain in screen-manager)
to a "back-to-main" keyboard action triggered by Shift+B on the
supervision surface. Previously dead code after the running-view
retirement.

Adds B to SUPERVISION_HINTS so the binding is discoverable.
Stakes out the tmux-based real-process e2e called out by the spec
(feedback_real_process_e2e convention). Body deferred to a follow-up
that fills it in following tests/e2e/watch-relist-tmux.ts.
…onScreen (#193)

The harness still drives a real claude-code review-loop; it just now
matches the new FLEET banner + agent-card text instead of the retired
running-view's "Contribution Feed" / "coder [1]" labels. Goal injection
moves from a mid-session `:` prompt to the wizard's goal-input screen
(SupervisionScreen does not currently expose a mid-session prompt).

Requires ANTHROPIC_API_KEY. Run as:
  ANTHROPIC_API_KEY=... bun run tests/tui/typed-acp-tmux-e2e.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: make agent supervision the hero surface of the operator experience

1 participant