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(kanban): add global swimlane overview per project

Alex3b40334fee43
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 236cbbf64..25007fbdb 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -419,7 +419,8 @@ import { canClearDirty, canCommitCanvas, canCreateOnCanvas } from '../state/pers
import { isHidden } from '../lib/ui-visibility'
import { boardLogEvents } from '../lib/boardLogDiff'
import { useBoardLog } from '../state/boardLog'
-import { isKanbanOpen, useViewMode, viewFor } from '../state/viewMode'
+import { isGlobalKanbanOpen, isKanbanOpen, useViewMode, viewFor } from '../state/viewMode'
+import { GlobalKanbanView } from '../components/kanban/GlobalKanbanView'
import { useFocusNode, FOCUS_SURFACE_ID } from '../state/focusNode'
import { focusTargetId } from '../lib/focusTarget'
import {
@@ -2197,7 +2198,7 @@ export function Canvas() {
if (node) {
// Same rule as focusNodeById: if the project we just landed on shows the BOARD, the
// node lives on a card, not on the canvas hidden under it.
- if (isKanbanOpen(useProjects.getState().activeProjectId)) {
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId)) {
useViewMode.getState().requestCard(pending)
} else {
setNodes((ns) => ns.map((n) => ({ ...n, selected: n.id === pending })))
@@ -2247,7 +2248,9 @@ export function Canvas() {
// ride the same debounced whole-file save.
useEffect(() => registerWorkspaceDirty(markDirty), [markDirty])
- const kanbanOpen = useViewMode((s) => !!activeProjectId && viewFor(s, activeProjectId) === 'kanban')
+ const perProjectKanbanOpen = useViewMode((s) => !!activeProjectId && viewFor(s, activeProjectId) === 'kanban')
+ const globalKanbanOpen = useViewMode((s) => s.globalKanban)
+ const kanbanOpen = globalKanbanOpen || perProjectKanbanOpen
const projectKanban = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.kanban)
// Fresh default per project — ids must not be shared across projects; NOT persisted
// until the first edit writes it (spec lazy-default rule).
@@ -4056,7 +4059,7 @@ export function Canvas() {
// so the user actually sees the login node they must interact with. Same rationale as the
// Settings-overlay close in the add-account listeners above.
const pid = useProjects.getState().activeProjectId
- if (pid && isKanbanOpen(pid)) useViewMode.getState().toggle(pid)
+ if (pid && (isGlobalKanbanOpen() || isKanbanOpen(pid))) useViewMode.getState().toggle(pid)
}
window.addEventListener('nodeterm:switch-system-account', onSwitchSystemAccount)
return () => window.removeEventListener('nodeterm:switch-system-account', onSwitchSystemAccount)
@@ -4264,7 +4267,7 @@ export function Canvas() {
}
const onKeyDown = (e: KeyboardEvent): void => {
- if (isKanbanOpen(useProjects.getState().activeProjectId)) return
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId)) return
const combo = dictationBinding()
if (combo === '' || !isHoldChord(combo)) return
@@ -5968,7 +5971,7 @@ export function Canvas() {
return nodesRef.current.filter((n) => !n.parentId).length >= 2
}, [])
const arrangeAllNodes = useCallback(() => {
- if (isKanbanOpen(useProjects.getState().activeProjectId)) return
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId)) return
const targets = nodesRef.current
.filter((n) => !n.parentId)
.sort((a, b) => a.position.y - b.position.y || a.position.x - b.position.x)
@@ -6103,7 +6106,7 @@ export function Canvas() {
const stepAndFrame = useCallback(
(direction: 'back' | 'forward') => {
const activeId = useProjects.getState().activeProjectId
- if (!activeId || isKanbanOpen(activeId)) return
+ if (!activeId || isGlobalKanbanOpen() || isKanbanOpen(activeId)) return
const next = stepBreadcrumb(navRef.current, direction, (nodeId) =>
nodesRef.current.some((n) => n.id === nodeId)
)
@@ -6171,7 +6174,7 @@ export function Canvas() {
}
// The kanban board is an opaque overlay and its card modal already IS a focused view of a
// session — engaging under it would just hide the canvas twice.
- if (isKanbanOpen(useProjects.getState().activeProjectId)) return
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId)) return
const target = focusTargetId(nodesRef.current)
if (!target) {
setNotice({ kind: 'error', text: FOCUS_NO_TARGET_NOTICE })
@@ -6306,12 +6309,18 @@ export function Canvas() {
// shell, and the digit addresses an open project). `liveProjectJumpTarget` is the same decision
// the terminals' swallow asks, so the two can't disagree; a null target leaves the key to
// whatever has focus. `switchProject` no-ops on the active id.
+ // When the global swimlane kanban is open, the same chord scrolls to the Nth swimlane instead
+ // of switching tabs (see GlobalKanbanView's `nodeterm:swimlane-jump` listener).
const projectJumpGesture = useCallback((raw: GlobalKeyEvent): boolean => {
const e = raw as KeyboardEvent
if (projectJumpDigit(e) === null) return false
const targetId = liveProjectJumpTarget(e)
if (!targetId) return false
e.preventDefault()
+ if (isGlobalKanbanOpen()) {
+ window.dispatchEvent(new CustomEvent('nodeterm:swimlane-jump', { detail: { projectId: targetId } }))
+ return true
+ }
switchProject(targetId)
return true
}, [switchProject])
@@ -6345,7 +6354,7 @@ export function Canvas() {
// copy on a Linux box. The board is an opaque overlay over the canvas, so a copy there
// would act on a selection the user cannot see (the canvas-only-shortcut discipline).
const projects = useProjects.getState()
- if (!isMac || isKanbanOpen(projects.activeProjectId)) return false
+ if (!isMac || isGlobalKanbanOpen() || isKanbanOpen(projects.activeProjectId)) return false
const paths = selectedLocalFilePaths(nodesRef.current, {
projectIsRelay: !!projects.getProject(projects.activeProjectId ?? '')?.remote
})
@@ -6469,7 +6478,7 @@ export function Canvas() {
const globalKeyDeps = useRef<GlobalKeydownDeps | null>(null)
globalKeyDeps.current = {
activeElement: () => document.activeElement as unknown as ContextElement | null,
- kanbanOpen: () => isKanbanOpen(useProjects.getState().activeProjectId),
+ kanbanOpen: () => isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId),
overrides: activeKeybindingOverrides,
isMac,
// Read per keystroke (the deps object is rebuilt each render anyway, but the thunk is what
@@ -6484,9 +6493,10 @@ export function Canvas() {
'app.settings': () => { setSettingsSection(undefined); setSettingsOpen(true); return true },
'app.shortcutsPanel': () => { setShortcutsOpen((v) => !v); return true },
'view.kanbanToggle': () => {
- const id = useProjects.getState().activeProjectId
- if (!id) return false
- useViewMode.getState().toggle(id)
+ // New global swimlane kanban: toggle the overview that shows all projects as swimlanes.
+ // Per-project kanban remains via the tab's kanban button (TabBar toggle) and direct toggle().
+ // Keyboard shortcut now controls the global overview — Cmd+1..9 then jumps within it.
+ useViewMode.getState().toggleGlobalKanban()
return true
},
'view.focusMode': () => { toggleFocusMode(); return true },
@@ -7587,7 +7597,7 @@ export function Canvas() {
// The board is a full-page overlay: framing the node on the canvas underneath it is
// invisible, which is why the notch's Go (and every other "go to node" path) read as
// broken there. On the board, "go to" means OPEN THE CARD.
- if (isKanbanOpen(useProjects.getState().activeProjectId)) {
+ if (isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId)) {
useViewMode.getState().requestCard(nodeId)
useAgentStatus.getState().setActive(nodeId, true)
useAgentStatus.getState().clearUnread(nodeId)
@@ -7617,6 +7627,14 @@ export function Canvas() {
)
focusNodeRef.current = focusNodeById
+ // Global kanban swimlane "Open on canvas" path — GlobalKanbanView dispatches this after closing
+ // the overview, so focusNodeById can frame the node on the canvas (project switch included).
+ useEffect(() => {
+ const handler = (e: CustomEvent<{ nodeId: string }>) => focusNodeById(e.detail.nodeId)
+ window.addEventListener('nodeterm:focus-node' as never, handler as never)
+ return () => window.removeEventListener('nodeterm:focus-node' as never, handler as never)
+ }, [focusNodeById])
+
// 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
@@ -7625,10 +7643,10 @@ export function Canvas() {
// list existing while the canvas is what you are looking at.
const kanbanSessions = useMemo(
() =>
- kanbanOpen
+ perProjectKanbanOpen
? nodes.map(toKanbanSession).filter((s): s is KanbanSession => s !== null)
: NO_KANBAN_SESSIONS,
- [nodes, kanbanOpen]
+ [nodes, perProjectKanbanOpen]
)
// Create a node from the board's per-column "+ New" menu: it lands on the canvas (view
@@ -11339,7 +11357,9 @@ export function Canvas() {
)
})()}
</div>
- {kanbanOpen && (
+ {globalKanbanOpen ? (
+ <GlobalKanbanView />
+ ) : perProjectKanbanOpen && (
<KanbanView
board={projectKanban ?? seedBoard}
sessions={kanbanSessions}
diff --git a/src/renderer/canvas/toKanbanSessionState.ts b/src/renderer/canvas/toKanbanSessionState.ts
new file mode 100644
index 000000000..d42a6a5e7
--- /dev/null
+++ b/src/renderer/canvas/toKanbanSessionState.ts
@@ -0,0 +1,46 @@
+import type { CanvasNodeState } from '@shared/types'
+import { NODE_COLORS } from '../state/workspace'
+import type { KanbanSession } from '../components/kanban/KanbanView'
+
+export function toKanbanSessionState(n: CanvasNodeState): KanbanSession | null {
+ if (n.kind === 'browser') {
+ return {
+ id: n.id,
+ title: n.title || 'Browser',
+ color: n.color ?? NODE_COLORS[0],
+ kind: 'browser',
+ url: n.url,
+ partition: n.partition,
+ spawn: {}
+ }
+ }
+ if (n.kind === 'sticky') {
+ const txt = n.text ?? ''
+ return {
+ id: n.id,
+ title: txt.trim().split('\n')[0].replace(/^#{1,6}\s+/, '').trim().slice(0, 80) || 'Note',
+ color: n.color ?? NODE_COLORS[2],
+ kind: 'sticky',
+ text: txt,
+ textUpdatedAt: n.textUpdatedAt,
+ textUpdatedBy: n.textUpdatedBy,
+ spawn: {}
+ }
+ }
+ if (n.kind !== 'terminal') return null
+ return {
+ id: n.id,
+ title: n.title ?? '',
+ color: n.color ?? NODE_COLORS[0],
+ kind: 'terminal',
+ agentId: n.agentId as string | undefined,
+ spawn: {
+ shell: n.shell,
+ cwd: n.cwd,
+ agentId: n.agentId as string | undefined,
+ accountId: n.accountId as string | undefined,
+ ssh: n.ssh,
+ sshRemoteTmux: !!n.sshRemoteTmux
+ }
+ }
+}
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index 0a0625e6c..bc6603ef2 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -87,7 +87,7 @@ export function TabBar({
// Closed projects are hidden here (reopen them from the start screen's "Recently closed").
const projects = useMemo(() => allProjects.filter((p) => !p.closed), [allProjects])
const activeId = useProjects((s) => s.activeProjectId)
- const kanbanActive = useViewMode((s) => !!activeId && viewFor(s, activeId) === 'kanban')
+ const kanbanActive = useViewMode((s) => s.globalKanban || (!!activeId && viewFor(s, activeId) === 'kanban'))
// Unread dots need only the unread id set — subscribing to the whole status map re-rendered
// the TabBar on every working/waiting flip of any agent. Primitive signature → rare updates.
const unreadIds = useAgentStatus((s) => {
@@ -358,7 +358,15 @@ export function TabBar({
)}
onClick={(e) => {
e.stopPropagation() // a tab click switches projects, this only flips the view
- useViewMode.getState().toggle(p.id)
+ // Global swimlane overview replaces per-project tabs — toggle the global board
+ const vm = useViewMode.getState()
+ if (vm.globalKanban || viewFor(vm, p.id) === 'kanban') {
+ // If either global or per-project kanban is open, close both to return to canvas
+ if (vm.globalKanban) vm.toggleGlobalKanban()
+ if (viewFor(vm, p.id) === 'kanban') vm.toggle(p.id)
+ } else {
+ vm.toggleGlobalKanban()
+ }
}}
>
{kanbanActive ? <IconCanvasView /> : <IconKanban />}
diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsx
new file mode 100644
index 000000000..67a86b8d3
--- /dev/null
+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx
@@ -0,0 +1,389 @@
+import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import type { ProjectKanban } from '@shared/types'
+import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId } from '@shared/agents/config'
+import { useProjects } from '../../state/projects'
+import { useSettings } from '../../state/settings'
+import {
+ addColumn, assignNode, assignedTo, boardLabels, cardMatchesLabelFilter, cardMeta, columnForNode,
+ deleteColumn, labelsForCard, moveColumn,
+ nextColumnColor, pruneAssignments, recolorColumn, renameColumn, unassigned, defaultKanban
+} from '../../lib/kanban'
+import { KanbanColumn, type KanbanLane } from './KanbanColumn'
+import { SessionCard } from './SessionCard'
+import { toKanbanSessionState } from '../../canvas/toKanbanSessionState'
+import { createAgentNode, createBrowserNode, createStickyNode, createTerminalNode, flowToNodeStates, resolveNewNodeAccount } from '../../state/workspace'
+import { useViewMode } from '../../state/viewMode'
+import { useSession } from '../../session/session'
+import { activePermissionMode } from '../../state/permissionMode'
+import { CardModal } from './CardModal'
+import { ContextMenu, type MenuItem } from '../ContextMenu'
+import { IconAgent, IconNote, IconTerminal, IconTrash, IconExternal, IconSwitch, IconWeb } from '../icons'
+import { useBoardLog } from '../../state/boardLog'
+import { boardLogEvents } from '../../lib/boardLogDiff'
+import { markWorkspaceDirty } from '../../state/workspaceDirty'
+import type { KanbanCreateChoice, KanbanSession } from './KanbanView'
+
+// One swimlane = one project's board
+interface SwimlaneProps {
+ projectId: string
+ projectName: string
+ projectColor?: string
+ board: ProjectKanban
+ sessions: KanbanSession[]
+ onChangeBoard: (next: ProjectKanban) => void
+ onOpenNode: (nodeId: string, projectId: string) => void
+ onCreateNode: (projectId: string, choice: KanbanCreateChoice, columnId: string | null) => void
+ onDeleteNode: (projectId: string, nodeId: string) => void
+ onRenameNode: (nodeId: string, title: string) => void
+ onEditSticky: (projectId: string, nodeId: string, text: string) => void
+ onBrowserNav: (projectId: string, nodeId: string, patch: { url?: string; title?: string }) => void
+ onModalChange: (nodeId: string | null) => void
+ highlight?: boolean
+}
+
+const Swimlane = memo(function Swimlane({
+ projectId, projectName, projectColor, board, sessions, onChangeBoard, onOpenNode, onCreateNode, onDeleteNode, onRenameNode, onEditSticky, onBrowserNav, onModalChange, highlight
+}: SwimlaneProps) {
+ const dragRef = useRef<{ kind: 'column'; id: string } | { kind: 'card'; id: string } | null>(null)
+ const [modalNodeId, setModalNodeId] = useState<string | null>(null)
+ const [cardMenu, setCardMenu] = useState<{ x: number; y: number; nodeId: string } | null>(null)
+ const [labelFilter, setLabelFilter] = useState<string[]>([])
+ const customAgents = useSettings((s) => s.settings.customAgents)
+ const disabledAgents = useSettings((s) => s.settings.disabledAgents)
+
+ useEffect(() => { onModalChange(modalNodeId) }, [modalNodeId, onModalChange])
+
+ const requestedCardNodeId = useViewMode((s) => s.requestedCardNodeId)
+ useEffect(() => {
+ if (!requestedCardNodeId) return
+ if (sessions.some(s => s.id === requestedCardNodeId)) {
+ setModalNodeId(requestedCardNodeId)
+ useViewMode.getState().clearCardRequest()
+ }
+ }, [requestedCardNodeId, sessions])
+
+ const byId = useMemo(() => new Map(sessions.map(s => [s.id, s])), [sessions])
+ const sessionIds = useMemo(() => sessions.map(s => s.id), [sessions])
+
+ const paletteLabels = useMemo(() => boardLabels(board), [board])
+ const localFilterKeys = useMemo(() => new Set(paletteLabels.map(l => `local:${l.id}`)), [paletteLabels])
+ const activeLocalFilter = useMemo(() => labelFilter.filter(id => localFilterKeys.has(id)).map(k => k.slice(6)), [labelFilter, localFilterKeys])
+
+ const labelsByCard = useMemo(() => {
+ const m = new Map<string, ReturnType<typeof labelsForCard>>()
+ if (Array.isArray(board.meta)) {
+ for (const entry of board.meta) {
+ if (!entry?.nodeId) continue
+ const l = labelsForCard(board, entry.nodeId)
+ if (l.length) m.set(entry.nodeId, l)
+ }
+ }
+ return m
+ }, [board])
+
+ const commit = useCallback((next: ProjectKanban) => {
+ onChangeBoard(pruneAssignments(next, sessionIds))
+ }, [onChangeBoard, sessionIds])
+
+ const createOptions = useMemo(() => [
+ ...BUILTIN_AGENT_IDS.filter(id => !disabledAgents.includes(id)).map(id => ({
+ key: id, label: AGENT_CONFIG[id].label, choice: { kind: 'agent', agentId: id } as KanbanCreateChoice, icon: <IconAgent />
+ })),
+ ...customAgents.filter(a => !disabledAgents.includes(a.id)).map(a => ({
+ key: a.id, label: a.label, choice: { kind: 'agent', agentId: a.id } as KanbanCreateChoice, icon: <IconAgent />
+ })),
+ { key: 'terminal', label: 'Terminal', choice: { kind: 'terminal' } as KanbanCreateChoice, icon: <IconTerminal /> },
+ { key: 'browser', label: 'Browser', choice: { kind: 'browser' } as KanbanCreateChoice, icon: <IconWeb /> },
+ { key: 'sticky', label: 'Sticky note', choice: { kind: 'sticky' } as KanbanCreateChoice, icon: <IconNote /> }
+ ], [customAgents, disabledAgents])
+
+ const columnCards = useMemo(() => {
+ const vis = (ids: string[]) => activeLocalFilter.length ? ids.filter(id => cardMatchesLabelFilter(board, id, activeLocalFilter)) : ids
+ const toCards = (ids: string[]) => {
+ const cards = ids.flatMap(id => byId.has(id) ? [byId.get(id)!] : [])
+ return cards
+ }
+ return {
+ ungrouped: toCards(vis(unassigned(board, sessionIds))),
+ byColumn: new Map(board.columns.map(c => [c.id, toCards(vis(assignedTo(board, c.id)))]))
+ }
+ }, [board, byId, sessionIds, activeLocalFilter])
+
+ const handleCardDragStart = useCallback((id: string) => { dragRef.current = { kind: 'card', id } }, [])
+ const handleColumnDragStart = useCallback((id: string) => { dragRef.current = { kind: 'column', id } }, [])
+ const handleDragEnd = useCallback(() => { dragRef.current = null }, [])
+
+ const dropOnColumn = useCallback((columnId: string | null) => {
+ const drag = dragRef.current; dragRef.current = null; if (!drag) return
+ if (drag.kind === 'column') {
+ if (columnId !== null) commit(moveColumn(board, drag.id, columnId))
+ } else {
+ commit(assignNode(board, drag.id, columnId, null))
+ }
+ }, [board, commit])
+
+ const dropAtCard = useCallback((columnId: string | null, targetNodeId: string, side: 'before' | 'after') => {
+ const drag = dragRef.current; dragRef.current = null; if (!drag) return
+ if (drag.kind === 'column') {
+ if (columnId !== null) commit(moveColumn(board, drag.id, columnId))
+ return
+ }
+ const ids = columnId === null ? unassigned(board, sessionIds) : assignedTo(board, columnId)
+ let beforeId: string | null = targetNodeId
+ if (side === 'after') {
+ const i = ids.indexOf(targetNodeId)
+ beforeId = i >= 0 && i + 1 < ids.length ? ids[i+1] : null
+ }
+ commit(assignNode(board, drag.id, columnId, beforeId))
+ }, [board, commit, sessionIds])
+
+ const dropAtCardFor = useMemo(() => {
+ const cache = new Map<string, (nodeId: string, side: 'before' | 'after') => void>()
+ return (columnId: string | null) => {
+ const key = columnId ?? '\u0000ungrouped'
+ let bound = cache.get(key)
+ if (!bound) { bound = (nodeId, side) => dropAtCard(columnId, nodeId, side); cache.set(key, bound) }
+ return bound
+ }
+ }, [dropAtCard])
+
+ const lanesFor = (columnId: string | null): KanbanLane[] => {
+ const cards = columnId === null ? columnCards.ungrouped : columnCards.byColumn.get(columnId) ?? []
+ const onDropAt = dropAtCardFor(columnId)
+ return [{
+ sourceId: 'sessions' as const,
+ count: cards.length,
+ cards: cards.map(s => (
+ <SessionCard
+ key={s.id}
+ session={s}
+ meta={cardMeta(board, s.id)}
+ labels={labelsByCard.get(s.id) ?? []}
+ onOpen={setModalNodeId}
+ onContext={(id, x, y) => setCardMenu({ nodeId: id, x, y })}
+ onDragStart={handleCardDragStart}
+ onDragEnd={handleDragEnd}
+ onDropAt={onDropAt}
+ />
+ ))
+ }]
+ }
+
+ const cardMenuItems = (nodeId: string): MenuItem[] => {
+ const curColId = columnForNode(board, nodeId)?.id ?? null
+ const moveTargets: MenuItem[] = [
+ ...(curColId !== null ? [{ label: 'Ungrouped', onClick: () => commit(assignNode(board, nodeId, null, null)) }] : []),
+ ...board.columns.filter(c => c.id !== curColId).map(c => ({ label: c.title, onClick: () => commit(assignNode(board, nodeId, c.id, null)) }))
+ ]
+ return [
+ { label: 'Open card', icon: <IconExternal />, onClick: () => setModalNodeId(nodeId) },
+ { label: 'Open on canvas', icon: <IconExternal />, onClick: () => onOpenNode(nodeId, projectId) },
+ ...(moveTargets.length ? [{ type: 'submenu', label: 'Move to', icon: <IconSwitch />, children: moveTargets } as MenuItem] : []),
+ { type: 'separator' },
+ { label: 'Delete', icon: <IconTrash />, danger: true, onClick: () => onDeleteNode(projectId, nodeId) }
+ ]
+ }
+
+ return (
+ <div id={`swimlane-${projectId}`} className={`kanban-swimlane${highlight ? ' kanban-swimlane--highlight' : ''}`}>
+ <div className="kanban-swimlane__header">
+ <span className="kanban-header__dot" style={{ background: projectColor || '#444' }} />
+ <span className="kanban-header__name">{projectName}</span>
+ <span className="kanban-swimlane__count">{sessions.length} sessions</span>
+ </div>
+ <div className="kanban-board kanban-swimlane__board">
+ <div className="kanban-board__columns">
+ <KanbanColumn
+ column={null}
+ lanes={lanesFor(null)}
+ createOptions={createOptions}
+ onCreate={(choice, colId) => onCreateNode(projectId, choice, colId)}
+ onDragEnd={handleDragEnd}
+ onDropOnColumn={dropOnColumn}
+ />
+ {board.columns.map(col => (
+ <KanbanColumn
+ key={col.id}
+ column={col}
+ lanes={lanesFor(col.id)}
+ onRename={(id, t) => commit(renameColumn(board, id, t))}
+ onRecolor={(id, c) => commit(recolorColumn(board, id, c))}
+ onDelete={(id) => commit(deleteColumn(board, id))}
+ createOptions={createOptions}
+ onCreate={(choice, colId) => onCreateNode(projectId, choice, colId)}
+ onColumnDragStart={handleColumnDragStart}
+ onDragEnd={handleDragEnd}
+ onDropOnColumn={dropOnColumn}
+ />
+ ))}
+ <button className="kanban-add-col" onClick={() => commit(addColumn(board, 'New column', nextColumnColor(board)))}>+ Add column</button>
+ </div>
+ </div>
+ {cardMenu && byId.has(cardMenu.nodeId) && (
+ <ContextMenu x={cardMenu.x} y={cardMenu.y} zIndex={60} items={cardMenuItems(cardMenu.nodeId)} onClose={() => setCardMenu(null)} />
+ )}
+ {modalNodeId && byId.has(modalNodeId) && (
+ <CardModal
+ session={byId.get(modalNodeId)!}
+ columnTitle={columnForNode(board, modalNodeId)?.title ?? null}
+ board={board}
+ onChangeBoard={commit}
+ onClose={() => setModalNodeId(null)}
+ onOpenCanvas={() => { setModalNodeId(null); onOpenNode(modalNodeId, projectId) }}
+ onRename={(t) => onRenameNode(modalNodeId, t)}
+ onEditSticky={(t) => onEditSticky(projectId, modalNodeId, t)}
+ onBrowserNav={(patch) => onBrowserNav(projectId, modalNodeId, patch)}
+ />
+ )}
+ </div>
+ )
+})
+
+export const GlobalKanbanView = memo(function GlobalKanbanView() {
+ const projects = useProjects(s => s.projects.filter(p => !p.closed))
+ const { api } = useSession()
+ const modalRef = useRef<string | null>(null)
+ const [highlightId, setHighlightId] = useState<string | null>(null)
+ const containerRef = useRef<HTMLDivElement>(null)
+
+ // Expose scroll-to-swimlane for Cmd+1..9
+ useEffect(() => {
+ const handler = (e: CustomEvent<{ projectId: string }>) => {
+ const el = document.getElementById(`swimlane-${e.detail.projectId}`)
+ if (el) {
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' })
+ setHighlightId(e.detail.projectId)
+ setTimeout(() => setHighlightId(null), 1500)
+ }
+ }
+ window.addEventListener('nodeterm:swimlane-jump' as never, handler as never)
+ return () => window.removeEventListener('nodeterm:swimlane-jump' as never, handler as never)
+ }, [])
+
+ const onChangeBoard = useCallback((projectId: string, next: ProjectKanban) => {
+ const prev = useProjects.getState().getProject(projectId)?.kanban ?? defaultKanban()
+ useProjects.getState().setProjectKanban(projectId, next)
+ markWorkspaceDirty()
+ const cardTitle = (nodeId: string) => {
+ const proj = useProjects.getState().getProject(projectId)
+ const n = proj?.nodes.find(x => x.id === nodeId)
+ if (!n) return ''
+ const s = toKanbanSessionState(n as never)
+ return s ? s.title || 'Untitled' : ''
+ }
+ for (const { nodeId, event } of boardLogEvents(prev, next, cardTitle)) {
+ useBoardLog.getState().append(api, projectId, { kind: 'event', nodeId, event })
+ }
+ }, [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()
+ }
+ }, [])
+
+ const onDeleteNode = useCallback((projectId: string, nodeId: string) => {
+ const proj = useProjects.getState().getProject(projectId)
+ const label = proj?.nodes.find(n => n.id === nodeId)?.title || 'this session'
+ if (!confirm(`Delete ${label}? Its terminal session will end.`)) return
+ useProjects.setState(s => ({ projects: s.projects.map(p => p.id === projectId ? { ...p, nodes: p.nodes.filter(n => n.id !== nodeId) } : p) }))
+ markWorkspaceDirty()
+ // best-effort kill tmux session (works for local and remote via api)
+ try { (api as unknown as { pty: { destroy: (id: string) => void } }).pty.destroy(nodeId as never) } catch {}
+ try { (window as unknown as { nodeTerminal?: { pty: { destroy: (id: string) => void } } }).nodeTerminal?.pty.destroy(nodeId) } catch {}
+ }, [api])
+
+ const onRenameNode = useCallback((nodeId: string, title: string) => {
+ // find owning project
+ const proj = useProjects.getState().projects.find(p => p.nodes.some(n => n.id === nodeId))
+ if (!proj) return
+ useProjects.setState(s => ({ projects: s.projects.map(p => p.id === proj.id ? { ...p, nodes: p.nodes.map(n => n.id === nodeId ? { ...n, title, titleAuto: false } : n) } : p) }))
+ }, [])
+
+ const onEditSticky = useCallback((projectId: string, nodeId: string, text: string) => {
+ useProjects.setState(s => ({ projects: s.projects.map(p => p.id === projectId ? { ...p, nodes: p.nodes.map(n => n.id === nodeId ? { ...n, text } as never : n) } : p) }))
+ markWorkspaceDirty()
+ }, [])
+
+ const onBrowserNav = useCallback((projectId: string, nodeId: string, patch: { url?: string; title?: string }) => {
+ useProjects.setState(s => ({ projects: s.projects.map(p => p.id === projectId ? { ...p, nodes: p.nodes.map(n => n.id === nodeId ? { ...n, ...patch } as never : n) } : p) }))
+ markWorkspaceDirty()
+ }, [])
+
+ const onOpenNode = useCallback((nodeId: string, _projectId: string) => {
+ const vm = useViewMode.getState()
+ if (vm.globalKanban) vm.toggleGlobalKanban()
+ // Let Canvas's focusNodeById handle project switching and canvas framing
+ setTimeout(() => window.dispatchEvent(new CustomEvent('nodeterm:focus-node', { detail: { nodeId } })), 50)
+ }, [])
+
+ if (projects.length === 0) {
+ return (
+ <div className="kanban-overlay global-kanban">
+ <div className="kanban-header"><span className="kanban-header__name">All Projects — Kanban</span></div>
+ <div className="kanban-empty">No projects yet. Create a project to see its swimlane.</div>
+ </div>
+ )
+ }
+
+ return (
+ <div className="kanban-overlay global-kanban" ref={containerRef}>
+ <div className="kanban-header">
+ <span className="kanban-header__name">All Projects</span>
+ <span className="kanban-swimlane__hint">{projects.length} projects — Cmd+1..{Math.min(9, projects.length)} to jump</span>
+ <button
+ className="kanban-header__close"
+ title="Back to canvas (Cmd+Shift+B)"
+ onClick={() => useViewMode.getState().toggleGlobalKanban()}
+ >
+ ✕
+ </button>
+ </div>
+ <div className="global-kanban__scroll">
+ {projects.map((p, idx) => {
+ const board = p.kanban ?? defaultKanban()
+ const sessions = p.nodes.map(n => toKanbanSessionState(n as never)).filter((s): s is KanbanSession => s !== null)
+ return (
+ <Swimlane
+ key={p.id}
+ projectId={p.id}
+ projectName={`${idx+1}. ${p.name}`}
+ projectColor={p.color}
+ board={board}
+ sessions={sessions}
+ onChangeBoard={next => onChangeBoard(p.id, next)}
+ onOpenNode={onOpenNode}
+ onCreateNode={onCreateNode}
+ onDeleteNode={onDeleteNode}
+ onRenameNode={onRenameNode}
+ onEditSticky={onEditSticky}
+ onBrowserNav={onBrowserNav}
+ onModalChange={id => { modalRef.current = id }}
+ highlight={highlightId === p.id}
+ />
+ )
+ })}
+ </div>
+ </div>
+ )
+})
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index 4318c8a5d..5bfcf110c 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -144,7 +144,7 @@ import { PresenceChips } from '../components/PresenceChips'
import { useAgentNodes } from '../state/agentNodes'
import { useTerminalFocus } from '../state/terminalFocus'
import { useProjects } from '../state/projects'
-import { isKanbanOpen, useViewMode, viewFor } from '../state/viewMode'
+import { isGlobalKanbanOpen, isKanbanOpen, useViewMode, viewFor } from '../state/viewMode'
import { useSshConn } from '../state/sshConn'
import { useWorktrees } from '../state/worktrees'
import { isRemoteSessionNode } from '@shared/worktree'
@@ -2581,7 +2581,7 @@ export function TerminalNode({
terminalShortcutPolicy() !== 'terminal-first' && liveProjectJumpTarget(e) !== null
const registryOwns = terminalChordBubbles(
e,
- isKanbanOpen(useProjects.getState().activeProjectId ?? '')
+ isGlobalKanbanOpen() || isKanbanOpen(useProjects.getState().activeProjectId ?? '')
)
const action = terminalKeyAction(e, term.hasSelection(), ownsProjectJump, registryOwns)
if (action === 'pass') return true
diff --git a/src/renderer/state/viewMode.ts b/src/renderer/state/viewMode.ts
index 8145c7cb0..33aeb38f2 100644
--- a/src/renderer/state/viewMode.ts
+++ b/src/renderer/state/viewMode.ts
@@ -9,6 +9,7 @@ import { readLocal, writeLocal } from '../lib/localStore'
// project the user hasn't explicitly toggled, while their explicit choices stick.
export const PROJECT_VIEW_KEY = 'nodeterm.projectView'
+export const GLOBAL_KANBAN_KEY = 'nodeterm.globalKanban'
export type ProjectView = 'canvas' | 'kanban'
@@ -39,6 +40,9 @@ interface ViewModeState {
defaultView: ProjectView
setDefaultView(v: ProjectView): void
toggle(projectId: string): void
+ /** Global swimlane overview — when true, kanban shows all projects as swimlanes instead of per-project tabs. */
+ globalKanban: boolean
+ toggleGlobalKanban(): void
/**
* A node whose CARD should be opened on the board, set by anything that "goes to" a node while
* the board is up — the notch HUD's Go, a notification click, ⌘K, the sessions sidebar. Those
@@ -58,9 +62,20 @@ export function viewFor(s: Pick<ViewModeState, 'viewByProject' | 'defaultView'>,
return s.viewByProject[projectId] ?? s.defaultView
}
+function readGlobalKanban(): boolean {
+ try {
+ const raw = readLocal(GLOBAL_KANBAN_KEY)
+ return raw === '1' || raw === 'true'
+ } catch { return false }
+}
+function saveGlobalKanban(v: boolean): void {
+ try { writeLocal(GLOBAL_KANBAN_KEY, v ? '1' : '0') } catch { /* ignore */ }
+}
+
export const useViewMode = create<ViewModeState>((set) => ({
viewByProject: parseViewMap(readLocal(PROJECT_VIEW_KEY)),
defaultView: 'canvas',
+ globalKanban: readGlobalKanban(),
setDefaultView: (v) => set((s) => (s.defaultView === v ? s : { defaultView: v })),
requestedCardNodeId: null,
requestCard: (nodeId) => set({ requestedCardNodeId: nodeId }),
@@ -77,6 +92,12 @@ export const useViewMode = create<ViewModeState>((set) => ({
// Leaving the board (or entering it) drops any unconsumed request — it belonged to the view
// the user just left, and firing it later would pop a card out of nowhere.
return { viewByProject: next, requestedCardNodeId: null }
+ }),
+ toggleGlobalKanban: () =>
+ set((s) => {
+ const next = !s.globalKanban
+ saveGlobalKanban(next)
+ return { globalKanban: next, requestedCardNodeId: null }
})
}))
@@ -85,3 +106,8 @@ export const useViewMode = create<ViewModeState>((set) => ({
export function isKanbanOpen(projectId: string): boolean {
return !!projectId && viewFor(useViewMode.getState(), projectId) === 'kanban'
}
+
+/** True when the global swimlane overview is active (all projects as swimlanes). */
+export function isGlobalKanbanOpen(): boolean {
+ return useViewMode.getState().globalKanban
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 7859f558e..fd35f2721 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -8737,6 +8737,68 @@ button.group-node__setup:disabled {
flex-direction: column;
}
}
+/* Global swimlane kanban — one swimlane per project */
+.global-kanban {
+ /* same base as .kanban-overlay but with vertical scroll for swimlanes */
+}
+.global-kanban__scroll {
+ flex: 1;
+ overflow-y: auto;
+ overflow-x: hidden;
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+ padding-bottom: 24px;
+}
+.kanban-swimlane {
+ border-bottom: 1px solid rgba(var(--tint-rgb), 0.08);
+ background: var(--canvas-bg);
+ scroll-margin-top: 8px;
+}
+.kanban-swimlane--highlight {
+ outline: 2px solid var(--accent);
+ outline-offset: -2px;
+ animation: kanban-swimlane-highlight 1.5s ease;
+}
+@keyframes kanban-swimlane-highlight {
+ 0% { outline-color: var(--accent); }
+ 100% { outline-color: transparent; }
+}
+.kanban-swimlane__header {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 12px 18px 8px;
+ border-bottom: 1px solid rgba(var(--tint-rgb), 0.06);
+ background: rgba(var(--tint-rgb), 0.02);
+ position: sticky;
+ top: 0;
+ z-index: 1;
+}
+.kanban-swimlane__count {
+ margin-left: auto;
+ font-size: 11px;
+ color: rgba(var(--tint-rgb), 0.45);
+}
+.kanban-swimlane__hint {
+ margin-left: auto;
+ font-size: 11px;
+ color: rgba(var(--tint-rgb), 0.5);
+}
+.kanban-swimlane__board {
+ padding: 12px 16px 16px;
+ /* override .kanban-board flex:1 which would stretch swimlane */
+ flex: none;
+ overflow-x: auto;
+ overflow-y: visible;
+ height: auto;
+ max-height: none;
+}
+.kanban-empty {
+ padding: 40px 18px;
+ color: rgba(var(--tint-rgb), 0.5);
+ font-size: 13px;
+}
.kanban-card__nodedot {
width: 8px;
height: 8px;