Files
stack/docs/fleet/proposals/mosaic-platform-prd/PRD-webui-fleet-control.md
Jason Woltje 6b8c3c5d3a
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
docs(fleet): refine Mosaic Platform PRD per Jason's review (R1–R7)
Post-review refinements to the DRAFT PRD set (decisions D1–D12 unchanged):

- R1: PRD-permission-relay is now self-contained — its cited design source
  (guard-rails-capability-permissions.md) is absent from origin/main, so the
  essential model (prepare-freely/execute-with-approval, permission levels,
  resource:action grants) is folded in as the authoritative spec.
- R2: Phase-1 conversation channel is tmux/CLI via the f4 Phase-1 tmux
  connector (operator issues /remote-control); Matrix room (J5/K1) is Phase 2.
- R3: Jarvis is a Level-0 orchestrator (delegation + subagents, never executes
  coding/infra); AC-NS-8 latency isolation is a separate-model-capacity
  guarantee, not just a separate process (NS-10, AC-NS-8, ASM-5).
- R4: jarvis-brain reframed as the P0 (prototype) Mosaic Stack; tenant-1
  migration targets the proper stack storage layer (vector DB + enhanced
  memory + flat-file backends). Agent memory/runbooks migrate live into the
  memory subsystem and are NOT frozen; repo retires read-only only after both
  PA data and agent memory are verified migrated (X2/X-R7).
- R5: homelab→USC promotion is an explicit owner sign-off gate, not an
  automated metric (X deployment-scope).
- R6: verified K1 is covered by f4-matrix-connector.md Phase 2 (no new doc).
- R7: clarified always-available Opus ≠ standing cost (idle = no bill) (J-R2).
- Also normalized PRD-backlog-providers.md and PRD-webui-fleet-control.md with
  prettier (whitespace-only) — they were non-conformant as originally pushed
  and would have re-broken repo-wide format:check on merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
2026-07-09 14:50:54 -05:00

4.9 KiB
Raw Blame History

PRD — webUI Fleet Control · Workstream W (realizes F6)

Status: DRAFT for ratification · Goals: W1W3 · Upstream anchor: PRD-fleet-suite.md Phase F6 ("webUI hooks — stable JSON contract + terminate/attach(butt-in) surface") Confirmed gap: zero xterm/pty/tmux code in apps/web on either the old snapshot or origin/main.

Mission

The user can pop in on any agentic tmux session from the web, and get a full top-down view of the system — fleet roster, health, work in flight, spend — without touching a terminal. This is the product surface for "user has ability to pop in on any agent session; full top-down view available."

Requirements

Attach service (W1)

ID Requirement
W-R1 A gateway service exposes per-agent session streams over WebSocket: watch (read-only pane view, cannot type) and butt-in (interactive takeover), mirroring the existing CLI verbs mosaic agent watch/attach.
W-R2 Authz is workspace-scoped through the product auth stack (BetterAuth/Authentik); watch and butt-in are separate grants; butt-in may be requires_approval per workspace policy (workstream P).
W-R3 Every attach (watch or butt-in) is audited: who, which agent, when, duration.
W-R4 Butt-in visibly flags the session to the agent runtime and other viewers (no silent takeover).
W-R5 Contract is stable JSON + streaming frames per F6's "stable JSON contract" requirement, so TUI/CLI and webUI share it.

Web terminal (W2)

ID Requirement
W-R6 xterm.js view in apps/web wired to W1: session list → click → live pane; toggle watch↔butt-in per grants.
W-R7 Reconnect-safe (network blips resume the stream), mobile-usable read-only view.

Top-down dashboard (W3)

ID Requirement
W-R8 Fleet dashboard: roster with per-agent state (systemd + tmux + heartbeat join, as fleet ps provides), current card/task, last activity, drift/boot-enable warnings.
W-R9 Work-in-flight view: backlog cards by state with depends_on DAG rendering; advisory spend per card (NS-2/NS-5).
W-R10 Operator controls: PAUSE kill-switch (NS-8), per-agent terminate (killswitch service), queue pause/resume — each gated + audited; destructive controls confirm.
W-R11 Existing widget framework (AgentStatusWidget, OrchestratorEventsWidget, SSE proxy routes) is the starting point, upgraded to the fleet contract rather than rebuilt.

Acceptance criteria

  1. From a browser (desktop + phone), the user watches a live coder-agent pane read-only, then butt-ins with the right grant, types a message, detaches; agent session continues; audit log shows both.
  2. Dashboard reflects an agent crash within one heartbeat interval; PAUSE flip halts dispatch within one tick (AC-NS-5) from the UI.
  3. A user without butt-in grant can watch but cannot type (enforced server-side).

Non-goals

  • Replacing tmux as the session substrate (tmux remains the transport; web is a view).
  • Cross-host federation of the dashboard (rides the existing federation workstream later, per upstream note "Phase 5 rides federation").

Assumptions

  • ASSUMPTION: pty bridging terminates at the gateway on the fleet host (web1), not in apps/web; Next.js only speaks WebSocket to the gateway.
  • ASSUMPTION: the jarvis-brain dashboard's node-pty/xterm work (dashboard/server/terminal.ts) serves as reference implementation only; code is not ported wholesale into the multi-tenant product without the authz layer above.