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(canvas-control): kanban board + card movement verbs
enesfd519ffb74e8
diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.tsindex adb5e7850..c4678aeec 100644--- a/src/main/canvas-control-core.test.ts+++ b/src/main/canvas-control-core.test.ts@@ -130,6 +130,23 @@ describe('parseControlRequest', () => {expect(isDestructiveVerb('rename')).toBe(false)})+ it('board takes no required args and is not destructive', () => {+ expect(parseControlRequest('board', {})).toEqual({ verb: 'board', args: {} })+ expect(isDestructiveVerb('board')).toBe(false)+ })++ it('assign requires --node; --column/--before are optional and it is not destructive', () => {+ expect(parseControlRequest('assign', {})).toEqual({ error: 'assign requires --node <id>' })+ // No --column is valid: it means "back to Ungrouped".+ expect(parseControlRequest('assign', { node: 'n1' })).toEqual({ verb: 'assign', args: { node: 'n1' } })+ expect(parseControlRequest('assign', { node: 'n1', column: 'In Progress' })).toEqual({+ verb: 'assign',+ args: { node: 'n1', column: 'In Progress' }+ })+ // Moving a card is board metadata only — no session is touched, so no confirm dialog.+ expect(isDestructiveVerb('assign')).toBe(false)+ })+it('merges the canvas-control block idempotently, preserving other content', () => {const block = buildCanvasControlInstructions('/tmp/nodeterm.sh')const first = mergeCanvasControlBlock('# My own notes\n', block)@@ -146,7 +163,7 @@ describe('parseControlRequest', () => {it('instructions cover the verb set and the confirm caveat', () => {const body = buildCanvasControlInstructions('/tmp/nodeterm.sh')- for (const verb of ['list', 'open-agent', 'spawn-team', 'group', 'arrange', 'rename', 'write', 'close']) {+ for (const verb of ['list', 'open-agent', 'spawn-team', 'group', 'arrange', 'rename', 'write', 'close', 'board', 'assign']) {expect(body).toContain(verb)}expect(body.toLowerCase()).toContain('confirm')diff --git a/src/main/canvas-control-core.ts b/src/main/canvas-control-core.tsindex 3769d2499..279f6e7c3 100644--- a/src/main/canvas-control-core.ts+++ b/src/main/canvas-control-core.ts@@ -23,6 +23,8 @@ export type ControlVerb =| 'rename'| 'write'| 'close'+ | 'board'+ | 'assign'export interface ControlCommand {verb: ControlVerb@@ -49,7 +51,9 @@ const VERBS: ControlVerb[] = ['branch','rename','write',- 'close'+ 'close',+ 'board',+ 'assign']const DESTRUCTIVE: ReadonlySet<ControlVerb> = new Set(['write', 'close'])@@ -82,6 +86,7 @@ export function parseControlRequest(if (v === 'link' && !args.to) return { error: 'link requires --to <id,id>' }if (v === 'verify' && !args.node) return { error: 'verify requires --node <id>' }if (v === 'spawn-team' && !args.team) return { error: 'spawn-team requires --team <json>' }+ if (v === 'assign' && !args.node) return { error: 'assign requires --node <id>' }if (v === 'open-worktree' && !args.branch) return { error: 'open-worktree requires --branch <name>' }if (v === 'close-worktree' && !args.group) return { error: 'close-worktree requires --group <id>' }if (v === 'branch' && !args.node) return { error: 'branch requires --node <id>' }@@ -160,6 +165,13 @@ export function buildCanvasControlInstructions(shimPath: string): string {'- `rename --node <id> --title "New Name"` — rename any node (terminals, groups, stickies…).','- `write --node <id> --text "..."` / `close --node <id>` — type into / close a node.',' Both ask the user to confirm a dialog and may be denied.',+ '- `board` — the project\'s kanban board: every column (id + title) and the session cards in each,',+ ' plus the virtual Ungrouped column. Start here when you need a column id or want the board state.',+ '- `assign --node <id> [--column <id|title>] [--before <nodeId>]` — move a session card to a column',+ ' (match by column id or title). Omit `--column` (or pass `ungrouped`) to send it back to Ungrouped.',+ ' `--before <nodeId>` drops it above that card within the column. This is board metadata only — it',+ ' never moves the node on the canvas or changes its group. Use it to reflect progress: move a card',+ ' to your "In Progress"/"Done" column as work advances.','','Orchestration ("Build with Nodeterm orchestration"): first decide what is genuinely','independent — for every "and then", ask whether the next step READS the previous step\'s',@@ -273,7 +285,7 @@ exit 1export function buildCanvasSkillBody(shimPath: string): string {return `---name: manage-nodeterm-canvas-description: Create, organize and control nodes on the nodeterm canvas — open Claude Code / Codex / Gemini / terminal nodes, spawn a team of agents that divide up a task, create git worktrees as bound groups, wrap nodes in labeled groups, arrange/align/rename them, link nodes so you can read back what they produced, show an image/video/web page, write to or close a terminal. Use whenever the user says "Build with Nodeterm orchestration", asks to create or open nodes/sessions/terminals, split or parallelize work across subagents/agents/sessions/worktrees, delegate parts of a task to other agents, work on several things at once, build something using multiple Claude (or other agent) sessions, collect or synthesize the results of agents you opened, organize the canvas into groups by topic, or visualize code/output you produced. Only works inside a nodeterm Claude session.+description: Create, organize and control nodes on the nodeterm canvas — open Claude Code / Codex / Gemini / terminal nodes, spawn a team of agents that divide up a task, create git worktrees as bound groups, wrap nodes in labeled groups, arrange/align/rename them, link nodes so you can read back what they produced, move session cards between kanban columns to track progress, show an image/video/web page, write to or close a terminal. Use whenever the user says "Build with Nodeterm orchestration", asks to create or open nodes/sessions/terminals, split or parallelize work across subagents/agents/sessions/worktrees, delegate parts of a task to other agents, work on several things at once, build something using multiple Claude (or other agent) sessions, collect or synthesize the results of agents you opened, organize the canvas into groups by topic, move tasks across a kanban board, or visualize code/output you produced. Only works inside a nodeterm Claude session.---# Manage the nodeterm canvas@@ -341,9 +353,20 @@ Verbs:- \`rename --node <id> --title "New Name"\` — rename any node (terminals, groups, stickies…).- \`write --node <id> --text "..."\` — type text into a terminal node. (Asks the user to confirm.)- \`close --node <id>\` — close a node. (Asks the user to confirm.)+- \`board\` — read the project's kanban board: every column (id + title) and the session cards+ filed in each, plus the virtual Ungrouped column (unfiled sessions). Start here when you need+ a column id, or to see how the work is currently laid out.+- \`assign --node <id> [--column <id|title>] [--before <nodeId>]\` — file a session card under a+ column, matching \`--column\` by id or (case-insensitive) title. Omit \`--column\`, or pass+ \`ungrouped\`, to send it back to Ungrouped; \`--before <nodeId>\` drops it just above that card+ within the column. This is board metadata ONLY — it never moves the node on the canvas, changes+ its group, or touches the running session. Use it to reflect progress: as a station finishes,+ move its card into your "In Progress" / "Done" column so the board tells the real story.Notes:- \`write\` and \`close\` require the user to approve a confirmation dialog; they may be denied.+- \`board\` and \`assign\` act on the CURRENTLY OPEN project's board — the same one you see when you+ toggle the kanban view. They need no confirmation.- If the CLI says canvas control is unavailable, you are not in a controllable nodeterm session — do not retry.To orchestrate a team: decide the roles + a concrete starting prompt for each, then onediff --git a/src/main/canvas-control-shim.test.ts b/src/main/canvas-control-shim.test.tsindex 065b5f07b..6bcf1f620 100644--- a/src/main/canvas-control-shim.test.ts+++ b/src/main/canvas-control-shim.test.ts@@ -105,6 +105,13 @@ describe('canvas-control shim', () => {expect(received.at(-1)?.args).toEqual({ node: 'n1', title: '' })})+ it('carries the kanban verbs (board / assign) through', async () => {+ await callShim(['board'])+ expect(received.at(-1)).toMatchObject({ verb: 'board', args: {} })+ await callShim(['assign', '--node', 'node-7', '--column', 'In Progress'])+ expect(received.at(-1)).toMatchObject({ verb: 'assign', args: { node: 'node-7', column: 'In Progress' } })+ })+it('reports server-side failures on stderr with a non-zero exit', async () => {await expect(callShim(['boom'])).rejects.toMatchObject({code: 1,diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 46a0f6fbb..3e56beb79 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -238,7 +238,7 @@ import type {TranscriptHit} from '@shared/types'import type { KanbanCreateChoice, KanbanSession } from '../components/kanban/KanbanView'-import { assignNode, defaultKanban, labelsForCard, migrateProjectTags } from '../lib/kanban'+import { assignNode, assignedTo, defaultKanban, labelsForCard, migrateProjectTags, resolveColumnRef, unassigned } from '../lib/kanban'import { registerWorkspaceDirty } from '../state/workspaceDirty'import { isHidden } from '../lib/ui-visibility'import { boardLogEvents } from '../lib/boardLogDiff'@@ -6313,6 +6313,111 @@ export function Canvas() {})return}+ case 'board': {+ // Read-only snapshot of the CURRENTLY OPEN project's kanban board: columns + the+ // session cards filed in each, plus the virtual Ungrouped column. The board's cards+ // ARE the canvas session nodes (toKanbanSession), derived live — the board file only+ // stores column assignments, so a session with no/dangling assignment sits Ungrouped.+ const store = useProjects.getState()+ const pid = store.activeProjectId+ const board = store.getProject(pid ?? '')?.kanban+ const sessions = nodesRef.current+ .map(toKanbanSession)+ .filter((s): s is KanbanSession => s !== null)+ const titleOf = new Map(sessions.map((s) => [s.id, s.title || 'Untitled']))+ const sessionIds = sessions.map((s) => s.id)+ if (!board) {+ // No board yet (lazy default not written) — every session is Ungrouped.+ const lines = [+ 'Kanban board: (no columns yet — default To Do / In Progress / Done appears on first edit)',+ `Ungrouped (${sessionIds.length}):`,+ ...sessionIds.map((id) => ` - ${titleOf.get(id)} (id: ${id})`)+ ]+ reply({+ ok: true,+ message: lines.join('\n'),+ result: { columns: [], ungrouped: sessionIds }+ })+ return+ }+ const columnsOut = board.columns.map((c) => {+ const ids = assignedTo(board, c.id).filter((id) => titleOf.has(id))+ return { id: c.id, title: c.title, cards: ids }+ })+ const ungroupedIds = unassigned(board, sessionIds)+ const fmt = (ids: string[]) => ids.map((id) => ` - ${titleOf.get(id)} (id: ${id})`)+ const lines = [+ 'Kanban board:',+ ...columnsOut.flatMap((c) => [+ `${c.title} (${c.cards.length}) [column id: ${c.id}]:`,+ ...fmt(c.cards)+ ]),+ `Ungrouped (${ungroupedIds.length}):`,+ ...fmt(ungroupedIds)+ ]+ reply({+ ok: true,+ message: lines.join('\n'),+ result: { columns: columnsOut, ungrouped: ungroupedIds }+ })+ return+ }+ case 'assign': {+ // Move a session card between kanban columns — the "agent-driven card movement" the+ // board's own scope note called out as missing. Board metadata ONLY: assignNode writes+ // an assignment, it never touches the canvas node, its group, or the running session.+ const nodeId = (args.node ?? '').trim()+ const target = nodesRef.current.find((n) => n.id === nodeId)+ if (!target || toKanbanSession(target) === null) {+ reply({ ok: false, error: `assign: --node names no session card (${nodeId || 'missing'})` })+ return+ }+ const store = useProjects.getState()+ const pid = store.activeProjectId+ if (!pid) {+ reply({ ok: false, error: 'assign: no active project' })+ return+ }+ // Read prev fresh so the board-log diff below has the SAME base the write mutates —+ // a lazy-default board is materialized here (as the first UI edit would) so the+ // resolved column ids are stable across the write and the diff.+ const prev = store.getProject(pid)?.kanban ?? defaultKanban()+ // Resolve --column by id or (case-insensitive) title; empty / "ungrouped" → null+ // (unassign). `undefined` = no such column, so report what IS available.+ const rawCol = (args.column ?? '').trim()+ const columnId = resolveColumnRef(prev, rawCol)+ if (columnId === undefined) {+ reply({+ ok: false,+ error: `assign: no column "${rawCol}" — columns: ${prev.columns.map((c) => c.title).join(', ') || '(none)'}`+ })+ return+ }+ const before = (args.before ?? '').trim() || null+ const next = assignNode(prev, nodeId, columnId, before)+ store.setProjectKanban(pid, next)+ markDirty()+ // Board-log the move through the same diff funnel the UI uses (card-moved), so the+ // board feed reads identically whether a person or an agent moved the card. cardTitle+ // returns '' ONLY for a dead node; a live card with no title maps to 'Untitled'.+ const cardTitle = (id: string): string => {+ const n = nodesRef.current.find((x) => x.id === id)+ const card = n ? toKanbanSession(n) : null+ return card ? card.title || 'Untitled' : ''+ }+ for (const { nodeId: nid, event } of boardLogEvents(prev, next, cardTitle)) {+ useBoardLog.getState().append(api, pid, { kind: 'event', nodeId: nid, event })+ }+ const where = columnId+ ? next.columns.find((c) => c.id === columnId)?.title ?? columnId+ : 'Ungrouped'+ reply({+ ok: true,+ message: `moved ${cardTitle(nodeId) || nodeId} to ${where}`,+ result: { node: nodeId, column: columnId }+ })+ return+ }default:reply({ ok: false, error: `unknown verb: ${verb}` })}diff --git a/src/renderer/lib/kanban.test.ts b/src/renderer/lib/kanban.test.tsindex 4b20edea2..2feae223c 100644--- a/src/renderer/lib/kanban.test.ts+++ b/src/renderer/lib/kanban.test.ts@@ -6,7 +6,7 @@ import {setCardDue, setCardPriority, toggleAssignee, unassigned,boardLabels, cardMatchesLabelFilter, createLabel, deleteLabel, labelColor, labelsForCard,recolorLabel, renameLabel, reorderLabels, toggleCardLabel,- autoLabelColor, migrateProjectTags, migrateTagsToLabels, setCardLabels+ autoLabelColor, migrateProjectTags, migrateTagsToLabels, setCardLabels, resolveColumnRef} from './kanban'import type { Project } from '@shared/types'@@ -128,6 +128,16 @@ describe('assignments', () => {const same = board()expect(pruneAssignments(same, ['n1', 'n2', 'n3'])).toBe(same)})+ it('resolveColumnRef: id, title (case-insensitive), ungrouped/empty → null, unknown → undefined', () => {+ // The agent-facing `assign --column` resolver. An agent naturally passes a title.+ expect(resolveColumnRef(board(), 'a')).toBe('a')+ expect(resolveColumnRef(board(), 'doing')).toBe('b')+ expect(resolveColumnRef(board(), ' To Do ')).toBe('a')+ // null (unassign) and undefined (no such column) must stay distinguishable.+ expect(resolveColumnRef(board(), '')).toBeNull()+ expect(resolveColumnRef(board(), 'Ungrouped')).toBeNull()+ expect(resolveColumnRef(board(), 'nope')).toBeUndefined()+ })})describe('columnForNode', () => {diff --git a/src/renderer/lib/kanban.ts b/src/renderer/lib/kanban.tsindex 74e95434c..86da913d8 100644--- a/src/renderer/lib/kanban.ts+++ b/src/renderer/lib/kanban.ts@@ -95,6 +95,22 @@ export function assignedTo(k: ProjectKanban, columnId: string): string[] {return k.assignments.filter((a) => a.columnId === columnId).map((a) => a.nodeId)}+/**+ * Resolve a user-supplied column reference (from the canvas-control `assign` verb) to a column+ * id. Empty or 'ungrouped' (case-insensitive) → `null` (the virtual Ungrouped column = unassign).+ * Otherwise match by exact id first, then by case-insensitive title. Unknown → `undefined`, so the+ * caller can distinguish "send to Ungrouped" (null) from "no such column" (undefined) and report+ * the available columns. Agents naturally pass a title ("In Progress"); ids come from `board`.+ */+export function resolveColumnRef(k: ProjectKanban, ref: string): string | null | undefined {+ const raw = ref.trim()+ if (!raw || raw.toLowerCase() === 'ungrouped') return null+ const byId = k.columns.find((c) => c.id === raw)+ if (byId) return byId.id+ const byTitle = k.columns.find((c) => c.title.toLowerCase() === raw.toLowerCase())+ return byTitle ? byTitle.id : undefined+}+/** Ids from `sessionIds` with no live assignment — never assigned, or assigned to a column* that no longer exists (e.g. a git merge kept the assignment but lost the column). Order* follows `sessionIds` (= canvas order). */