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(remote): jail the phone bridge to every local project root, not the focused tab
enes8cc7aa2ffd8e
diff --git a/src/core/workspace-store.test.ts b/src/core/workspace-store.test.tsindex d52e7f050..95bc3880d 100644--- a/src/core/workspace-store.test.ts+++ b/src/core/workspace-store.test.ts@@ -377,6 +377,22 @@ describe('projects.list relay blob (iOS wire contract)', () => {})})+describe('localProjectCwds (the phone bridge jail roots)', () => {+ it('lists local ref cwds only — inline and ssh entries carry no host-local root', async () => {+ const store = new WorkspaceStore()+ await store.save(ws([+ project({ cwd: projRoot }),+ project({ id: 'inline1', name: 'inline' }),+ project({ id: 'ssh1', ssh: { server: { host: 'h', user: 'u' } as never, remoteCwd: '~/x' }, cwd: undefined })+ ]))+ expect(store.localProjectCwds()).toEqual([projRoot])+ })++ it('empty before any load/save', () => {+ expect(new WorkspaceStore().localProjectCwds()).toEqual([])+ })+})+describe('appendRemoteNode (phone-registered sessions over the relay)', () => {it('appends into a local ref project file as an OUTSIDE edit (watcher must see it)', async () => {const store = new WorkspaceStore()diff --git a/src/core/workspace-store.ts b/src/core/workspace-store.tsindex 1f06345e4..07a5e2366 100644--- a/src/core/workspace-store.ts+++ b/src/core/workspace-store.ts@@ -360,6 +360,13 @@ export class WorkspaceStore {return (this.index?.entries ?? []).filter((e) => e.ssh).map((e) => e.id)}+ /** The local ref cwds of the current index — the workspace half of the phone bridge's fs/git+ * jail. The phone browses EVERY project over `projects.list`, so jailing to only the active+ * canvas's node cwds denied any project the desktop didn't happen to have focused. */+ localProjectCwds(): string[] {+ return (this.index?.entries ?? []).filter((e) => e.cwd).map((e) => e.cwd!)+ }+/** Node ids of an ssh project's cached file — the slice of the agent-status mirror its host* receives (see remote-status-push.ts). Empty when the project isn't an ssh entry. */sshProjectNodeIds(projectId: string): Set<string> {diff --git a/src/main/index.ts b/src/main/index.tsindex 575b88ac8..1a2a18ee7 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -1055,7 +1055,11 @@ app.whenReady().then(async () => {const hostBridge = {git: gitService,registerNode: (projectId: string, node: { id: string; title?: string; agentId?: string }) =>- workspaceStore.appendRemoteNode(projectId, node)+ workspaceStore.appendRemoteNode(projectId, node),+ // Jail roots beyond the active canvas: the phone browses EVERY project (projects.list), so+ // its fs/git access spans every local project root — not just the tab the desktop happens+ // to have focused (that gap read as "cwd is outside the shared project roots" on the phone).+ workspaceRoots: () => workspaceStore.localProjectCwds()}initRemoteHost(win, ptyManager, listProjectsOutput, hostBridge)// NEW interactive relay host (Stage 4): a connecting peer desktop becomes a first-classdiff --git a/src/main/remote/host-service.ts b/src/main/remote/host-service.tsindex e73742346..20fe8fa2c 100644--- a/src/main/remote/host-service.ts+++ b/src/main/remote/host-service.ts@@ -695,6 +695,10 @@ export interface HostSessionOptions {git?: HostGitOps/** Registers a phone-started session as a project node (`projects.registerNode`). Optional. */registerNode?: (projectId: string, node: { id: string; title?: string; agentId?: string }) => Promise<boolean>+ /** Extra fs/git jail roots beyond the shared canvas's node cwds — production passes the+ * workspace's local project cwds: the phone browses EVERY project over `projects.list`, so a+ * canvas-only jail denied whichever project the desktop didn't happen to have focused. */+ extraRoots?: () => string[]/*** A peer completed the E2EE handshake and awaits an approval decision. The caller inspects the* session (sas / peerPublicKeyB64) and either approves immediately (pin-once) or prompts the@@ -807,7 +811,7 @@ export function connectHostSession(opts: HostSessionOptions): HostSession {opts.pty,socket,fsOps,- () => rootsFromCanvas(opts.getLatestCanvas()),+ () => [...rootsFromCanvas(opts.getLatestCanvas()), ...(opts.extraRoots?.() ?? [])],opts.listProjects ?? (async () => ''),opts.getClientId ?? (() => null),opts.git,@@ -831,6 +835,8 @@ export function connectHostSession(opts: HostSessionOptions): HostSession {export interface HostBridgeDeps {git?: HostGitOpsregisterNode?: (projectId: string, node: { id: string; title?: string; agentId?: string }) => Promise<boolean>+ /** Workspace-level jail roots (local project cwds) merged with the canvas node cwds. */+ workspaceRoots?: () => string[]}export function initRemoteHost(@@ -898,6 +904,7 @@ export function initRemoteHost(listProjects,git: bridge.git,registerNode: bridge.registerNode,+ extraRoots: bridge.workspaceRoots,// Typing attribution: this session's input frames are this phone's keystrokes.getClientId: () => phone.id(),// Interactive host: surface the SAS + a fresh pending id so the human can verify + approve.diff --git a/src/main/remote/standing-host.ts b/src/main/remote/standing-host.tsindex 06096ffd6..f4bd889d1 100644--- a/src/main/remote/standing-host.ts+++ b/src/main/remote/standing-host.ts@@ -375,6 +375,7 @@ export function initStandingHost(listProjects,git: bridge.git,registerNode: bridge.registerNode,+ extraRoots: bridge.workspaceRoots,// Typing attribution: this pooled session's input frames are ITS phone's keystrokes.getClientId: () => pooled.presence.id(),onPeerReady: () => void onPeerReady(pooled),