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
feat(project-settings): projectSettings IPC namespace across both shells
enes259f1c04e2bc
diff --git a/src/core/workspace-store.settings.test.ts b/src/core/workspace-store.settings.test.tsindex b595fd15f..34dc25482 100644--- a/src/core/workspace-store.settings.test.ts+++ b/src/core/workspace-store.settings.test.ts@@ -356,3 +356,19 @@ describe('project settings — ssh leg', () => {expect(s?.shared?.setup?.setupScript).toBe('no-io')})})++describe('project settings IPC registration', () => {+ it('registers the three channels and round-trips through platform handlers', async () => {+ // fakePlatform's `handle` already records into `fake.handlers` (a plain object keyed by+ // channel) — no monkey-patching needed, just read handlers back off it.+ const store = new WorkspaceStore()+ store.registerIpc()+ await store.save(ws([project({ cwd: projRoot })]))+ const handlers = fake.handlers+ expect(await handlers['project-settings:write-shared']('p1', { terminal: { shell: '/bin/zsh' } })).toBe(true)+ const snap = (await handlers['project-settings:read']('p1')) as { shared: { terminal?: { shell?: string } } | null }+ expect(snap.shared?.terminal?.shell).toBe('/bin/zsh')+ expect(await handlers['project-settings:update-local']('p1', { ignoreShared: { setup: true } })).toBe(true)+ expect(await handlers['project-settings:read']('nope')).toBeNull()+ })+})diff --git a/src/core/workspace-store.ts b/src/core/workspace-store.tsindex da1cfc1be..7b411167a 100644--- a/src/core/workspace-store.ts+++ b/src/core/workspace-store.ts@@ -16,7 +16,8 @@ import { readProjectSettingsFile, writeProjectSettingsFile } from './project-setimport {parseProjectSettingsFile, sameProjectSettingsContent, sanitizeProjectLocalSettings,sanitizeProjectSettingsDoc, serializeProjectSettingsFile,- type ProjectLocalSettings, type ProjectSettingsDoc, type ProjectSettingsFileV1+ type ProjectLocalSettings, type ProjectSettingsDoc, type ProjectSettingsFileV1,+ type ProjectSettingsSnapshot} from '../shared/project-settings'import { readProjectCapabilities, type ProjectCapability } from '../shared/project-capabilities'import type { CapabilityAckMap } from './project-capability-consent'@@ -41,17 +42,10 @@ export interface RemoteWorkspaceIO {const projectFilePath = (cwd: string): string => path.join(cwd, PROJECT_DIR, PROJECT_FILE)-/** What one project's settings look like right now: the git-shared document (null when there is- * none, or it cannot be trusted/read) plus this machine's own overlay. `resolveProjectSettings`- * turns the pair into effective values; this type only reports what each side says. */-export interface ProjectSettingsState {- shared: ProjectSettingsFileV1 | null- local: ProjectLocalSettings | undefined- /** The shared file exists but is git-conflict-marked, so it is left untouched for the user to- * resolve. `shared` is null for a local ref; for an ssh project the last-known-good offline cache- * is still served alongside the flag (it is the only readable copy of that document). */- conflict?: true-}+/** Alias of the shared `ProjectSettingsSnapshot` (moved to `shared/project-settings.ts` so the+ * renderer's `ProjectSettingsApi` can name the shape without importing core) — the store's+ * methods keep this name in their signatures. */+export type ProjectSettingsState = ProjectSettingsSnapshot/** A parsed project file together with the exact bytes it was parsed from. `lastWritten` must* record `raw` — see the field it caches. */@@ -184,6 +178,13 @@ export class WorkspaceStore {platform().handle(IPC.workspaceLoad, () => this.load())platform().handle(IPC.workspaceSave, (workspace: Workspace) => this.save(workspace))platform().handle(IPC.workspaceProbeFolder, (folder: string) => this.probeFolder(folder))+ platform().handle(IPC.projectSettingsRead, (projectId: unknown) =>+ typeof projectId === 'string' ? this.readProjectSettings(projectId) : null)+ platform().handle(IPC.projectSettingsWriteShared, (projectId: unknown, doc: ProjectSettingsDoc) =>+ typeof projectId === 'string' ? this.writeProjectSettings(projectId, doc) : false)+ platform().handle(IPC.projectSettingsUpdateLocal,+ (projectId: unknown, local: ProjectLocalSettings | undefined) =>+ typeof projectId === 'string' ? this.updateLocalProjectSettings(projectId, local) : false)}/**@@ -655,11 +656,13 @@ export class WorkspaceStore {** False = there is nowhere to write it, or writing would destroy something. On BOTH legs: an* unknown id, an inline canvas (no folder), and a git-conflicted shared file — the user's to- * resolve, left untouched (the local leg sees it in the read-before-write, the ssh leg remembers- * it from the last read, since looking again would cost a round trip per keystroke). Local leg- * only: an unreadable file (a failed read is never evidence of absence, so it may not be- * clobbered either) or a failed write. SSH leg only: an index write that did not persist —- * a failed REMOTE write is not false there, because the cache already holds the edit.+ * resolve, left untouched (the local leg sees it in the read-before-write; the ssh leg sees it+ * WARM from a cache or last-read doc this run already has, or — COLD, when neither map knows this+ * project yet — from the one read `writeSshSettings` does itself before its first write, per its+ * own docstring above). Local leg only: an unreadable file (a failed read is never evidence of+ * absence, so it may not be clobbered either) or a failed write. SSH leg only: an index write that+ * did not persist — a failed REMOTE write is not false there, because the cache already holds+ * the edit.*/async writeProjectSettings(projectId: string, doc: ProjectSettingsDoc): Promise<boolean> {const e = this.index?.entries.find((x) => x.id === projectId)diff --git a/src/preload/index.ts b/src/preload/index.tsindex 45e1fdf5c..73cce0a7f 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -137,6 +137,13 @@ const api: NodeTerminalApi = {return () => ipcRenderer.removeListener(IPC.workspaceExternalChange, h)}},+ projectSettings: {+ read: (projectId: string) => ipcRenderer.invoke(IPC.projectSettingsRead, projectId),+ writeShared: (projectId: string, doc) =>+ ipcRenderer.invoke(IPC.projectSettingsWriteShared, projectId, doc),+ updateLocal: (projectId: string, local) =>+ ipcRenderer.invoke(IPC.projectSettingsUpdateLocal, projectId, local)+ },dialog: {selectFolder: () => ipcRenderer.invoke(IPC.dialogSelectFolder),selectFile: () => ipcRenderer.invoke(IPC.dialogSelectFile)diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.tsindex 6188df37a..367bb1299 100644--- a/src/renderer/bridge/stubs.ts+++ b/src/renderer/bridge/stubs.ts@@ -294,6 +294,15 @@ export function buildStubApi(): Omit<saveGatewayCredential: U('agent.saveGatewayCredential'),clearGatewayCredential: U('agent.clearGatewayCredential')},+ projectSettings: {+ // Overridden by the real WS-backed namespace in ws-bridge (same registerIpc() call as+ // `workspace`); this fallback only matters if some future assembly spreads the stub alone.+ // Fail-closed rather than reject: an unknown/unreachable project reads as "no settings" and+ // a write/update as "did not happen", matching the real handlers' contract for an unknown id.+ read: () => Promise.resolve(null),+ writeShared: () => Promise.resolve(false),+ updateLocal: () => Promise.resolve(false)+ },chat: {readTranscript: U('chat.readTranscript')},diff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.tsindex 1762f6079..120fcda95 100644--- a/src/renderer/bridge/ws-bridge.ts+++ b/src/renderer/bridge/ws-bridge.ts@@ -204,11 +204,12 @@ const AI_NAMING_UNAVAILABLE = {message: 'AI naming is not available in the server edition yet'}-/** 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. */+/** Build the real `pty` / `workspace` / `projectSettings` / `settings` namespaces (plus the+ * top-level `userDataDir`) over an RpcClient, mirroring the preload's+ * invoke(→request)/send(→cast) split exactly. */export function buildRealApi(client: RpcClient-): Pick<NodeTerminalApi, 'pty' | 'workspace' | 'settings' | 'agent' | 'userDataDir'> {+): Pick<NodeTerminalApi, 'pty' | 'workspace' | 'projectSettings' | 'settings' | 'agent' | 'userDataDir'> {const pty: PtyApi = {create: (options: PtyCreateOptions) =>client.request(IPC.ptyCreate, options) as ReturnType<PtyApi['create']>,@@ -287,6 +288,19 @@ export function buildRealApi(onExternalChange: () => () => {}}+ // REAL: WorkspaceStore (core) registers the project-settings:* channels too — same+ // registerIpc() call as workspace above — so the server serves this on both shells.+ const projectSettings: NodeTerminalApi['projectSettings'] = {+ read: (projectId) =>+ client.request(IPC.projectSettingsRead, projectId) as ReturnType<+ NodeTerminalApi['projectSettings']['read']+ >,+ writeShared: (projectId, doc) =>+ client.request(IPC.projectSettingsWriteShared, projectId, doc) as Promise<boolean>,+ updateLocal: (projectId, local) =>+ client.request(IPC.projectSettingsUpdateLocal, projectId, local) as Promise<boolean>+ }+const settings: SettingsApi = {load: () => client.request(IPC.settingsLoad) as Promise<Settings>,save: (s: Settings) => client.request(IPC.settingsSave, s) as Promise<void>@@ -321,7 +335,7 @@ export function buildRealApi(// `/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, agent, userDataDir }+ return { pty, workspace, projectSettings, settings, agent, userDataDir }}export function buildGitHubApi(diff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex b815d7bf1..37ef09d09 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -238,6 +238,9 @@ export const IPC = {workspaceLoad: 'workspace:load',workspaceSave: 'workspace:save',workspaceProbeFolder: 'workspace:probe-folder',+ projectSettingsRead: 'project-settings:read',+ projectSettingsWriteShared: 'project-settings:write-shared',+ projectSettingsUpdateLocal: 'project-settings:update-local',// main → renderer eventsworkspaceMigrated: 'workspace:migrated',/** Payload: the `workspace.json.corrupt-<ts>` filename the unreadable index was preserved as. */diff --git a/src/shared/project-settings.ts b/src/shared/project-settings.tsindex 05e1fae2f..d66e43971 100644--- a/src/shared/project-settings.ts+++ b/src/shared/project-settings.ts@@ -67,6 +67,19 @@ export type ProjectSettingsParse =| { status: 'invalid' }| { status: 'conflict' }+/** What one project's settings look like right now: the git-shared document (null when there is+ * none, or it cannot be trusted/read) plus this machine's own overlay. `resolveProjectSettings`+ * turns the pair into effective values; this type only reports what each side says. Shared here+ * (not core) so the renderer's `ProjectSettingsApi` can name it without importing core. */+export interface ProjectSettingsSnapshot {+ shared: ProjectSettingsFileV1 | null+ local: ProjectLocalSettings | undefined+ /** The shared file exists but is git-conflict-marked, so it is left untouched for the user to+ * resolve. `shared` is null for a local ref; for an ssh project the last-known-good offline cache+ * is still served alongside the flag (it is the only readable copy of that document). */+ conflict?: true+}+const STRING_CAP = 1024const BIG_STRING_CAP = 64000const LAUNCH_CMD_CAP = 4096diff --git a/src/shared/types.ts b/src/shared/types.tsindex b3ca27dee..dac640707 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -755,6 +755,19 @@ export interface WorkspaceApi {onExternalChange(cb: (project: Project) => void): () => void}+export interface ProjectSettingsApi {+ /** `{shared, local, conflict?}` for a known project id, or null for an unknown one. */+ read(projectId: string): Promise<import('./project-settings').ProjectSettingsSnapshot | null>+ /** Whole-document write of the git-shared `.nodeterm/settings.json`. See+ * `WorkspaceStore.writeProjectSettings` for the false-vs-true contract. */+ writeShared(projectId: string, doc: import('./project-settings').ProjectSettingsDoc): Promise<boolean>+ /** This machine's own overlay; `local: undefined` clears it. */+ updateLocal(+ projectId: string,+ local: import('./project-settings').ProjectLocalSettings | undefined+ ): Promise<boolean>+}+export interface DialogApi {/** Opens a native folder picker; returns the chosen path or null if cancelled. */selectFolder(): Promise<string | null>@@ -2464,6 +2477,7 @@ export interface PresenceApi {export interface NodeTerminalApi {pty: PtyApiworkspace: WorkspaceApi+ projectSettings: ProjectSettingsApidialog: DialogApisettings: SettingsApispeech: SpeechApi