Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

Merge main preserving media replay and phone consent guidance

review723f45393266
diff --cc CLAUDE.md
index 008269a55,c2525fedf..6f550a72d
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -4904,33 -4943,19 +4943,50 @@@ sessions is a hazard whatever kills it
When a change is genuinely desktop-only (native menus, auto-update, Keychain), say so; the
point is to make the call consciously, not to leave the other surfaces to rot.
+## Media playback lifetime (#680)
+
+Audio routes through `isMediaFile` to the existing persisted `video` kind and native audio controls.
+Legacy audio editor nodes migrate on load. Desktop uses the existing local/SSH allowlist; Server
+and relay retain their explicit media transport degradation. Native mobile does not consume these
+React nodes; its own player/IME behavior requires a separate device check.
+
+Remote cache entries requested in this run are retained until exit, including cache hits; pruning
+waits are coordinated with a concurrent cache reader. The 20-entry cap is soft for retained files,
+so disk use may grow in a long run; prior-run entries are eligible again after restart. `mediaRange`
+handles suffix ranges and rejects unsatisfiable ones without weakening the serve-time path jail.
+
+## Subagent reload replay (#680)
+
+`core/subagent-replay.ts` retains at most 512 running starts for the existing WORKING_STALE_MS,
+with original host timestamps. The shared mirror event path feeds it (including synthetic async
+ends); session boundaries and clearNode discard it. Both shells expose the same read, and desktop
+preload / browser / relay subscribe before requesting it. Only lifecycle events wait behind the
+snapshot (bounded to 512 events / 3 seconds); live permission alerts are not delayed or replayed.
+No disk restore, transcript backlog, completed-card replay, or authorization evidence is provided.
+A host restart or a missed original start is still outside this recovery.
+
+
+## IME mode switching (#680)
+
+`terminal/ime-mode-switch.ts` adapts xterm 5.5's composition helper after `open()` in both terminal
+surfaces. Caps Lock must not finalize an active composition: the subsequent native compositionend
+owns that commit. The test executes the dependency's real helper, with an unpatched double-send
+control. This pins one event ordering, not every native IME; macOS Chinese Caps Lock still needs a
+device run, including insertText and compositionend orderings. Revalidate the adapter on xterm upgrades.
++
+ ### Standing phone consent lifetime (#819)
+
+ A browse socket can close before the human clicks the SAS dialog. `core/phone-approval.ts` retains
+ only the handshake-bound id/key for 120 seconds, at most 64 requests, one per key. Socket closure
+ releases presence and transport but does not discard that bounded consent; replacement, rejection,
+ expiry and host stop clear the exact dialog id. Approval requires BOTH id and displayed key (no
+ key-only match or mismatched-key fallback), consumes once, then persists before granting access.
+ `remote:phone:approve` is raw, owner-window Electron IPC, never a relay RPC. Its response separates
+ stale/persistence failure from approved/saved-disconnected; renderer rejection/timeout is explicitly
+ unconfirmed. SAS derivation and mutual trust verification are unchanged. Legacy interactive offers
+ remain session-only, and Server Edition rejects standing phone approval as unsupported.
+
+ Pin/revoke mutations use `updateApprovedDevices` to queue the entire read/modify/write in process;
+ unique-temp atomic rename alone cannot prevent lost updates. Non-ENOENT reads and malformed JSON
+ reject rather than overwrite unknown trust state. The queue is not a cross-process lock. A click
+ accepted before host stop may finish its disk save, but must never open the now-closed session.
diff --cc CONTRIBUTING.md
index 9c1f1ea9e,b04888f37..ef368b97b
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@@ -796,11 -814,13 +814,18 @@@ Two files, two audiences
invariant that only lives in a commit message is one refactor away from being violated by someone
who never saw it.
+- Media URLs live for the app run. Remote cache pruning must keep files already handed to
+ players; the cache cap is soft until restart. Use the existing `video` node for audio too.
+- Subagent reload replay is display-only and current-host-only. Never replay status/permission
+ events or treat a replayed card as verified process ownership; subscribe before taking its snapshot.
+
+ **Phone consent belongs to the verified handshake, not the browse socket.** A standing phone's
+ SAS request survives transport closure only until its 120-second deadline; approval requires the
+ issued id and displayed box key together. Keep request/reply outcomes distinct (stale request,
+ failed pin save, missing IPC response, saved-but-disconnected). All production pin/revoke writers
+ must use `updateApprovedDevices` for the whole read/modify/write, so concurrent updates cannot
+ lose approvals or resurrect revoked keys. Server Edition does not host this legacy relay path.
+
Managed Codex login terminals are agent-less: core identifies their provider from the saved
account list. Before opening one, await `useSettings.getState().flush()` after adding the account.
The normal 300 ms coalesced save is too late: an unknown id can launch against the system home.