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.

feat(handoff): shared capability, IPC channel, and API types for transfer

enes8224747981df
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 2d78a0363..77367cbb3 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -203,6 +203,10 @@ const api: NodeTerminalApi = {
return () => ipcRenderer.removeListener(channel, handler)
}
},
+ handoff: {
+ build: (sessionId, agentId, sourceNodeId, cwd) =>
+ ipcRenderer.invoke(IPC.handoffBuild, sessionId, agentId, sourceNodeId, cwd)
+ },
bridge: {
configPath: () => ipcRenderer.invoke(IPC.bridgeConfigPath),
setTopology: (topology) => ipcRenderer.invoke(IPC.bridgeSetTopology, topology),
diff --git a/src/shared/agents/config.ts b/src/shared/agents/config.ts
index ee4b36783..a1a7395d8 100644
--- a/src/shared/agents/config.ts
+++ b/src/shared/agents/config.ts
@@ -51,6 +51,8 @@ export const RECURRING_CAPABLE = ['claude'] as const // /loop, /schedule, /cron
export const BRANCH_CAPABLE = ['claude'] as const
export const BRIDGE_CAPABLE = ['claude'] as const
export const USAGE_CAPABLE = ['claude'] as const
+// Agents whose native transcript we can read + render for cross-agent transfer.
+export const TRANSFER_SOURCE_CAPABLE = ['claude', 'codex', 'gemini'] as const
const includes = (list: readonly string[], id: AgentId): boolean => list.includes(id)
@@ -61,6 +63,7 @@ export const canRecur = (id: AgentId): boolean => includes(RECURRING_CAPABLE, id
export const canBranch = (id: AgentId): boolean => includes(BRANCH_CAPABLE, id)
export const canBridge = (id: AgentId): boolean => includes(BRIDGE_CAPABLE, id)
export const hasUsage = (id: AgentId): boolean => includes(USAGE_CAPABLE, id)
+export const canTransferFrom = (id: AgentId): boolean => includes(TRANSFER_SOURCE_CAPABLE, id)
// Returns the builtin config for an id, or undefined for custom/unknown agents.
export const agentConfig = (id: AgentId): AgentConfig | undefined =>
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index 2ae71e443..edc487492 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -93,5 +93,6 @@ export const IPC = {
remoteClientExit: (connectionId: string, streamId: number) =>
`remote:client:exit:${connectionId}:${streamId}`,
// Fired when a connection's relay socket drops (host/relay gone).
- remoteClientClosed: (connectionId: string) => `remote:client:closed:${connectionId}`
+ remoteClientClosed: (connectionId: string) => `remote:client:closed:${connectionId}`,
+ handoffBuild: 'handoff:build'
} as const
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 266ea307a..655c2b03b 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -496,6 +496,22 @@ export interface ClaudeApi {
): Promise<TranscriptLine[]>
}
+export type HandoffResult = { filePath: string } | { error: string }
+
+export interface HandoffApi {
+ /**
+ * Render the source agent's full conversation transcript (located by `sessionId`)
+ * to a portable Markdown file under `<cwd>/.nodeterm/` and return its absolute path.
+ * No summarization — the entire transcript including tool calls and outputs.
+ */
+ build(
+ sessionId: string,
+ agentId: string,
+ sourceNodeId: string,
+ cwd: string | undefined
+ ): Promise<HandoffResult>
+}
+
export interface LicenseStatus {
/** 'pro' when entitled, else null. */
tier: string | null
@@ -578,6 +594,7 @@ export interface NodeTerminalApi {
claude: ClaudeApi
remoteHost: RemoteHostApi
remoteClient: RemoteClientApi
+ handoff: HandoffApi
/** Fires when the user presses Cmd/Ctrl+M (toggle markdown view). Returns unsubscribe. */
onMarkdownToggle(listener: () => void): () => void
/** Fires when the user presses Cmd/Ctrl+W (close selected node). Returns unsubscribe. */