cmux-tui: add read-only agent session observer

Closed
TE
18d ago
+214-62

Problem

Agents and UI clients can already attach to a selected acpmux session and receive replayable wire records, but the existing wrapper also exposes prompt, cancel, and permission operations. A canary/debug observer needs a server-enforced read-only boundary.

Change

  • add agent-session-observe-v1 and the agent-session-observe command;
  • reuse the existing bounded attach/replay/live event stream, cursor resume, and lag/close reasons;
  • make read-only mode monotonic for a connection and surface: attach -> observe upgrades, observe -> attach cannot downgrade;
  • reject prompt, cancel, and permission mutations before calling acpmux;
  • move observer code/tests into dedicated modules so existing Rust god-file files do not grow;
  • document the command and refusal code.

Validation

  • git show --check, git diff --check, and rustfmt checks pass;
  • existing attach/test files remain at or below merge-base line counts (1140/1159 and 974/975);
  • exact-head hosted verification: https://github.com/manaflow-ai/cmux/actions/runs/38991266082 — focused Linux/macOS tests, MSRV, lint, and aarch64 release artifact all passed after one infrastructure-only cache 502 rerun.

Head: 65e6282df9edec7e2238b9ef26b604fbdcc5f5bc