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(worktree): GroupWorktree type + serializer round-trip
enes2bffb873c1ca
diff --git a/src/renderer/state/workspace.test.ts b/src/renderer/state/workspace.test.tsnew file mode 100644index 000000000..638038db1--- /dev/null+++ b/src/renderer/state/workspace.test.ts@@ -0,0 +1,41 @@+import { describe, it, expect } from 'vitest'+import { flowToNodeStates, nodeStatesToFlow } from './workspace'+import type { CanvasNode } from './workspace'++describe('group worktree serialization', () => {+ it('round-trips data.worktree on a group node', () => {+ const group = {+ id: 'group_1',+ type: 'group',+ position: { x: 0, y: 0 },+ width: 400,+ height: 300,+ data: {+ title: 'G',+ color: '#fff',+ group: null,+ worktree: {+ repoPath: '/repo',+ branch: 'feature/x',+ baseRef: 'main',+ path: '/wt/feature-x',+ createdByApp: true+ }+ }+ } as unknown as CanvasNode++ const states = flowToNodeStates([group])+ expect(states[0].worktree).toEqual(group.data.worktree)++ const back = nodeStatesToFlow(states)+ expect(back[0].data.worktree).toEqual(group.data.worktree)+ })++ it('leaves worktree undefined for unbound groups', () => {+ const group = {+ id: 'group_2', type: 'group', position: { x: 0, y: 0 }, width: 1, height: 1,+ data: { title: 'G', color: '#fff', group: null }+ } as unknown as CanvasNode+ expect(flowToNodeStates([group])[0].worktree).toBeUndefined()+ })+})diff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.tsindex 2d637d939..143eebcd3 100644--- a/src/renderer/state/workspace.ts+++ b/src/renderer/state/workspace.ts@@ -43,6 +43,8 @@ export interface NodeData {commitOid?: string/** Which agent runs in this terminal node (claude/codex/gemini/custom). */agentId?: AgentId+ /** group-only: the git worktree this group is bound to (single source of truth). */+ worktree?: import('@shared/worktree').GroupWorktree/*** When set, this terminal runs on a REMOTE host over the relay (RemoteTransport) rather than* the local PTY (LocalTransport). Not persisted — remote nodes are transient to a live@@ -433,7 +435,8 @@ export function nodeStatesToFlow(states: CanvasNodeState[]): CanvasNode[] {filePath: n.filePath,diffStaged: n.diffStaged,commitOid: n.commitOid,- agentId+ agentId,+ worktree: n.worktree}}})@@ -481,7 +484,8 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {filePath: n.data.filePath,diffStaged: n.data.diffStaged,commitOid: n.data.commitOid,- agentId: n.data.agentId+ agentId: n.data.agentId,+ worktree: n.data.worktree}})}diff --git a/src/shared/types.ts b/src/shared/types.tsindex 3d372d3f3..f735ece02 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -2,6 +2,7 @@import type { NormalizedAgentEvent } from './agents/normalize'import type { AgentId, PromptInjectionMode } from './agents/config'+import type { GroupWorktree } from './worktree'export interface PtyCreateOptions {shell?: string@@ -52,6 +53,8 @@ export interface CanvasNodeState {diffStaged?: boolean/** diff-only: when set, the diff shows parent (<oid>^) vs commit (<oid>) for a file from history. */commitOid?: string+ /** group-only: when bound, the git worktree this group works in. */+ worktree?: GroupWorktree}/**diff --git a/src/shared/worktree.ts b/src/shared/worktree.tsnew file mode 100644index 000000000..1e3077677--- /dev/null+++ b/src/shared/worktree.ts@@ -0,0 +1,12 @@+export interface GroupWorktree {+ /** Main repo root chosen at bind time. */+ repoPath: string+ /** The worktree's branch (new or existing). */+ branch: string+ /** Branch this was created from — the merge target (e.g. "main"). */+ baseRef: string+ /** Worktree directory on disk. */+ path: string+ /** Whether this app created the worktree (gates safe directory deletion). */+ createdByApp: boolean+}