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(workspace): handedOffTo — a project shared to a hosted team is never written again
reviewba2f51b8ebb0
diff --git a/src/core/workspace-files.test.ts b/src/core/workspace-files.test.tsindex 393cdceeb..d16e782ec 100644--- a/src/core/workspace-files.test.ts+++ b/src/core/workspace-files.test.ts@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest'import type { CanvasNodeState, Project, ProjectKanban, Workspace } from '../shared/types'import {toPortableNodes, resolveNodes, projectToFile, fileToProject, framingViewport,- sameProjectContent, splitWorkspace, serializeProjectFile, sanitizeKanban+ sameProjectContent, splitWorkspace, serializeProjectFile, sanitizeKanban, sanitizeHandedOffTo} from './workspace-files'import { legacyFileId } from '../shared/project-id'import { CANVAS_LAYOUTS_CAP, type CanvasLayout } from '../shared/canvas-layout'@@ -433,6 +433,53 @@ describe('splitWorkspace', () => {})})+describe('handedOffTo', () => {+ const sshConn = { server: { host: 'h', user: 'u' } as any, remoteCwd: '~/app' }+ const handed = { hostId: 'h1', projectId: 'project-9', at: 1 }++ it('sanitizes: keeps a well-formed record, drops junk', () => {+ expect(sanitizeHandedOffTo({ hostId: 'h1', projectId: 'project-1', at: 5 })).toEqual({ hostId: 'h1', projectId: 'project-1', at: 5 })+ expect(sanitizeHandedOffTo({ at: 5 })).toEqual({ at: 5 }) // a handover in progress+ expect(sanitizeHandedOffTo('x')).toBeUndefined()+ expect(sanitizeHandedOffTo(null)).toBeUndefined()+ expect(sanitizeHandedOffTo({ hostId: 7, at: 5 })).toEqual({ at: 5 })+ expect(sanitizeHandedOffTo({ hostId: 'h'.repeat(200), at: 5 })).toEqual({ at: 5 })+ expect(sanitizeHandedOffTo({ hostId: '', projectId: 'p'.repeat(129), at: 5 })).toEqual({ at: 5 })+ expect(sanitizeHandedOffTo({ hostId: 'h1' })).toBeUndefined() // no timestamp+ expect(sanitizeHandedOffTo({ hostId: 'h1', at: Number.NaN })).toBeUndefined()+ expect(sanitizeHandedOffTo({ hostId: 'h1', at: '5' })).toBeUndefined()+ })++ it('rides the SSH index entry and never the shared file or the ssh cache', () => {+ const p = project({ id: 'p3', ssh: sshConn, handedOffTo: handed })+ const { index, files, dataFiles } = splitWorkspace(+ { version: 2, activeProjectId: 'p3', projects: [p] }, () => 1, '2026-07-11T00:00:00.000Z')+ expect(index.entries[0].handedOffTo).toEqual(handed)+ // The cache is the copy that gets mirrored to the host's project.json.+ expect(index.entries[0].cache).toBeDefined()+ expect(JSON.stringify(index.entries[0].cache)).not.toContain('handedOffTo')+ for (const f of [...files.values(), ...dataFiles.values()]) expect(JSON.stringify(f)).not.toContain('handedOffTo')+ expect(JSON.stringify(projectToFile(p, 1, '2026-07-11T00:00:00.000Z'))).not.toContain('handedOffTo')+ })++ it('an unavailable placeholder keeps it on its header-only entry', () => {+ const { index } = splitWorkspace(+ { version: 2, activeProjectId: 'p3', projects: [project({ id: 'p3', ssh: sshConn, handedOffTo: handed, unavailable: true })] },+ () => 1, '2026-07-11T00:00:00.000Z')+ expect(index.entries[0].handedOffTo).toEqual(handed)+ expect(index.entries[0].cache).toBeUndefined()+ })++ it('fileToProject restores it from the entry, and only from the entry', () => {+ const f = projectToFile(project({ ssh: sshConn }), 1, '2026-07-11T00:00:00.000Z')+ expect(fileToProject(f, { id: 'p1', ssh: sshConn, handedOffTo: handed }).handedOffTo).toEqual(handed)+ expect('handedOffTo' in fileToProject(f, { id: 'p1', ssh: sshConn })).toBe(false)+ // A field of this name in the shared file is not this machine's record and is never read.+ const forged = { ...f, handedOffTo: handed } as ProjectFileV1+ expect('handedOffTo' in fileToProject(forged, { id: 'p1', ssh: sshConn })).toBe(false)+ })+})+describe('serializeProjectFile', () => {it('is pretty-printed with version first (stable git diffs)', () => {const s = serializeProjectFile(projectToFile(project(), 1, '2026-07-11T00:00:00.000Z'))diff --git a/src/core/workspace-files.ts b/src/core/workspace-files.tsindex 6455d1e63..b8fe10a57 100644--- a/src/core/workspace-files.ts+++ b/src/core/workspace-files.ts@@ -10,7 +10,7 @@ import {} from '../shared/node-exec'import { sanitizeViews } from '../shared/kanban-views'import { CLOSED_SESSIONS_CAP } from '../shared/types'-import type { BridgeLink, CanvasNodeState, ClosedSessionEntry, NavStop, Project, ProjectKanban, Viewport, Workspace } from '../shared/types'+import type { BridgeLink, CanvasNodeState, ClosedSessionEntry, HandedOffTo, NavStop, Project, ProjectKanban, Viewport, Workspace } from '../shared/types'import { projectCapabilityFields, readProjectCapabilities } from '../shared/project-capabilities'import { loadedAgentBrowserPartition } from '../shared/browser-partition'import { sanitizeProjectIcon, type ProjectIcon } from '../shared/project-icon'@@ -209,6 +209,9 @@ export interface IndexEntryV3 {closed?: boolean/** Set alongside `closed: true` — see `Project.closedAt`. */closedAt?: number+ /** See `HandedOffTo`. Index-only; never written to the shared project.json. Validated on every+ * load (`sanitizeHandedOffTo`): workspace.json is hand-editable input. */+ handedOffTo?: HandedOffTo/** MACHINE-LOCAL camera for a ref'd project (local folder or ssh). Where this user is looking is* not something a repo shares — the file's copy churned the git diff on every pan. */viewport?: Viewport@@ -598,6 +601,21 @@ export function sanitizeLoadedClosedSessions(x: unknown): ClosedSessionEntry[] |})}+/** The index is hand-editable: keep only a well-formed record. A record without a finite `at` is+ * not one at all (the project is an ordinary SSH project again); a malformed or oversized+ * `hostId`/`projectId` is dropped on its own, which still leaves the guard in place. */+export function sanitizeHandedOffTo(v: unknown): HandedOffTo | undefined {+ if (!v || typeof v !== 'object') return undefined+ const o = v as Record<string, unknown>+ if (typeof o.at !== 'number' || !Number.isFinite(o.at)) return undefined+ const ok = (s: unknown, max: number): s is string => typeof s === 'string' && s.length > 0 && s.length <= max+ return {+ at: o.at,+ ...(ok(o.hostId, 64) ? { hostId: o.hostId } : {}),+ ...(ok(o.projectId, 128) ? { projectId: o.projectId } : {})+ }+}+/*** The shared file plus this machine's own half of the project.*@@ -615,6 +633,8 @@ export function fileToProject(ssh?: Project['ssh']closed?: booleanclosedAt?: number+ /** This machine's "Share with team" handover record (index entry only; never from the file). */+ handedOffTo?: HandedOffTo/** This machine's camera. Falls back to the file's legacy one (a pre-change file, or a* teammate's) and then to a frame that puts the canvas on screen. */viewport?: Viewport@@ -684,6 +704,9 @@ export function fileToProject(...(base.ssh ? { ssh: base.ssh } : {}),...(base.closed ? { closed: true } : {}),...(base.closedAt ? { closedAt: base.closedAt } : {}),+ // Machine-local, from the index entry ONLY: a file field named `handedOffTo` is not this+ // machine's record and is never read.+ ...(base.handedOffTo ? { handedOffTo: base.handedOffTo } : {}),// Machine-local, from the index entry ONLY: a file field named `capabilityAck` is a forgery// attempt (the shared file cannot carry this machine's consent) and is simply never read....(base.capabilityAck ? { capabilityAck: base.capabilityAck } : {}),@@ -787,7 +810,10 @@ export function splitWorkspace(const header = {id: p.id, name: p.name, color: p.color,...(p.closed ? { closed: true } : {}),- ...(p.closedAt ? { closedAt: p.closedAt } : {})+ ...(p.closedAt ? { closedAt: p.closedAt } : {}),+ // On the header so even an unavailable placeholder's entry keeps it: the guard must hold+ // while the server is unreachable too.+ ...(p.handedOffTo ? { handedOffTo: p.handedOffTo } : {})}// The machine-local half of a REF'd project (a folder or an ssh endpoint), which used to ride// the shared file: this user's camera and this machine's default managed account. Deliberatelydiff --git a/src/core/workspace-store.test.ts b/src/core/workspace-store.test.tsindex 84d4fc0a0..a1cf511e0 100644--- a/src/core/workspace-store.test.ts+++ b/src/core/workspace-store.test.ts@@ -880,6 +880,131 @@ describe('ssh mirror guarantee (unmirrored retry)', () => {})})+// "Share with team": once an SSH project is handed over to the nodeterm-server on its host, the+// server core is the only writer of its project.json. A desktop that kept mirroring, reconciling or+// polling it would push its stale cache over the file the server now owns.+describe('handedOffTo — a project shared to a hosted team is never written again', () => {+ const sshConn = { server: { host: 'h', user: 'u' } as any, remoteCwd: '~/app' }+ const handed = { hostId: 'h1', projectId: 'project-9', at: 1 }++ /** A healthy connection that counts every read and write, and records which project each was for. */+ const countingIO = () => {+ const state = { reads: 0, writes: 0, readIds: [] as string[], writeIds: [] as string[], remote: {} as Record<string, string> }+ const io = {+ read: async (id: string) => {+ state.reads+++ state.readIds.push(id)+ return state.remote[id] != null+ ? { status: 'ok' as const, content: state.remote[id] }+ : { status: 'absent' as const }+ },+ write: async (id: string, _s: any, c: string) => {+ state.writes+++ state.writeIds.push(id)+ state.remote[id] = c+ return true+ }+ }+ return { state, io }+ }+ const changedNode = { id: 'term-2', kind: 'terminal' as const, position: { x: 9, y: 9 }, size: { width: 1, height: 1 }, title: 'new', color: '#fff', group: null }++ it('a changed canvas is saved without a mirror write, even when the mirror was re-owed', async () => {+ const { state, io } = countingIO()+ const store = new WorkspaceStore(io)+ const p = project({ id: 'ps', ssh: sshConn, cwd: undefined })+ await store.save(ws([p])) // the ordinary pre-handover mirror+ expect(state.writes).toBe(1)+ const before = { ...state }++ const handedOff = { ...p, handedOffTo: handed, nodes: [...p.nodes, changedNode] }+ await store.save(ws([handedOff]))+ expect(state.writes).toBe(before.writes)+ expect(state.reads).toBe(before.reads)++ store.markUnmirrored('ps') // a dropped trailing write reporting back must not force it either+ await store.save(ws([{ ...handedOff, nodes: [...handedOff.nodes, { ...changedNode, id: 'term-3' }] }]))+ expect(state.writes).toBe(before.writes)+ expect(state.reads).toBe(before.reads)+ // The save itself still lands locally.+ const index = JSON.parse(await fs.readFile(path.join(userData, 'workspace.json'), 'utf-8'))+ expect(index.entries[0].handedOffTo).toEqual(handed)+ expect(index.entries[0].cache.nodes.map((n: { id: string }) => n.id)).toEqual(['term-1', 'term-2', 'term-3'])+ })++ it('refreshSshProject resolves null without reading or writing the server file', async () => {+ const { state, io } = countingIO()+ const store = new WorkspaceStore(io)+ // Handed off from its first save: not even the never-blind-write first reconcile may run.+ await store.save(ws([project({ id: 'ps', ssh: sshConn, cwd: undefined, handedOffTo: handed })]))+ expect(state.reads).toBe(0)+ expect(state.writes).toBe(0)+ expect(await store.refreshSshProject('ps')).toBeNull()+ expect(await store.refreshSshProject('ps', { pushIfStanding: false })).toBeNull()+ expect(state.reads).toBe(0)+ expect(state.writes).toBe(0)+ })++ it('sshProjectIds() leaves it out of the connected-project poll and still lists the others', async () => {+ const { io } = countingIO()+ const store = new WorkspaceStore(io)+ await store.save(ws([+ project({ id: 'ps', ssh: sshConn, cwd: undefined, handedOffTo: handed }),+ project({ id: 'other', ssh: { ...sshConn, remoteCwd: '~/other' }, cwd: undefined }),+ project({ id: 'local', cwd: projRoot })+ ]))+ expect(store.sshProjectIds()).toEqual(['other'])+ })++ it('survives a restart: load() returns it, and the reloaded store still never touches the file', async () => {+ const { state, io } = countingIO()+ await new WorkspaceStore(io).save(ws([+ project({ id: 'ps', ssh: sshConn, cwd: undefined, handedOffTo: handed }),+ project({ id: 'other', ssh: { ...sshConn, remoteCwd: '~/other' }, cwd: undefined })+ ]))+ const restarted = new WorkspaceStore(io)+ const loaded = await restarted.load()+ expect(loaded.projects.find((p) => p.id === 'ps')!.handedOffTo).toEqual(handed)+ expect(loaded.projects.find((p) => p.id === 'other')!.handedOffTo).toBeUndefined()+ expect(restarted.sshProjectIds()).toEqual(['other'])+ expect(await restarted.refreshSshProject('ps')).toBeNull()+ await restarted.save(loaded)+ // The other SSH project is reconciled and mirrored as usual; the handed-off one never is.+ expect(state.readIds).toContain('other')+ expect(state.readIds).not.toContain('ps')+ expect(state.writeIds).not.toContain('ps')+ })++ it('an unreadable (cache-less) handed-off entry keeps the record through its placeholder', async () => {+ await fs.writeFile(path.join(userData, 'workspace.json'), JSON.stringify({+ version: 3, activeProjectId: 'ps',+ entries: [{ id: 'ps', name: 'foo', color: '#7aa2f7', ssh: sshConn, handedOffTo: handed }]+ }))+ const store = new WorkspaceStore(countingIO().io)+ const loaded = await store.load()+ expect(loaded.projects[0]).toMatchObject({ id: 'ps', unavailable: true, handedOffTo: handed })+ await store.save(loaded)+ const index = JSON.parse(await fs.readFile(path.join(userData, 'workspace.json'), 'utf-8'))+ expect(index.entries[0].handedOffTo).toEqual(handed)+ })++ it('a hand-edited record is validated on load (workspace.json is hand-editable input)', async () => {+ await fs.writeFile(path.join(userData, 'workspace.json'), JSON.stringify({+ version: 3, activeProjectId: 'ps',+ entries: [+ { id: 'ps', name: 'foo', color: '#7aa2f7', ssh: sshConn, handedOffTo: { hostId: 'h'.repeat(200), at: 5 } },+ { id: 'junk', name: 'bar', color: '#7aa2f7', ssh: { ...sshConn, remoteCwd: '~/bar' }, handedOffTo: { hostId: 'h1' } }+ ]+ }))+ const store = new WorkspaceStore(countingIO().io)+ const loaded = await store.load()+ expect(loaded.projects.find((p) => p.id === 'ps')!.handedOffTo).toEqual({ at: 5 })+ // No timestamp: not a record at all, so the project is an ordinary SSH project again.+ expect('handedOffTo' in loaded.projects.find((p) => p.id === 'junk')!).toBe(false)+ expect(store.sshProjectIds()).toEqual(['junk'])+ })+})+// THE reset bug (field report: 12 fresh project ids for one server folder in two weeks, 45 orphaned// tmux sessions). Re-adding a folder via the SSH dialog minted a fresh project id with an empty// canvas; its first mirror write clobbered the server's populated .nodeterm/project.json, and revdiff --git a/src/core/workspace-store.ts b/src/core/workspace-store.tsindex 5c9f21fd2..8a666e8a3 100644--- a/src/core/workspace-store.ts+++ b/src/core/workspace-store.ts@@ -6,14 +6,15 @@ import { IPC } from '../shared/ipc'import { platform } from './platform'import {DEFAULT_PROJECT_ID, EMPTY_WORKSPACE,- type BridgeLink, type CanvasNodeState, type KanbanColumn, type KanbanLabel, type Project, type ProjectKanban,- type Workspace, type WorkspaceSaveOptions, type WorkspaceV1+ type BridgeLink, type CanvasNodeState, type HandedOffTo, type KanbanColumn, type KanbanLabel, type Project,+ type ProjectKanban, type Workspace, type WorkspaceSaveOptions, type WorkspaceV1} from '../shared/types'import { contentOf, type CanvasContent } from '../shared/canvas-content'import {PROJECT_DIR, PROJECT_FILE, fileToProject, inlineProjectFileRelPath, isInlineProjectFileId,projectToFile, resolveNodes, sameProjectContent,sanitizeLoadedClosedSessions, sanitizeNodeTriggers, serializeProjectFile, splitWorkspace,+ sanitizeHandedOffTo,sanitizeKanban,sanitizeLinks,type IndexEntryV3, type ProjectFileV1, type WorkspaceIndexV3@@ -537,6 +538,9 @@ export class WorkspaceStore {// layouts happens later, in `fileToProject`, which is the first point that knows what the// project file actually carries.entry.layoutViewports = sanitizeLayoutViewports(entry.layoutViewports)+ // Same rule for the "Share with team" handover record: it decides whether this desktop may+ // write an SSH project's file at all, so only a well-formed record is honoured.+ entry.handedOffTo = sanitizeHandedOffTo(entry.handedOffTo)}this.index = indexconst built: LoadedEntry[] = []@@ -599,6 +603,7 @@ export class WorkspaceStore {cwd: e.cwd,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -622,6 +627,7 @@ export class WorkspaceStore {ssh: e.ssh,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -1113,6 +1119,7 @@ export class WorkspaceStore {id: e.id,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -1509,6 +1516,7 @@ export class WorkspaceStore {// ssh caches: bump rev on change so a later remote write can win; mirror write in Task 8.for (const e of index.entries) {if (!e.ssh || !e.cache) continue+ if (e.handedOffTo) continue // handed to a hosted team: the server core is the only writer nowconst prevRev = this.revs.get(e.id) ?? 0const previousCache = this.index?.entries.find((old) => old.id === e.id && old.cache)?.cacheconst changedSinceLoad = !(previousCache && sameProjectContent(previousCache, e.cache))@@ -1839,6 +1847,7 @@ export class WorkspaceStore {cwd: e.cwd,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -1890,9 +1899,10 @@ export class WorkspaceStore {return adopted}- /** The ssh entry ids of the current index — what the connected-project poll iterates. */+ /** The ssh entry ids of the current index — what the connected-project poll iterates — except+ * one handed to a hosted team (never polled again). */sshProjectIds(): string[] {- return (this.index?.entries ?? []).filter((e) => e.ssh).map((e) => e.id)+ return (this.index?.entries ?? []).filter((e) => e.ssh && !e.handedOffTo).map((e) => e.id)}/**@@ -2390,6 +2400,7 @@ export class WorkspaceStore {cwd: e.cwd,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -2449,6 +2460,7 @@ export class WorkspaceStore {cwd: e.cwd,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -2670,6 +2682,7 @@ export class WorkspaceStore {ssh: e.ssh,closed: e.closed,closedAt: e.closedAt,+ handedOffTo: e.handedOffTo,viewport: e.viewport,defaultAccountId: e.defaultAccountId,breadcrumbs: e.breadcrumbs,@@ -2737,7 +2750,7 @@ export class WorkspaceStore {}this.revs.set(e.id, e.cache.rev)return fileToProject(e.cache, {- id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt,+ id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt, handedOffTo: e.handedOffTo,viewport: e.viewport, defaultAccountId: e.defaultAccountId, breadcrumbs: e.breadcrumbs,closedSessions: e.closedSessions, layoutViewports: e.layoutViewports,capabilityAck: e.capabilityAck, localExec: e.localExec@@ -2816,6 +2829,7 @@ export class WorkspaceStore {* Returns the adopted project (for the caller to surface) or null when our cache stood/pushed.*/private async reconcileSsh(e: IndexEntryV3, pushIfStanding = true): Promise<Project | null> {+ if (e.handedOffTo) return null // handed to a hosted team: the server core is the only writer nowif (!e.ssh || !this.remoteIO) return nullconst res = await this.remoteIO.read(e.id, e.ssh)if (res.status === 'error') {@@ -2885,7 +2899,7 @@ export class WorkspaceStore {if (owed) this.unmirrored.add(e.id)else this.unmirrored.delete(e.id) // pure adopt: the server copy IS the truth now — nothing owedreturn fileToProject(adopted, {- id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt,+ id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt, handedOffTo: e.handedOffTo,viewport: e.viewport, defaultAccountId: e.defaultAccountId, breadcrumbs: e.breadcrumbs,closedSessions: e.closedSessions, layoutViewports: e.layoutViewports,capabilityAck: e.capabilityAck, localExec: e.localExec@@ -2901,7 +2915,7 @@ export class WorkspaceStore {this.revs.set(e.id, e.cache.rev)this.unmirrored.add(e.id) // the merged set must land on the servermerged = fileToProject(e.cache, {- id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt,+ id: e.id, ssh: e.ssh, closed: e.closed, closedAt: e.closedAt, handedOffTo: e.handedOffTo,viewport: e.viewport, defaultAccountId: e.defaultAccountId, breadcrumbs: e.breadcrumbs,closedSessions: e.closedSessions, layoutViewports: e.layoutViewports,capabilityAck: e.capabilityAck, localExec: e.localExec@@ -2941,13 +2955,19 @@ function nodesMissingFrom(base: CanvasNodeState[], from: CanvasNodeState[]): Can}/** A labeled grey placeholder for a ref whose file can't be read right now. */-function unavailableProject(e: { id: string; name: string; color: string; closed?: boolean; closedAt?: number; cwd?: string; ssh?: Project['ssh'] }): Project {+function unavailableProject(e: {+ id: string; name: string; color: string; closed?: boolean; closedAt?: number+ handedOffTo?: HandedOffTo; cwd?: string; ssh?: Project['ssh']+}): Project {return {id: e.id, name: e.name, color: e.color,viewport: { x: 0, y: 0, zoom: 1 }, nodes: [],...(e.cwd ? { cwd: e.cwd } : {}), ...(e.ssh ? { ssh: e.ssh } : {}),...(e.closed ? { closed: true } : {}),...(e.closedAt ? { closedAt: e.closedAt } : {}),+ // The placeholder is what the renderer saves back for this entry, so the guard must ride it:+ // an unreachable handed-off project must stay handed off.+ ...(e.handedOffTo ? { handedOffTo: e.handedOffTo } : {}),unavailable: true}}diff --git a/src/shared/types.ts b/src/shared/types.tsindex 90690d514..c8bd25c1a 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -1026,6 +1026,12 @@ export interface NavStop {note: string}+/** MACHINE-LOCAL: this SSH project was handed over to a hosted team on its host ("Share with+ * team"). From that moment the server core is the only writer of its project.json, so this+ * desktop never mirrors, reconciles or polls it again. `hostId` absent = the handover started+ * and did not finish (the same guard applies until the user reopens it). */+export interface HandedOffTo { hostId?: string; projectId?: string; at: number }+/** A project is one canvas/page: its own nodes, viewport, and default working dir. */export interface Project {id: string@@ -1113,6 +1119,8 @@ export interface Project {* shared project file, same rule as `closed` itself. Absent on a project closed before this* field existed; such entries sort last. */closedAt?: number+ /** See `HandedOffTo`. Index-only; never written to the shared project.json. */+ handedOffTo?: HandedOffTo/*** Sessions (terminal/agent/sticky/…) deleted from this project, most-recent-first, capped at* 20. MACHINE-LOCAL, same rule as `closedAt`/`breadcrumbs` — see `IndexEntryV3.closedSessions`,