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.

fix(whiteboards): a folder project kept in app data keeps its boards in its app-data root

reviewb4baabed7dc9
diff --git a/src/core/fs-handlers.ts b/src/core/fs-handlers.ts
index 04c324ff3..ff45213d2 100644
--- a/src/core/fs-handlers.ts
+++ b/src/core/fs-handlers.ts
@@ -4,7 +4,7 @@ import type { CorePlatform } from './platform'
import * as fsOps from './fs-ops'
import { saveUpload } from './uploads'
import { saveCanvasImage } from './canvas-images'
-import { readWhiteboard, saveWhiteboard } from './whiteboards'
+import { readWhiteboard, saveWhiteboard, type WhiteboardLocation } from './whiteboards'
import { clearAlertSound, readAlertSound, saveAlertSound } from './alert-sounds'
import type { AlertSoundKind } from '../shared/alert-sound'
import { IPC } from '../shared/ipc'
@@ -51,9 +51,21 @@ export function registerFsHandlers(
* the durable app-local fallback, which is a coherent degrade, not a failure.
*/
localProjectCwd?: (projectId: string) => string | undefined
+ /**
+ * Where a project's whiteboards go (`WorkspaceStore.whiteboardLocationForProject`), derived the
+ * same way from this shell's own index. Not `localProjectCwd`: a folder project kept in app data
+ * keeps its boards in its own app-data root rather than in the app's shared folder, where two
+ * projects holding the same committed canvas — the same node ids — would share boards. Absent ⇒
+ * `localProjectCwd`'s folder.
+ */
+ whiteboardLocation?: (projectId: string) => Omit<WhiteboardLocation, 'userDataDir'>
} = {}
): void {
const home = expandHomePath
+ const boardLocation = (projectId: string): WhiteboardLocation => ({
+ ...(deps.whiteboardLocation ? deps.whiteboardLocation(projectId) : { projectCwd: deps.localProjectCwd?.(projectId) }),
+ userDataDir: platform.userDataDir
+ })
platform.handle(IPC.fsList, (dirPath: string) => fsOps.listDir(home(dirPath)))
platform.handle(IPC.fsRead, (filePath: string) => fsOps.readText(home(filePath)))
platform.handle(IPC.fsReadBinary, (filePath: string) => fsOps.readBinary(home(filePath)))
@@ -80,30 +92,19 @@ export function registerFsHandlers(
dataBase64
})
)
- // A whiteboard's scene + picture: beside project.json when the project has a local cwd, else in
- // this core's data dir. Addressed by node id only — see core/whiteboards.ts for why a path is
- // never accepted.
+ // A whiteboard's scene + picture: beside project.json when the project has a local cwd (in its
+ // app-data root when its canvas is kept there), else in this core's data dir. Addressed by node id
+ // only — see core/whiteboards.ts for why a path is never accepted.
// `expectedRev` is the compare-and-set revision (see `saveWhiteboard`): a stale one is refused.
platform.handle(
IPC.filesSaveWhiteboard,
(projectId: string, nodeId: string, scene: string, thumbnailBase64?: string, expectedRev?: string | null) =>
- saveWhiteboard(
- { projectCwd: deps.localProjectCwd?.(projectId), userDataDir: platform.userDataDir },
- nodeId,
- scene,
- thumbnailBase64,
- expectedRev
- )
+ saveWhiteboard(boardLocation(projectId), nodeId, scene, thumbnailBase64, expectedRev)
)
platform.handle(
IPC.filesReadWhiteboard,
(projectId: string, nodeId: string, sourceId?: string, withScene?: boolean) =>
- readWhiteboard(
- { projectCwd: deps.localProjectCwd?.(projectId), userDataDir: platform.userDataDir },
- nodeId,
- sourceId,
- withScene !== false
- )
+ readWhiteboard(boardLocation(projectId), nodeId, sourceId, withScene !== false)
)
// Custom alert sounds (issue #289): bytes in, a FIXED per-kind file under this core's data dir
// out. Reads and deletes take only a kind, so no caller can aim them at another file. See
diff --git a/src/core/whiteboards.test.ts b/src/core/whiteboards.test.ts
index 3aee50601..fb77f8cc1 100644
--- a/src/core/whiteboards.test.ts
+++ b/src/core/whiteboards.test.ts
@@ -252,3 +252,56 @@ describe('compare-and-set: a save made against a stale revision is refused', ()
expect(await onDisk()).toBe(sceneOf('two'))
})
})
+
+// A folder project can keep its canvas in app data (issue #1145) so that nothing is written into
+// the folder. Its boards then live in the project's own app-data root (`appDataProjectRoot` in
+// workspace-store.ts), and the folder's boards — drawn before the move — are only ever READ.
+describe('a folder project kept in app data', () => {
+ let appRoot: string
+ beforeEach(() => {
+ appRoot = join(userDataDir, 'project-files', 'project-p1')
+ })
+
+ it("writes into the project's app-data root, creating it, and nothing into the folder", async () => {
+ const loc = { projectCwd: appRoot, createRoot: true, readOnlyRoot: projectCwd, userDataDir }
+ const saved = await saveWhiteboard(loc, 'whiteboard-1', scene, png)
+ expect(pathOf(saved)).toBe(join(projectWhiteboardsDir(appRoot), 'whiteboard-1.excalidraw'))
+ expect(await fs.readdir(projectCwd)).toEqual([])
+ expect((await readWhiteboard(loc, 'whiteboard-1'))?.scene).toBe(scene)
+ })
+
+ it('a board drawn in the folder before the move still opens, and its next save lands in app data', async () => {
+ await saveWhiteboard({ projectCwd, userDataDir }, 'whiteboard-1', scene, png)
+ const loc = { projectCwd: appRoot, createRoot: true, readOnlyRoot: projectCwd, userDataDir }
+
+ const before = await readWhiteboard(loc, 'whiteboard-1')
+ expect(before).toMatchObject({ scene, fromSource: false })
+ const edited = JSON.stringify({ type: 'excalidraw', elements: [{ id: 'b' }] })
+ // Saved against the folder file's revision: the compare-and-set sees the same board the read did.
+ expect(await saveWhiteboard(loc, 'whiteboard-1', edited, png, before!.rev)).toMatchObject({ ok: true })
+
+ expect((await readWhiteboard(loc, 'whiteboard-1'))?.scene).toBe(edited)
+ expect(await fs.readFile(join(projectWhiteboardsDir(projectCwd), 'whiteboard-1.excalidraw'), 'utf8')).toBe(scene)
+ })
+
+ it('never writes into the read-only root, even when the app-data root will not take the board', async () => {
+ await fs.mkdir(userDataDir, { recursive: true })
+ await fs.writeFile(join(userDataDir, 'project-files'), 'not a directory')
+ const loc = { projectCwd: appRoot, createRoot: true, readOnlyRoot: projectCwd, userDataDir }
+ const saved = await saveWhiteboard(loc, 'whiteboard-1', scene)
+ expect(pathOf(saved)).toBe(join(appWhiteboardsDir(userDataDir), 'whiteboard-1.excalidraw'))
+ expect(await fs.readdir(projectCwd)).toEqual([])
+ })
+
+ it('reads every place a save can land before the read-only root, so a save is never shadowed', async () => {
+ // The folder still holds the board as it was before the move…
+ await saveWhiteboard({ projectCwd, userDataDir }, 'whiteboard-1', scene)
+ // …and the app-data root cannot take the edit, so it falls back to the app folder.
+ await fs.mkdir(userDataDir, { recursive: true })
+ await fs.writeFile(join(userDataDir, 'project-files'), 'not a directory')
+ const loc = { projectCwd: appRoot, createRoot: true, readOnlyRoot: projectCwd, userDataDir }
+ const edited = JSON.stringify({ type: 'excalidraw', elements: [{ id: 'b' }] })
+ await saveWhiteboard(loc, 'whiteboard-1', edited)
+ expect((await readWhiteboard(loc, 'whiteboard-1'))?.scene).toBe(edited)
+ })
+})
diff --git a/src/core/whiteboards.ts b/src/core/whiteboards.ts
index cfef00823..dcb4f4edf 100644
--- a/src/core/whiteboards.ts
+++ b/src/core/whiteboards.ts
@@ -11,6 +11,11 @@
// the remote host) or a project folder that has been deleted — the same cases, for the same
// reasons, as `canvasImageTarget` in canvas-images.ts.
//
+// A folder project whose canvas is kept in app data (issue #1145) writes nothing into its folder:
+// its boards go to the same layout under its own app-data root (`appDataProjectRoot` in
+// workspace-store.ts), and the folder's boards — drawn before the move — are only read. See
+// `WhiteboardLocation`.
+//
// **The path is derived HERE from (project, node id), never accepted from the renderer.** A
// node's data comes from the git-shared project.json, which anyone with commit access can edit;
// taking a path from it would let a crafted canvas aim a read or an overwrite anywhere this
@@ -48,7 +53,20 @@ export const WHITEBOARD_SCENE_MAX_BYTES = 64 * 1024 * 1024
export const WHITEBOARD_THUMB_MAX_BYTES = 16 * 1024 * 1024
export interface WhiteboardLocation {
+ /** The directory whose `.nodeterm/whiteboards/` takes this project's boards. */
projectCwd?: string
+ /**
+ * `projectCwd` is the app's own directory — a folder project kept in app data, whose root is
+ * `appDataProjectRoot` — so a write creates it. Never set for a user's folder: one that is gone
+ * is not resurrected.
+ */
+ createRoot?: boolean
+ /**
+ * A root that is READ and never written: the other side of a folder project that moved its canvas
+ * between its folder and app data (issue #1145), so a board drawn before the move still opens.
+ * Read after every folder a save can land in, so a board saved since is never shadowed by it.
+ */
+ readOnlyRoot?: string
userDataDir: string
}
@@ -83,7 +101,8 @@ const within = (root: string, child: string): boolean => {
* `.nodeterm` that links out of the project would make `whiteboards` on the other side. A project
* folder that is GONE is refused too, so a write never resurrects a directory the user deleted.
*/
-async function projectBoardsDir(projectCwd: string, create: boolean): Promise<string | null> {
+async function projectBoardsDir(projectCwd: string, create: boolean, createRoot = false): Promise<string | null> {
+ if (create && createRoot) await fs.mkdir(projectCwd, { recursive: true }).catch(() => undefined)
const root = await fs.realpath(projectCwd).catch(() => null)
if (!root || !(await fs.stat(root).then((s) => s.isDirectory(), () => false))) return null
const boards = join(root, '.nodeterm', 'whiteboards')
@@ -109,14 +128,19 @@ async function projectBoardsDir(projectCwd: string, create: boolean): Promise<st
/** The folders a board may be in, most specific first. `write` creates the project's folder; a read
* only looks in one that exists. A project folder that cannot be used (see `projectBoardsDir`) is
- * left out, so the board lands in — or is read from — the app folder alone. */
+ * left out, so the board lands in — or is read from — the app folder alone. The read-only root is
+ * never a write target, and a read reaches it last. */
async function candidateDirs(loc: WhiteboardLocation, write: boolean): Promise<string[]> {
const dirs: string[] = []
if (loc.projectCwd) {
- const dir = await projectBoardsDir(loc.projectCwd, write).catch(() => null)
+ const dir = await projectBoardsDir(loc.projectCwd, write, loc.createRoot === true).catch(() => null)
if (dir) dirs.push(dir)
}
dirs.push(appWhiteboardsDir(loc.userDataDir))
+ if (!write && loc.readOnlyRoot) {
+ const dir = await projectBoardsDir(loc.readOnlyRoot, false).catch(() => null)
+ if (dir && !dirs.includes(dir)) dirs.push(dir)
+ }
return dirs
}
diff --git a/src/core/workspace-store.folder-data.test.ts b/src/core/workspace-store.folder-data.test.ts
index 9aa7d8d89..7a979e1c7 100644
--- a/src/core/workspace-store.folder-data.test.ts
+++ b/src/core/workspace-store.folder-data.test.ts
@@ -12,6 +12,7 @@ import path from 'path'
import { initPlatform, resetPlatformForTests } from './platform'
import { fakePlatform } from './platform-fake'
import { WorkspaceStore } from './workspace-store'
+import { readWhiteboard, saveWhiteboard } from './whiteboards'
import type { CanvasNodeState, Project, Workspace } from '../shared/types'
let userData: string
@@ -170,6 +171,48 @@ describe('its side files', () => {
expect(store.boardLogRootForProject('project-ref')).toBe(folder + '-b')
await fs.rm(folder + '-b', { recursive: true, force: true })
})
+
+ it("whiteboards live in its app-data root, never in the folder, and are not shared by node id", async () => {
+ // Two folders holding the same committed canvas (a worktree, a second checkout) share node ids.
+ // In their folders each board has its own file; in app data they must not share one either.
+ const store = new WorkspaceStore()
+ await store.save(ws([project(), project({ id: 'project-p2', cwd: folder + '-b' })]))
+ const board = (id: string) => ({ ...store.whiteboardLocationForProject(id), userDataDir: userData })
+ const scene = JSON.stringify({ type: 'excalidraw', elements: [{ id: 'mine' }] })
+
+ const saved = await saveWhiteboard(board('project-p1'), 'whiteboard-1', scene)
+ expect(saved).toMatchObject({
+ ok: true,
+ path: path.join(userData, 'project-files', 'project-p1', '.nodeterm', 'whiteboards', 'whiteboard-1.excalidraw')
+ })
+ expect(await fs.readdir(folder)).toEqual([])
+ expect(await readWhiteboard(board('project-p2'), 'whiteboard-1')).toBeNull()
+
+ // Deleting the project takes its boards with its other app-data side files.
+ await store.save(ws([project({ id: 'project-p2', cwd: folder + '-b' })]))
+ expect(await readWhiteboard(board('project-p1'), 'whiteboard-1')).toBeNull()
+ await fs.rm(folder + '-b', { recursive: true, force: true })
+ })
+
+ it('whiteboard locations: a folder ref writes its folder; a cwd-less canvas has none', async () => {
+ const store = new WorkspaceStore()
+ await store.save(ws([
+ project({ id: 'project-ref', storeInAppData: undefined }),
+ project({ id: 'project-inline', storeInAppData: undefined, cwd: undefined })
+ ]))
+ // A folder ref writes its folder and reads, after it, what it drew while it was in app data.
+ expect(store.whiteboardLocationForProject('project-ref')).toEqual({
+ projectCwd: folder, readOnlyRoot: path.join(userData, 'project-files', 'project-ref')
+ })
+ // A cwd-less canvas (and an unknown id) takes the app folder alone.
+ expect(store.whiteboardLocationForProject('project-inline')).toEqual({})
+ expect(store.whiteboardLocationForProject('no-such-project')).toEqual({})
+ // A folder project in app data writes its app-data root and only reads its folder.
+ await store.save(ws([project({ id: 'project-ref' })]))
+ expect(store.whiteboardLocationForProject('project-ref')).toEqual({
+ projectCwd: path.join(userData, 'project-files', 'project-ref'), createRoot: true, readOnlyRoot: folder
+ })
+ })
})
describe('the phone writers', () => {
diff --git a/src/core/workspace-store.ts b/src/core/workspace-store.ts
index db8ffaf22..f02e1c698 100644
--- a/src/core/workspace-store.ts
+++ b/src/core/workspace-store.ts
@@ -23,6 +23,7 @@ import {
} from './workspace-files'
import { projectSettingsPath, readProjectSettingsFile, writeProjectSettingsFile } from './project-settings-files'
import { gitTracksFile } from './git-tracked'
+import type { WhiteboardLocation } from './whiteboards'
import type { PrepareFolderStorageResult, ProjectStorageKind, ReleaseFolderFilesResult } from '../shared/project-storage'
import {
parseProjectSettingsFile, sameProjectSettingsContent, sanitizeProjectLocalSettings,
@@ -2236,6 +2237,27 @@ export class WorkspaceStore {
return e ? folderFileCwd(e) : undefined
}
+ /**
+ * Where a project's whiteboards live (core/whiteboards.ts), without the app folder every location
+ * falls back to. A folder ref writes `<cwd>/.nodeterm/whiteboards/` and reads, after it, what it
+ * drew while its canvas was kept in app data. A folder-data-ref writes the same layout under its
+ * app-data root and only READS its folder, where the boards drawn before the move still are
+ * (issue #1145: nothing is written into the folder). Not the canvas images' answer
+ * (`sideFilesFolderForProject`): the app's shared image folder is keyed by file name, while a board
+ * is keyed by node id, which two folders holding the same committed canvas share — in one shared
+ * folder, two such projects in app data would read and overwrite each other's boards. SSH and
+ * cwd-less projects answer `{}`: the app folder alone.
+ */
+ whiteboardLocationForProject(projectId: string): Omit<WhiteboardLocation, 'userDataDir'> {
+ const e = this.index?.entries.find((x) => x.id === projectId)
+ if (!e || e.ssh) return {}
+ const appData = isInlineProjectFileId(e.id) ? appDataProjectRoot(e.id) : undefined
+ if (isFolderDataRef(e)) return appData ? { projectCwd: appData, createRoot: true, readOnlyRoot: e.cwd } : {}
+ const cwd = folderFileCwd(e)
+ if (!cwd) return {}
+ return appData ? { projectCwd: cwd, readOnlyRoot: appData } : { projectCwd: cwd }
+ }
+
/**
* The root a project's board log lives under (`<root>/.nodeterm/board-log.jsonl`), or undefined
* when it has none (ssh — routed separately — and cwd-less canvases). A folder ref's is its
diff --git a/src/main/index.ts b/src/main/index.ts
index 3ea7eeec9..74389b509 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -2117,8 +2117,11 @@ app.whenReady().then(async () => {
// `localProjectCwd` is how a canvas image finds the project's own `.nodeterm/images/`. It
// answers undefined for an SSH project (its cwd is on the host, and the image node reads
// locally) and for a relay tab (not in this index at all) — both take the app-local fallback.
+ // `whiteboardLocation` is the same idea for a whiteboard, except that a folder project kept in app
+ // data keeps its boards in its own app-data root (see `whiteboardLocationForProject`).
registerFsHandlers(corePlatform, {
- localProjectCwd: (projectId: string) => workspaceStore.sideFilesFolderForProject(projectId)
+ localProjectCwd: (projectId: string) => workspaceStore.sideFilesFolderForProject(projectId),
+ whiteboardLocation: (projectId: string) => workspaceStore.whiteboardLocationForProject(projectId)
})
const githubSecret = new ElectronGitHubSecretStore(app.getPath('userData'), safeStorage)
diff --git a/src/main/whiteboard-location-wiring.test.ts b/src/main/whiteboard-location-wiring.test.ts
new file mode 100644
index 000000000..f6755871e
--- /dev/null
+++ b/src/main/whiteboard-location-wiring.test.ts
@@ -0,0 +1,23 @@
+// Where a whiteboard is written is decided by a dep each shell wires into `registerFsHandlers`
+// (`whiteboardLocation`). It is optional in core — without it a board falls back to
+// `localProjectCwd` — so dropping one shell's wire compiles, passes every unit test, and silently
+// sends a folder project kept in app data (issue #1145) to the app's shared board folder on that
+// shell, where two projects holding the same committed canvas share boards by node id. Pinned at
+// source level in BOTH shells, the remedy this repo uses for that class of hole
+// (relay-attach-wiring.test.ts).
+import { describe, expect, it } from 'vitest'
+import fs from 'node:fs'
+import path from 'node:path'
+
+const read = (rel: string): string => fs.readFileSync(path.join(__dirname, '..', rel), 'utf8').replace(/\r\n/g, '\n')
+const WIRE = /whiteboardLocation: \(projectId: string\) => workspaceStore\.whiteboardLocationForProject\(projectId\)/
+
+describe('the whiteboard location is wired in both shells', () => {
+ it('the desktop', () => {
+ expect(read('main/index.ts')).toMatch(WIRE)
+ })
+ it('the Server Edition, and its handler registrar forwards it', () => {
+ expect(read('server/index.ts')).toMatch(WIRE)
+ expect(read('server/handlers/index.ts')).toMatch(/whiteboardLocation: deps\.whiteboardLocation/)
+ })
+})
diff --git a/src/renderer/lib/projectCloseSessions.test.ts b/src/renderer/lib/projectCloseSessions.test.ts
index a3a068170..8ceb1d397 100644
--- a/src/renderer/lib/projectCloseSessions.test.ts
+++ b/src/renderer/lib/projectCloseSessions.test.ts
@@ -88,7 +88,7 @@ describe('deleteConfirmCopy', () => {
it('a project stored in app data: says the canvas goes with it (#1145)', () => {
const c = deleteConfirmCopy({ ...project({ nodes: [{ id: 't1' }] }), storeInAppData: true })
- expect(c.message).toContain('the canvas, its project settings and its board log are: they were stored in app data')
+ expect(c.message).toContain('not deleted, but the canvas, project settings, board log and whiteboards it kept in app data are.')
expect(c.message).not.toContain('.nodeterm/project.json')
})
diff --git a/src/renderer/lib/projectCloseSessions.ts b/src/renderer/lib/projectCloseSessions.ts
index da6a5b141..4ffd19aac 100644
--- a/src/renderer/lib/projectCloseSessions.ts
+++ b/src/renderer/lib/projectCloseSessions.ts
@@ -117,7 +117,7 @@ export function deleteConfirmCopy(project: ProjectLike): DeleteConfirmCopy {
// A project stored in app data (#1145) has no copy in its folder: removing it deletes the canvas
// and its app-data side files (WorkspaceStore's data-file sweep).
const tail = project.storeInAppData && !project.ssh
- ? `The folder ${where} is not deleted, but the canvas, its project settings and its board log are: they were stored in app data, not in the folder.`
+ ? `The folder ${where} is not deleted, but the canvas, project settings, board log and whiteboards it kept in app data are.`
: `The folder ${where} (including .nodeterm/project.json) is not deleted.`
return {
message: `Delete “${name}”? This ${sessions}removes the project from nodeterm. ${tail}`,
diff --git a/src/server/handlers/index.test.ts b/src/server/handlers/index.test.ts
index 5fe257d9d..1804aef17 100644
--- a/src/server/handlers/index.test.ts
+++ b/src/server/handlers/index.test.ts
@@ -11,6 +11,7 @@ import { DEFAULT_SETTINGS, type GitStatus } from '../../shared/types'
import { initPlatform, resetPlatformForTests } from '../../core/platform'
import { DownloadTickets } from '../../core/download-tickets'
import { projectImagesDir } from '../../core/canvas-images'
+import { projectWhiteboardsDir } from '../../core/whiteboards'
// The per-account hook writers are exercised by src/core/claude-accounts-service.test.ts. Observe
// them here instead of running them: the real installer writes into the USER's `~/.nodeterm`, and
@@ -100,6 +101,30 @@ describe('registerCoreHandlers (canvas images)', () => {
})
expect((res as { result: string }).result).toBe(path.join(projectImagesDir(repo), 'shot.png'))
})
+
+ it('forwards whiteboardLocation, so a board lands where the SHELL resolved it', async () => {
+ // A folder project kept in app data answers its app-data root here and no folder from
+ // `localProjectCwd`; a missing forward would send its boards to the app's shared folder.
+ resetPlatformForTests()
+ const p2 = new ServerPlatform({ userDataDir: repo, appVersion: '0' })
+ initPlatform(p2)
+ const appRoot = path.join(repo, 'project-files', 'p2')
+ registerCoreHandlers(p2, {
+ getSettings: () => DEFAULT_SETTINGS,
+ localProjectCwd: () => undefined,
+ whiteboardLocation: (id) => (id === 'p2' ? { projectCwd: appRoot, createRoot: true } : {})
+ })
+ const ui2 = p2.attach({ sendText: () => {}, sendBinary: () => {} })
+ const res = await p2.dispatch(ui2, {
+ t: 'req',
+ id: 1,
+ method: IPC.filesSaveWhiteboard,
+ args: ['p2', 'whiteboard-1', '{"type":"excalidraw"}']
+ })
+ expect((res as { result: { path: string } }).result.path).toBe(
+ path.join(projectWhiteboardsDir(appRoot), 'whiteboard-1.excalidraw')
+ )
+ })
})
describe('registerCoreHandlers (download tickets)', () => {
diff --git a/src/server/handlers/index.ts b/src/server/handlers/index.ts
index d1009a254..96480bdca 100644
--- a/src/server/handlers/index.ts
+++ b/src/server/handlers/index.ts
@@ -6,6 +6,7 @@ import { DOWNLOAD_PATH, downloadName } from '../download'
import { GitService } from '../../core/git-service'
import { generateCommitMessage } from '../../core/commit-message'
import { registerFsHandlers } from '../../core/fs-handlers'
+import type { WhiteboardLocation } from '../../core/whiteboards'
import { claudeCliCaps, registerClaudeCliIpc } from '../../core/claude-cli'
import { registerGrokCliIpc } from '../../core/grok-cli'
import { registerCursorCliIpc } from '../../core/cursor-cli'
@@ -36,6 +37,8 @@ export function registerCoreHandlers(
downloadTickets?: DownloadTickets
/** See fs-handlers' dep of the same name — the canvas-image write directory. */
localProjectCwd?: (projectId: string) => string | undefined
+ /** See fs-handlers' dep of the same name — where a project's whiteboards go. */
+ whiteboardLocation?: (projectId: string) => Omit<WhiteboardLocation, 'userDataDir'>
}
): { gitService: GitService } {
// Explorer downloads: mint a one-shot ticket over this (authenticated) channel; the transfer
@@ -55,7 +58,8 @@ export function registerCoreHandlers(
return { url: `${DOWNLOAD_PATH}?t=${encodeURIComponent(token)}`, name: downloadName(p, dir) }
}
: undefined,
- localProjectCwd: deps.localProjectCwd
+ localProjectCwd: deps.localProjectCwd,
+ whiteboardLocation: deps.whiteboardLocation
})
const gitService = new GitService()
diff --git a/src/server/index.ts b/src/server/index.ts
index 4f46c441a..8a2498c26 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -377,7 +377,8 @@ export async function startServer(
getSettings: () => settingsStore.get(),
onSettingsChange: (cb) => settingsStore.onChange(cb),
downloadTickets,
- localProjectCwd: (projectId: string) => workspaceStore.sideFilesFolderForProject(projectId)
+ localProjectCwd: (projectId: string) => workspaceStore.sideFilesFolderForProject(projectId),
+ whiteboardLocation: (projectId: string) => workspaceStore.whiteboardLocationForProject(projectId)
})
// Project setup/archive runner — same construction as src/main/index.ts, and the SAME
// `registerProjectSetupHandlers` trust boundary (project-setup-handlers.ts): it derives rootPath/