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): saved views — shared filter sets, per-user active view
review7cb9c80365cc
diff --git a/src/core/workspace-files.test.ts b/src/core/workspace-files.test.tsindex 5cf318bce..b7271a7aa 100644--- a/src/core/workspace-files.test.ts+++ b/src/core/workspace-files.test.ts@@ -579,6 +579,7 @@ describe('kanban board persistence', () => {})describe('sanitizeKanban — the board is hostile, git-shared input', () => {+ const clean_ = (): ProjectKanban => clean()const clean = (): ProjectKanban => ({columns: [{ id: 'kcol-a', title: 'To Do', color: '#0a84ff', category: 'unstarted' },@@ -639,6 +640,16 @@ describe('sanitizeKanban — the board is hostile, git-shared input', () => {])})+ it('admits saved views through sanitizeViews (a garbage list is dropped, a clean one kept)', () => {+ const views = [{ id: 'kview-1', name: 'Mine', query: { assignees: ['enes'] } }]+ const clean = { ...clean_(), views }+ expect(sanitizeKanban(clean)).toBe(clean)+ const bad = { ...clean_(), views: [{ id: 3 }, 'x', { id: 'v', name: 'Bugs', query: { source: 'nope', labels: ['local:l'] } }] }+ expect(sanitizeKanban(bad)?.views).toEqual([{ id: 'v', name: 'Bugs', query: { labels: ['local:l'] } }])+ const junk = { ...clean_(), views: 'nope' }+ expect('views' in (sanitizeKanban(junk) as object)).toBe(false)+ })+it('keeps fields it does not know (a newer build\'s board data round-trips)', () => {const k = { ...clean(), futureThing: [1, 2], columns: [{ ...clean().columns[0], wip: 3 }] }const out = sanitizeKanban(k) as unknown as Record<string, unknown>diff --git a/src/core/workspace-files.ts b/src/core/workspace-files.tsindex 5a67126dc..c41782874 100644--- a/src/core/workspace-files.ts+++ b/src/core/workspace-files.ts@@ -9,6 +9,7 @@ import {type LocalNodeExecMap} from '../shared/node-exec'import { isValidRank } from '../shared/kanban-rank'+import { sanitizeViews } from '../shared/kanban-views'import { CLOSED_SESSIONS_CAP } from '../shared/types'import type { BridgeLink, CanvasNodeState, ClosedSessionEntry, NavStop, Project, ProjectKanban, Viewport, Workspace } from '../shared/types'import { projectCapabilityFields, readProjectCapabilities } from '../shared/project-capabilities'@@ -419,6 +420,7 @@ const isRecord = (x: unknown): x is Record<string, unknown> =>* - an assignment that is not an object with string `nodeId` and `columnId` is dropped, and a* `rank` that `isValidRank` refuses is dropped from it (the card then derives its position from* array order — see @shared/kanban-order).+ * - `views` go through `sanitizeViews` (a non-list is dropped, bad entries repaired or dropped).* Every other field — known or not — round-trips untouched.** Returns the SAME object when nothing needed repair, so a clean file is never rewritten, and@@ -458,7 +460,17 @@ export function sanitizeKanban(k: unknown): ProjectKanban | undefined {}assignments.push(a as unknown as ProjectKanban['assignments'][number])}- return changed ? { ...k, columns, assignments } : k+ // Saved views: their own tolerant reader (@shared/kanban-views), same identity discipline.+ let views: ProjectKanban['views'] | undefined = k.views+ if ('views' in k) {+ views = sanitizeViews(k.views)+ if (views !== k.views) changed = true+ }+ if (!changed) return k+ const next: ProjectKanban = { ...k, columns, assignments }+ if (views) next.views = views+ else delete next.views+ return next}/** A `{x, y}` point, checked at the boundary because the file is hostile input. */diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex 3baf7843a..7d6638bbc 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -1,5 +1,7 @@import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'-import type { KanbanColumnCategory, KanbanLabel, ProjectKanban } from '@shared/types'+import type { KanbanColumnCategory, KanbanLabel, KanbanSavedView, KanbanViewQuery, ProjectKanban } from '@shared/types'+import { deleteView, renameView, sameViewQuery, saveView, updateView, viewQuery } from '@shared/kanban-views'+import { promptDialog } from '../promptDialog'import {boardProgress, categoryChangeImpact, categoryChangeMessage, columnCategory} from '@shared/kanban-category'@@ -184,7 +186,13 @@ export const KanbanView = memo(function KanbanView({// Board label filter — transient (per board session; resets when you leave the board). Empty =// show everything; otherwise a card must carry at least one selected label (cardMatchesLabelFilter).const [labelFilter, setLabelFilter] = useState<string[]>([])+ // Member + column filters (names; column ids to SHOW, `ungrouped` included). With the source and+ // label filters they are what a saved view carries (@shared/kanban-views).+ const [assigneeFilter, setAssigneeFilter] = useState<string[]>([])+ const [columnFilter, setColumnFilter] = useState<string[]>([])const [filterOpen, setFilterOpen] = useState(false)+ const [viewsMenu, setViewsMenu] = useState<{ x: number; y: number } | null>(null)+ const [pendingViewDelete, setPendingViewDelete] = useState<KanbanSavedView | null>(null)// Status chips (Running / Needs you / Unread) — TRANSIENT component state, never persisted and// never part of a saved view: they filter on second-by-second agent state (lib/kanbanStatusChips).const [statusChips, setStatusChips] = useState<StatusChip[]>([])@@ -205,6 +213,13 @@ export const KanbanView = memo(function KanbanView({// Per-user display: whether `closed` columns are on screen (localStorage, never the board).const showClosed = useKanbanDisplay((s) => s.byProject[projectId]?.showClosed === true)const setShowClosed = useKanbanDisplay((s) => s.setShowClosed)+ // Saved views are SHARED (board.views); which one this user last applied is theirs.+ const activeViewId = useKanbanDisplay((s) => s.byProject[projectId]?.viewId)+ const setActiveViewId = useKanbanDisplay((s) => s.setActiveViewId)+ const views = useMemo(() => (Array.isArray(board.views) ? board.views : []), [board.views])+ const activeView = views.find((v) => v.id === activeViewId)+ const boardRef = useRef(board)+ boardRef.current = board// A category change that would re-mean cards waits here for an explicit confirmation.const [pendingCategory, setPendingCategory] = useState<{ columnId: string; category: KanbanColumnCategory | undefined; message: string } | null@@ -284,10 +299,27 @@ export const KanbanView = memo(function KanbanView({// The serialised config is the epoch visible to the renderer. Reconnect when mappings change.// eslint-disable-next-line react-hooks/exhaustive-deps}, [api, projectId, githubConfigKey, columnIdsKey, githubFilterKey, connectGitHub, githubRetry])+ // A view's filters, applied. The chips are deliberately not touched — a view never carries them.+ // A source the board cannot show (no GitHub on this board) falls back to every source.+ const applyQuery = useCallback(+ (q: KanbanViewQuery, k: ProjectKanban) => {+ setSource(k.github ? q.source ?? 'all' : 'all')+ setLabelFilter(q.labels ?? [])+ setAssigneeFilter(q.assignees ?? [])+ setColumnFilter(q.columns ?? [])+ },+ []+ )useEffect(() => {- setSource('all')setModalIssue(null)setStatusChips([])+ // Entering a board (or switching projects under it) restores the view this user last applied+ // there; a view a teammate has since deleted is simply not found.+ const k = boardRef.current+ const remembered = useKanbanDisplay.getState().activeViewId(projectId)+ const view = Array.isArray(k.views) ? k.views.find((v) => v.id === remembered) : undefined+ applyQuery(view?.query ?? {}, k)+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [projectId])useEffect(() => {if (!modalIssue || !github) return@@ -429,12 +461,15 @@ export const KanbanView = memo(function KanbanView({// them per column — and their identities hold across renders that change neither the board,// the sessions, nor the filter, which is what lets the memoized columns skip.const columnCards = useMemo(() => {- // Label filter AND status chips (each an OR within itself).+ // Label filter AND member filter AND status chips (each an OR within itself).+ const hasMember = (id: string): boolean =>+ (cardMeta(board, id)?.assignees ?? []).some((a) => assigneeFilter.includes(a?.name))const vis = (ids: string[]): string[] =>- activeLocalFilter.length || statusChips.length+ activeLocalFilter.length || assigneeFilter.length || statusChips.length? ids.filter((id) =>(!activeLocalFilter.length || cardMatchesLabelFilter(board, id, activeLocalFilter)) &&+ (!assigneeFilter.length || hasMember(id)) &&matchesStatusChips(statusFacts, id, statusChips)): ids@@ -446,7 +481,7 @@ export const KanbanView = memo(function KanbanView({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, statusChips, statusFacts])+ }, [board, byId, sessionIds, activeLocalFilter, assigneeFilter, statusChips, statusFacts])// Lifecycle: the board's progress (null when no column says what "complete" means) and the// columns this user sees — `closed` ones only when they asked for them.@@ -455,10 +490,90 @@ export const KanbanView = memo(function KanbanView({() => board.columns.filter((c) => columnCategory(c) === 'closed').length,[board.columns])+ // The column filter names columns to SHOW; ids that no longer exist are ignored, and a filter+ // left with none that do means "every column" rather than an empty board.+ const liveColumnFilter = useMemo(+ () => columnFilter.filter((id) => id === 'ungrouped' || board.columns.some((c) => c.id === id)),+ [columnFilter, board.columns]+ )const shownColumns = useMemo(- () => (showClosed ? board.columns : board.columns.filter((c) => columnCategory(c) !== 'closed')),- [board.columns, showClosed]+ () =>+ board.columns.filter(+ (c) =>+ (showClosed || columnCategory(c) !== 'closed') &&+ (!liveColumnFilter.length || liveColumnFilter.includes(c.id))+ ),+ [board.columns, showClosed, liveColumnFilter])+ const ungroupedShown = !liveColumnFilter.length || liveColumnFilter.includes('ungrouped')+ // Every name assigned on this board (plus any still selected), for the member filter.+ const memberNames = useMemo(() => {+ const names = new Set<string>(assigneeFilter)+ for (const m of Array.isArray(board.meta) ? board.meta : []) {+ for (const a of m?.assignees ?? []) if (typeof a?.name === 'string' && a.name) names.add(a.name)+ }+ return [...names].sort((a, b) => a.localeCompare(b))+ }, [board.meta, assigneeFilter])+ const toggleIn = (set: (f: (cur: string[]) => string[]) => void, value: string): void =>+ set((cur) => (cur.includes(value) ? cur.filter((x) => x !== value) : [...cur, value]))+ const filterCount = activeFilter.length + assigneeFilter.length + liveColumnFilter.length+ // Views: what the board shows now, and whether the active view still describes it.+ const currentQuery = useMemo(+ () => viewQuery({ source, labels: activeFilter, assignees: assigneeFilter, columns: liveColumnFilter }),+ [source, activeFilter, assigneeFilter, liveColumnFilter]+ )+ const viewDirty = !!activeView && !sameViewQuery(currentQuery, activeView.query)+ const saveCurrentView = async (): Promise<void> => {+ const name = await promptDialog({+ message: 'Name this view. Views are saved with the board, so everyone who opens it gets them.',+ placeholder: 'e.g. Mine, Review queue',+ confirmLabel: 'Save view'+ })+ if (!name) return+ const saved = saveView(boardRef.current, name, currentQuery)+ if (!saved.id) return+ commit(saved.k)+ setActiveViewId(projectId, saved.id)+ }+ const renameActiveView = async (view: KanbanSavedView): Promise<void> => {+ const name = await promptDialog({ message: 'Rename this view', initialValue: view.name, confirmLabel: 'Rename' })+ if (!name) return+ const next = renameView(boardRef.current, view.id, name)+ if (next !== boardRef.current) commit(next)+ }+ const viewsMenuItems = (): MenuItem[] => [+ { type: 'label', label: views.length ? 'Saved views' : 'No saved views yet' },+ ...views.map((v): MenuItem => ({+ label: v.name,+ icon: v.id === activeView?.id ? <span aria-label="current">✓</span> : undefined,+ onClick: () => {+ applyQuery(v.query, board)+ setActiveViewId(projectId, v.id)+ }+ })),+ { type: 'separator' },+ { label: 'Save current filters as a view…', onClick: () => void saveCurrentView() },+ ...(activeView+ ? ([+ ...(viewDirty+ ? [{+ label: `Update “${activeView.name}” to the current filters`,+ onClick: () => commit(updateView(board, activeView.id, currentQuery))+ }]+ : []),+ { label: `Rename “${activeView.name}”…`, onClick: () => void renameActiveView(activeView) },+ { label: `Delete “${activeView.name}”…`, danger: true, onClick: () => setPendingViewDelete(activeView) },+ { type: 'separator' },+ {+ label: 'Leave the view (show every card)',+ onClick: () => {+ applyQuery({}, board)+ setActiveViewId(projectId, undefined)+ }+ }+ ] as MenuItem[])+ : [])+ ]// ── Keyboard (board.* registry commands, dispatched by Canvas through lib/boardKeys) ──────────// Board order = the session cards on screen, column by column (Ungrouped first), top to bottom —@@ -467,10 +582,10 @@ export const KanbanView = memo(function KanbanView({const navColumns = useMemo<string[][]>(() => {if (!sourceVisible(source, 'sessions')) return []return [- columnCards.ungrouped.map((c) => c.id),+ ungroupedShown ? columnCards.ungrouped.map((c) => c.id) : [],...shownColumns.map((col) => (columnCards.byColumn.get(col.id) ?? NO_CARDS).map((c) => c.id))]- }, [columnCards, shownColumns, source])+ }, [columnCards, shownColumns, ungroupedShown, source])const boardKeyRef = useRef<(action: BoardKeyAction) => boolean>(() => false)boardKeyRef.current = (action) => {const active = document.activeElement@@ -762,68 +877,99 @@ export const KanbanView = memo(function KanbanView({)})}</div>- {(paletteLabels.length > 0 || githubLabels.length > 0 || activeFilter.length > 0) && (- <div className="kanban-header__filter">- <button- className={`kanban-filter-btn${activeFilter.length ? ' kanban-filter-btn--on' : ''}`}- title="Filter by label"- onClick={() => setFilterOpen((v) => !v)}- >- Filter{activeFilter.length ? ` · ${activeFilter.length}` : ''}- </button>- {filterOpen && (- <>- <div className="label-picker__scrim" onMouseDown={() => setFilterOpen(false)} />- <div className="kanban-filter-menu">- {paletteLabels.length > 0 && <div className="kanban-filter-group">Sessions</div>}- {paletteLabels.map((l) => {- const s = labelSwatch(l.color)- const key = `local:${l.id}`- const on = activeFilter.includes(key)- return (- <button key={key} className="kanban-filter-row" onClick={() => toggleFilter(key)}>- <span className="kanban-label-chip" style={{ background: s.bg, color: s.fg }}>- {l.name || 'Label'}- </span>- {on && <span className="label-picker__rowcheck">✓</span>}- </button>- )- })}- {githubLabels.length > 0 && <div className="kanban-filter-group">GitHub</div>}- {githubLabels.map((label) => {- const key = `github:${label.name.normalize('NFKC').toLocaleLowerCase('en-US')}`- const on = activeFilter.includes(key)- return (- <button key={key} className="kanban-filter-row" onClick={() => toggleFilter(key)}>- <span className="github-issue-label" style={{- borderColor: `#${label.color}`,- color: `#${label.color}`- }}>{label.name}</span>- {on && <span className="label-picker__rowcheck">✓</span>}- </button>- )- })}- {activeFilter.length > 0 && (- <button className="kanban-filter-clear" onClick={() => setLabelFilter([])}>- Clear filter+ <div className="kanban-header__filter">+ <button+ className={`kanban-filter-btn${filterCount ? ' kanban-filter-btn--on' : ''}`}+ title="Filter by label, member or column"+ onClick={() => setFilterOpen((v) => !v)}+ >+ Filter{filterCount ? ` · ${filterCount}` : ''}+ </button>+ {filterOpen && (+ <>+ <div className="label-picker__scrim" onMouseDown={() => setFilterOpen(false)} />+ <div className="kanban-filter-menu">+ {paletteLabels.length > 0 && <div className="kanban-filter-group">Sessions</div>}+ {paletteLabels.map((l) => {+ const s = labelSwatch(l.color)+ const key = `local:${l.id}`+ const on = activeFilter.includes(key)+ return (+ <button key={key} className="kanban-filter-row" onClick={() => toggleFilter(key)}>+ <span className="kanban-label-chip" style={{ background: s.bg, color: s.fg }}>+ {l.name || 'Label'}+ </span>+ {on && <span className="label-picker__rowcheck">✓</span>}</button>- )}- </div>- </>- )}- </div>- )}+ )+ })}+ {githubLabels.length > 0 && <div className="kanban-filter-group">GitHub</div>}+ {githubLabels.map((label) => {+ const key = `github:${label.name.normalize('NFKC').toLocaleLowerCase('en-US')}`+ const on = activeFilter.includes(key)+ return (+ <button key={key} className="kanban-filter-row" onClick={() => toggleFilter(key)}>+ <span className="github-issue-label" style={{+ borderColor: `#${label.color}`,+ color: `#${label.color}`+ }}>{label.name}</span>+ {on && <span className="label-picker__rowcheck">✓</span>}+ </button>+ )+ })}+ {memberNames.length > 0 && <div className="kanban-filter-group">Members</div>}+ {memberNames.map((name) => (+ <button key={`member:${name}`} className="kanban-filter-row" onClick={() => toggleIn(setAssigneeFilter, name)}>+ <span className="kanban-filter-member">{name}</span>+ {assigneeFilter.includes(name) && <span className="label-picker__rowcheck">✓</span>}+ </button>+ ))}+ <div className="kanban-filter-group">Columns</div>+ {[{ id: 'ungrouped', title: 'Ungrouped' }, ...board.columns].map((c) => (+ <button key={`column:${c.id}`} className="kanban-filter-row" onClick={() => toggleIn(setColumnFilter, c.id)}>+ <span className="kanban-filter-member">{c.title}</span>+ {liveColumnFilter.includes(c.id) && <span className="label-picker__rowcheck">✓</span>}+ </button>+ ))}+ {filterCount > 0 && (+ <button+ className="kanban-filter-clear"+ onClick={() => {+ setLabelFilter([])+ setAssigneeFilter([])+ setColumnFilter([])+ }}+ >+ Clear filter+ </button>+ )}+ </div>+ </>+ )}+ </div>+ <button+ className={`kanban-filter-btn kanban-views-btn${activeView ? ' kanban-filter-btn--on' : ''}`}+ title={activeView ? `Saved view: ${activeView.name}${viewDirty ? ' (filters changed since it was saved)' : ''}` : 'Saved views'}+ onClick={(e) => {+ const r = (e.currentTarget as HTMLElement).getBoundingClientRect()+ setViewsMenu({ x: r.left, y: r.bottom + 4 })+ }}+ >+ {activeView ? `View: ${activeView.name}${viewDirty ? ' •' : ''}` : 'Views'}+ </button></div><div className="kanban-board"><div className="kanban-board__columns">- <KanbanColumn- column={null}- lanes={lanesFor(null)}- createOptions={createOptions}- onCreate={onCreateNode}- onDragEnd={handleDragEnd}- onDropOnColumn={dropOnColumn}- />+ {ungroupedShown && (+ <KanbanColumn+ column={null}+ lanes={lanesFor(null)}+ createOptions={createOptions}+ onCreate={onCreateNode}+ onDragEnd={handleDragEnd}+ onDropOnColumn={dropOnColumn}+ />+ )}{shownColumns.map((col) => (<KanbanColumnkey={col.id}@@ -886,6 +1032,31 @@ export const KanbanView = memo(function KanbanView({onClose={() => setModalIssue(null)}/>)}+ {viewsMenu && (+ <ContextMenu+ x={viewsMenu.x}+ y={viewsMenu.y}+ zIndex={60}+ items={viewsMenuItems()}+ onClose={() => setViewsMenu(null)}+ />+ )}+ {pendingViewDelete && (+ <ConfirmDialog+ message={`Delete the view "${pendingViewDelete.name}"? Views are saved with the board, so it goes for everyone who opens it.`}+ confirmLabel="Delete view"+ danger+ onCancel={() => setPendingViewDelete(null)}+ onConfirm={() => {+ const gone = pendingViewDelete+ setPendingViewDelete(null)+ // Re-resolved at confirm time: the board can have changed while the dialog was up.+ const next = deleteView(boardRef.current, gone.id)+ if (next !== boardRef.current) commit(next)+ if (useKanbanDisplay.getState().activeViewId(projectId) === gone.id) setActiveViewId(projectId, undefined)+ }}+ />+ )}{pendingCategory && (<ConfirmDialogmessage={pendingCategory.message}diff --git a/src/renderer/components/kanban/KanbanView.views.test.tsx b/src/renderer/components/kanban/KanbanView.views.test.tsxnew file mode 100644index 000000000..1dc285fec--- /dev/null+++ b/src/renderer/components/kanban/KanbanView.views.test.tsx@@ -0,0 +1,205 @@+// @vitest-environment jsdom+//+// Saved views: the member + column filters a view can carry, saving the current filters as a+// SHARED view (project.kanban.views), applying one, and the per-user half — which view this person+// last applied lives in localStorage, and the live-state chips never enter a view.+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import { KanbanView, type KanbanSession } from './KanbanView'+import type { ProjectKanban } from '@shared/types'+import { useKanbanDisplay } from '../../state/kanbanDisplay'+import { useProjects } from '../../state/projects'+import { useAgentStatus } from '../../state/agentStatus'++vi.mock('../../session/session', () => ({+ useSession: () => ({ source: 'local', api: window.nodeTerminal })+}))+const prompt = vi.hoisted(() => ({ answer: 'Mine' as string | null }))+vi.mock('../promptDialog', () => ({ promptDialog: vi.fn(async () => prompt.answer) }))++let root: Root | null = null+let host: HTMLElement+const card = (id: string): KanbanSession =>+ ({ id, title: `Card ${id}`, color: '#fff', kind: 'terminal', spawn: {} }) as unknown as KanbanSession+const ENES = { name: 'enes', color: '#0a84ff' }+const SAM = { name: 'sam', color: '#ff453a' }++const board = (extra: Partial<ProjectKanban> = {}): ProjectKanban => ({+ columns: [+ { id: 'a', title: 'To Do', color: '#0a84ff' },+ { id: 'b', title: 'Done', color: '#32d74b' }+ ],+ assignments: [+ { nodeId: 'n1', columnId: 'a' },+ { nodeId: 'n2', columnId: 'b' }+ ],+ meta: [+ { nodeId: 'n1', assignees: [ENES] },+ { nodeId: 'n2', assignees: [SAM] }+ ],+ ...extra+})++beforeEach(() => {+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe(): void {}+ unobserve(): void {}+ disconnect(): void {}+ }+ )+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {+ boardLog: { list: async () => [], onChanged: () => () => {} },+ settings: { save: async () => {} }+ }+ prompt.answer = 'Mine'+ useProjects.setState({ activeProjectId: 'p-views' } as never)+ useKanbanDisplay.setState({ byProject: {} })+ useAgentStatus.setState({ byId: { n1: { unread: false, state: 'working' } } } as never)+})+afterEach(() => {+ if (root) act(() => root!.unmount())+ root = null+ host?.remove()+ document.body.innerHTML = ''+ useAgentStatus.setState({ byId: {} } as never)+ vi.unstubAllGlobals()+})++function mount(k: ProjectKanban, onChange = vi.fn()): { onChange: ReturnType<typeof vi.fn>; rerender: (b: ProjectKanban) => void } {+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+ const noop = (): void => {}+ const el = (b: ProjectKanban) => (+ <KanbanView+ board={b}+ sessions={['n1', 'n2', 'n3'].map(card)}+ onChange={onChange}+ onOpenNode={noop}+ onCreateNode={noop}+ onRenameNode={noop}+ onEditSticky={noop}+ onDeleteNode={noop}+ onModalNodeChange={noop}+ onBrowserNav={noop}+ onSetIcon={noop}+ />+ )+ act(() => root!.render(el(k)))+ return { onChange, rerender: (b) => act(() => root!.render(el(b))) }+}++const click = (el: Element | null | undefined): void => {+ if (!el) throw new Error('missing element')+ act(() => {+ el.dispatchEvent(new MouseEvent('click', { bubbles: true }))+ })+}+const visible = (): string[] =>+ [...document.querySelectorAll('.kanban-card--session .kanban-card__title')].map((el) => el.textContent ?? '')+const columnTitles = (): string[] =>+ [...document.querySelectorAll('.kanban-col')].map(+ (c) => c.querySelector('.kanban-col__title')?.textContent ?? ''+ )+const row = (sel: string, text: string): Element | undefined =>+ [...document.querySelectorAll(sel)].find((el) => el.textContent?.includes(text))+const openFilter = (): void => click(document.querySelector('.kanban-filter-btn:not(.kanban-closed-toggle)'))+const openViews = (): void => click(document.querySelector('.kanban-views-btn'))++describe('KanbanView — member and column filters', () => {+ it('a member filter shows only that person’s cards', () => {+ mount(board())+ openFilter()+ click(row('.kanban-filter-row', 'enes'))+ expect(visible()).toEqual(['Card n1'])+ })++ it('a column filter shows only the chosen columns (Ungrouped included)', () => {+ mount(board())+ openFilter()+ click(row('.kanban-filter-row', 'Done'))+ expect(columnTitles()).toEqual(['Done'])+ click(row('.kanban-filter-row', 'Ungrouped'))+ expect(columnTitles()).toEqual(['Ungrouped', 'Done'])+ })+})++describe('KanbanView — saved views', () => {+ it('saves the current filters as a SHARED view, and remembers it as this user’s active one', async () => {+ const { onChange } = mount(board())+ openFilter()+ click(row('.kanban-filter-row', 'enes'))+ openViews()+ await act(async () => {+ row('.ctx-item', 'Save current filters')!.dispatchEvent(new MouseEvent('click', { bubbles: true }))+ })+ const next = onChange.mock.calls.at(-1)![0] as ProjectKanban+ expect(next.views).toEqual([{ id: expect.any(String), name: 'Mine', query: { assignees: ['enes'] } }])+ expect(useKanbanDisplay.getState().activeViewId('p-views')).toBe(next.views![0].id)+ })++ it('a view NEVER carries the live-state chips', async () => {+ const { onChange } = mount(board())+ click(row('.kanban-status-chip', 'Running'))+ openViews()+ await act(async () => {+ row('.ctx-item', 'Save current filters')!.dispatchEvent(new MouseEvent('click', { bubbles: true }))+ })+ const next = onChange.mock.calls.at(-1)![0] as ProjectKanban+ expect(next.views?.[0].query).toEqual({})+ expect(JSON.stringify(next.views)).not.toMatch(/running|chip/i)+ })++ it('applying a view sets its filters and leaves the chips exactly as they were', () => {+ mount(board({ views: [{ id: 'v1', name: 'Done only', query: { columns: ['b'] } }] }))+ click(row('.kanban-status-chip', 'Running'))+ openViews()+ click(row('.ctx-item', 'Done only'))+ expect(columnTitles()).toEqual(['Done'])+ expect(useKanbanDisplay.getState().activeViewId('p-views')).toBe('v1')+ expect(document.querySelector('.kanban-status-chip--running.kanban-status-chip--on')).not.toBeNull()+ })++ it('a remount restores the view this user last applied', () => {+ useKanbanDisplay.getState().setActiveViewId('p-views', 'v1')+ mount(board({ views: [{ id: 'v1', name: 'Mine', query: { assignees: ['sam'] } }] }))+ expect(visible()).toEqual(['Card n2'])+ expect(document.querySelector('.kanban-views-btn')?.textContent).toContain('Mine')+ })++ it('a remembered view that no longer exists (a teammate deleted it) is ignored', () => {+ useKanbanDisplay.getState().setActiveViewId('p-views', 'gone')+ mount(board())+ expect(visible()).toEqual(['Card n3', 'Card n1', 'Card n2'])+ })++ it('marks the active view as modified when the filters drift, and can update it', () => {+ const { onChange } = mount(board({ views: [{ id: 'v1', name: 'Mine', query: { assignees: ['enes'] } }] }))+ openViews()+ click(row('.ctx-item', 'Mine'))+ openFilter()+ click(row('.kanban-filter-row', 'sam'))+ expect(document.querySelector('.kanban-views-btn')?.textContent).toContain('•')+ openViews()+ click(row('.ctx-item', 'Update'))+ const next = onChange.mock.calls.at(-1)![0] as ProjectKanban+ expect(next.views?.[0].query.assignees?.sort()).toEqual(['enes', 'sam'])+ })++ it('deleting a view asks first — views are shared with everyone on the board', () => {+ const { onChange } = mount(board({ views: [{ id: 'v1', name: 'Mine', query: {} }] }))+ openViews()+ click(row('.ctx-item', 'Mine'))+ openViews()+ click(row('.ctx-item', 'Delete'))+ expect(onChange).not.toHaveBeenCalled()+ click([...document.querySelectorAll('button')].find((b) => b.textContent === 'Delete view'))+ const next = onChange.mock.calls.at(-1)![0] as ProjectKanban+ expect(next.views).toBeUndefined()+ expect(useKanbanDisplay.getState().activeViewId('p-views')).toBeUndefined()+ })+})diff --git a/src/renderer/lib/kanbanSources.test.ts b/src/renderer/lib/kanbanSources.test.tsindex 6533572bd..ff2e29c34 100644--- a/src/renderer/lib/kanbanSources.test.ts+++ b/src/renderer/lib/kanbanSources.test.ts@@ -56,3 +56,14 @@ describe('kanban source registry', () => {expect(() => kanbanSource('nope' as never)).toThrow()})})++// A saved view stores the source filter in the shared file, and its sanitizer (which core runs)+// cannot import this registry. So the shared list is a second spelling — pinned here, so a source+// added to the registry without it is refused on load instead of silently dropped from views.+describe('saved-view source parity', () => {+ it('KANBAN_VIEW_SOURCES is exactly "all" plus the registry', async () => {+ const { KANBAN_VIEW_SOURCES } = await import('@shared/kanban-views')+ const { KANBAN_SOURCES } = await import('./kanbanSources')+ expect([...KANBAN_VIEW_SOURCES].sort()).toEqual(['all', ...KANBAN_SOURCES.map((s) => s.id)].sort())+ })+})diff --git a/src/renderer/state/kanbanDisplay.test.ts b/src/renderer/state/kanbanDisplay.test.tsindex edbf07543..b37f206e3 100644--- a/src/renderer/state/kanbanDisplay.test.ts+++ b/src/renderer/state/kanbanDisplay.test.ts@@ -16,6 +16,13 @@ describe('parseKanbanDisplay', () => {expect(parseKanbanDisplay('"str"')).toEqual({})})+ it('reads the active view id as a string only', () => {+ expect(parseKanbanDisplay('{"p1":{"viewId":"kview-1"},"p2":{"viewId":7}}')).toEqual({+ p1: { viewId: 'kview-1' },+ p2: {}+ })+ })+it('keeps only literal booleans — a hand-edited value never flips a default', () => {expect(parseKanbanDisplay('{"p1":{"showClosed":"yes"},"p2":7,"p3":{"showClosed":true,"x":1}}')).toEqual({p1: {},@@ -33,3 +40,15 @@ describe('useKanbanDisplay', () => {expect(useKanbanDisplay.getState().showClosed('p-b')).toBe(false)})})++describe('useKanbanDisplay — the active view is this user\'s', () => {+ it('remembers and clears the active view per project', () => {+ const s = useKanbanDisplay.getState()+ expect(s.activeViewId('p-v')).toBeUndefined()+ s.setActiveViewId('p-v', 'kview-1')+ expect(useKanbanDisplay.getState().activeViewId('p-v')).toBe('kview-1')+ expect(useKanbanDisplay.getState().activeViewId('p-other')).toBeUndefined()+ useKanbanDisplay.getState().setActiveViewId('p-v', undefined)+ expect(useKanbanDisplay.getState().activeViewId('p-v')).toBeUndefined()+ })+})diff --git a/src/renderer/state/kanbanDisplay.ts b/src/renderer/state/kanbanDisplay.tsindex 31ea63c2e..2184bc51f 100644--- a/src/renderer/state/kanbanDisplay.ts+++ b/src/renderer/state/kanbanDisplay.ts@@ -15,6 +15,9 @@ export const KANBAN_DISPLAY_KEY = 'nodeterm.kanbanDisplay'export interface ProjectBoardDisplay {/** Show columns whose category is `closed`. Absent = hidden (the point of `closed`). */showClosed?: boolean+ /** The saved view (`kanban.views[].id`) this user last applied. The views are shared; which one+ * a person is looking at is theirs. A stale id (the view was deleted) is simply ignored. */+ viewId?: string}export type KanbanDisplayMap = Record<string, ProjectBoardDisplay>@@ -38,6 +41,7 @@ export function parseKanbanDisplay(raw: string | null): KanbanDisplayMap {if (!isRecord(v)) continueconst entry: ProjectBoardDisplay = {}if (typeof v.showClosed === 'boolean') entry.showClosed = v.showClosed+ if (typeof v.viewId === 'string' && v.viewId) entry.viewId = v.viewIdout[pid] = entry}return out@@ -55,6 +59,8 @@ interface KanbanDisplayState {byProject: KanbanDisplayMapshowClosed(projectId: string): booleansetShowClosed(projectId: string, show: boolean): void+ activeViewId(projectId: string): string | undefined+ setActiveViewId(projectId: string, viewId: string | undefined): void}export const useKanbanDisplay = create<KanbanDisplayState>((set, get) => ({@@ -64,5 +70,12 @@ export const useKanbanDisplay = create<KanbanDisplayState>((set, get) => ({const byProject = { ...get().byProject, [projectId]: { ...get().byProject[projectId], showClosed: show } }save(byProject)set({ byProject })+ },+ activeViewId: (projectId) => get().byProject[projectId]?.viewId,+ setActiveViewId: (projectId, viewId) => {+ const { viewId: _old, ...rest } = get().byProject[projectId] ?? {}+ const byProject = { ...get().byProject, [projectId]: viewId ? { ...rest, viewId } : rest }+ save(byProject)+ set({ byProject })}}))diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex ffb625251..fc9b2d542 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -12055,10 +12055,24 @@ button.group-node__setup:disabled {background: color-mix(in srgb, var(--state-unread) 14%, transparent);}-/* The title strip carries progress, the closed toggle, three chips and Filter. None of them may- wrap (a wrapped button grows the fixed-height strip into the columns); the project name is what- gives way, and the progress BAR drops before its "n/m done" text. */-.kanban-header .kanban-filter-btn,+/* ── Saved views (header) — the views are shared, the active one is this user's ── */+.kanban-views-btn {+ margin-left: 6px;+ max-width: 220px;+ min-width: 64px;+ flex-shrink: 1;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.kanban-filter-member {+ font-size: 12px;+ color: rgba(var(--tint-rgb), 0.85);+}+/* The title strip carries progress, the closed toggle, three chips, Filter and Views. None of them+ may wrap (a wrapped button grows the fixed-height strip into the columns); the project name and+ the Views label are what give way, and the progress BAR drops before its "n/m done" text. */+.kanban-header .kanban-filter-btn:not(.kanban-views-btn),.kanban-status-chips,.kanban-progress,.kanban-header__filter {diff --git a/src/shared/kanban-views.test.ts b/src/shared/kanban-views.test.tsnew file mode 100644index 000000000..f90da58a4--- /dev/null+++ b/src/shared/kanban-views.test.ts@@ -0,0 +1,123 @@+import { describe, expect, it } from 'vitest'+import type { ProjectKanban } from './types'+import {+ KANBAN_VIEWS_MAX,+ VIEW_NAME_MAX,+ deleteView,+ renameView,+ sameViewQuery,+ sanitizeViews,+ saveView,+ updateView,+ viewQuery+} from './kanban-views'++const board = (): ProjectKanban => ({ columns: [{ id: 'c', title: 'C', color: '#fff' }], assignments: [] })++describe('viewQuery — what a view may carry', () => {+ it('captures source, labels, assignees and columns — and nothing else', () => {+ const q = viewQuery({+ source: 'sessions',+ labels: ['local:l1', 'github:bug'],+ assignees: ['enes'],+ columns: ['c'],+ // The live-state chips reach the builder in real life (it is fed the board's filter state);+ // they must not come out the other side.+ statusChips: ['running']+ } as Parameters<typeof viewQuery>[0])+ expect(q).toEqual({ source: 'sessions', labels: ['local:l1', 'github:bug'], assignees: ['enes'], columns: ['c'] })+ expect(JSON.stringify(q)).not.toContain('running')+ })++ it('omits what is at its default (an empty view is an empty query)', () => {+ expect(viewQuery({ source: 'all', labels: [], assignees: [], columns: [] })).toEqual({})+ })+})++describe('sameViewQuery', () => {+ it('ignores list order and absent-vs-empty', () => {+ expect(sameViewQuery({ labels: ['a', 'b'] }, { labels: ['b', 'a'], assignees: [] })).toBe(true)+ expect(sameViewQuery({ source: 'all' }, {})).toBe(true)+ expect(sameViewQuery({ labels: ['a'] }, { labels: ['b'] })).toBe(false)+ expect(sameViewQuery({ source: 'github' }, {})).toBe(false)+ })+})++describe('transforms', () => {+ it('save → rename → update → delete', () => {+ const saved = saveView(board(), 'Mine', { assignees: ['enes'] })+ expect(saved.k.views).toEqual([{ id: saved.id, name: 'Mine', query: { assignees: ['enes'] } }])+ const id = saved.id!+ const renamed = renameView(saved.k, id, 'Only mine')+ expect(renamed.views?.[0].name).toBe('Only mine')+ const updated = updateView(renamed, id, { source: 'sessions' })+ expect(updated.views?.[0].query).toEqual({ source: 'sessions' })+ const deleted = deleteView(updated, id)+ expect('views' in deleted).toBe(false)+ })++ it('trims and bounds names; an empty name is refused (the board is unchanged)', () => {+ const k = board()+ expect(saveView(k, ' ', {}).k).toBe(k)+ expect(saveView(k, 'x'.repeat(200), {}).k.views?.[0].name).toHaveLength(VIEW_NAME_MAX)+ expect(saveView(k, ' Mine \n', {}).k.views?.[0].name).toBe('Mine')+ })++ it('unknown ids are no-ops returning the same board', () => {+ const k = saveView(board(), 'A', {}).k+ expect(renameView(k, 'nope', 'B')).toBe(k)+ expect(updateView(k, 'nope', {})).toBe(k)+ expect(deleteView(k, 'nope')).toBe(k)+ })++ it('refuses a view past the cap rather than growing the shared file without bound', () => {+ let k = board()+ for (let i = 0; i < KANBAN_VIEWS_MAX; i++) k = saveView(k, `v${i}`, {}).k+ const over = saveView(k, 'one more', {})+ expect(over.k).toBe(k)+ expect(over.id).toBeNull()+ })+})++describe('sanitizeViews — hostile, git-shared input', () => {+ it('returns a clean list BY IDENTITY', () => {+ const views = [{ id: 'kview-1', name: 'A', query: { source: 'sessions' as const } }]+ expect(sanitizeViews(views)).toBe(views)+ })++ it('absent stays absent; a non-array is dropped', () => {+ expect(sanitizeViews(undefined)).toBeUndefined()+ expect(sanitizeViews('nope')).toBeUndefined()+ expect(sanitizeViews({})).toBeUndefined()+ })++ it('drops entries a renderer would trip on, never throwing', () => {+ const out = sanitizeViews([+ null,+ 7,+ { id: 3, name: 'x', query: {} },+ { id: 'a', name: { x: 1 }, query: {} },+ { id: 'b', name: '', query: {} },+ { id: 'c', name: 'ok', query: 'nope' },+ { id: 'd', name: 'kept', query: {} }+ ])+ expect(out).toEqual([{ id: 'd', name: 'kept', query: {} }])+ })++ it('repairs a query field-by-field: unknown source dropped, non-string list items dropped', () => {+ const out = sanitizeViews([+ { id: 'a', name: 'A', query: { source: 'everything', labels: ['ok', 3, null], assignees: 'enes', columns: ['c'] } }+ ])+ expect(out).toEqual([{ id: 'a', name: 'A', query: { labels: ['ok'], columns: ['c'] } }])+ })++ it('keeps query fields it does not know (a newer build’s filter survives an older save)', () => {+ const out = sanitizeViews([{ id: 'a', name: 'A', query: { priority: ['high'] } }])+ expect(out?.[0].query).toEqual({ priority: ['high'] })+ })++ it('drops a duplicate id and caps the list', () => {+ const many = Array.from({ length: KANBAN_VIEWS_MAX + 5 }, (_, i) => ({ id: `v${i}`, name: `V${i}`, query: {} }))+ expect(sanitizeViews([...many.slice(0, 1), ...many])?.length).toBe(KANBAN_VIEWS_MAX)+ })+})diff --git a/src/shared/kanban-views.ts b/src/shared/kanban-views.tsnew file mode 100644index 000000000..faddbfec9--- /dev/null+++ b/src/shared/kanban-views.ts@@ -0,0 +1,162 @@+/**+ * Saved board views: named filter sets stored in `project.kanban.views`, so a team shares how it+ * looks at its board ("Mine", "Review queue", "Bugs only").+ *+ * What a view carries is DELIBERATELY narrow — `viewQuery` is the only builder, and it reads only+ * the source, label, assignee and column filters:+ * - never the Running / Needs you / Unread chips: they filter on second-by-second agent state, and+ * a view that restored them would show a board that is wrong before anyone looked at it;+ * - never display preferences (showing closed columns) and never the ACTIVE view: those are one+ * person's, and live in localStorage (`state/kanbanDisplay.ts`).+ *+ * The list is git-shared, hand-editable input, so `sanitizeViews` runs inside `sanitizeKanban` on+ * every load and save seam. It repairs rather than invents, keeps query fields it does not know+ * (a newer build's filter must survive an older teammate's save), and returns a clean list BY+ * IDENTITY so a well-formed file is never rewritten.+ */+import type { KanbanSavedView, KanbanViewQuery, ProjectKanban } from './types'++export const KANBAN_VIEW_SOURCES: ReadonlyArray<NonNullable<KanbanViewQuery['source']>> = [+ 'all',+ 'github',+ 'pulls',+ 'sessions'+]+export const VIEW_NAME_MAX = 60+export const KANBAN_VIEWS_MAX = 50+const ID_MAX = 128+const ITEM_MAX = 200+const LIST_MAX = 200++// eslint-disable-next-line no-control-regex+const CONTROL = /[\u0000-\u001f\u007f-\u009f]/g++const isRecord = (x: unknown): x is Record<string, unknown> =>+ !!x && typeof x === 'object' && !Array.isArray(x)++/** A shown name: control characters out, trimmed, bounded. '' = no usable name. */+function cleanName(name: string): string {+ return name.replace(CONTROL, ' ').trim().slice(0, VIEW_NAME_MAX).trim()+}++const LIST_FIELDS = ['labels', 'assignees', 'columns'] as const++/** The filters a view saves, from the board's filter state. Anything else it is handed — the+ * live-state chips above all — is ignored by construction. Defaults are omitted. */+export function viewQuery(filters: {+ source: KanbanViewQuery['source']+ labels: readonly string[]+ assignees: readonly string[]+ columns: readonly string[]+}): KanbanViewQuery {+ const q: KanbanViewQuery = {}+ if (filters.source && filters.source !== 'all') q.source = filters.source+ for (const f of LIST_FIELDS) if (filters[f].length) q[f] = [...filters[f]]+ return q+}++/** Do two queries select the same cards? List order and absent-vs-empty do not matter. */+export function sameViewQuery(a: KanbanViewQuery, b: KanbanViewQuery): boolean {+ if ((a.source ?? 'all') !== (b.source ?? 'all')) return false+ return LIST_FIELDS.every((f) => {+ const x = [...(a[f] ?? [])].sort()+ const y = [...(b[f] ?? [])].sort()+ return x.length === y.length && x.every((v, i) => v === y[i])+ })+}++function sanitizeQuery(q: Record<string, unknown>): KanbanViewQuery {+ let changed = false+ const out: Record<string, unknown> = { ...q }+ if ('source' in q && !KANBAN_VIEW_SOURCES.includes(q.source as never)) {+ delete out.source+ changed = true+ }+ for (const f of LIST_FIELDS) {+ if (!(f in q)) continue+ const v = q[f]+ if (!Array.isArray(v)) {+ delete out[f]+ changed = true+ continue+ }+ const kept = v.filter((x): x is string => typeof x === 'string' && x.length > 0 && x.length <= ITEM_MAX).slice(0, LIST_MAX)+ if (kept.length !== v.length) {+ if (kept.length) out[f] = kept+ else delete out[f]+ changed = true+ }+ }+ return (changed ? out : q) as KanbanViewQuery+}++/** Admit a views list from a file (see the module note). */+export function sanitizeViews(x: unknown): KanbanSavedView[] | undefined {+ if (!Array.isArray(x)) return undefined+ let changed = false+ const out: KanbanSavedView[] = []+ const seen = new Set<string>()+ for (const v of x) {+ if (out.length >= KANBAN_VIEWS_MAX) {+ changed = true+ break+ }+ if (+ !isRecord(v) ||+ typeof v.id !== 'string' || !v.id || v.id.length > ID_MAX || seen.has(v.id) ||+ typeof v.name !== 'string' || !cleanName(v.name) ||+ !isRecord(v.query)+ ) {+ changed = true+ continue+ }+ seen.add(v.id)+ const name = cleanName(v.name)+ const query = sanitizeQuery(v.query)+ if (name !== v.name || query !== v.query) {+ out.push({ ...(v as unknown as KanbanSavedView), name, query })+ changed = true+ } else {+ out.push(v as unknown as KanbanSavedView)+ }+ }+ if (!changed) return x as KanbanSavedView[]+ return out.length ? out : undefined+}++const views = (k: ProjectKanban): KanbanSavedView[] => (Array.isArray(k.views) ? k.views : [])++function withViews(k: ProjectKanban, list: KanbanSavedView[]): ProjectKanban {+ if (list.length) return { ...k, views: list }+ const { views: _gone, ...rest } = k+ return rest+}++/** Save the current filters as a new view. `id` null = refused (no usable name, or at the cap) and+ * the board is returned unchanged. */+export function saveView(+ k: ProjectKanban,+ name: string,+ query: KanbanViewQuery+): { k: ProjectKanban; id: string | null } {+ const clean = cleanName(name)+ if (!clean || views(k).length >= KANBAN_VIEWS_MAX) return { k, id: null }+ const id = `kview-${Math.random().toString(36).slice(2, 10)}`+ return { k: withViews(k, [...views(k), { id, name: clean, query }]), id }+}++export function renameView(k: ProjectKanban, id: string, name: string): ProjectKanban {+ const clean = cleanName(name)+ if (!clean || !views(k).some((v) => v.id === id)) return k+ return withViews(k, views(k).map((v) => (v.id === id ? { ...v, name: clean } : v)))+}++export function updateView(k: ProjectKanban, id: string, query: KanbanViewQuery): ProjectKanban {+ if (!views(k).some((v) => v.id === id)) return k+ return withViews(k, views(k).map((v) => (v.id === id ? { ...v, query } : v)))+}++export function deleteView(k: ProjectKanban, id: string): ProjectKanban {+ if (!views(k).some((v) => v.id === id)) return k+ return withViews(k, views(k).filter((v) => v.id !== id))+}diff --git a/src/shared/types.ts b/src/shared/types.tsindex a2f49911b..3df85be35 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -686,9 +686,32 @@ export interface KanbanLabel {color: KanbanLabelColor}+/** A saved board view's filters (@shared/kanban-views). SHARED content: a view is how a team+ * looks at its board. Deliberately NOT here: the live-state status chips (never persisted+ * anywhere) and display preferences like showing closed columns (per user, localStorage). */+export interface KanbanViewQuery {+ /** The source filter; absent = all. */+ source?: 'all' | 'github' | 'pulls' | 'sessions'+ /** Label filter keys (`local:<labelId>` | `github:<folded name>`); OR within the list. */+ labels?: string[]+ /** Assignee names (the presence identity's name); a card needs one of them. */+ assignees?: string[]+ /** Column ids to SHOW (`ungrouped` names the virtual column); absent/empty = every column. */+ columns?: string[]+}++export interface KanbanSavedView {+ id: string+ name: string+ query: KanbanViewQuery+}+export interface ProjectKanban {columns: KanbanColumn[]assignments: KanbanAssignment[]+ /** Saved views — named filter sets shared with everyone on the board. Tolerated as absent or+ * malformed (sanitizeViews); the ACTIVE view is per user (localStorage), never here. */+ views?: KanbanSavedView[]/** Optional card metadata; tolerated as absent/malformed by every reader (lib normalizes). */meta?: KanbanCardMeta[]/** Board-level label palette (Notion-style). Cards reference these by id in `meta[].labels`;