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(kanban): unify node tags into board labels + color-at-create + default view
enes329a5fa01648
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex a81fc2e6e..ed58c36fb 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -5,6 +5,7 @@ import { PromptDialogHost } from './components/promptDialog'import { SessionProvider } from './session/session'import { localSession } from './session/localSession'import { useSettings } from './state/settings'+import { useViewMode } from './state/viewMode'import { setWebglEnabled } from './terminal/webgl-budget'export default function App() {@@ -16,6 +17,13 @@ export default function App() {setWebglEnabled(gpu !== false)}, [gpu])+ // Keep the view-mode store's default in sync with the Settings choice, so projects the user+ // hasn't explicitly toggled follow it (and flip live when the setting changes).+ const defaultView = useSettings((s) => s.settings.defaultProjectView)+ useEffect(() => {+ useViewMode.getState().setDefaultView(defaultView === 'kanban' ? 'kanban' : 'canvas')+ }, [defaultView])+return (<SessionProvider session={localSession}><ReactFlowProvider>diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex e06909ab3..f079a0dcc 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -208,11 +208,12 @@ import type { SshServer, SshConnection } from '@shared/ssh'import { sshHostKey } from '@shared/ssh'import type { CanvasNodeState, Project, ProjectKanban, SshProjectStatus, TranscriptHit } from '@shared/types'import { KanbanView, type KanbanCreateChoice, type KanbanSession } from '../components/kanban/KanbanView'-import { assignNode, defaultKanban } from '../lib/kanban'+import { assignNode, defaultKanban, labelsForCard, migrateProjectTags } from '../lib/kanban'+import { registerWorkspaceDirty } from '../state/workspaceDirty'import { isHidden } from '../lib/ui-visibility'import { boardLogEvents } from '../lib/boardLogDiff'import { useBoardLog } from '../state/boardLog'-import { isKanbanOpen, useViewMode } from '../state/viewMode'+import { isKanbanOpen, useViewMode, viewFor } from '../state/viewMode'import {createCanvasPublisher,isEphemeralNodeId,@@ -1346,7 +1347,11 @@ export function Canvas() {})api.workspace.load().then((ws) => {if (cancelled) return- useProjects.getState().hydrate(ws)+ // One-time unification: fold legacy free-text node `tags` into board labels (idempotent —+ // a project with no tagged nodes is returned unchanged). The unconditional save below then+ // persists the conversion, so the next load is a no-op.+ const projects = ws.projects.map(migrateProjectTags)+ useProjects.getState().hydrate({ ...ws, projects })// Upgrade the on-disk format (e.g. v1 -> v2 migration) right away.void api.workspace.save(useProjects.getState().toWorkspace())})@@ -1472,8 +1477,11 @@ export function Canvas() {const markDirty = useCallback(() => {if (!loadingRef.current) setDirty(true)}, [])+ // Expose markDirty to surfaces outside Canvas (a canvas node editing its kanban labels), so they+ // ride the same debounced whole-file save.+ useEffect(() => registerWorkspaceDirty(markDirty), [markDirty])- const kanbanOpen = useViewMode((s) => !!activeProjectId && !!s.viewByProject[activeProjectId])+ const kanbanOpen = useViewMode((s) => !!activeProjectId && viewFor(s, activeProjectId) === 'kanban')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).@@ -6890,12 +6898,13 @@ export function Canvas() {}))const cs = useAgentStatus.getState()+ // Labels replaced free-text tags — search matches label NAMES now (unified system).+ const searchKanban = useProjects.getState().getProject(useProjects.getState().activeProjectId)?.kanbannodesRef.current.filter((n) => n.type !== 'group').forEach((n) => {- const tags = (n.data.tags as string[]) ?? []- const a =- (n.data.agentId as AgentId | undefined) ?? (tags.includes('claude') ? 'claude' : undefined)+ const labelNames = searchKanban ? labelsForCard(searchKanban, n.id).map((l) => l.name) : []+ const a = (n.data.agentId as AgentId | undefined) ?? undefinedconst isAgent = !!a && hasHooks(a)const session = isAgent ? cs.byId[n.id]?.session : undefined// Show the running agent's icon (claude/codex/gemini/custom) when the node is an agent,@@ -6913,7 +6922,7 @@ export function Canvas() {id: `node-${n.id}`,label: `Go to ${n.data.title}`,section: 'Opened terminals',- hint: [tags.join(' '), session, isAgent ? `nt-${n.id}` : '']+ hint: [labelNames.join(' '), session, isAgent ? `nt-${n.id}` : ''].filter(Boolean).join(' '),icon,diff --git a/src/renderer/components/NodeTags.tsx b/src/renderer/components/NodeTags.tsxdeleted file mode 100644index 810645f6e..000000000--- a/src/renderer/components/NodeTags.tsx+++ /dev/null@@ -1,54 +0,0 @@-import { useState } from 'react'--interface NodeTagsProps {- tags: string[]- onChange: (tags: string[]) => void-}--/** Inline tag chips with add/remove, used inside nodes. */-export function NodeTags({ tags, onChange }: NodeTagsProps) {- const [adding, setAdding] = useState(false)- const [draft, setDraft] = useState('')-- const commit = () => {- const t = draft.trim()- if (t && !tags.includes(t)) onChange([...tags, t])- setDraft('')- setAdding(false)- }-- return (- <div className="node-tags nodrag">- {tags.map((t) => (- <span key={t} className="node-tag">- {t}- <button title="Remove tag" onClick={() => onChange(tags.filter((x) => x !== t))}>- ×- </button>- </span>- ))}- {adding ? (- <input- className="node-tag-input"- value={draft}- autoFocus- spellCheck={false}- placeholder="tag"- onChange={(e) => setDraft(e.target.value)}- onKeyDown={(e) => {- if (e.key === 'Enter') commit()- if (e.key === 'Escape') {- setDraft('')- setAdding(false)- }- }}- onBlur={commit}- />- ) : (- <button className="node-tag-add" title="Add tag" onClick={() => setAdding(true)}>- + tag- </button>- )}- </div>- )-}diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex f2f204b6d..68341c2f2 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -1,7 +1,7 @@import { useEffect, useMemo, useRef, useState } from 'react'import { createPortal } from 'react-dom'import { useProjects } from '../state/projects'-import { useViewMode } from '../state/viewMode'+import { useViewMode, viewFor } from '../state/viewMode'import { useAgentStatus } from '../state/agentStatus'import { useSettings } from '../state/settings'import { accountsForProject, sshAccountsHint, systemAccountDisplay } from '../state/workspace'@@ -80,7 +80,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 && !!s.viewByProject[activeId])+ const kanbanActive = useViewMode((s) => !!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) => {diff --git a/src/renderer/components/kanban/LabelPicker.tsx b/src/renderer/components/kanban/LabelPicker.tsxindex ae04986d8..b9cdcc103 100644--- a/src/renderer/components/kanban/LabelPicker.tsx+++ b/src/renderer/components/kanban/LabelPicker.tsx@@ -1,7 +1,7 @@import { useMemo, useRef, useState } from 'react'import type { KanbanLabelColor, ProjectKanban } from '@shared/types'import {- KANBAN_LABEL_COLORS,+ autoLabelColor,boardLabels,createLabel,deleteLabel,@@ -12,13 +12,6 @@ import {} from '../../lib/kanban'import { LABEL_COLOR_OPTIONS, labelSwatch } from '../../lib/kanbanLabelColors'-/** Auto-color for a newly created label: rotate the palette (skipping 'default') so consecutive- * new labels get distinct colors, Notion-style. */-function nextLabelColor(board: ProjectKanban): KanbanLabelColor {- const colors = KANBAN_LABEL_COLORS.filter((c) => c !== 'default')- return colors[boardLabels(board).length % colors.length]-}-/*** Notion-style label picker: type to filter existing labels or CREATE a new one inline, click a row* to assign/unassign, and edit a label (rename / recolor / delete) from its ⋯ menu. All edits go@@ -35,6 +28,10 @@ export function LabelPicker({}): React.JSX.Element {const [query, setQuery] = useState('')const [editing, setEditing] = useState<string | null>(null)+ // Color chosen for the NEXT label created inline. Seeded to the rotating auto-color; the user can+ // override it before hitting Create, and it re-seeds to the next auto-color after each create.+ const [createColor, setCreateColor] = useState<KanbanLabelColor>(() => autoLabelColor(board))+ const [colorMenuOpen, setColorMenuOpen] = useState(false)const inputRef = useRef<HTMLInputElement>(null)const all = boardLabels(board)@@ -48,9 +45,11 @@ export function LabelPicker({const toggle = (id: string) => onChange(toggleCardLabel(board, nodeId, id))const create = () => {if (!canCreate) return- const { k, id } = createLabel(board, query.trim(), nextLabelColor(board))+ const { k, id } = createLabel(board, query.trim(), createColor)onChange(toggleCardLabel(k, nodeId, id))setQuery('')+ setColorMenuOpen(false)+ setCreateColor(autoLabelColor(k)) // advance to the next auto-color for the following createinputRef.current?.focus()}@@ -154,15 +153,44 @@ export function LabelPicker({)})}{canCreate && (- <button className="label-picker__create" onClick={create}>- Create{' '}- <span- className="kanban-label-chip"- style={{ background: labelSwatch(nextLabelColor(board)).bg, color: labelSwatch(nextLabelColor(board)).fg }}+ <div className="label-picker__createrow">+ <button+ className="label-picker__createcolor"+ title="Pick color"+ onClick={() => setColorMenuOpen((v) => !v)}>- {query.trim()}- </span>- </button>+ <span className="label-picker__swatch" style={{ background: labelSwatch(createColor).bg }} />+ <span className="label-picker__caret">▾</span>+ </button>+ <button className="label-picker__create" onClick={create}>+ Create{' '}+ <span+ className="kanban-label-chip"+ style={{ background: labelSwatch(createColor).bg, color: labelSwatch(createColor).fg }}+ >+ {query.trim()}+ </span>+ </button>+ {colorMenuOpen && (+ <div className="label-picker__createcolors">+ {LABEL_COLOR_OPTIONS.map((opt) => (+ <button+ key={opt.color}+ className="label-picker__colorrow"+ onClick={() => {+ setCreateColor(opt.color)+ setColorMenuOpen(false)+ inputRef.current?.focus()+ }}+ >+ <span className="label-picker__swatch" style={{ background: opt.bg }} />+ <span className="label-picker__colorname">{opt.title}</span>+ {createColor === opt.color && <span className="label-picker__check">✓</span>}+ </button>+ ))}+ </div>+ )}+ </div>)}</div></div>diff --git a/src/renderer/components/kanban/NodeLabels.tsx b/src/renderer/components/kanban/NodeLabels.tsxnew file mode 100644index 000000000..c96b2114c--- /dev/null+++ b/src/renderer/components/kanban/NodeLabels.tsx@@ -0,0 +1,51 @@+import { useMemo, useState } from 'react'+import type { ProjectKanban } from '@shared/types'+import { useProjects } from '../../state/projects'+import { markWorkspaceDirty } from '../../state/workspaceDirty'+import { defaultKanban, labelsForCard } from '../../lib/kanban'+import { LabelChips } from './LabelChips'+import { LabelPicker } from './LabelPicker'++/**+ * The canvas node's label row — the SAME board labels as the kanban card (unified: a node's+ * "tags" are now board labels). Shows the colored chips and a "+" that opens the Notion picker to+ * create/assign/edit labels. Edits go to the active project's kanban and persist via the shared+ * workspace-dirty seam (this component lives outside Canvas). A node only ever renders in the+ * active project, so the active project's board is the right one.+ */+export function NodeLabels({ nodeId }: { nodeId: string }): React.JSX.Element {+ const [open, setOpen] = useState(false)+ const kanban = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.kanban)+ // Adding the first label seeds the default board (To Do / In Progress / Done), exactly like the+ // board's own lazy default — so a node-side label add never leaves an empty column-less board.+ const board = useMemo(() => kanban ?? defaultKanban(), [kanban])+ const labels = labelsForCard(board, nodeId)++ const commit = (next: ProjectKanban): void => {+ const pid = useProjects.getState().activeProjectId+ if (!pid) return+ useProjects.getState().setProjectKanban(pid, next)+ markWorkspaceDirty()+ }++ return (+ <div className="term-node__labelrow nodrag">+ <LabelChips labels={labels} size="sm" />+ <button+ className="term-node__labeladd"+ title="Add label"+ onClick={() => setOpen((v) => !v)}+ >+ + Label+ </button>+ {open && (+ <>+ <div className="label-picker__scrim" onMouseDown={() => setOpen(false)} />+ <div className="label-picker__pop">+ <LabelPicker board={board} nodeId={nodeId} onChange={commit} />+ </div>+ </>+ )}+ </div>+ )+}diff --git a/src/renderer/components/onboarding/OnboardingFlow.tsx b/src/renderer/components/onboarding/OnboardingFlow.tsxindex a93941333..7065cd663 100644--- a/src/renderer/components/onboarding/OnboardingFlow.tsx+++ b/src/renderer/components/onboarding/OnboardingFlow.tsx@@ -315,6 +315,23 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {</>)}</div>+ <div className="onb-defaultview">+ <span className="onb-defaultview__label">Open new projects as</span>+ <div className="onb-seg" role="group" aria-label="Default view">+ <button+ className={`onb-seg__btn${settings.defaultProjectView !== 'kanban' ? ' is-on' : ''}`}+ onClick={() => update({ defaultProjectView: 'canvas' })}+ >+ Canvas+ </button>+ <button+ className={`onb-seg__btn${settings.defaultProjectView === 'kanban' ? ' is-on' : ''}`}+ onClick={() => update({ defaultProjectView: 'kanban' })}+ >+ Kanban+ </button>+ </div>+ </div></>)}diff --git a/src/renderer/components/settings/sections/BehaviorSection.tsx b/src/renderer/components/settings/sections/BehaviorSection.tsxindex 6db3dab2a..667310665 100644--- a/src/renderer/components/settings/sections/BehaviorSection.tsx+++ b/src/renderer/components/settings/sections/BehaviorSection.tsx@@ -8,6 +8,10 @@ import { Select } from '@renderer/ui/Select'import { hintLabel } from '@shared/platform-utils'const ROWS = {+ defaultView: {+ title: 'Default view',+ keywords: ['default', 'view', 'kanban', 'board', 'canvas', 'project']+ },gridSize: { title: 'Grid size', keywords: ['grid', 'size', 'snap'] },nodeSize: {title: 'Default node size',@@ -33,6 +37,22 @@ export function BehaviorSection({ isActive }: { isActive: boolean }): React.JSX.const update = useSettings((s) => s.update)return (<SettingsSection id="behavior" title="Behavior" isActive={isActive} searchEntries={ENTRIES}>+ <SearchableRow {...ROWS.defaultView}>+ <FieldRow+ label="Default view"+ description="How a project opens when you haven't switched it. Projects you toggle keep their own choice."+ control={+ <Select+ aria-label="Default view"+ value={settings.defaultProjectView === 'kanban' ? 'kanban' : 'canvas'}+ onChange={(e) => update({ defaultProjectView: e.target.value as 'canvas' | 'kanban' })}+ >+ <option value="canvas">Canvas</option>+ <option value="kanban">Kanban board</option>+ </Select>+ }+ />+ </SearchableRow><SearchableRow {...ROWS.gridSize}><FieldRowlabel="Grid size"diff --git a/src/renderer/lib/kanban.test.ts b/src/renderer/lib/kanban.test.tsindex e8dca68ae..4b9866e6d 100644--- a/src/renderer/lib/kanban.test.ts+++ b/src/renderer/lib/kanban.test.ts@@ -5,8 +5,10 @@ import {cardMeta, columnForNode, nextColumnColor, pruneAssignments, recolorColumn, renameColumn,setCardDue, setCardPriority, toggleAssignee, unassigned,boardLabels, cardMatchesLabelFilter, createLabel, deleteLabel, labelColor, labelsForCard,- recolorLabel, renameLabel, reorderLabels, toggleCardLabel+ recolorLabel, renameLabel, reorderLabels, toggleCardLabel,+ autoLabelColor, migrateProjectTags, migrateTagsToLabels, setCardLabels} from './kanban'+import type { Project } from '@shared/types'const board = (): ProjectKanban => ({columns: [@@ -251,3 +253,76 @@ describe('board labels', () => {expect(cardMeta(k, 'n1')?.labels).toEqual([a])})})++describe('tag → label migration', () => {+ const proj = (nodes: Array<Partial<Project['nodes'][number]> & { id: string }>, kanban?: Project['kanban']): Project => ({+ id: 'p', name: 'P', color: '#888', viewport: { x: 0, y: 0, zoom: 1 },+ nodes: nodes.map((n) => ({+ kind: 'terminal', position: { x: 0, y: 0 }, size: { width: 1, height: 1 },+ title: n.id, color: '#888', group: null, ...n+ })) as Project['nodes'],+ ...(kanban ? { kanban } : {})+ })++ it('setCardLabels sets the exact list; empty drops the entry', () => {+ let k = createLabel(board(), 'A', 'blue').k+ const a = boardLabels(k)[0].id+ k = setCardLabels(k, 'n1', [a, a]) // dedup+ expect(cardMeta(k, 'n1')?.labels).toEqual([a])+ expect(cardMeta(setCardLabels(k, 'n1', []), 'n1')).toBeUndefined()+ })++ it('autoLabelColor rotates the palette skipping default', () => {+ let k = board()+ expect(autoLabelColor(k)).toBe('gray')+ k = createLabel(k, 'A', 'gray').k+ expect(autoLabelColor(k)).toBe('brown')+ })++ it('migrateTagsToLabels creates a label per unique tag, reuses by name (case-insensitive)', () => {+ let k = migrateTagsToLabels(board(), [{ nodeId: 'n1', tags: ['bug', 'bug', 'ui'] }])+ expect(boardLabels(k).map((l) => l.name)).toEqual(['bug', 'ui'])+ expect(labelsForCard(k, 'n1').map((l) => l.name)).toEqual(['bug', 'ui'])+ // a second node with the SAME tag name (different case) reuses the label+ k = migrateTagsToLabels(k, [{ nodeId: 'n2', tags: ['BUG'] }])+ expect(boardLabels(k)).toHaveLength(2) // no dup created+ expect(labelsForCard(k, 'n2').map((l) => l.name)).toEqual(['bug'])+ })++ it('migrateProjectTags: tags → labels, node.tags cleared, unchanged when no tags', () => {+ const p = proj([{ id: 'n1', tags: ['bug', 'backend'] }, { id: 'n2' }])+ const m = migrateProjectTags(p)+ expect(boardLabels(m.kanban!).map((l) => l.name)).toEqual(['bug', 'backend'])+ expect(labelsForCard(m.kanban!, 'n1').map((l) => l.name)).toEqual(['bug', 'backend'])+ expect((m.nodes[0] as { tags?: unknown }).tags).toBeUndefined() // cleared+ // a project with NO tagged nodes is returned by identity (idempotent no-op)+ const clean = proj([{ id: 'n1' }])+ expect(migrateProjectTags(clean)).toBe(clean)+ // running twice is a no-op (the second run finds no tags)+ expect(migrateProjectTags(m)).toBe(m)+ })++ it("migrateProjectTags honors the legacy ['claude'] marker: agentId set, NOT a label", () => {+ const p = proj([{ id: 'n1', tags: ['claude'] }, { id: 'n2', tags: ['claude', 'wip'] }])+ const m = migrateProjectTags(p)+ // 'claude' becomes agentId, never a label+ expect(m.nodes.find((n) => n.id === 'n1')!.agentId).toBe('claude')+ expect(boardLabels(m.kanban!).map((l) => l.name)).toEqual(['wip']) // only the non-claude tag+ expect(labelsForCard(m.kanban!, 'n1')).toEqual([]) // claude-only node gets no label+ expect(labelsForCard(m.kanban!, 'n2').map((l) => l.name)).toEqual(['wip'])+ // a node that ALREADY has agentId is not overwritten+ const withAgent = proj([{ id: 'n1', tags: ['claude'], agentId: 'codex' }])+ expect(migrateProjectTags(withAgent).nodes[0].agentId).toBe('codex')+ })++ it('migrateProjectTags reuses an existing board label and seeds a default board when absent', () => {+ // no kanban → a default board (3 columns) is seeded so the board is never column-less+ const m = migrateProjectTags(proj([{ id: 'n1', tags: ['x'] }]))+ expect(m.kanban!.columns).toHaveLength(3)+ // an existing label of the same name is reused, not duplicated+ const existing = createLabel(defaultKanban(), 'x', 'red').k+ const m2 = migrateProjectTags(proj([{ id: 'n1', tags: ['x'] }], existing))+ expect(boardLabels(m2.kanban!)).toHaveLength(1)+ expect(labelsForCard(m2.kanban!, 'n1')[0]).toMatchObject({ name: 'x', color: 'red' })+ })+})diff --git a/src/renderer/lib/kanban.ts b/src/renderer/lib/kanban.tsindex 470b964a2..1c1015ebf 100644--- a/src/renderer/lib/kanban.ts+++ b/src/renderer/lib/kanban.ts@@ -1,4 +1,4 @@-import type { BoardLogAuthor, KanbanAssignment, KanbanCardMeta, KanbanColumn, KanbanLabel, KanbanLabelColor, KanbanPriority, ProjectKanban } from '@shared/types'+import type { BoardLogAuthor, CanvasNodeState, KanbanAssignment, KanbanCardMeta, KanbanColumn, KanbanLabel, KanbanLabelColor, KanbanPriority, Project, ProjectKanban } from '@shared/types'import { NODE_COLORS } from '../state/workspace'// Pure kanban board transforms — the ONLY place board structure changes. The UI computes@@ -324,3 +324,74 @@ export function cardMatchesLabelFilter(const on = new Set(cardMeta(k, nodeId)?.labels ?? [])return filterIds.some((id) => on.has(id))}++/** Set a card's exact label list (dedup; empty drops the field/entry). */+export function setCardLabels(k: ProjectKanban, nodeId: string, ids: string[]): ProjectKanban {+ const cur = cardMeta(k, nodeId)+ const labels = [...new Set(ids)]+ return withCardMeta(k, nodeId, {+ assignees: cur?.assignees,+ dueAt: cur?.dueAt,+ priority: cur?.priority,+ ...(labels.length ? { labels } : {})+ })+}++/** Auto-color for a created label: rotate the palette skipping 'default' (Notion-style). */+export function autoLabelColor(k: ProjectKanban): KanbanLabelColor {+ const colors = KANBAN_LABEL_COLORS.filter((c) => c !== 'default')+ return colors[boardLabels(k).length % colors.length]+}++// ── Unification: legacy free-text node tags → board labels ────────────────────────────────────++/** Fold each node's free-text tags into board labels: reuse an existing label by name (case-+ * insensitive) or create one (auto-colored), then apply its id to that card. Pure; the caller+ * clears the nodes' `tags`. Idempotent by construction (an empty tag list contributes nothing). */+export function migrateTagsToLabels(+ k: ProjectKanban,+ nodeTags: Array<{ nodeId: string; tags: string[] }>+): ProjectKanban {+ let board = k+ for (const { nodeId, tags } of nodeTags) {+ const names = [...new Set(tags.map((t) => t.trim()).filter(Boolean))]+ if (!names.length) continue+ const ids: string[] = []+ for (const name of names) {+ const existing = boardLabels(board).find((l) => l.name.toLowerCase() === name.toLowerCase())+ if (existing) ids.push(existing.id)+ else {+ const res = createLabel(board, name, autoLabelColor(board))+ board = res.k+ ids.push(res.id)+ }+ }+ const cur = cardMeta(board, nodeId)?.labels ?? []+ board = setCardLabels(board, nodeId, [...cur, ...ids])+ }+ return board+}++/**+ * One-time per-project unification, run at workspace hydrate (idempotent — a project whose nodes+ * carry no `tags` is returned UNCHANGED, by identity). For every node with `tags`:+ * - the legacy `['claude']` MARKER is honored (agentId ← 'claude' when unset) — it was never a+ * user tag, so it is NOT turned into a label (mirrors nodeStatesToFlow's own claude migration);+ * - every other tag becomes a board label (reused/created) applied to that card;+ * - the node's `tags` field is dropped (so the next hydrate is a no-op).+ */+export function migrateProjectTags(project: Project): Project {+ const tagged = project.nodes.filter((n) => Array.isArray(n.tags) && n.tags.length > 0)+ if (!tagged.length) return project+ const nodeTags = tagged+ .map((n) => ({ nodeId: n.id, tags: (n.tags as string[]).filter((t) => t !== 'claude') }))+ .filter((x) => x.tags.length > 0)+ const kanban = migrateTagsToLabels(project.kanban ?? defaultKanban(), nodeTags)+ const nodes: CanvasNodeState[] = project.nodes.map((n) => {+ if (!Array.isArray(n.tags) || !n.tags.length) return n+ const hadClaude = n.tags.includes('claude')+ const { tags: _t, ...rest } = n+ return !n.agentId && hadClaude ? { ...rest, agentId: 'claude' } : rest+ })+ return { ...project, nodes, kanban }+}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex d2035ad1d..1696f94ae 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -60,9 +60,7 @@ import {} from '../terminal/agent-restart'import { FindBar } from '../components/FindBar'import { IconSearch, IconChat, IconMic, IconReload } from '../components/icons'-import { NodeTags } from '../components/NodeTags'-import { LabelChips } from '../components/kanban/LabelChips'-import { labelsForCard } from '../lib/kanban'+import { NodeLabels } from '../components/kanban/NodeLabels'import { Tooltip } from '../components/Tooltip'import { useTerminalSearch } from '../terminal/useTerminalSearch'import { ContextMeter } from '../components/ContextMeter'@@ -74,7 +72,7 @@ import type { ClientId } from '@shared/presence'import { PresenceChips } from '../components/PresenceChips'import { useAgentNodes } from '../state/agentNodes'import { useProjects } from '../state/projects'-import { useViewMode } from '../state/viewMode'+import { useViewMode, viewFor } from '../state/viewMode'import { useSshConn } from '../state/sshConn'import { useWorktrees } from '../state/worktrees'import { isRemoteSessionNode } from '@shared/worktree'@@ -387,7 +385,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN// exactly like a park, and the visible modal drives the shared grid. A node only ever lives in the// ACTIVE project's React Flow, so the active project's view is the one that matters.const boardOpen = useViewMode(- (s) => s.viewByProject[useProjects.getState().activeProjectId ?? ''] === 'kanban'+ (s) => viewFor(s, useProjects.getState().activeProjectId ?? '') === 'kanban')const boardOpenRef = useRef(boardOpen)const dwellRef = useRef<ReturnType<typeof setTimeout> | null>(null)@@ -422,17 +420,6 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasNconst skipBlurRef = useRef(false)const mdMode = !!data.mdModeconst collapsed = !!data.collapsed- const tags = (data.tags as string[]) ?? []- // Kanban labels applied to this card, resolved from the ACTIVE project's board palette (a node- // only ever lives in the active project). Read the kanban ref reactively; resolve in a memo so a- // fresh array doesn't churn the selector.- const projectKanbanForLabels = useProjects(- (s) => s.projects.find((p) => p.id === s.activeProjectId)?.kanban- )- const kanbanLabels = useMemo(- () => (projectKanbanForLabels ? labelsForCard(projectKanbanForLabels, id) : []),- [projectKanbanForLabels, id]- )// Derive the node's agent once, through the shared helper — the canvas menu decides whether to// offer this node's in-place restart from the SAME derivation, and a second copy drifting from// this one yields a row whose closure refuses every click.@@ -2055,13 +2042,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN/>)}- {kanbanLabels.length > 0 && (- <LabelChips labels={kanbanLabels} size="sm" className="term-node__labels nodrag" />- )}-- {!collapsed && (- <NodeTags tags={tags} onChange={(t) => updateNodeData(id, { tags: t })} />- )}+ {!collapsed && <NodeLabels nodeId={id} />}{/* Body always mounted (keeps xterm alive); hidden via CSS when collapsed. */}<divdiff --git a/src/renderer/state/viewMode.test.ts b/src/renderer/state/viewMode.test.tsindex 058bf29af..d7d501769 100644--- a/src/renderer/state/viewMode.test.ts+++ b/src/renderer/state/viewMode.test.ts@@ -1,21 +1,33 @@-import { describe, it, expect } from 'vitest'-import { parseViewMap, useViewMode, isKanbanOpen } from './viewMode'+import { describe, it, expect, beforeEach } from 'vitest'+import { parseViewMap, useViewMode, isKanbanOpen, viewFor } from './viewMode'describe('parseViewMap', () => {- it('keeps only kanban entries, tolerates garbage', () => {+ it('keeps canvas/kanban entries, tolerates garbage', () => {expect(parseViewMap(null)).toEqual({})expect(parseViewMap('not json')).toEqual({})expect(parseViewMap('[1,2]')).toEqual({})- expect(parseViewMap(JSON.stringify({ p1: 'kanban', p2: 'canvas', p3: 42 }))).toEqual({ p1: 'kanban' })+ expect(parseViewMap(JSON.stringify({ p1: 'kanban', p2: 'canvas', p3: 42 }))).toEqual({ p1: 'kanban', p2: 'canvas' })})})-describe('toggle', () => {- it('flips a project in and out of kanban', () => {+describe('toggle + default', () => {+ beforeEach(() => useViewMode.setState({ viewByProject: {}, defaultView: 'canvas' }))+ it('flips a project explicitly (stores canvas/kanban, overriding the default)', () => {useViewMode.getState().toggle('p1')expect(useViewMode.getState().viewByProject.p1).toBe('kanban')useViewMode.getState().toggle('p1')- expect(useViewMode.getState().viewByProject.p1).toBeUndefined()+ expect(useViewMode.getState().viewByProject.p1).toBe('canvas') // explicit, not deleted+ })+ it('an unset project follows the default; toggling flips FROM the resolved default', () => {+ const s = useViewMode.getState()+ expect(viewFor(s, 'x')).toBe('canvas')+ expect(isKanbanOpen('x')).toBe(false)+ useViewMode.setState({ defaultView: 'kanban' })+ expect(isKanbanOpen('x')).toBe(true) // now follows the kanban default+ // toggling an unset project flips off the resolved default → explicit 'canvas'+ useViewMode.getState().toggle('x')+ expect(useViewMode.getState().viewByProject.x).toBe('canvas')+ expect(isKanbanOpen('x')).toBe(false) // explicit choice beats the kanban default})})@@ -32,7 +44,7 @@ describe('card requests (board-aware "go to node")', () => {})it('a view toggle drops an unconsumed request', () => {- useViewMode.setState({ viewByProject: {}, requestedCardNodeId: null })+ useViewMode.setState({ viewByProject: {}, defaultView: 'canvas', requestedCardNodeId: null })useViewMode.getState().toggle('p9')expect(isKanbanOpen('p9')).toBe(true)useViewMode.getState().requestCard('term-2')diff --git a/src/renderer/state/viewMode.ts b/src/renderer/state/viewMode.tsindex bbb8a9a2c..b5115c80c 100644--- a/src/renderer/state/viewMode.ts+++ b/src/renderer/state/viewMode.ts@@ -2,24 +2,29 @@ import { create } from 'zustand'// Which view each project shows (canvas or kanban) — PERSONAL, per machine: persisted in// localStorage, deliberately never in the git-shared .nodeterm/project.json (spec rule).-// Only 'kanban' entries are stored; an absent project id means canvas (the default).+//+// A project with an EXPLICIT entry uses it; a project with NONE follows `defaultView` (the+// Settings → "Default view" choice, synced in from settings). So changing the default flips every+// project the user hasn't explicitly toggled, while their explicit choices stick.export const PROJECT_VIEW_KEY = 'nodeterm.projectView'-/** Parses the persisted map, keeping only valid 'kanban' entries. Exported for tests. */-export function parseViewMap(raw: string | null): Record<string, 'kanban'> {+export type ProjectView = 'canvas' | 'kanban'++/** Parses the persisted map, keeping only valid canvas/kanban entries. Exported for tests. */+export function parseViewMap(raw: string | null): Record<string, ProjectView> {try {const parsed = raw ? (JSON.parse(raw) as Record<string, unknown>) : {}if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return {}- const out: Record<string, 'kanban'> = {}- for (const [id, v] of Object.entries(parsed)) if (v === 'kanban') out[id] = 'kanban'+ const out: Record<string, ProjectView> = {}+ for (const [id, v] of Object.entries(parsed)) if (v === 'kanban' || v === 'canvas') out[id] = vreturn out} catch {return {}}}-function save(v: Record<string, 'kanban'>): void {+function save(v: Record<string, ProjectView>): void {try {localStorage.setItem(PROJECT_VIEW_KEY, JSON.stringify(v))} catch {@@ -28,7 +33,10 @@ function save(v: Record<string, 'kanban'>): void {}interface ViewModeState {- viewByProject: Record<string, 'kanban'>+ viewByProject: Record<string, ProjectView>+ /** The fallback view for projects with no explicit entry (Settings → Default view). */+ defaultView: ProjectView+ setDefaultView(v: ProjectView): voidtoggle(projectId: string): void/*** A node whose CARD should be opened on the board, set by anything that "goes to" a node while@@ -44,19 +52,29 @@ interface ViewModeState {clearCardRequest(): void}+/** The resolved view for a project: its explicit entry, or the default. */+export function viewFor(s: Pick<ViewModeState, 'viewByProject' | 'defaultView'>, projectId: string): ProjectView {+ return s.viewByProject[projectId] ?? s.defaultView+}+export const useViewMode = create<ViewModeState>((set) => ({// localStorage guard: this module is also imported by node-environment vitest suites.viewByProject: parseViewMap(typeof localStorage === 'undefined' ? null : localStorage.getItem(PROJECT_VIEW_KEY)),+ defaultView: 'canvas',+ setDefaultView: (v) => set((s) => (s.defaultView === v ? s : { defaultView: v })),requestedCardNodeId: null,requestCard: (nodeId) => set({ requestedCardNodeId: nodeId }),clearCardRequest: () => set({ requestedCardNodeId: null }),toggle: (projectId) =>set((s) => {- const next = { ...s.viewByProject }- if (next[projectId]) delete next[projectId]- else next[projectId] = 'kanban'+ // Flip the RESOLVED view and store it EXPLICITLY, so this choice now overrides the default.+ const cur = s.viewByProject[projectId] ?? s.defaultView+ const next: Record<string, ProjectView> = {+ ...s.viewByProject,+ [projectId]: cur === 'kanban' ? 'canvas' : 'kanban'+ }if (typeof localStorage !== 'undefined') save(next)// 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.@@ -67,5 +85,5 @@ export const useViewMode = create<ViewModeState>((set) => ({/** True when the given project currently shows the kanban board (read outside React —* keydown handlers use this so they need no store subscription/deps). */export function isKanbanOpen(projectId: string): boolean {- return !!projectId && !!useViewMode.getState().viewByProject[projectId]+ return !!projectId && viewFor(useViewMode.getState(), projectId) === 'kanban'}diff --git a/src/renderer/state/workspaceDirty.ts b/src/renderer/state/workspaceDirty.tsnew file mode 100644index 000000000..9ca5d4d7a--- /dev/null+++ b/src/renderer/state/workspaceDirty.ts@@ -0,0 +1,18 @@+// A tiny seam so code OUTSIDE Canvas can trigger the same debounced workspace save Canvas owns.+// Canvas registers its `markDirty`; other surfaces (a canvas node editing its kanban labels) call+// `markWorkspaceDirty()`. No-op when nothing is registered (boot before Canvas mounts, tests).++let cb: (() => void) | null = null++/** Canvas calls this on mount with its markDirty; the returned fn unregisters on unmount. */+export function registerWorkspaceDirty(fn: () => void): () => void {+ cb = fn+ return () => {+ if (cb === fn) cb = null+ }+}++/** Trigger the debounced workspace save from anywhere in the renderer. */+export function markWorkspaceDirty(): void {+ cb?.()+}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex f62a463ba..7b618f1dc 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -7401,6 +7401,28 @@ body,.term-node__labels {padding: 0 8px 4px;}+/* Canvas node label row (unified with kanban labels): chips + an add button + the picker popover. */+.term-node__labelrow {+ position: relative;+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 4px;+ padding: 2px 8px 5px;+}+.term-node__labeladd {+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid rgba(255, 255, 255, 0.1);+ border-radius: 4px;+ color: rgba(255, 255, 255, 0.6);+ font-size: 10.5px;+ padding: 1px 6px;+ cursor: pointer;+}+.term-node__labeladd:hover {+ background: rgba(255, 255, 255, 0.12);+ color: #fff;+}.kanban-meta__row--labels {position: relative;align-items: center;@@ -7518,6 +7540,46 @@ body,.label-picker__create:hover {background: rgba(255, 255, 255, 0.06);}+.label-picker__createrow {+ position: relative;+ display: flex;+ align-items: center;+ gap: 2px;+}+.label-picker__createcolor {+ display: flex;+ align-items: center;+ gap: 2px;+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid rgba(255, 255, 255, 0.1);+ border-radius: 5px;+ padding: 4px 5px;+ cursor: pointer;+}+.label-picker__createcolor:hover {+ background: rgba(255, 255, 255, 0.12);+}+.label-picker__caret {+ font-size: 8px;+ color: rgba(255, 255, 255, 0.5);+}+.label-picker__createcolors {+ position: absolute;+ top: calc(100% + 4px);+ left: 0;+ z-index: 60;+ width: 170px;+ max-height: 240px;+ overflow-y: auto;+ background: #262628;+ border: 1px solid rgba(255, 255, 255, 0.16);+ border-radius: 7px;+ box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);+ padding: 5px;+ display: flex;+ flex-direction: column;+ gap: 1px;+}/* edit panel */.label-picker__edithead {display: flex;@@ -8193,6 +8255,37 @@ body,padding: 12px 16px;color: rgba(235, 235, 245, 0.8);}+.onb-defaultview {+ display: flex;+ align-items: center;+ gap: 10px;+ margin-top: 16px;+}+.onb-defaultview__label {+ font-size: 13px;+ color: rgba(235, 235, 245, 0.7);+}+.onb-seg {+ display: inline-flex;+ border: 1px solid rgba(255, 255, 255, 0.16);+ border-radius: 8px;+ overflow: hidden;+}+.onb-seg__btn {+ background: none;+ border: none;+ color: rgba(235, 235, 245, 0.75);+ font-size: 13px;+ padding: 6px 14px;+ cursor: pointer;+}+.onb-seg__btn + .onb-seg__btn {+ border-left: 1px solid rgba(255, 255, 255, 0.14);+}+.onb-seg__btn.is-on {+ background: var(--accent);+ color: #fff;+}.onb-tryit.is-done {border-style: solid;border-color: rgba(52, 199, 89, 0.5);diff --git a/src/shared/types.ts b/src/shared/types.tsindex cad344e20..38dcf062d 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -691,6 +691,9 @@ export interface Settings {* switch (the historical behavior). Off = every project defaults to expanded and a* project switch never touches the user's expand/collapse choices. */sidebarAutoCollapse: boolean+ /** Fallback view for projects the user hasn't explicitly toggled (canvas or the kanban board).+ * Personal machine-local preference; per-project explicit choices override it. */+ defaultProjectView: 'canvas' | 'kanban'/** ms to dwell over a terminal before it takes pointer focus (pan-across guard). */panHoverDelay: numberdoubleClickFocus: boolean@@ -820,6 +823,7 @@ export const DEFAULT_SETTINGS: Settings = {defaultNodeWidth: 640,defaultNodeHeight: 440,sidebarAutoCollapse: true,+ defaultProjectView: 'canvas',panHoverDelay: 600,doubleClickFocus: true,wheelZoom: false,