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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(relay): a viewer-fallback session follows share changes; docs for the final fixes
review09580a88aace
diff --git a/CLAUDE.md b/CLAUDE.mdindex 8b89402d0..3523948f6 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -8503,8 +8503,9 @@ invariants:translates no ids, so a tab under any other id asks the host about a project it does not know: aclosed relay copy under that id is replaced, anything else holding it (an open tab, a localproject) is skipped, never renamed. One relay connection serves all of a team's tabs. They follow- `relay:hosted:shared-changed {projectIds}`, which goes to EVERY member connection (`EDITOR_ONLY`- as a call, always passed by `VIEW_EVENTS`), because `workspace:server-change` ignores unknown ids+ `relay:hosted:shared-changed {projectIds}`, which goes to EVERY connection the host serves —+ `tellMembers` asks `standing`, so the `pinFailed` viewer fallback is included (`EDITOR_ONLY` as a+ call, always passed by `VIEW_EVENTS`), because `workspace:server-change` ignores unknown idsand viewers never receive `canvas:authority-changed`. A tab the user closes is dismissed untilthe project is unshared; nothing shared keeps one placeholder tab. A hosted tab never cold-resumesan agent (`canColdRestore` excludes `source === 'relay'`). A CLOSED team tab (any `remote`diff --git a/docs/hosted-team-relay.md b/docs/hosted-team-relay.mdindex b4745587c..c01e584b8 100644--- a/docs/hosted-team-relay.md+++ b/docs/hosted-team-relay.md@@ -245,8 +245,8 @@ Nothing changes before you press **Share**. The dialog ("Share <name> with a teaThe installer's output streams into the dialog; a build takes many minutes, and the desktop waits upto 30 of them. The desktop downloads the installer to a temp file before running it, never pipes itinto `bash`: with no `pipefail`, a failed download pipes an empty script that exits 0, which would-read as a successful install. **Cancel** stops this desktop waiting. Whatever the installer already-did on the host stays, and the project has not been touched yet.+read as a successful install. **Cancel** stops the install and ends the share there. Whatever the+installer already did on the host stays, and the project has not been touched yet.### Which terminals continue@@ -612,7 +612,8 @@ project of yours that holds the id is skipped, never renamed.- **Share changes are live.** Whenever `sharedProjects` changes (`team share`, `team unshare`,`team bootstrap`), the host sends `relay:hosted:shared-changed {projectIds}` to every connected- member, Viewers included. The desktop opens a tab for a newly shared project, with no new code and+ session it serves, Viewers included, and a device served as a Viewer because its approval could+ not be written too. The desktop opens a tab for a newly shared project, with no new code andno new approval, and closes the tab of an unshared one; nothing is deleted on the host. A tab thata share event opens is added at the end of the tab bar.- **A tab you close stays closed** while its project stays shared, for the rest of the app run. Once@@ -1330,4 +1331,15 @@ on a Mac and a second desktop as a teammate. Record `team status --json` at each22. **Reopening the old SSH project warns.** From "Recently closed", with ⇧⌘T, and by opening thesame host and folder as an SSH project again: each warns, naming the team and the host. Cancelleaves it closed; "Open here anyway" opens it, and its later saves reach the host's- `.nodeterm/project.json` again.+ `.nodeterm/project.json` again. Its Claude node does not resume on its own: it shows the+ "Not resumed" banner, and no second `claude` for that conversation starts on the host.+23. **A home folder is refused.** An SSH project left at `~` (the dialog's starting folder): Share+ with team refuses it before anything is installed ("This project's folder is your home+ directory…"). On the host, `team bootstrap --adopt ~ --json` answers `E_BAD_CWD`.+24. **Cancel during the install.** On a fresh host, press Cancel while the installer streams: the+ result says the install was cancelled, the SSH project stays open and unmarked, its terminals+ keep running, and nothing is bootstrapped.+25. **Going to a shared node lands on the team's tab.** After item 17, a completion notification of+ the resumed agent, its sessions-sidebar row, ⌘K and a teammate's face all open the team's tab+ with the node focused, never the reopen warning of the closed SSH project. A closed team tab is+ not listed under "Recently closed".diff --git a/src/core/relay/hosted-service.test.ts b/src/core/relay/hosted-service.test.tsindex 79f1db51e..98a9692dc 100644--- a/src/core/relay/hosted-service.test.ts+++ b/src/core/relay/hosted-service.test.ts@@ -771,6 +771,24 @@ describe('hosted service — a session with no team entry (R27)', () => {warn.mockRestore()}})++ it('a session served under the viewer fallback still follows share changes (its tabs must not go stale)', async () => {+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})+ try {+ const w = world()+ const owner = await ownerOnline(w)+ const keys = genKeyPair()+ const { g, pendingId } = await pendingGuest(w, keys)+ disk.failTeamWrite = true // the pin write fails once: no team entry, served as a viewer+ owner.req(5, IPC.relayHostedApprove, [pendingId, 'editor'])+ await vi.waitFor(() => expect(g.isApproved()).toBe(true))+ await hostOpened(w, keys)+ await w.svc.share('p2', true)+ await vi.waitFor(() => expect(g.events(IPC.relayHostedSharedChanged)).toEqual([{ projectIds: ['P', 'p2'] }]))+ } finally {+ warn.mockRestore()+ }+ })})describe('hosted service — removal', () => {diff --git a/src/core/relay/hosted-service.ts b/src/core/relay/hosted-service.tsindex fdbca590f..011e1a301 100644--- a/src/core/relay/hosted-service.ts+++ b/src/core/relay/hosted-service.ts@@ -281,10 +281,12 @@ export function createHostedService(deps: HostedServiceDeps): HostedService {const tellOwners = (channel: string, payload: unknown): void => {for (const c of conns) if (c.open && memberRole(keyOf(c)) === 'owner') send(c, channel, payload)}- /** Every connected member, judged per send (a removed member gets nothing). Unlike `tellOwners`- * this reaches viewers: the payload is only what their narrowed workspace already shows. */+ /** Every connected session that is served at all, judged per send by `standing` (a removed member+ * gets nothing). Unlike `tellOwners` this reaches viewers, the viewer fallback of a session whose+ * pin write failed included: its tabs follow share changes too, and the payload is only what its+ * narrowed workspace already shows. */const tellMembers = (channel: string, payload: unknown): void => {- for (const c of conns) if (c.open && memberRole(keyOf(c)) !== undefined) send(c, channel, payload)+ for (const c of conns) if (c.open && c.session && standing(c, c.session) !== null) send(c, channel, payload)}const pendingList = (): HostedPending[] => [...pending.values()].map((p) => ({ ...p.info }))diff --git a/src/renderer/canvas/canvas-wiring.test.tsx b/src/renderer/canvas/canvas-wiring.test.tsxindex f1f799a2b..834a6d72e 100644--- a/src/renderer/canvas/canvas-wiring.test.tsx+++ b/src/renderer/canvas/canvas-wiring.test.tsx@@ -15,7 +15,7 @@ import path from 'path'import { afterEach, describe, expect, it } from 'vitest'import { chromeObstacles, FIT_VIEW_GAP } from './fit-view'-const CANVAS_SRC = fs.readFileSync(path.join(__dirname, 'Canvas.tsx'), 'utf8')+const CANVAS_SRC = fs.readFileSync(path.join(__dirname, 'Canvas.tsx'), 'utf8').replace(/\r\n/g, '\n')/** jsdom lays nothing out, so every rect is 0×0 and `chromeObstacles`'s size filter would drop the* element. Give it the measurement a real bottom-left pill cluster has. */@@ -553,7 +553,7 @@ describe('the canvas lock is remembered only when the user opted in', () => {describe('the last-session close offer is wired to the × and to the existing close path (issue #848)', () => {// The decision lives in lib/lastSessionClose and is tested there; what those tests cannot see is// WHO raises it and WHAT accepting it does. Both are a line each in files with no render harness.- const TERMINAL_SRC = fs.readFileSync(path.join(__dirname, '..', 'nodes', 'TerminalNode.tsx'), 'utf8')+ const TERMINAL_SRC = fs.readFileSync(path.join(__dirname, '..', 'nodes', 'TerminalNode.tsx'), 'utf8').replace(/\r\n/g, '\n')const closeButton = TERMINAL_SRC.slice(TERMINAL_SRC.indexOf('<Tooltip label="Close (ends the session)">'),TERMINAL_SRC.indexOf('<IconClose />', TERMINAL_SRC.indexOf('<Tooltip label="Close (ends the session)">'))