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(server): serve the real data dir over app:user-data-dir (browser had none)
enes34520627b04d
diff --git a/src/renderer/bridge/stubs.test.ts b/src/renderer/bridge/stubs.test.tsindex cd63bb6d7..76b73d740 100644--- a/src/renderer/bridge/stubs.test.ts+++ b/src/renderer/bridge/stubs.test.ts@@ -34,7 +34,6 @@ describe('bridge stubs', () => {await expect(s.announcements.fetch()).resolves.toEqual([])await expect(s.updates.getPolicy()).resolves.toBeNull()await expect(s.usage.fetch()).resolves.toBeNull()- await expect(s.userDataDir()).resolves.toBe('')await expect(s.license.getStatus()).rejects.toMatchObject({ code: E_UNSUPPORTED })})diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.tsindex 036576526..3ee065cd8 100644--- a/src/renderer/bridge/stubs.ts+++ b/src/renderer/bridge/stubs.ts@@ -112,6 +112,9 @@ export function buildStubApi(): Omit<| 'dialog'| 'onAgentStatus'| 'onSubagentActivity'+ // Real over the bridge (IPC.appUserDataDir): the worktree dialog's default path is derived from+ // it, and a '' stub would propose `/worktrees/…` at the filesystem root.+ | 'userDataDir'> {const api = {ssh: {@@ -272,7 +275,6 @@ export function buildStubApi(): Omit<closeWindow: noop,setBadgeCount: noop,getPathForFile: (): string => '',- userDataDir: (): Promise<string> => Promise.resolve(''),notify: async (payload: NotifyPayload): Promise<'shown' | 'failed' | 'skipped'> => {if (typeof Notification !== 'undefined' && Notification.permission === 'granted') {try {@@ -300,6 +302,7 @@ export function buildStubApi(): Omit<| 'dialog'| 'onAgentStatus'| 'onSubagentActivity'+ | 'userDataDir'>return apidiff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.tsindex bf341f4bd..5621ae9b3 100644--- a/src/renderer/bridge/ws-bridge.ts+++ b/src/renderer/bridge/ws-bridge.ts@@ -154,9 +154,11 @@ const AI_NAMING_UNAVAILABLE = {message: 'AI naming is not available in the server edition yet'}-/** Build the three real namespaces (`pty`, `workspace`, `settings`) over an RpcClient, mirroring- * the preload's invoke(→request)/send(→cast) split exactly. */-function buildRealApi(client: RpcClient): Pick<NodeTerminalApi, 'pty' | 'workspace' | 'settings'> {+/** Build the real `pty` / `workspace` / `settings` namespaces (plus the top-level `userDataDir`)+ * over an RpcClient, mirroring the preload's invoke(→request)/send(→cast) split exactly. */+function buildRealApi(+ client: RpcClient+): Pick<NodeTerminalApi, 'pty' | 'workspace' | 'settings' | 'userDataDir'> {const pty: PtyApi = {create: (options: PtyCreateOptions) =>client.request(IPC.ptyCreate, options) as ReturnType<PtyApi['create']>,@@ -199,7 +201,12 @@ function buildRealApi(client: RpcClient): Pick<NodeTerminalApi, 'pty' | 'workspasave: (s: Settings) => client.request(IPC.settingsSave, s) as Promise<void>}- return { pty, workspace, settings }+ // The server's data dir, over the SAME channel the desktop preload uses. It is the writable base+ // the worktree dialog derives its default path from — a stub returning '' would suggest+ // `/worktrees/…` at the filesystem root (the server usually runs as root, and git would create it).+ const userDataDir = (): Promise<string> => client.request(IPC.appUserDataDir) as Promise<string>++ return { pty, workspace, settings, userDataDir }}/**diff --git a/src/server/handlers/index.test.ts b/src/server/handlers/index.test.tsindex 2ecb6748d..54e5b896c 100644--- a/src/server/handlers/index.test.ts+++ b/src/server/handlers/index.test.ts@@ -56,4 +56,9 @@ describe('registerCoreHandlers (git)', () => {it('fs handlers are registered too (delegated)', async () => {expect(await call(IPC.fsRead, path.join(repo, 'a.txt'))).toBe('two\n')})+ it("app:user-data-dir answers the server's real data dir (never '')", async () => {+ // The worktree dialog derives its default path from this: an empty answer would suggest+ // `/worktrees/…` at the filesystem ROOT, which the (often root-run) server would create.+ expect(await call(IPC.appUserDataDir)).toBe(repo)+ })})diff --git a/src/server/handlers/index.ts b/src/server/handlers/index.tsindex 56753ef6d..a40b8ac1e 100644--- a/src/server/handlers/index.ts+++ b/src/server/handlers/index.ts@@ -26,6 +26,11 @@ export function registerCoreHandlers(// Local server has no SSH projects; keep git running against the local remote.platform.handle(IPC.gitSetActiveRemote, () => null)+ // Desktop: ipcMain.handle(IPC.appUserDataDir, () => app.getPath('userData')).+ // The browser needs the REAL data dir: it is the writable base the worktree dialog derives its+ // default path from, and an empty answer there proposes `/worktrees/…` at the filesystem root.+ platform.handle(IPC.appUserDataDir, () => platform.userDataDir)+// The browser needs the same `--permission-mode auto` version gate as desktop: the server's own// claude CLI is the one that will run the terminal nodes. Warm it so the first call is cached.registerClaudeCliIpc()