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): team progress on an orchestrator's card, and no repeated facts
reviewc0f564cb6e13
diff --git a/CLAUDE.md b/CLAUDE.mdindex b411d24a0..c278bd2ba 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -5854,6 +5854,43 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord meawhile the user is away: a window focus in between drops it (`installHandoffFocusReset`), or thenext chime — for a turn the user sat and watched — was swallowed. v1 is agent-drivenmoves only: a teammate's move arriving by git, or the phone's relay move, pings nobody.+ - **Team progress** (`lib/teamProgress.ts`, `components/TeamProgressChip.tsx`): a session that+ opened stations shows "N of M done" as a small ring on its board card, its card modal header+ AND its canvas node header — ONE component, so three views of one node cannot count+ differently; clicking it lists the stations and a row travels to that node. A station is a+ session node that is the target of the FIRST rope into it in `project.ropes` order: ropes carry+ two relations with one `ctrl-<source>-<target>` id shape ("opened by" and an `--after` / verify+ wait), nothing on the node records the opener, and every writer appends the opener's rope+ before the same command's dep ropes (`connect` then `ropeDeps`; `missingDepRopes` heals after+ the file's own ropes). Without that rule every `--after` upstream read as a team leader. Rules+ the count keeps: **unknown is unknown, never done** (state is transient; after a restart a+ station reads `unknown` until it reports), paused/hibernated count as a finished turn (both are+ written only by an exit that refused a busy session), a held launch reads `queued`, `done` ++ `lastTurnError` reads `errored` (the `--after` verdict), a station that can never report (plain+ terminal, hook-less agent) is listed as "no status" and kept OUT of M (it would pin the ring+ below complete forever — the line `--after` draws), and a deleted station is not a station.+ Subscriptions: each chip reads `teamProgressSig` — one character per station, no ids — never+ `byId`; the per-project board gets the teams as a prop from Canvas, the Omni lanes derive+ theirs from the stored `p.ropes`/`p.nodes`, and the canvas node header reads `useTeamStations`+ (`state/teamStations.ts`, a transient store Canvas publishes from its live control ropes). The+ previous map is threaded back into `stationsByOpener`, so an unchanged team keeps its array+ identity across drag frames and nothing re-renders. Desktop + Server Edition identical;+ Mobile: follow-up (the phone board would need the ropes).+ - **The card does not repeat what its place says** (`lib/cardRedundancy.ts`). The session-name+ chip is hidden when it is the card's title (agent titles auto-track it) — the same rule the+ canvas node header has always had, now one function for both — and a past due date in a+ done/closed column keeps its date but drops the overdue alarm. The card MODAL keeps both facts:+ its header names a session that differs from the title, and its Due strip still says+ "Overdue". Audited and NOT hidden (written in the module so the next audit does not re-derive+ it): the card never names its column or its project, and there is no badge that restates a+ column category — RUNNING / NEEDS YOU describe the agent's turn right now, which is exactly+ what an idle card in In Progress needs distinguished.+ - **`bridges` / `ropes` are admitted through `sanitizeLinks`** (`core/workspace-files.ts`) on the+ same seams as `sanitizeKanban` — `fileToProject`, `projectToFile`, the inline-project branch+ and the legacy v2 path of the store. They are git-shared, hand-editable input that every reader+ maps as `BridgeLink[]`, and the canvas's rope restore threw on one `null` entry at project load.+ A non-list is dropped, an entry without non-empty string `id`/`source`/`target` is dropped, and a+ clean list comes back BY IDENTITY.**Phone** (nodeterm-ios): must at least not break on `category`, `rank` or `views` (extra JSONkeys its board decoder ignores). The relay-served move now lands at the top with a rank, whilethe phone's direct-SSH writer (`KanbanBoardWriter`) still appends without one — the next desktopdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 0b59495a0..948262735 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -138,6 +138,13 @@ so the live-state chips can never be saved into one. Board keys areregistry commands in the `board` scope — the only scope allowed a bare letter, because it neverfires while typing or in a terminal.+A card chip that reads agent state subscribes to a **primitive signature** of the nodes it shows+(`teamProgressSig`, `issueRunChipSig`), never to the whole `agentStatus.byId` map — that map changes+on every hook event of every node. Before a card shows a fact, check that its place on the board+does not already say it (`lib/cardRedundancy.ts`); the card modal keeps every fact the card drops.+`project.ropes` / `bridges` are hostile input like the board: they are admitted through+`sanitizeLinks` on every load and save seam, and a reader still tolerates anything.+Before adding a GitHub read, check what the existing poll already fetches. Pull request cardsneeded no new request at all: `/repos/{repo}/issues` returns pull requests, and the client used todiscard them. `/repos/{repo}/pulls` looks like the obvious endpoint and is the expensive one — itdiff --git a/src/core/workspace-files.links.test.ts b/src/core/workspace-files.links.test.tsnew file mode 100644index 000000000..4d0a44b45--- /dev/null+++ b/src/core/workspace-files.links.test.ts@@ -0,0 +1,58 @@+import { describe, expect, it } from 'vitest'+import type { CanvasNodeState, Project } from '../shared/types'+import { fileToProject, projectToFile, sanitizeLinks } from './workspace-files'++// `bridges` / `ropes` come straight out of the git-shared, hand-editable project file, and every+// reader maps them as `BridgeLink[]` — the canvas's rope restore did `ropes.map((r) => r.id)`, so a+// single `null` entry threw on project load.+const node: CanvasNodeState = {+ id: 'a', kind: 'terminal', position: { x: 0, y: 0 }, size: { width: 400, height: 300 },+ title: 't', color: '#fff', group: null+}+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })++describe('sanitizeLinks', () => {+ it('returns the same array when every entry is well-formed', () => {+ const links = [rope('a', 'b'), { ...rope('b', 'c'), extra: 1 }]+ expect(sanitizeLinks(links)).toBe(links)+ })++ it('drops the entries a reader cannot use, keeping the rest in order', () => {+ const hostile: unknown[] = [+ null, 5, 'ctrl-a-b', [], rope('a', 'b'),+ { id: 'x', source: {}, target: 'b' }, { id: '', source: 'a', target: 'b' },+ { source: 'a', target: 'b' }, { id: 'y', source: 'a', target: '' }, rope('b', 'c')+ ]+ expect(sanitizeLinks(hostile)).toEqual([rope('a', 'b'), rope('b', 'c')])+ })++ it('a non-list is dropped', () => {+ for (const bad of ['ropes', 5, {}, null, undefined, { length: 1, 0: rope('a', 'b') }]) {+ expect(sanitizeLinks(bad)).toBeUndefined()+ }+ })+})++describe('the file seams admit only readable links', () => {+ it('fileToProject', () => {+ const file = {+ version: 1, rev: 1, savedAt: 1, id: 'legacy', name: 'p', color: '#fff',+ viewport: { x: 0, y: 0, zoom: 1 }, nodes: [node],+ ropes: [null, rope('a', 'b')],+ bridges: 'nope'+ }+ const p = fileToProject(file as never, { id: 'p1' })+ expect(p.ropes).toEqual([rope('a', 'b')])+ expect(p.bridges).toBeUndefined()+ })++ it('projectToFile (what we write is what the next machine trusts)', () => {+ const project = {+ id: 'p1', name: 'p', color: '#fff', viewport: { x: 0, y: 0, zoom: 1 }, nodes: [node],+ ropes: [rope('a', 'b'), { id: 7 }], bridges: [rope('a', 'b')]+ } as unknown as Project+ const file = projectToFile(project, 1, '2026-09-29T00:00:00.000Z')+ expect(file.ropes).toEqual([rope('a', 'b')])+ expect(file.bridges).toEqual([rope('a', 'b')])+ })+})diff --git a/src/core/workspace-files.ts b/src/core/workspace-files.tsindex 2a90580a2..6455d1e63 100644--- a/src/core/workspace-files.ts+++ b/src/core/workspace-files.ts@@ -365,6 +365,8 @@ export function projectToFile(const layouts = sanitizeLayouts(p.layouts)// Same two-seam rule for the board (see `sanitizeKanban`).const kanban = p.kanban ? sanitizeKanban(p.kanban) : undefined+ const bridges = p.bridges ? sanitizeLinks(p.bridges) : undefined+ const ropes = p.ropes ? sanitizeLinks(p.ropes) : undefinedreturn {version: 1,rev,@@ -375,8 +377,9 @@ export function projectToFile(viewport: framingViewport(nodes),nodes,...(icon ? { icon } : {}),- ...(p.bridges ? { bridges: p.bridges } : {}),- ...(p.ropes ? { ropes: p.ropes } : {}),+ // The same two-seam rule as the board: what we write is what the next machine trusts.+ ...(bridges ? { bridges } : {}),+ ...(ropes ? { ropes } : {}),...(p.defaultPermissionMode ? { defaultPermissionMode: p.defaultPermissionMode } : {}),// Strict-normalised (literal true only, known keys only) and omitted when off — an off// capability adds no bytes to the committed file. `capabilityAck` is deliberately NOT here:@@ -405,6 +408,27 @@ export function validKanban(k: unknown): k is ProjectKanban {const isRecord = (x: unknown): x is Record<string, unknown> =>!!x && typeof x === 'object' && !Array.isArray(x)+/**+ * A project's `bridges` / `ropes` as they may be ADMITTED. Both come straight out of the git-shared,+ * hand-editable project file, and every reader treats them as `BridgeLink[]`: the canvas restores+ * them with `ropes.map((r) => ropeEdge(r.id, r.source, r.target))`, the server-change merge maps+ * their ids, the headless factory spreads them. A non-list, or one `null` entry, threw on project+ * load. The rule: a non-list is dropped; an entry that is not an object with non-empty string `id`,+ * `source` and `target` is dropped; every other field an entry carries round-trips untouched.+ *+ * Returns the SAME array when nothing needed repair, so a clean file is never rewritten, and+ * `undefined` for a non-list. Used on every seam `sanitizeKanban` is.+ */+export function sanitizeLinks(links: unknown): BridgeLink[] | undefined {+ if (!Array.isArray(links)) return undefined+ const ok = (l: unknown): l is BridgeLink =>+ isRecord(l) &&+ typeof l.id === 'string' && l.id !== '' &&+ typeof l.source === 'string' && l.source !== '' &&+ typeof l.target === 'string' && l.target !== ''+ return links.every(ok) ? (links as BridgeLink[]) : links.filter(ok)+}+/*** The board as it may be ADMITTED: `validKanban`'s shape rule plus the per-entry repairs a* hand-edited, git-shared file needs before a renderer touches it — a render throw on a bad board@@ -621,6 +645,8 @@ export function fileToProject(// in as well as out is what stops workspace.json accumulating orphans forever.const layoutViewports = pruneLayoutViewports(base.layoutViewports, layouts)const kanban = sanitizeKanban(f.kanban)+ const bridges = f.bridges ? sanitizeLinks(f.bridges) : undefined+ const ropes = f.ropes ? sanitizeLinks(f.ropes) : undefinedreturn {id: base.id,// A project whose stored name IS its own path is one this machine (or a teammate's) created@@ -644,8 +670,9 @@ export function fileToProject(base.id)),- ...(f.bridges ? { bridges: f.bridges } : {}),- ...(f.ropes ? { ropes: f.ropes } : {}),+ // Hostile input like the rest of the file: a non-list or a malformed entry threw on load.+ ...(bridges ? { bridges } : {}),+ ...(ropes ? { ropes } : {}),...(defaultAccountId ? { defaultAccountId } : {}),...(f.defaultPermissionMode ? { defaultPermissionMode: f.defaultPermissionMode } : {}),// The file is hostile input: only a literal `true` under a known key survives the readdiff --git a/src/core/workspace-store.links.test.ts b/src/core/workspace-store.links.test.tsnew file mode 100644index 000000000..0408b3d34--- /dev/null+++ b/src/core/workspace-store.links.test.ts@@ -0,0 +1,83 @@+import { describe, it, expect, beforeEach, afterEach } from 'vitest'+import { promises as fs } from 'fs'+import os from 'os'+import path from 'path'+import { initPlatform, resetPlatformForTests } from './platform'+import { fakePlatform } from './platform-fake'+import { WorkspaceStore } from './workspace-store'++// `ropes` / `bridges` reach the renderer through three load seams that are not `fileToProject`'s+// alone: a folder project's file (fileToProject), an INLINE project stored verbatim in+// workspace.json, and a pre-v3 workspace.json that skips loadV3. Each owes `sanitizeLinks`, or a+// hand-edited `null` rope throws in the canvas's rope restore on project load.++let userData: string+let projRoot: string+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })+const HOSTILE = [null, 5, { id: 'x', source: {}, target: 'b' }, rope('a', 'b')]++beforeEach(async () => {+ userData = await fs.mkdtemp(path.join(os.tmpdir(), 'nt-ws-'))+ projRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'nt-proj-'))+ initPlatform(fakePlatform({ userDataDir: userData }))+})+afterEach(async () => {+ resetPlatformForTests()+ await fs.rm(userData, { recursive: true, force: true })+ await fs.rm(projRoot, { recursive: true, force: true })+})++const writeIndex = (index: unknown): Promise<void> =>+ fs.writeFile(path.join(userData, 'workspace.json'), JSON.stringify(index), 'utf-8')++describe('the canvas links are admitted on every load seam', () => {+ it('an inline (cwd-less) project stored verbatim in workspace.json', async () => {+ await writeIndex({+ version: 3,+ activeProjectId: 'p1',+ entries: [{+ id: 'p1', name: 'foo', color: '#7aa2f7',+ project: {+ id: 'p1', name: 'foo', color: '#7aa2f7', viewport: { x: 0, y: 0, zoom: 1 }, nodes: [],+ ropes: HOSTILE, bridges: 'not a list'+ }+ }]+ })+ const loaded = await new WorkspaceStore().load()+ expect(loaded.projects[0].ropes).toEqual([rope('a', 'b')])+ expect(loaded.projects[0].bridges).toBeUndefined()+ })++ it('a legacy (v2) workspace.json, which skips loadV3', async () => {+ await writeIndex({+ version: 2,+ activeProjectId: 'p1',+ projects: [{+ id: 'p1', name: 'foo', color: '#7aa2f7', viewport: { x: 0, y: 0, zoom: 1 }, nodes: [],+ ropes: HOSTILE, bridges: [rope('a', 'b')]+ }]+ })+ const loaded = await new WorkspaceStore().load()+ expect(loaded.projects[0].ropes).toEqual([rope('a', 'b')])+ expect(loaded.projects[0].bridges).toEqual([rope('a', 'b')])+ })++ it("a folder project's git-shared project.json", async () => {+ await fs.mkdir(path.join(projRoot, '.nodeterm'), { recursive: true })+ await fs.writeFile(+ path.join(projRoot, '.nodeterm', 'project.json'),+ JSON.stringify({+ version: 1, rev: 3, savedAt: '2026-09-29T00:00:00.000Z', id: 'legacy', name: 'foo',+ color: '#7aa2f7', viewport: { x: 0, y: 0, zoom: 1 }, nodes: [], ropes: HOSTILE+ }),+ 'utf-8'+ )+ await writeIndex({+ version: 3,+ activeProjectId: 'p1',+ entries: [{ id: 'p1', name: 'foo', color: '#7aa2f7', cwd: projRoot }]+ })+ const loaded = await new WorkspaceStore().load()+ expect(loaded.projects[0].ropes).toEqual([rope('a', 'b')])+ })+})diff --git a/src/core/workspace-store.ts b/src/core/workspace-store.tsindex f7d78c0ca..a63f8a24f 100644--- a/src/core/workspace-store.ts+++ b/src/core/workspace-store.ts@@ -14,6 +14,7 @@ import {projectToFile, resolveNodes, sameProjectContent,sanitizeLoadedClosedSessions, sanitizeNodeTriggers, serializeProjectFile, splitWorkspace,sanitizeKanban,+ sanitizeLinks,type IndexEntryV3, type ProjectFileV1, type WorkspaceIndexV3} from './workspace-files'import { readProjectSettingsFile, writeProjectSettingsFile } from './project-settings-files'@@ -351,9 +352,12 @@ export class WorkspaceStore {// same kanban shape guard here — a v1/hand-edited board would otherwise crash the render —// and the same trigger shape rule (workspace.json is hand-editable input too).// `rest` drops BOTH guarded fields; each is added back below only if it passes its guard.- const { kanban, closedSessions, layouts, layoutViewports, ...rest } = e.project+ const { kanban, closedSessions, layouts, layoutViewports, bridges, ropes, ...rest } = e.projectconst admittedKanban = sanitizeKanban(kanban)const base = admittedKanban ? { ...rest, kanban: admittedKanban } : rest+ // The canvas links, like the board: a non-list or a `null` entry threw on project load.+ const admittedBridges = bridges ? sanitizeLinks(bridges) : undefined+ const admittedRopes = ropes ? sanitizeLinks(ropes) : undefined// An inline project's embedded layouts are hand-editable input exactly like a git-shared// file's, and they never pass through `fileToProject` on this branch, so they are// sanitized (and their cameras pruned against them) here instead.@@ -369,6 +373,8 @@ export class WorkspaceStore {project: {...base,nodes: sanitizeNodeTriggers(base.nodes),+ ...(admittedBridges ? { bridges: admittedBridges } : {}),+ ...(admittedRopes ? { ropes: admittedRopes } : {}),...(history ? { closedSessions: history } : {}),...(admitted ? { layouts: admitted } : {}),...(views ? { layoutViewports: views } : {})@@ -2407,13 +2413,20 @@ function migrateLegacy(parsed: unknown): Workspace {// migrates the file.const layouts = sanitizeLayouts(p.layouts)const views = pruneLayoutViewports(sanitizeLayoutViewports(p.layoutViewports), layouts)+ // And the canvas links, for the same reason: a malformed rope threw at project load.+ const bridges = p.bridges ? sanitizeLinks(p.bridges) : undefined+ const ropes = p.ropes ? sanitizeLinks(p.ropes) : undefinedconst unchanged = history === p.closedSessions&& layouts === p.layouts&& views === p.layoutViewports+ && bridges === p.bridges+ && ropes === p.ropesif (unchanged) return p- const { closedSessions: _c, layouts: _l, layoutViewports: _v, ...rest } = p+ const { closedSessions: _c, layouts: _l, layoutViewports: _v, bridges: _b, ropes: _r, ...rest } = preturn {...rest,+ ...(bridges ? { bridges } : {}),+ ...(ropes ? { ropes } : {}),...(history ? { closedSessions: history } : {}),...(layouts ? { layouts } : {}),...(views ? { layoutViewports: views } : {})diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 6ac096b9c..4f3cac81a 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -708,6 +708,8 @@ import {import type { CodexAccount } from '@shared/codex-account'import { useSystemCodexAccount } from '../state/systemCodexAccount'import { kanbanSessionsFrom, toKanbanSession } from './toKanbanSession'+import type { TeamStation } from '../lib/teamProgress'+import { canvasTeamStations, useTeamStations } from '../state/teamStations'import { applyPullAutoMove } from '../lib/pullAutoMove'import { useWallpaperBackground, wallpaperLayers } from '../state/wallpaper'import { showCanvasDots } from '../lib/canvasDots'@@ -9944,6 +9946,22 @@ export function Canvas() {[nodes, perProjectKanbanOpen, activeProjectSsh])+ // Team progress (lib/teamProgress): the stations each session opened, read off the live control+ // ropes — the first rope into a node is its opener's; a later one is an `--after` wait. Published+ // to a small store so a terminal node's header draws the same ring its board card does. The+ // previous map is threaded back in, so an unchanged team keeps its array identity and a node+ // header (or card) subscribed to it does not re-render on every drag frame. A canvas without+ // ropes — most of them — skips the node walk entirely.+ const teamStationsRef = useRef<ReadonlyMap<string, readonly TeamStation[]>>()+ const teamStations = useMemo(() => {+ const next = canvasTeamStations(controlEdges, nodes, teamStationsRef.current)+ teamStationsRef.current = next+ return next+ }, [controlEdges, nodes])+ useEffect(() => {+ useTeamStations.getState().set(teamStations)+ }, [teamStations])+// Create a node from the board's per-column "+ New" menu: it lands on the canvas (view// center) and, for a real column, is assigned there. The assignment is written directly —// NOT through the board's pruned commit path: the fresh node isn't in the derived session@@ -15742,6 +15760,7 @@ export function Canvas() {accountMenuItems={accountSwitchRows}onAutoMoveFromPulls={autoMoveCardFromPulls}issueAgentMenu={issueAgentMenu}+ teams={teamStations}/>)}<UpdateCard />diff --git a/src/renderer/components/TeamProgressChip.tsx b/src/renderer/components/TeamProgressChip.tsxnew file mode 100644index 000000000..18a0a9606--- /dev/null+++ b/src/renderer/components/TeamProgressChip.tsx@@ -0,0 +1,114 @@+import { memo, useState } from 'react'+import { useAgentStatus } from '../state/agentStatus'+import {+ parseTeamProgressSig,+ STATION_LABEL,+ summarizeTeam,+ teamProgressSig,+ teamProgressText,+ type TeamStation+} from '../lib/teamProgress'+import { ContextMenu, type MenuItem } from './ContextMenu'++const RING_R = 5+const RING_C = 2 * Math.PI * RING_R++/**+ * "N of M done" over the stations an orchestrator session opened (lib/teamProgress), drawn by the+ * session's board card, its card modal header and its canvas node header — one component, so the+ * three views of one node cannot count differently. Clicking it lists the stations; a row travels+ * to that node.+ *+ * It subscribes to a primitive signature of its OWN stations' states (`teamProgressSig`), never to+ * the whole status map, so a hook event elsewhere on the canvas re-renders nothing here.+ */+export const TeamProgressChip = memo(function TeamProgressChip({+ stations,+ onTravel,+ menuZIndex = 70+}: {+ stations: readonly TeamStation[]+ onTravel: (nodeId: string) => void+ /** Above the host surface: the card modal's scrim sits at 55. */+ menuZIndex?: number+}): React.JSX.Element | null {+ const sig = useAgentStatus((s) => teamProgressSig(s.byId, stations))+ const [menu, setMenu] = useState<{ x: number; y: number } | null>(null)+ if (stations.length === 0) return null+ const kinds = parseTeamProgressSig(sig)+ const progress = summarizeTeam(kinds)+ // Only stations that can never report (plain terminals): there is nothing to count.+ if (progress.total === 0) return null+ const text = teamProgressText(progress)+ const frac = progress.done / progress.total+ const items: MenuItem[] = [+ { type: 'label', label: text },+ ...stations.map((station, i): MenuItem => {+ const kind = kinds[i] ?? 'unknown'+ return {+ label: `${station.title.trim() || 'Untitled session'} — ${STATION_LABEL[kind]}`,+ icon: <span className={`team-progress__dot team-progress__dot--${kind}`} aria-hidden="true" />,+ hint: 'Go to this station on the canvas',+ onClick: () => onTravel(station.id)+ }+ })+ ]+ const stop = (e: React.SyntheticEvent) => e.stopPropagation()+ return (+ // The chip sits INSIDE a clickable card / a draggable node header, and the menu is a body+ // portal whose React events still bubble through this tree — so every event is stopped here,+ // or picking a station would also open the card it was picked from.+ <span+ className="team-progress-wrap"+ onClick={stop}+ onDoubleClick={stop}+ onMouseDown={stop}+ onPointerDown={stop}+ onContextMenu={stop}+ onKeyDown={stop}+ >+ <button+ type="button"+ className={`team-progress nodrag${progress.attention ? ` team-progress--${progress.attention}` : ''}${+ progress.done === progress.total ? ' team-progress--complete' : ''+ }`}+ data-done={progress.done}+ data-total={progress.total}+ title={`Stations this session opened: ${text} — click to list them`}+ aria-label={`Team progress: ${text}`}+ aria-haspopup="menu"+ aria-expanded={!!menu}+ onClick={(e) => {+ const r = e.currentTarget.getBoundingClientRect()+ setMenu((cur) => (cur ? null : { x: r.left, y: r.bottom + 4 }))+ }}+ >+ <svg className="team-progress__ring" viewBox="0 0 14 14" width="13" height="13" aria-hidden="true">+ <circle className="team-progress__track" cx="7" cy="7" r={RING_R} />+ <circle+ className="team-progress__arc"+ cx="7"+ cy="7"+ r={RING_R}+ strokeDasharray={`${(frac * RING_C).toFixed(2)} ${RING_C.toFixed(2)}`}+ transform="rotate(-90 7 7)"+ />+ </svg>+ <span className="team-progress__count">+ {progress.done}/{progress.total}+ </span>+ {progress.attention && <span className="team-progress__attn" aria-hidden="true" />}+ </button>+ {menu && (+ <ContextMenu+ x={menu.x}+ y={menu.y}+ zIndex={menuZIndex}+ scroll+ items={items}+ onClose={() => setMenu(null)}+ />+ )}+ </span>+ )+})diff --git a/src/renderer/components/kanban/CardModal.teamProgress.test.tsx b/src/renderer/components/kanban/CardModal.teamProgress.test.tsxnew file mode 100644index 000000000..a2b7e25dc--- /dev/null+++ b/src/renderer/components/kanban/CardModal.teamProgress.test.tsx@@ -0,0 +1,103 @@+// @vitest-environment jsdom+//+// The card modal keeps what the card leaves out, and carries the same team ring the card does.+import { act } from 'react'+import { createRoot } from 'react-dom/client'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import type { ProjectKanban } from '@shared/types'+import { resetDialogStack } from '../dialog-stack'+import { useAgentStatus, type AgentNodeStatus } from '../../state/agentStatus'+import { useProjects } from '../../state/projects'+import { CardModal } from './CardModal'+import type { KanbanSession } from './KanbanView'+import type { TeamStation } from '../../lib/teamProgress'++vi.mock('../../session/session', () => ({+ useSession: () => ({ api: { pty: {}, shell: { openExternal: vi.fn(async () => {}) } } })+}))+vi.mock('./BoardLogPanel', () => ({ BoardLogPanel: () => null }))+vi.mock('../ContextMeter', () => ({ ContextMeter: () => null }))+vi.mock('./ModalTerminal', () => ({ ModalTerminal: () => <div className="kanban-modal__term" /> }))+vi.mock('../../nodes/BrowserSurface', () => ({ BrowserSurface: () => null }))++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const status = (patch: Partial<AgentNodeStatus>): AgentNodeStatus => ({ unread: false, ...patch }) as AgentNodeStatus+const session: KanbanSession = {+ id: 'orch', title: 'Orchestrator', color: '#fff', kind: 'terminal', agentId: 'claude', spawn: {}+} as KanbanSession+const team: TeamStation[] = [+ { id: 'a', title: 'Station a', agentId: 'claude', queued: false },+ { id: 'b', title: 'Station b', agentId: 'claude', queued: true }+]+const board: ProjectKanban = {+ columns: [{ id: 'done', title: 'Done', color: '#32d74b', category: 'done' }],+ assignments: [{ nodeId: 'orch', columnId: 'done' }],+ meta: [{ nodeId: 'orch', dueAt: 1 }]+} as unknown as ProjectKanban++let host: HTMLDivElement+beforeEach(() => {+ resetDialogStack()+ vi.stubGlobal('ResizeObserver', class { observe(): void {} unobserve(): void {} disconnect(): void {} })+ ;(window as unknown as { nodeTerminal: unknown }).nodeTerminal = {+ onMarkdownToggle: () => () => {},+ boardLog: { list: async () => [], onChanged: () => () => {} }+ }+ useProjects.setState({ activeProjectId: 'p-modal' } as never)+ host = document.createElement('div')+ document.body.append(host)+})+afterEach(() => {+ resetDialogStack()+ document.body.innerHTML = ''+ useAgentStatus.setState({ byId: {} } as never)+ vi.unstubAllGlobals()+})++function mount(onTravel = vi.fn()): () => void {+ const root = createRoot(host)+ act(() =>+ root.render(+ <CardModal session={session} columnTitle="Done" board={board} onChangeBoard={vi.fn()} onClose={vi.fn()}+ onOpenCanvas={vi.fn()} onRename={vi.fn()} onEditSticky={vi.fn()} onSetIcon={vi.fn()}+ onBrowserNav={vi.fn()} team={team} onTravel={onTravel} />+ )+ )+ return () => act(() => root.unmount())+}++describe('CardModal — team progress and the facts the card leaves out', () => {+ it('carries the same ring as the card, and travels from its list', () => {+ useAgentStatus.setState({ byId: { a: status({ state: 'done' }) } } as never)+ const onTravel = vi.fn()+ const unmount = mount(onTravel)+ const chip = document.querySelector<HTMLButtonElement>('.kanban-modal__header .team-progress')!+ expect(chip.textContent).toBe('1/2')+ act(() => chip.dispatchEvent(new MouseEvent('click', { bubbles: true })))+ const rows = [...document.querySelectorAll<HTMLElement>('.ctx-menu .ctx-item')]+ expect(rows.map((r) => r.textContent)).toEqual(['Station a — done', 'Station b — queued'])+ act(() => rows[1].dispatchEvent(new MouseEvent('click', { bubbles: true })))+ expect(onTravel).toHaveBeenCalledWith('b')+ unmount()+ })++ it('names the session when it is not the title, and stays quiet when it is', () => {+ useAgentStatus.setState({ byId: { orch: status({ session: 'Fan out the auth fix' }) } } as never)+ let unmount = mount()+ expect(document.querySelector('.kanban-modal__session')?.textContent).toBe('Fan out the auth fix')+ unmount()+ useAgentStatus.setState({ byId: { orch: status({ session: 'orchestrator' }) } } as never)+ unmount = mount()+ expect(document.querySelector('.kanban-modal__session')).toBeNull()+ unmount()+ })++ it('still says "Overdue" in a Done column — the card drops the alarm, the modal keeps the fact', () => {+ const unmount = mount()+ expect(+ [...document.querySelectorAll('.kanban-due--overdue')].map((el) => el.textContent)+ ).toContain('Overdue')+ unmount()+ })+})diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsxindex f6459941e..b376d68f7 100644--- a/src/renderer/components/kanban/CardModal.tsx+++ b/src/renderer/components/kanban/CardModal.tsx@@ -20,6 +20,9 @@ import { ContextMeter } from '../ContextMeter'import { isRemoteSessionNode } from '@shared/worktree'import { AccountChip, useAccountChip } from '../AccountChip'import { IssueRefChip } from '../IssueRefChip'+import { TeamProgressChip } from '../TeamProgressChip'+import type { TeamStation } from '../../lib/teamProgress'+import { sessionNameRepeatsTitle } from '../../lib/cardRedundancy'import type { IssueRef } from '@shared/github-issue-ref'import { useAgentStatus } from '../../state/agentStatus'import { useCardPanel } from '../../state/cardPanel'@@ -82,13 +85,17 @@ interface CardModalProps {* (a board with no issue lane to open it on). The node header and the session card show the* same chip — the canvas and the board are two views of one node. */onOpenIssue?: (ref: IssueRef) => void+ /** The stations this session opened (lib/teamProgress) — the same ring the card shows. */+ team?: readonly TeamStation[]+ /** A station was picked from the ring's list: close the modal and go to that node. */+ onTravel?: (nodeId: string) => void}/** Trello-style card popup over the board. Scrim click / Esc close it; the board (and the* canvas under it) stay mounted. Terminal cards carry the node header's actions too:* search / dictate / AI-name / the ⌘M view — ChatPanel or the output markdown, the same face the* canvas node shows (the node itself is hidden under the board). */-export function CardModal({ session, columnTitle, board, onChangeBoard, onClose, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue }: CardModalProps) {+export function CardModal({ session, columnTitle, board, onChangeBoard, onClose, onOpenCanvas, onRename, onEditSticky, onBrowserNav, onSetIcon, onOpenIssue, team, onTravel }: CardModalProps) {const { api } = useSession()const idRef = useRef<string>()if (!idRef.current) idRef.current = nextDialogId()@@ -108,6 +115,10 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,// Same chip as the card and the canvas node header — the modal is where a user checks WHICH// session this is, so the account belongs in its header chips, not only two views away.const observedAccount = useAgentStatus((st) => st.byId[session.id]?.account)+ // The session name, where it is not already the title (lib/cardRedundancy — the rule the card+ // and the canvas node header use). The card carries it on its detail line; the modal, which+ // hides the node, carries it here so the session's name is never two views away.+ const sessionName = useAgentStatus((st) => st.byId[session.id]?.session)const accountChip = useAccountChip(session.spawn.accountId, observedAccount)const [naming, setNaming] = useState(false)// Comments & activity panel: OPEN by default in the modal; the header 💬 collapses it. The@@ -353,6 +364,12 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,)}<span className="kanban-modal__column">{columnTitle ?? 'Ungrouped'}</span>{isTerminal && onOpenIssue && <IssueRefChip issueRef={session.issueRef} onOpen={onOpenIssue} />}+ {isTerminal && team && team.length > 0 && onTravel && <TeamProgressChip stations={team} onTravel={onTravel} />}+ {isTerminal && sessionName && !sessionNameRepeatsTitle(sessionName, session.title) && (+ <span className="kanban-card__session kanban-modal__session" title={sessionName}>+ {sessionName}+ </span>+ )}{isTerminal && <AccountChip chip={accountChip} />}{/* The driving chip, so a user watching a browser card THROUGH the modal is notdriving-blind. The lease is keyed by node id (not by webview object), so this showsdiff --git a/src/renderer/components/kanban/GlobalKanbanView.teamProgress.test.tsx b/src/renderer/components/kanban/GlobalKanbanView.teamProgress.test.tsxnew file mode 100644index 000000000..e96b03faf--- /dev/null+++ b/src/renderer/components/kanban/GlobalKanbanView.teamProgress.test.tsx@@ -0,0 +1,82 @@+// @vitest-environment jsdom+//+// The Omni overview reads each lane's team straight out of the project in the store — `ropes`+// included, which is git-shared, hand-editable input. Whatever it holds, the overview renders.+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { act } from 'react'+import { createRoot, type Root } from 'react-dom/client'+import type { CanvasNodeState, Project } from '@shared/types'+import { GlobalKanbanView } from './GlobalKanbanView'+import { useProjects } from '../../state/projects'+import { useAgentStatus, type AgentNodeStatus } from '../../state/agentStatus'++vi.mock('../../session/session', () => ({+ useSession: () => ({ source: 'local', api: window.nodeTerminal })+}))+vi.mock('../ContextMeter', () => ({ ContextMeter: () => null }))++let root: Root | null = null+let host: HTMLElement++const term = (id: string, over: Partial<CanvasNodeState> = {}): CanvasNodeState => ({+ id, kind: 'terminal', position: { x: 0, y: 0 }, size: { width: 400, height: 300 },+ title: `Station ${id}`, color: '#fff', group: null, agentId: 'claude', ...over+})+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })+const project = (id: string, ropes: unknown): Project => ({+ id, name: id, color: '#7aa2f7', viewport: { x: 0, y: 0, zoom: 1 },+ nodes: [term('orch', { title: 'Orchestrator' }), term('a'), term('b')],+ ropes+} as unknown as Project)++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 () => {} }+ }+ useAgentStatus.setState({+ byId: { a: { unread: false, state: 'done' } as AgentNodeStatus }+ } as never)+})+afterEach(() => {+ if (root) act(() => root!.unmount())+ root = null+ host?.remove()+ document.body.innerHTML = ''+ vi.unstubAllGlobals()+})++function mount(projects: Project[]): void {+ useProjects.setState({ projects, activeProjectId: projects[0].id } as never)+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+ act(() => root!.render(<GlobalKanbanView />))+}++const orchChip = (laneId: string): HTMLElement | null =>+ document.querySelector(`#swimlane-${laneId} [data-kanban-card="orch"] .team-progress`)++describe('Omni overview — team progress from the stored ropes', () => {+ it("shows each lane's orchestrator its own team", () => {+ mount([project('p1', [rope('orch', 'a'), rope('orch', 'b')])])+ expect(orchChip('p1')?.textContent).toBe('1/2')+ })++ for (const [name, ropes] of [+ ['a string', 'ropes'],+ ['an object', { 0: rope('orch', 'a'), length: 1 }],+ ['null entries and wrong types', [null, 5, 'x', [], { source: {}, target: 'a' }, { source: 'orch', target: 7 }]],+ ['self and cyclic ropes', [rope('orch', 'orch'), rope('a', 'b'), rope('b', 'a')]]+ ] as const) {+ it(`renders with hostile ropes (${name})`, () => {+ expect(() => mount([project('p1', ropes), project('p2', [rope('orch', 'a')])])).not.toThrow()+ expect(document.querySelectorAll('#swimlane-p1 .kanban-card--session').length).toBe(3)+ expect(orchChip('p1')).toBeNull()+ // A hostile lane does not take the healthy one with it.+ expect(orchChip('p2')?.textContent).toBe('1/1')+ })+ }+})diff --git a/src/renderer/components/kanban/GlobalKanbanView.tsx b/src/renderer/components/kanban/GlobalKanbanView.tsxindex b0b84cc21..d60c436f5 100644--- a/src/renderer/components/kanban/GlobalKanbanView.tsx+++ b/src/renderer/components/kanban/GlobalKanbanView.tsx@@ -1,5 +1,5 @@import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'-import type { ProjectKanban } from '@shared/types'+import type { BridgeLink, CanvasNodeState, ProjectKanban } from '@shared/types'import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId } from '@shared/agents/config'import { useProjects } from '../../state/projects'import { useSettings } from '../../state/settings'@@ -25,6 +25,9 @@ import { boardLogEvents } from '../../lib/boardLogDiff'import { markWorkspaceDirty } from '../../state/workspaceDirty'import type { KanbanCreateChoice, KanbanSession } from './KanbanView'import type { NodeIcon } from '@shared/node-icon'+import { columnCategory } from '@shared/kanban-category'+import { NO_STATIONS, stationsByOpener, type TeamStation } from '../../lib/teamProgress'+import { stationNodeFromState } from '../../state/teamStations'/*** Global (Omni) Kanban overview — one swimlane per open project.@@ -52,6 +55,10 @@ interface SwimlaneProps {projectColor?: stringboard: ProjectKanbansessions: KanbanSession[]+ /** The project's persisted ropes and nodes — the source of each card's team-progress ring+ * (lib/teamProgress). The ropes are hand-editable input; the reader tolerates anything. */+ ropes?: BridgeLink[]+ nodes: CanvasNodeState[]onChangeBoard: (next: ProjectKanban) => voidonOpenNode: (nodeId: string, projectId: string) => voidonCreateNode: (projectId: string, choice: KanbanCreateChoice, columnId: string | null) => void@@ -65,7 +72,7 @@ interface SwimlaneProps {}const Swimlane = memo(function Swimlane({- projectId, projectName, projectColor, board, sessions, onChangeBoard, onOpenNode, onCreateNode, onDeleteNode, onRenameNode, onEditSticky, onBrowserNav, onSetIcon, onModalChange, highlight+ projectId, projectName, projectColor, board, sessions, ropes, nodes, onChangeBoard, onOpenNode, onCreateNode, onDeleteNode, onRenameNode, onEditSticky, onBrowserNav, onSetIcon, onModalChange, highlight}: SwimlaneProps) {const dragRef = useRef<{ kind: 'column'; id: string } | { kind: 'card'; id: string } | null>(null)const [modalNodeId, setModalNodeId] = useState<string | null>(null)@@ -87,6 +94,14 @@ const Swimlane = memo(function Swimlane({}, [requestedCardNodeId, sessions])const byId = useMemo(() => new Map(sessions.map(s => [s.id, s])), [sessions])+ // Team progress per opener. The previous map is threaded back in so an unchanged team keeps its+ // array identity and the memoized card does not re-render.+ const teamsRef = useRef<ReadonlyMap<string, readonly TeamStation[]>>()+ const teams = useMemo(() => {+ teamsRef.current = stationsByOpener(ropes, Array.isArray(nodes) ? nodes.map(stationNodeFromState) : [], teamsRef.current)+ return teamsRef.current+ }, [ropes, nodes])+ const travel = useCallback((nodeId: string) => onOpenNode(nodeId, projectId), [onOpenNode, projectId])const sessionIds = useMemo(() => sessions.map(s => s.id), [sessions])const paletteLabels = useMemo(() => boardLabels(board), [board])@@ -174,6 +189,7 @@ const Swimlane = memo(function Swimlane({const lanesFor = (columnId: string | null): KanbanLane[] => {const cards = columnId === null ? columnCards.ungrouped : columnCards.byColumn.get(columnId) ?? []const onDropAt = dropAtCardFor(columnId)+ const category = columnId === null ? undefined : columnCategory(board.columns.find(c => c.id === columnId))return [{sourceId: 'sessions' as const,count: cards.length,@@ -188,6 +204,9 @@ const Swimlane = memo(function Swimlane({onDragStart={handleCardDragStart}onDragEnd={handleDragEnd}onDropAt={onDropAt}+ team={teams.get(s.id) ?? NO_STATIONS}+ onTravel={travel}+ columnCategory={category}/>))}]@@ -282,6 +301,8 @@ const Swimlane = memo(function Swimlane({onEditSticky={(t) => onEditSticky(projectId, modalNodeId, t)}onBrowserNav={(patch) => onBrowserNav(projectId, modalNodeId, patch)}onSetIcon={(icon) => onSetIcon(projectId, modalNodeId, icon)}+ team={teams.get(modalNodeId) ?? NO_STATIONS}+ onTravel={(nodeId) => { setModalNodeId(null); travel(nodeId) }}/>)}</div>@@ -401,6 +422,8 @@ export const GlobalKanbanView = memo(function GlobalKanbanView() {projectColor={p.color}board={board}sessions={sessions}+ ropes={p.ropes}+ nodes={p.nodes}onChangeBoard={next => onChangeBoard(p.id, next)}onOpenNode={onOpenNode}onCreateNode={onCreateNode}diff --git a/src/renderer/components/kanban/KanbanView.teamProgress.test.tsx b/src/renderer/components/kanban/KanbanView.teamProgress.test.tsxnew file mode 100644index 000000000..45f4654ad--- /dev/null+++ b/src/renderer/components/kanban/KanbanView.teamProgress.test.tsx@@ -0,0 +1,161 @@+// @vitest-environment jsdom+//+// Team progress on an orchestrator's board card, and the card leaving out what its place on the+// board (or its own title) already says.+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 { useProjects } from '../../state/projects'+import { useAgentStatus, type AgentNodeStatus } from '../../state/agentStatus'+import { stationsByOpener, type StationNodeLike } from '../../lib/teamProgress'++vi.mock('../../session/session', () => ({+ useSession: () => ({ source: 'local', api: window.nodeTerminal })+}))+vi.mock('../ContextMeter', () => ({ ContextMeter: () => null }))++let root: Root | null = null+let host: HTMLElement+const card = (id: string, title = `Card ${id}`): KanbanSession =>+ ({ id, title, color: '#fff', kind: 'terminal', agentId: 'claude', spawn: {} }) as unknown as KanbanSession+const term = (id: string, extra: Partial<StationNodeLike> = {}): StationNodeLike =>+ ({ id, kind: 'terminal', title: `Station ${id}`, agentId: 'claude', ...extra })+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })+const status = (patch: Partial<AgentNodeStatus>): AgentNodeStatus => ({ unread: false, ...patch }) as AgentNodeStatus++const board = (): ProjectKanban => ({+ columns: [+ { id: 'doing', title: 'In Progress', color: '#ffd60a', category: 'started' },+ { id: 'done', title: 'Done', color: '#32d74b', category: 'done' }+ ],+ assignments: [+ { nodeId: 'orch', columnId: 'doing' },+ { nodeId: 'late-doing', columnId: 'doing' },+ { nodeId: 'late-done', columnId: 'done' }+ ],+ meta: [+ { nodeId: 'late-doing', dueAt: 1 },+ { nodeId: 'late-done', dueAt: 1 }+ ]+} as unknown as ProjectKanban)++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 () => {} }+ }+ useProjects.setState({ activeProjectId: 'p-team' } as never)+ useAgentStatus.setState({ byId: {} } as never)+})+afterEach(() => {+ if (root) act(() => root!.unmount())+ root = null+ host?.remove()+ document.body.innerHTML = ''+ vi.unstubAllGlobals()+})++function mount(opts: { onOpenNode?: (id: string) => void } = {}): void {+ // orch opened a, b, c, d, gone and a plain terminal; d also waits on a (an `--after` rope, which+ // must not make `a` a team leader); `gone` was deleted.+ const nodes = [term('orch'), term('a'), term('b'), term('c'), term('d'), term('plain', { agentId: undefined })]+ const teams = stationsByOpener(+ [rope('orch', 'a'), rope('orch', 'b'), rope('orch', 'c'), rope('orch', 'd'), rope('a', 'd'),+ rope('orch', 'gone'), rope('orch', 'plain')],+ nodes+ )+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+ const noop = (): void => {}+ const sessions = [card('orch', 'Orchestrator'), card('a'), card('late-doing'), card('late-done')]+ act(() => root!.render(+ <KanbanView board={board()} sessions={sessions} onChange={noop} onOpenNode={opts.onOpenNode ?? noop}+ onCreateNode={noop} onRenameNode={noop} onEditSticky={noop} onDeleteNode={noop}+ onModalNodeChange={noop} onBrowserNav={noop} onSetIcon={noop} teams={teams} />+ ))+}++const cardEl = (id: string): HTMLElement => document.querySelector<HTMLElement>(`[data-kanban-card="${id}"]`)!+const chipOf = (id: string): HTMLButtonElement | null => cardEl(id).querySelector<HTMLButtonElement>('.team-progress')++describe('team progress on the orchestrator card', () => {+ it('counts each station by its hook state; unknown is not done, a deleted or plain station is not in M', () => {+ useAgentStatus.setState({+ byId: {+ a: status({ state: 'done' }),+ b: status({ state: 'working' }),+ c: status({ state: 'blocked' })+ // d: no status yet — unknown+ }+ } as never)+ mount()+ const chip = chipOf('orch')!+ expect(chip.textContent).toBe('1/4')+ expect(chip.dataset.done).toBe('1')+ expect(chip.dataset.total).toBe('4')+ expect(chip.getAttribute('aria-label')).toBe(+ 'Team progress: 1 of 4 done — 1 needs you, 1 working, 1 unknown (+1 without status)'+ )+ expect(chip.className).toContain('team-progress--needs')+ // `a` opened nothing — its `--after` rope into d is a wait, not a team.+ expect(chipOf('a')).toBeNull()+ })++ it('follows the store: a station finishing moves the count', () => {+ useAgentStatus.setState({ byId: { a: status({ state: 'working' }) } } as never)+ mount()+ expect(chipOf('orch')!.textContent).toBe('0/4')+ act(() => useAgentStatus.setState({ byId: { a: status({ state: 'done' }) } } as never))+ expect(chipOf('orch')!.textContent).toBe('1/4')+ })++ it('lists the stations and travels to the one picked, without opening the card', () => {+ useAgentStatus.setState({ byId: { a: status({ state: 'done', lastTurnError: { at: 1 } }) } } as never)+ const onOpenNode = vi.fn()+ mount({ onOpenNode })+ act(() => chipOf('orch')!.dispatchEvent(new MouseEvent('click', { bubbles: true })))+ const rows = [...document.querySelectorAll<HTMLElement>('.ctx-menu .ctx-item')]+ expect(rows.map((r) => r.textContent)).toEqual([+ 'Station a — last turn failed',+ 'Station b — unknown',+ 'Station c — unknown',+ 'Station d — unknown',+ 'Station plain — no status'+ ])+ expect(document.querySelector('.ctx-menu .ctx-label')?.textContent).toBe(+ '0 of 4 done — 1 last turn failed, 3 unknown (+1 without status)'+ )+ act(() => rows[1].dispatchEvent(new MouseEvent('click', { bubbles: true })))+ expect(onOpenNode).toHaveBeenCalledWith('b')+ // The pick did not bubble to the card and open its modal.+ expect(document.querySelector('.kanban-modal')).toBeNull()+ })+})++describe('the card does not repeat what its place already says', () => {+ it('hides the session-name chip when it is the title, keeps it when it says more', () => {+ useAgentStatus.setState({+ byId: {+ orch: status({ session: ' orchestrator ', sessionId: 's1' }),+ a: status({ session: 'Refactor auth', sessionId: 's2' })+ }+ } as never)+ mount()+ expect(cardEl('orch').querySelector('.kanban-card__session')).toBeNull()+ expect(cardEl('a').querySelector('.kanban-card__session')?.textContent).toBe('Refactor auth')+ })++ it('no overdue alarm on a card the Done column already settled; the date stays', () => {+ mount()+ const doing = cardEl('late-doing').querySelector('.kanban-due')!+ const done = cardEl('late-done').querySelector('.kanban-due')!+ expect(doing.classList.contains('kanban-due--overdue')).toBe(true)+ expect(done.classList.contains('kanban-due--overdue')).toBe(false)+ expect(done.textContent).not.toBe('')+ })+})diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex fcb7ac9d4..305035d94 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -53,6 +53,7 @@ import { GITHUB_MAPPING_NOT_APPROVED, githubThrottleSentence } from '../../lib/gimport { pullStatusFreshness, type GitHubPullStatus } from '@shared/github-pull-status'import { pullsClosingIssue, pullsForCard, pullStatusByNumber } from '../../lib/pullLinks'import { usePullAutoMove, usePullChase } from './usePullAutoMove'+import { NO_STATIONS, type TeamStation } from '../../lib/teamProgress'/** One session node shown as a board card — derived LIVE from the canvas nodes; the board* itself stores only column assignments. */@@ -142,6 +143,12 @@ export interface KanbanViewProps {* same reason as `accountMenuItems`: a board with no canvas behind it offers none.*/issueAgentMenu?: (issue: GitHubIssueCardView) => MenuItem[]+ /**+ * The stations each session opened (lib/teamProgress `stationsByOpener`, keyed by the opener's+ * node id), for the team-progress ring on its card and card modal. Optional: without it no card+ * shows one.+ */+ teams?: ReadonlyMap<string, readonly TeamStation[]>}type Drag =@@ -211,7 +218,7 @@ function useCanvasCovered(): void {export const KanbanView = memo(function KanbanView({board, sessions, onChange, onOpenNode, onCreateNode, onRenameNode, onEditSticky, onDeleteNode,- onModalNodeChange, onBrowserNav, onSetIcon, accountMenuItems, onAutoMoveFromPulls, issueAgentMenu+ onModalNodeChange, onBrowserNav, onSetIcon, accountMenuItems, onAutoMoveFromPulls, issueAgentMenu, teams}: KanbanViewProps) {useCanvasCovered()const { api } = useSession()@@ -850,6 +857,7 @@ export const KanbanView = memo(function KanbanView({? columnCards.ungrouped: columnCards.byColumn.get(columnId) ?? NO_CARDSconst onDropAt = dropAtCardFor(columnId)+ const category = columnId === null ? undefined : columnCategory(board.columns.find((c) => c.id === columnId))lanes.push({sourceId: 'sessions',count: cards.length,@@ -867,6 +875,9 @@ export const KanbanView = memo(function KanbanView({onDropAt={onDropAt}pulls={pullsByCard.get(s.id) ?? NO_PULLS}pullFreshness={pullFreshness}+ team={teams?.get(s.id) ?? NO_STATIONS}+ onTravel={onOpenNode}+ columnCategory={category}/>))})@@ -1212,6 +1223,11 @@ export const KanbanView = memo(function KanbanView({setModalNodeId(null)handleOpenIssueRef(ref)}}+ team={teams?.get(modalNodeId) ?? NO_STATIONS}+ onTravel={(nodeId) => {+ setModalNodeId(null)+ onOpenNode(nodeId)+ }}/>)}{modalIssue && (diff --git a/src/renderer/components/kanban/SessionCard.tsx b/src/renderer/components/kanban/SessionCard.tsxindex 63a795924..4a4c92320 100644--- a/src/renderer/components/kanban/SessionCard.tsx+++ b/src/renderer/components/kanban/SessionCard.tsx@@ -1,5 +1,5 @@import { memo, useState } from 'react'-import type { KanbanCardMeta, KanbanLabel, KanbanPriority } from '@shared/types'+import type { KanbanCardMeta, KanbanColumnCategory, KanbanLabel, KanbanPriority } from '@shared/types'import { useAgentStatus } from '../../state/agentStatus'import { AccountChip, useAccountChip } from '../AccountChip'import { ContextMeter } from '../ContextMeter'@@ -14,6 +14,9 @@ import type { IssueRef } from '@shared/github-issue-ref'import { IssueRefChip } from '../IssueRefChip'import { cardBadge } from '../../lib/kanbanStatusChips'import { cardAssignees } from '@shared/kanban-labels'+import { TeamProgressChip } from '../TeamProgressChip'+import type { TeamStation } from '../../lib/teamProgress'+import { cardShowsOverdue, sessionNameRepeatsTitle } from '../../lib/cardRedundancy'const PRIO_COLOR = Object.fromEntries(PRIORITIES.map((p) => [p.id, p.color])) as Record<KanbanPriority, string>@@ -37,11 +40,17 @@ interface SessionCardProps {pullFreshness?: PullStatusFreshness/** The session's `#N` chip (it was started on a GitHub issue): open that issue. */onOpenIssue?: (ref: IssueRef) => void+ /** The stations this session opened (lib/teamProgress) — a stable array per card. */+ team?: readonly TeamStation[]+ /** A station row in the team list was picked: go to that node on the canvas. */+ onTravel?: (nodeId: string) => void+ /** The lifecycle category of the column the card sits in (lib/cardRedundancy reads it). */+ columnCategory?: KanbanColumnCategory}export const SessionCard = memo(function SessionCard({session, meta, labels = [], onOpen, onDragStart, onDragEnd, onDropAt, onContext, pulls,- pullFreshness = 'fresh', onOpenIssue+ pullFreshness = 'fresh', onOpenIssue, team, onTravel, columnCategory}: SessionCardProps) {// THIS card's agent status, subscribed per card rather than threaded down from the board.// KanbanView used to hold `useAgentStatus((s) => s.byId)` and pass the map through the column:@@ -70,12 +79,18 @@ export const SessionCard = memo(function SessionCard({const stickyPreview = session.kind === 'sticky' ? (session.text ?? '').trim() : ''const assignees = cardAssignees(meta)const due = meta?.dueAt- const overdue = due !== undefined && due < Date.now()+ // Not in a done/closed column: the column already settled it (lib/cardRedundancy). The card+ // modal's Due strip still says "Overdue".+ const overdue = cardShowsOverdue(due, Date.now(), columnCategory)+ // The session name is usually the title (agent titles auto-track it) — then the chip repeats it.+ const sessionName = status?.session && !sessionNameRepeatsTitle(status.session, session.title)+ ? status.session+ : undefinedconst priority = meta?.priority// The account chip counts as detail in its own right: a card whose only thing to say is "this// one is on the other Claude login" is exactly the card that must say it.const hasDetail =- !!status?.sessionId || !!status?.session || !!accountChip || stickyPreview.includes('\n')+ !!status?.sessionId || !!sessionName || !!accountChip || stickyPreview.includes('\n')return (<divclassName={`kanban-card kanban-card--session${dragging ? ' kanban-card--dragging' : ''}${@@ -123,6 +138,9 @@ export const SessionCard = memo(function SessionCard({{session.kind === 'terminal' && onOpenIssue && (<IssueRefChip issueRef={session.issueRef} onOpen={onOpenIssue} />)}+ {session.kind === 'terminal' && team && team.length > 0 && onTravel && (+ <TeamProgressChip stations={team} onTravel={onTravel} />+ )}{session.kind === 'sticky' && <span className="kanban-card__kind">note</span>}{session.kind === 'browser' && <span className="kanban-card__kind">web</span>}{badge === 'dropped' && (@@ -201,9 +219,9 @@ export const SessionCard = memo(function SessionCard({<><ContextMeter sessionId={status?.sessionId ?? null} nodeId={session.id} remote={isRemoteSessionNode(session.spawn)} agentId={session.agentId ?? session.spawn.agentId ?? status?.agentId} /><AccountChip chip={accountChip} />- {status?.session && (- <span className="kanban-card__session" title={status.session}>- {status.session}+ {sessionName && (+ <span className="kanban-card__session" title={sessionName}>+ {sessionName}</span>)}</>diff --git a/src/renderer/lib/cardRedundancy.test.ts b/src/renderer/lib/cardRedundancy.test.tsnew file mode 100644index 000000000..3522de585--- /dev/null+++ b/src/renderer/lib/cardRedundancy.test.ts@@ -0,0 +1,42 @@+import { describe, expect, it } from 'vitest'+import { cardShowsOverdue, sessionNameRepeatsTitle } from './cardRedundancy'++describe('sessionNameRepeatsTitle', () => {+ it('hides the chip when the session name is the title (titleAuto)', () => {+ expect(sessionNameRepeatsTitle('Fix login', 'Fix login')).toBe(true)+ expect(sessionNameRepeatsTitle(' fix LOGIN ', 'Fix login')).toBe(true)+ })++ it('keeps it when it says something the title does not', () => {+ expect(sessionNameRepeatsTitle('Fix login', 'Auth station')).toBe(false)+ expect(sessionNameRepeatsTitle('Fix login', '')).toBe(false)+ expect(sessionNameRepeatsTitle('Fix login', undefined)).toBe(false)+ })++ it('an empty or non-string session name has nothing to show', () => {+ expect(sessionNameRepeatsTitle(undefined, 'x')).toBe(true)+ expect(sessionNameRepeatsTitle(' ', 'x')).toBe(true)+ expect(sessionNameRepeatsTitle({ evil: 1 }, 'x')).toBe(true)+ })+})++describe('cardShowsOverdue', () => {+ const now = 1_000+ it('raises the alarm for a past date in a column that is not finished', () => {+ expect(cardShowsOverdue(500, now, undefined)).toBe(true)+ expect(cardShowsOverdue(500, now, 'unstarted')).toBe(true)+ expect(cardShowsOverdue(500, now, 'started')).toBe(true)+ })++ it('the done / closed column already settled it', () => {+ expect(cardShowsOverdue(500, now, 'done')).toBe(false)+ expect(cardShowsOverdue(500, now, 'closed')).toBe(false)+ })++ it('no date, a future date, or a hostile value is never overdue', () => {+ expect(cardShowsOverdue(undefined, now, 'started')).toBe(false)+ expect(cardShowsOverdue(2_000, now, 'started')).toBe(false)+ expect(cardShowsOverdue(Number.NaN, now, 'started')).toBe(false)+ expect(cardShowsOverdue('5' as never, now, 'started')).toBe(false)+ })+})diff --git a/src/renderer/lib/cardRedundancy.ts b/src/renderer/lib/cardRedundancy.tsnew file mode 100644index 000000000..242546274--- /dev/null+++ b/src/renderer/lib/cardRedundancy.ts@@ -0,0 +1,50 @@+/**+ * What a session card leaves out because where it sits, or what it already shows, says it.+ *+ * The card is small and every chip on it competes for the same glance, so a chip that repeats a+ * fact the card already carries — or one the column contradicts — costs attention and buys+ * nothing. Each rule below hides ONE thing on the CARD only; the card modal and the canvas node+ * keep the full picture (the modal's title, its Members/Due strip's "Overdue" chip).+ *+ * Audited and deliberately NOT hidden, because on a session card they do not exist or do not+ * repeat anything (recorded so the next audit does not re-derive it):+ * - a column chip: the card never names its column (only the modal and the canvas node's+ * half-pill do, where the column is NOT visible around them);+ * - a project chip in the Omni overview's swimlanes: the card carries none;+ * - a status badge that restates the column's lifecycle category: there is no DONE badge, and+ * RUNNING / NEEDS YOU describe the agent's turn right now, not the card's lifecycle — an+ * In Progress card that is idle is exactly what RUNNING distinguishes.+ */+import { isCompletedCategory } from '@shared/kanban-category'+import type { KanbanColumnCategory } from '@shared/types'++function normalized(text: string): string {+ return text.trim().replace(/\s+/g, ' ').toLowerCase()+}++/**+ * The session-name chip repeats the title. An agent node's title auto-tracks its session name+ * (`titleAuto`), so on most agent cards the two are the same words — the canvas node header has+ * always hidden that chip then, and the board card now asks the same question here. Compared+ * after trimming, collapsing whitespace and folding case: "Fix login" and "fix login " are one+ * name to a reader.+ */+export function sessionNameRepeatsTitle(session: unknown, title: unknown): boolean {+ if (typeof session !== 'string' || !session.trim()) return true // nothing to show at all+ if (typeof title !== 'string') return false+ return normalized(session) === normalized(title)+}++/**+ * Whether the CARD raises the overdue alarm. A card in a done/closed column is finished work, and+ * a red "late" on it is a claim the column already settled — the date stays, the alarm does not.+ * The card modal's Members/Due strip still says "Overdue": the modal keeps every fact.+ */+export function cardShowsOverdue(+ dueAt: number | undefined,+ now: number,+ category: KanbanColumnCategory | undefined+): boolean {+ if (typeof dueAt !== 'number' || !(dueAt < now)) return false+ return !isCompletedCategory(category)+}diff --git a/src/renderer/lib/teamProgress.test.ts b/src/renderer/lib/teamProgress.test.tsnew file mode 100644index 000000000..5f3865093--- /dev/null+++ b/src/renderer/lib/teamProgress.test.ts@@ -0,0 +1,203 @@+import { describe, expect, it } from 'vitest'+import {+ parseTeamProgressSig,+ stationKind,+ stationsByOpener,+ summarizeTeam,+ teamProgressSig,+ teamProgressText,+ type StationNodeLike,+ type TeamStation+} from './teamProgress'+import type { AgentNodeStatus } from '../state/agentStatus'++const term = (id: string, extra: Partial<StationNodeLike> = {}): StationNodeLike => ({+ id,+ kind: 'terminal',+ title: id.toUpperCase(),+ agentId: 'claude',+ ...extra+})+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })+const st = (patch: Partial<AgentNodeStatus>): AgentNodeStatus => ({ unread: false, ...patch }) as AgentNodeStatus++describe('stationsByOpener', () => {+ it('groups the rope targets under the node that opened them, in rope order', () => {+ const map = stationsByOpener([rope('o', 'a'), rope('o', 'b')], [term('o'), term('a'), term('b')])+ expect(map.get('o')?.map((s) => s.id)).toEqual(['a', 'b'])+ expect(map.get('o')?.[0]).toEqual({ id: 'a', title: 'A', agentId: 'claude', queued: false })+ })++ it('a later rope into the same target is a wait, not a second opener (pipeline + verify panel)', () => {+ // o opened a, b, c; b waits on a, c waits on b (`--after` writes its dep rope AFTER the opener's).+ const ropes = [rope('o', 'a'), rope('o', 'b'), rope('a', 'b'), rope('o', 'c'), rope('b', 'c')]+ const map = stationsByOpener(ropes, [term('o'), term('a'), term('b'), term('c')])+ expect(map.get('o')?.map((s) => s.id)).toEqual(['a', 'b', 'c'])+ expect(map.has('a')).toBe(false)+ expect(map.has('b')).toBe(false)+ })++ it('a deleted station is not a station, and its wait rope is not promoted to opener', () => {+ const ropes = [rope('o', 'a'), rope('o', 'gone'), rope('a', 'gone')]+ const map = stationsByOpener(ropes, [term('o'), term('a')])+ expect(map.get('o')?.map((s) => s.id)).toEqual(['a'])+ expect(map.has('a')).toBe(false)+ })++ it('a deleted opener shows nowhere, and does not hand its station to the next rope', () => {+ const map = stationsByOpener([rope('gone', 'a'), rope('b', 'a')], [term('a'), term('b')])+ expect(map.size).toBe(0)+ })++ it('only session nodes are stations (a browser popup rope is lineage, not a team member)', () => {+ const map = stationsByOpener(+ [rope('o', 'web'), rope('o', 'note'), rope('o', 'a')],+ [term('o'), { id: 'web', kind: 'browser' }, { id: 'note', kind: 'sticky' }, term('a')]+ )+ expect(map.get('o')?.map((s) => s.id)).toEqual(['a'])+ })++ it('carries the held launch as `queued`', () => {+ const map = stationsByOpener([rope('o', 'a')], [term('o'), term('a', { queued: true })])+ expect(map.get('o')?.[0].queued).toBe(true)+ })++ it('reuses the previous arrays and map when nothing changed', () => {+ const nodes = [term('o'), term('a'), term('p'), term('b')]+ const ropes = [rope('o', 'a'), rope('p', 'b')]+ const first = stationsByOpener(ropes, nodes)+ const again = stationsByOpener(ropes, nodes.map((n) => ({ ...n })), first)+ expect(again).toBe(first)+ const renamed = stationsByOpener(ropes, [term('o'), term('a', { title: 'new' }), term('p'), term('b')], first)+ expect(renamed).not.toBe(first)+ expect(renamed.get('p')).toBe(first.get('p'))+ expect(renamed.get('o')).not.toBe(first.get('o'))+ })++ it('a dropped group changes the map identity', () => {+ const first = stationsByOpener([rope('o', 'a')], [term('o'), term('a')])+ expect(stationsByOpener([], [term('o'), term('a')], first)).not.toBe(first)+ })++ it('hostile ropes and nodes from a hand-edited project.json never throw', () => {+ const hostile: unknown[] = [+ null,+ 5,+ 'ctrl-o-a',+ [],+ { source: {}, target: 'a' },+ { source: 'o', target: 7 },+ { source: '', target: 'a' },+ { source: 'o', target: 'o' },+ { source: '__proto__', target: 'constructor' },+ { source: 'o', target: 'a', id: { evil: true } },+ Object.create(null)+ ]+ const nodes = [+ term('o'),+ term('a', { title: { toString: () => 'x' }, agentId: 42 }),+ term('__proto__'),+ term('constructor'),+ { id: 5, kind: 'terminal' },+ null as unknown as StationNodeLike+ ]+ for (const ropes of [hostile, 'nope', { length: 3 }, null, undefined, 12]) {+ expect(() => stationsByOpener(ropes, nodes)).not.toThrow()+ }+ const map = stationsByOpener(hostile, nodes)+ expect(map.get('o')).toEqual([{ id: 'a', title: '', queued: false }])+ expect(map.get('__proto__')?.map((s) => s.id)).toEqual(['constructor'])+ expect(() => stationsByOpener([rope('o', 'a')], 'nodes' as never)).not.toThrow()+ })+})++describe('stationKind', () => {+ const s = (patch: Partial<TeamStation> = {}): TeamStation => ({ id: 'a', title: 'A', agentId: 'claude', queued: false, ...patch })++ it('maps each hook state', () => {+ expect(stationKind(s(), st({ state: 'done' }))).toBe('done')+ expect(stationKind(s(), st({ state: 'working' }))).toBe('working')+ expect(stationKind(s(), st({ state: 'waiting' }))).toBe('needs')+ expect(stationKind(s(), st({ state: 'blocked' }))).toBe('needs')+ expect(stationKind(s(), st({ state: 'done', lastTurnError: { at: 1 } }))).toBe('errored')+ expect(stationKind(s(), st({ state: 'done', dropped: true }))).toBe('dropped')+ })++ it('unknown is unknown — never done — for an agent that can report', () => {+ expect(stationKind(s(), undefined)).toBe('unknown')+ expect(stationKind(s(), st({}))).toBe('unknown')+ })++ it('a node that can never report is untracked, not unknown', () => {+ expect(stationKind(s({ agentId: undefined }), undefined)).toBe('untracked')+ expect(stationKind(s({ agentId: 'custom:nohooks' }), undefined)).toBe('untracked')+ // …unless the store has seen it run a reporting agent (a hand-launched claude in a plain terminal).+ expect(stationKind(s({ agentId: undefined }), st({ agentId: 'claude' }))).toBe('unknown')+ expect(stationKind(s({ agentId: undefined }), st({ state: 'done' }))).toBe('done')+ })++ it('paused / hibernated survive a restart as a finished turn', () => {+ expect(stationKind(s(), st({ paused: true }))).toBe('paused')+ expect(stationKind(s(), st({ hibernated: true }))).toBe('paused')+ })++ it('a held launch outranks idle readings but not live ones', () => {+ expect(stationKind(s({ queued: true }), undefined)).toBe('queued')+ expect(stationKind(s({ queued: true }), st({ state: 'done' }))).toBe('queued')+ expect(stationKind(s({ queued: true }), st({ state: 'working' }))).toBe('working')+ expect(stationKind(s({ queued: true }), st({ state: 'waiting' }))).toBe('needs')+ })+})++describe('teamProgressSig / summarizeTeam', () => {+ const stations: TeamStation[] = ['d', 'w', 'n', 'e', 'x', 'q', 'u', 'p', 'plain'].map((id) => ({+ id,+ title: id,+ agentId: id === 'plain' ? undefined : 'claude',+ queued: id === 'q'+ }))+ const byId: Record<string, AgentNodeStatus> = {+ d: st({ state: 'done' }),+ w: st({ state: 'working' }),+ n: st({ state: 'blocked' }),+ e: st({ state: 'done', lastTurnError: { at: 1 } }),+ x: st({ state: 'done', dropped: true }),+ p: st({ hibernated: true })+ }++ it('counts per state, unknown and untracked kept out of N', () => {+ const kinds = parseTeamProgressSig(teamProgressSig(byId, stations))+ expect(kinds).toEqual(['done', 'working', 'needs', 'errored', 'dropped', 'queued', 'unknown', 'paused', 'untracked'])+ const p = summarizeTeam(kinds)+ expect(p.done).toBe(2)+ expect(p.total).toBe(8)+ expect(p.counts.unknown).toBe(1)+ expect(p.attention).toBe('error')+ expect(teamProgressText(p)).toBe(+ '2 of 8 done — 1 dropped, 1 last turn failed, 1 needs you, 1 working, 1 queued, 1 unknown (+1 without status)'+ )+ })++ it('the signature carries no ids, and is stable across same-state events', () => {+ const sig = teamProgressSig(byId, stations)+ expect(sig).not.toContain('plain')+ const refreshed = { ...byId, d: st({ state: 'done', stateAt: 999 }) }+ expect(teamProgressSig(refreshed, stations)).toBe(sig)+ })++ it('a station that is not in the store reads unknown', () => {+ const p = summarizeTeam(parseTeamProgressSig(teamProgressSig({}, stations.slice(0, 2))))+ expect(p).toMatchObject({ done: 0, total: 2, attention: null })+ expect(p.counts.unknown).toBe(2)+ })++ it('attention ranks needs over working', () => {+ expect(summarizeTeam(['working', 'needs', 'done']).attention).toBe('needs')+ expect(summarizeTeam(['working', 'done']).attention).toBe('working')+ expect(summarizeTeam(['done', 'done']).attention).toBeNull()+ })++ it('an unreadable signature character reads as unknown, never done', () => {+ expect(parseTeamProgressSig('dZ')).toEqual(['done', 'unknown'])+ })+})diff --git a/src/renderer/lib/teamProgress.ts b/src/renderer/lib/teamProgress.tsnew file mode 100644index 000000000..bf58acc67--- /dev/null+++ b/src/renderer/lib/teamProgress.ts@@ -0,0 +1,251 @@+/**+ * Team progress: how far along the stations an orchestrator session opened are.+ *+ * A STATION is a session node this node opened — a target of one of the project's ropes+ * (`project.ropes`, `ctrl-<source>-<target>`). The orchestrator's card, its card modal and its+ * canvas node header show "N of M done" over those stations, and clicking the ring lists them.+ *+ * Four rules decided here, each with its reason:+ *+ * 1. **A rope names an opener only when it is the FIRST rope into its target.** Ropes carry two+ * relations with one id shape: "opened by" and "waits for" (`--after`, and the `verify` panel's+ * sequencing). Nothing on the node records which rope was the opener, but every writer appends+ * the opener's rope BEFORE the dep ropes of the same command (`connect` then `ropeDeps`; the+ * load-time `missingDepRopes` heal appends after whatever the file already holds). So the first+ * incoming rope is the opener, and a later one is a wait. Without this, every `--after`+ * dependency would read as a team leader: in a pipeline A → B → C each station would show the+ * next one as its team, and in a verify panel each reviewer would show the judge.+ * 2. **Unknown is unknown, never done.** Agent state is transient; after an app restart nobody has+ * reported yet. A station with no state reads `unknown` and does not count toward N. The only+ * idle facts that survive a restart are `paused` / `hibernated`, and both are written only by an+ * exit that refused a busy session — so they count as a finished turn (`paused`).+ * 3. **A station that can never report is not in M.** A plain terminal (a dev server an orchestrator+ * started) or an agent with no hooks never says `done`; counting it would pin the ring below+ * complete forever. It is listed as `untracked` and left out of the fraction — the same line+ * `--after` draws when it refuses to wait on such a node.+ * 4. **A station that is gone is not a station.** A rope whose target is no longer a session node+ * on this canvas (deleted, or never there in a hand-edited file) is skipped: a closed station is+ * not outstanding work, and there is nothing to travel to.+ *+ * The card subscribes to `teamProgressSig(byId, stations)` — one character per station — never to+ * the whole `byId` map (the `armedDepSig` / `loopSig` discipline). The signature carries no node+ * ids, so a hostile id cannot forge an entry for another station.+ *+ * `project.ropes` comes out of a git-shared, hand-editable file and is not sanitized on load, so+ * `stationsByOpener` accepts `unknown` and skips every entry it cannot read rather than throwing.+ */+import { capabilityAgentId, hasHooks, type AgentId } from '@shared/agents/config'+import type { AgentNodeStatus } from '../state/agentStatus'++export type StationKind =+ | 'done'+ | 'paused'+ | 'working'+ | 'needs'+ | 'errored'+ | 'dropped'+ | 'queued'+ | 'unknown'+ | 'untracked'++export interface TeamStation {+ id: string+ title: string+ /** The agent the node was created with (node data), when it says. */+ agentId?: string+ /** The node holds a launch it has not delivered yet (`pendingLaunch`). */+ queued: boolean+}++/** The fields `stationsByOpener` reads from a node — live canvas node or serialized state alike. */+export interface StationNodeLike {+ id: unknown+ /** React Flow `type` for a live node, `kind` for serialized state. */+ kind: unknown+ title?: unknown+ agentId?: unknown+ queued?: boolean+}++/** Shared empty list, so a card with no stations keeps a stable prop. */+export const NO_STATIONS: readonly TeamStation[] = Object.freeze([])++function readRope(r: unknown): { source: string; target: string } | null {+ if (!r || typeof r !== 'object') return null+ const { source, target } = r as { source?: unknown; target?: unknown }+ if (typeof source !== 'string' || typeof target !== 'string') return null+ if (!source || !target || source === target) return null+ return { source, target }+}++function sameStations(a: readonly TeamStation[], b: readonly TeamStation[]): boolean {+ return (+ a.length === b.length &&+ a.every(+ (s, i) =>+ s.id === b[i].id && s.title === b[i].title && s.agentId === b[i].agentId && s.queued === b[i].queued+ )+ )+}++/**+ * Stations grouped by the node that opened them (rule 1 above), in rope order. Pass the previous+ * result to keep each group's array identity — and the map's own identity — when nothing changed:+ * the canvas recomputes this on node changes, and a fresh array per render would defeat the card's+ * memo and wake every subscriber of the store it is published to.+ */+export function stationsByOpener(+ ropes: unknown,+ nodes: readonly StationNodeLike[],+ previous?: ReadonlyMap<string, readonly TeamStation[]>+): ReadonlyMap<string, readonly TeamStation[]> {+ const sessions = new Map<string, StationNodeLike>()+ for (const n of Array.isArray(nodes) ? nodes : []) {+ if (n && typeof n.id === 'string' && n.kind === 'terminal') sessions.set(n.id, n)+ }+ const grouped = new Map<string, TeamStation[]>()+ if (Array.isArray(ropes) && sessions.size > 0) {+ const opened = new Set<string>()+ for (const raw of ropes) {+ const rope = readRope(raw)+ if (!rope || opened.has(rope.target)) continue+ // The first rope into a target is its opener's, whether or not that target is still here —+ // a later rope into the same target is a wait, and must not be promoted by a deletion.+ opened.add(rope.target)+ const node = sessions.get(rope.target)+ if (!node || !sessions.has(rope.source)) continue+ const list = grouped.get(rope.source) ?? []+ list.push({+ id: rope.target,+ title: typeof node.title === 'string' ? node.title : '',+ ...(typeof node.agentId === 'string' && node.agentId ? { agentId: node.agentId } : {}),+ queued: !!node.queued+ })+ grouped.set(rope.source, list)+ }+ }+ const out = new Map<string, readonly TeamStation[]>()+ let unchanged = !!previous && previous.size === grouped.size+ for (const [opener, list] of grouped) {+ const prev = previous?.get(opener)+ if (prev && sameStations(prev, list)) out.set(opener, prev)+ else {+ out.set(opener, list)+ unchanged = false+ }+ }+ return unchanged && previous ? previous : out+}++type StatusLike = Pick<AgentNodeStatus, 'state'> &+ Partial<Pick<AgentNodeStatus, 'dropped' | 'paused' | 'hibernated' | 'lastTurnError' | 'agentId'>>++function reports(agentId: string | undefined): boolean {+ if (!agentId) return false+ try {+ return hasHooks(capabilityAgentId(agentId as AgentId))+ } catch {+ return false+ }+}++/**+ * One station's state. The ranking: a dead CLI first (the strongest claim, and only ever raised on+ * a `done` node), then the states a person must act on, then work in flight. A held launch outranks+ * every idle reading — nothing the node reported can be about a run that has not started — but not+ * a live `working` / `needs`: a user can launch a `manualOnly` station by hand, and its hooks are+ * then the truth. `done` with a live turn error is `errored`, the same verdict `--after` refuses on.+ */+export function stationKind(station: TeamStation, status: StatusLike | undefined): StationKind {+ if (status?.dropped) return 'dropped'+ const state = status?.state+ if (state === 'waiting' || state === 'blocked') return 'needs'+ if (state === 'working') return 'working'+ if (station.queued) return 'queued'+ if (state === 'done') return status?.lastTurnError ? 'errored' : 'done'+ if (status?.paused || status?.hibernated) return 'paused'+ return reports(station.agentId ?? status?.agentId) ? 'unknown' : 'untracked'+}++const CHAR: Record<StationKind, string> = {+ done: 'd',+ paused: 'p',+ working: 'w',+ needs: 'n',+ errored: 'e',+ dropped: 'x',+ queued: 'q',+ unknown: '?',+ untracked: '-'+}+const KIND_OF: Record<string, StationKind> = Object.fromEntries(+ Object.entries(CHAR).map(([kind, ch]) => [ch, kind as StationKind])+)++/** The primitive a card subscribes to: one character per station, in station order. */+export function teamProgressSig(+ byId: Readonly<Record<string, StatusLike | undefined>>,+ stations: readonly TeamStation[]+): string {+ let sig = ''+ for (const s of stations) sig += CHAR[stationKind(s, byId[s.id])]+ return sig+}++/** The kinds back out of a signature. A character it does not know reads as `unknown`. */+export function parseTeamProgressSig(sig: string): StationKind[] {+ return [...sig].map((ch) => KIND_OF[ch] ?? 'unknown')+}++export interface TeamProgress {+ /** Stations whose last turn ended cleanly (`done`, or paused/hibernated after one). */+ done: number+ /** Stations that can report — everything but `untracked`. The denominator. */+ total: number+ counts: Record<StationKind, number>+ /** What the ring's accent should say, strongest first. */+ attention: 'error' | 'needs' | 'working' | null+}++export function summarizeTeam(kinds: readonly StationKind[]): TeamProgress {+ const counts = Object.fromEntries(Object.keys(CHAR).map((k) => [k, 0])) as Record<StationKind, number>+ for (const k of kinds) counts[k]+++ const done = counts.done + counts.paused+ const total = kinds.length - counts.untracked+ const attention =+ counts.errored + counts.dropped > 0+ ? 'error'+ : counts.needs > 0+ ? 'needs'+ : counts.working > 0+ ? 'working'+ : null+ return { done, total, counts, attention }+}++export const STATION_LABEL: Record<StationKind, string> = {+ done: 'done',+ paused: 'done · paused',+ working: 'working',+ needs: 'needs you',+ errored: 'last turn failed',+ dropped: 'dropped',+ queued: 'queued',+ unknown: 'unknown',+ untracked: 'no status'+}++/** Order of the breakdown in the tooltip and the list header — attention first. */+const BREAKDOWN: readonly StationKind[] = [+ 'dropped', 'errored', 'needs', 'working', 'queued', 'unknown', 'done', 'paused', 'untracked'+]++/** "2 of 5 done — 1 working, 1 needs you, 1 unknown" (+ the untracked count, outside M). */+export function teamProgressText(p: TeamProgress): string {+ const parts = BREAKDOWN.filter((k) => k !== 'done' && k !== 'paused' && k !== 'untracked' && p.counts[k] > 0).map(+ (k) => `${p.counts[k]} ${STATION_LABEL[k]}`+ )+ const head = `${p.done} of ${p.total} done`+ const tail = p.counts.untracked > 0 ? ` (+${p.counts.untracked} without status)` : ''+ return `${head}${parts.length ? ` — ${parts.join(', ')}` : ''}${tail}`+}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex d33dcd434..f38af3c3d 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -237,6 +237,9 @@ import { agentLaunchOverride, COLLAPSED_HEIGHT, type CanvasNode } from '../stateimport { NodeColorSwatches } from '../components/NodeColorSwatches'import { AccountChip, useAccountChip } from '../components/AccountChip'import { IssueRefChip } from '../components/IssueRefChip'+import { TeamProgressChip } from '../components/TeamProgressChip'+import { useTeamStations } from '../state/teamStations'+import { sessionNameRepeatsTitle } from '../lib/cardRedundancy'import { effectiveAccountId } from '../lib/accountChip'import {hasHooks,@@ -289,6 +292,12 @@ import { waitForSshRemote } from '../lib/sshRemoteWait'/** Which physical modifier the registry's abstract `Cmd` resolves to for the find-bar chord. */const isMac = isMacPlatform()+/** A station was picked from the header's team ring: frame it — Canvas's `focusNodeById`, the same+ * path the Omni board's "Open on canvas" takes (it also handles a node in another project). */+function travelToStation(nodeId: string): void {+ window.dispatchEvent(new CustomEvent('nodeterm:focus-node', { detail: { nodeId } }))+}+/** How long a remote terminal waits for its project's ControlMaster before giving up and showing* the offline overlay. Sized for the SLOW-but-fine case (a cold app load whose connect is still* authenticating, a passphrase prompt, a distant host), not for the unreachable one — the@@ -1801,6 +1810,9 @@ export function TerminalNode({*/const observedAccount = status?.accountconst accountChip = useAccountChip(data.accountId, observedAccount)+ // This node's team (the stations it opened), published by Canvas from the live ropes. The store+ // keeps each unchanged team's array identity, so this re-renders only when THIS team changes.+ const team = useTeamStations((s) => s.byNode.get(id))const accountForReads = effectiveAccountId(data.accountId, observedAccount, claudeAccounts)/** Mirror for the session-name poll, whose effect must not restart when a late hook event* finally reveals the account (see its comment). */@@ -5694,7 +5706,7 @@ export function TerminalNode({{data.title || 'Untitled'}</span>)}- {status?.session && status.session !== data.title && (+ {status?.session && !sessionNameRepeatsTitle(status.session, data.title) && (<span className="term-node__session" title={status.session}>{status.session}</span>@@ -5713,6 +5725,9 @@ export function TerminalNode({)}}/>+ {/* The stations this session opened, and how far along they are — the same ring its board+ card and card modal draw (lib/teamProgress). A row travels to that station. */}+ {team && <TeamProgressChip stations={team} onTravel={travelToStation} menuZIndex={60} />}{/* The fallback, made visible. A Codex node that could not get a managed shared identityruns a perfectly good plain `codex` — but the user has to be able to SEE that it did,without reading a log, so the chip states it and its tooltip says why. Absent (and thediff --git a/src/renderer/state/teamStations.test.ts b/src/renderer/state/teamStations.test.tsnew file mode 100644index 000000000..091369ffd--- /dev/null+++ b/src/renderer/state/teamStations.test.ts@@ -0,0 +1,63 @@+import fs from 'fs'+import path from 'path'+import { describe, expect, it } from 'vitest'+import type { CanvasNode } from './workspace'+import { NO_TEAMS, canvasTeamStations, stationNodeFromFlow, stationNodeFromState, useTeamStations } from './teamStations'++const flow = (id: string, data: Record<string, unknown> = {}, type = 'terminal'): CanvasNode =>+ ({ id, type, position: { x: 0, y: 0 }, data: { title: `T ${id}`, agentId: 'claude', ...data } }) as unknown as CanvasNode+const rope = (source: string, target: string) => ({ id: `ctrl-${source}-${target}`, source, target })++describe('the canvas side of team progress', () => {+ it('reads a live node, a held launch included', () => {+ expect(stationNodeFromFlow(flow('a', { pendingLaunch: { after: [], command: 'x' } }))).toEqual({+ id: 'a', kind: 'terminal', title: 'T a', agentId: 'claude', queued: true+ })+ expect(stationNodeFromState({ id: 'b', kind: 'sticky' } as never)).toMatchObject({ id: 'b', kind: 'sticky', queued: false })+ expect(() => stationNodeFromState(null as never)).not.toThrow()+ })++ it('a canvas with no ropes skips the walk and keeps one identity', () => {+ const nodes = [flow('a'), flow('b')]+ expect(canvasTeamStations([], nodes)).toBe(NO_TEAMS)+ const prev = canvasTeamStations([], nodes)+ expect(canvasTeamStations([], [...nodes, flow('c')], prev)).toBe(prev)+ })++ it('derives teams from the control ropes, and clears them when the last rope goes', () => {+ const nodes = [flow('o'), flow('a')]+ const teams = canvasTeamStations([rope('o', 'a')], nodes)+ expect(teams.get('o')?.map((s) => s.id)).toEqual(['a'])+ // A drag frame: same ropes, fresh node objects — same map.+ expect(canvasTeamStations([rope('o', 'a')], nodes.map((n) => ({ ...n })), teams)).toBe(teams)+ const cleared = canvasTeamStations([], nodes, teams)+ expect(cleared.size).toBe(0)+ expect(canvasTeamStations([], nodes, cleared)).toBe(cleared)+ })++ it('the store only notifies when the map changes', () => {+ const map = canvasTeamStations([rope('o', 'a')], [flow('o'), flow('a')])+ useTeamStations.getState().set(map)+ const before = useTeamStations.getState()+ useTeamStations.getState().set(map)+ expect(useTeamStations.getState()).toBe(before)+ })+})++// The wiring has no compiler behind it: a node header that never reads the store, or a Canvas that+// never publishes, is well-typed and shows nothing. Pinned at source level, like the other+// *-wiring tests, because rendering Canvas / TerminalNode here is out of reach.+describe('wiring', () => {+ const read = (rel: string) => fs.readFileSync(path.join(__dirname, rel), 'utf8').replace(/\r\n/g, '\n')+ it('Canvas derives the teams from its live control ropes and publishes them', () => {+ const canvas = read('../canvas/Canvas.tsx')+ expect(canvas).toContain('canvasTeamStations(controlEdges, nodes, teamStationsRef.current)')+ expect(canvas).toContain('useTeamStations.getState().set(teamStations)')+ expect(canvas).toContain('teams={teamStations}')+ })+ it("the node header reads its OWN team from the store, never the whole status map", () => {+ const node = read('../nodes/TerminalNode.tsx')+ expect(node).toContain('useTeamStations((s) => s.byNode.get(id))')+ expect(node).toMatch(/<TeamProgressChip stations=\{team\} onTravel=\{travelToStation\}/)+ })+})diff --git a/src/renderer/state/teamStations.ts b/src/renderer/state/teamStations.tsnew file mode 100644index 000000000..f0c236206--- /dev/null+++ b/src/renderer/state/teamStations.ts@@ -0,0 +1,67 @@+import { create } from 'zustand'+import type { CanvasNodeState } from '@shared/types'+import type { CanvasNode } from './workspace'+import { stationsByOpener, type StationNodeLike, type TeamStation } from '../lib/teamProgress'++/**+ * The ACTIVE canvas's stations per opener (lib/teamProgress `stationsByOpener` over React Flow's+ * nodes and the live control ropes), published by Canvas so a terminal node's header can draw the+ * same team-progress ring its board card does without owning the ropes itself.+ *+ * TRANSIENT and derived: nothing here is persisted, and Canvas rewrites it whenever the nodes or+ * the ropes change. The map it holds keeps each unchanged team's array identity (the previous map+ * is threaded back in), so a node header subscribed to `byNode.get(id)` re-renders only when ITS+ * team changed.+ */+interface TeamStationsState {+ byNode: ReadonlyMap<string, readonly TeamStation[]>+ set: (byNode: ReadonlyMap<string, readonly TeamStation[]>) => void+}++/** No ropes, no teams — one shared empty map so the store and the board see a stable identity. */+export const NO_TEAMS: ReadonlyMap<string, readonly TeamStation[]> = new Map()+const EMPTY = NO_TEAMS++export const useTeamStations = create<TeamStationsState>((set) => ({+ byNode: EMPTY,+ set: (byNode) => set((s) => (s.byNode === byNode ? s : { byNode }))+}))++/** A live React Flow node, as `stationsByOpener` reads it. */+export function stationNodeFromFlow(n: CanvasNode): StationNodeLike {+ const data = (n.data ?? {}) as Record<string, unknown>+ return {+ id: n.id,+ kind: n.type,+ title: data.title,+ agentId: data.agentId,+ queued: !!data.pendingLaunch+ }+}++/** A serialized node (a project's `nodes` in the store — the Omni board's lanes). */+export function stationNodeFromState(n: CanvasNodeState): StationNodeLike {+ if (!n || typeof n !== 'object') return { id: undefined, kind: undefined }+ return {+ id: n.id,+ // Same reading as the Omni card list (toKanbanSessionState): a station is a node the lane draws.+ kind: n.kind,+ title: n.title,+ agentId: n.agentId,+ queued: !!n.pendingLaunch+ }+}++/**+ * The active canvas's teams, from its live control ropes and React Flow nodes. Canvas calls this on+ * every node change (a drag frame included), so it is cheap where it can be: a canvas with no ropes+ * and no team to clear — most of them — skips the node walk and keeps the previous identity.+ */+export function canvasTeamStations(+ ropes: readonly unknown[],+ nodes: readonly CanvasNode[],+ previous?: ReadonlyMap<string, readonly TeamStation[]>+): ReadonlyMap<string, readonly TeamStation[]> {+ if (ropes.length === 0 && (previous?.size ?? 0) === 0) return previous ?? NO_TEAMS+ return stationsByOpener(ropes, nodes.map(stationNodeFromFlow), previous)+}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 66ef67d5e..68ccae9dc 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -11092,6 +11092,98 @@ button.pull-checks__name {color: var(--text);background: rgba(var(--tint-rgb), 0.08);}+/* Team progress — "N of M done" over the stations a session opened (lib/teamProgress). One+ component on the board card, the card modal header and the canvas node header. The arc is the+ done fraction; the dot says the strongest thing a station is asking for. */+.team-progress-wrap {+ display: inline-flex;+ flex: 0 0 auto;+}+.team-progress {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ margin-left: 6px;+ padding: 0 6px 0 3px;+ border: 1px solid rgba(var(--tint-rgb), 0.16);+ border-radius: 999px;+ background: transparent;+ color: var(--muted);+ font: inherit;+ font-size: 10.5px;+ font-variant-numeric: tabular-nums;+ line-height: 1.6;+ cursor: pointer;+}+.team-progress:hover {+ color: var(--text);+ background: rgba(var(--tint-rgb), 0.08);+}+.team-progress__ring {+ flex: 0 0 auto;+}+.team-progress__track {+ fill: none;+ stroke: rgba(var(--tint-rgb), 0.2);+ stroke-width: 2;+}+.team-progress__arc {+ fill: none;+ stroke: var(--state-success);+ stroke-width: 2;+ stroke-linecap: round;+}+.team-progress--complete {+ color: var(--text);+}+.team-progress__attn {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--state-working);+}+.team-progress--needs .team-progress__attn {+ background: var(--state-attention);+}+.team-progress--error .team-progress__attn {+ background: var(--state-error);+}+/* The station list's state dots (ContextMenu row icons). */+.team-progress__dot {+ display: inline-block;+ width: 8px;+ height: 8px;+ border-radius: 50%;+ border: 1px solid rgba(var(--tint-rgb), 0.35);+}+.team-progress__dot--done,+.team-progress__dot--paused {+ background: var(--state-success);+ border-color: transparent;+}+.team-progress__dot--working {+ background: var(--state-working);+ border-color: transparent;+}+.team-progress__dot--needs {+ background: var(--state-attention);+ border-color: transparent;+}+.team-progress__dot--errored,+.team-progress__dot--dropped {+ background: var(--state-error);+ border-color: transparent;+}+.team-progress__dot--queued {+ background: var(--state-queued);+ border-color: transparent;+}+/* The session name in the card modal header: sized to its text, not a flex-filling detail line. */+.kanban-modal__session {+ flex: 0 1 auto;+ max-width: 220px;+ font-size: 11px;+}@media (max-width: 520px) {.kanban-header {gap: 6px;