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(kanban): global create, scroll, menu overlap and opencode

Alexf34ddab592c9
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index fba77a595..013c79900 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -7641,6 +7641,24 @@ export function Canvas() {
return () => window.removeEventListener('nodeterm:focus-node' as never, handler as never)
}, [focusNodeById])
+ // Global kanban swimlane "New session" path — creates a node in the target project's
+ // swimlane even when that project is not the active canvas. The per-column create
+ // menu in GlobalKanbanView dispatches this, and we switch to the target project
+ // first so the new TerminalNode mounts and its tmux session starts correctly.
+ useEffect(() => {
+ const handler = (e: CustomEvent<{ projectId: string; choice: KanbanCreateChoice; columnId: string | null }>) => {
+ const { projectId, choice, columnId } = e.detail
+ if (projectId !== useProjects.getState().activeProjectId) {
+ switchProject(projectId)
+ setTimeout(() => createNodeInColumn(choice, columnId), 120)
+ } else {
+ createNodeInColumn(choice, columnId)
+ }
+ }
+ window.addEventListener('nodeterm:create-node' as never, handler as never)
+ return () => window.removeEventListener('nodeterm:create-node' as never, handler as never)
+ }, [createNodeInColumn, switchProject])
+
// Session board cards are derived LIVE from the canvas nodes; the board stores only assignments.
// Only while the board is OPEN: `nodes` gets a fresh identity on every drag frame, so a closed
// board was rebuilding a card object per node ~60×/s for a surface that is not mounted. The
diff --git a/src/renderer/canvas/toKanbanSessionState.ts b/src/renderer/canvas/toKanbanSessionState.ts
index d42a6a5e7..a44a5bc8b 100644
--- a/src/renderer/canvas/toKanbanSessionState.ts
+++ b/src/renderer/canvas/toKanbanSessionState.ts
@@ -28,6 +28,8 @@ export function toKanbanSessionState(n: CanvasNodeState): KanbanSession | null {
}
}
if (n.kind !== 'terminal') return null
+ const raw = n as unknown as Record<string, unknown>
+ const initialCommand = (raw.initialCommand as string | undefined) ?? (raw.pendingLaunch as { command?: string } | undefined)?.command
return {
id: n.id,
title: n.title ?? '',
@@ -40,7 +42,8 @@ export function toKanbanSessionState(n: CanvasNodeState): KanbanSession | null {
agentId: n.agentId as string | undefined,
accountId: n.accountId as string | undefined,
ssh: n.ssh,
- sshRemoteTmux: !!n.sshRemoteTmux
- }
+ sshRemoteTmux: !!n.sshRemoteTmux,
+ ...(initialCommand ? { initialCommand } : {})
+ } as never
}
}
diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsx
index 4e647fe1c..8eee4e93c 100644
--- a/src/renderer/components/kanban/GlobalKanbanView.tsx
+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx
@@ -283,29 +283,11 @@ export const GlobalKanbanView = memo(function GlobalKanbanView() {
}, [api])
const onCreateNode = useCallback((projectId: string, choice: KanbanCreateChoice, columnId: string | null) => {
- const project = useProjects.getState().getProject(projectId)
- if (!project) return
- const nodes = project.nodes
- const index = nodes.length
- const at = { x: 100 + index * 20, y: 100 + index * 20 }
- let flowNode: import('../../state/workspace').CanvasNode | null = null
- if (choice.kind === 'terminal') flowNode = createTerminalNode(index, project.cwd, at, undefined, project.ssh)
- else if (choice.kind === 'sticky') flowNode = createStickyNode(index, at)
- else if (choice.kind === 'browser') flowNode = createBrowserNode(index, '', at)
- else {
- const acc = resolveNewNodeAccount(undefined, project as never, useSettings.getState().settings.claudeAccounts)
- flowNode = createAgentNode(choice.agentId, index, project.cwd, at, undefined, project.ssh, acc, activePermissionMode(choice.agentId), projectId)
- }
- if (!flowNode) return
- const stateNode = flowToNodeStates([flowNode])[0]
- const prevNodes = [...project.nodes, stateNode]
- useProjects.setState(s => ({ projects: s.projects.map(p => p.id === projectId ? { ...p, nodes: prevNodes } : p) }))
- markWorkspaceDirty()
- const board = project.kanban ?? defaultKanban()
- if (columnId) {
- useProjects.getState().setProjectKanban(projectId, assignNode(board, stateNode.id, columnId, null))
- markWorkspaceDirty()
- }
+ // Delegate to Canvas's createNodeInColumn which correctly mounts the TerminalNode
+ // and starts the tmux session (via transport.create). Direct store manipulation
+ // would leave the tmux session unstarted for non-active projects, causing the
+ // card's modal to open a fresh empty session that immediately closes.
+ window.dispatchEvent(new CustomEvent('nodeterm:create-node', { detail: { projectId, choice, columnId } }))
}, [])
const onDeleteNode = useCallback((projectId: string, nodeId: string) => {
diff --git a/src/renderer/components/kanban/ModalTerminal.tsx b/src/renderer/components/kanban/ModalTerminal.tsx
index 0326c8fa4..711bbb389 100644
--- a/src/renderer/components/kanban/ModalTerminal.tsx
+++ b/src/renderer/components/kanban/ModalTerminal.tsx
@@ -57,6 +57,8 @@ export interface ModalSpawn {
ssh?: SshConnection
/** SSH-project node: tmux runs on the REMOTE host (over the project's ControlMaster). */
sshRemoteTmux?: boolean
+ /** One-shot launch command for a fresh session (agent CLIs). */
+ initialCommand?: string
}
/**
@@ -328,6 +330,17 @@ export function ModalTerminal({ nodeId, spawn, searchOpen, onCloseSearch }: Moda
term.write('\r\n\x1b[90m[session ended]\x1b[0m\r\n')
)
)
+ // For a fresh session created from the global swimlane kanban (or any card modal
+ // that is the first spawner), the one-shot initialCommand must be delivered here —
+ // the canvas TerminalNode that normally does this never mounted for non-active
+ // projects, so the modal is the first and only client. Without this, an opencode
+ // card would open as an empty shell and immediately appear to close.
+ if (res.fresh && spawn.initialCommand) {
+ // Small delay to let the shell initialize, matching TerminalNode's writeWhenShellReady
+ setTimeout(() => {
+ if (!dead && sessionId) transport.write(sessionId, spawn.initialCommand + '\r')
+ }, 300)
+ }
// The pty runs at the SMALLEST subscriber's grid; render exactly what it tells us and letterbox
// the rest (the canvas node votes independently — the modal's smaller pane may shrink it).
if (transport.onSize)
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 9b96d15d7..301481e58 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -8757,9 +8757,14 @@ button.group-node__setup:disabled {
border-radius: 12px;
background: rgba(var(--tint-rgb), 0.02);
scroll-margin-top: 12px;
- overflow: hidden;
+ overflow: visible;
+ position: relative;
+ z-index: 1;
box-shadow: 0 2px 12px rgba(0, 0, 0, calc(0.12 * var(--shadow-k)));
}
+.kanban-swimlane:has(.kanban-col__newmenu) {
+ z-index: 10;
+}
.kanban-swimlane:nth-child(even) {
background: rgba(var(--tint-rgb), 0.035);
}