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(sidebar): add working count to projectSignalCounts
Mina Samehb4d851617ee7
diff --git a/src/renderer/lib/sessionList.test.ts b/src/renderer/lib/sessionList.test.tsindex 92a0d467d..7de94198b 100644--- a/src/renderer/lib/sessionList.test.ts+++ b/src/renderer/lib/sessionList.test.ts@@ -4,7 +4,9 @@ import {sessionStatusKind,isGroupCollapsed,projectSignalCounts,- type ProjectInput+ type ProjectInput,+ type SessionRowVM,+ type SessionGroup} from './sessionList'import type { AgentNodeStatus } from '../state/agentStatus'@@ -140,42 +142,37 @@ describe('buildSessionList', () => {})describe('projectSignalCounts', () => {- it('counts attention and unread across ungrouped and grouped sessions', () => {- const proj: ProjectInput[] = [- {- id: 'p1',- name: 'P1',- color: '#123',- nodes: [- node('g1', { kind: 'group', title: 'G', color: '#abc' }),- node('a'), // waiting → attention- node('b', { parentId: 'g1' }), // blocked → attention- node('c'), // done + unread → unread- node('d'), // idle + unread → unread (state lost, unread persisted)- node('e'), // working + unread → NOT counted (mirrors the row glyph precedence)- node('f') // plain idle → neither- ]- }- ]- const status: Record<string, AgentNodeStatus> = {- a: { unread: false, state: 'waiting' },- b: { unread: true, state: 'blocked' }, // attention wins over unread- c: { unread: true, state: 'done' },- d: { unread: true },- e: { unread: true, state: 'working' }- }- const [g] = buildSessionList(proj, null, 'p1', status, '')- expect(projectSignalCounts(g)).toEqual({ attention: 2, unread: 2 })+ const group = (sessions: Partial<SessionRowVM>[]) => ({+ projectId: 'p1',+ projectName: 'P',+ projectColor: '#111',+ isActive: false,+ groups: [],+ ungrouped: sessions.map((s, i) => ({+ id: `s${i}`,+ title: `s${i}`,+ color: '#888',+ isAgent: false,+ statusKind: 'idle' as const,+ stateLabel: 'Idle',+ unread: false,+ usesContext: false,+ ...s+ }))+ })++ it('counts working sessions alongside attention/unread', () => {+ const g = group([+ { statusKind: 'working' },+ { statusKind: 'working' },+ { statusKind: 'attention' },+ { statusKind: 'idle' }+ ])+ expect(projectSignalCounts(g)).toEqual({ attention: 1, unread: 0, working: 2 })})- it('returns zeros for a quiet project', () => {- const [g] = buildSessionList(- [{ id: 'p1', name: 'P1', color: '#123', nodes: [node('x')] }],- null,- 'p1',- {},- ''- )- expect(projectSignalCounts(g)).toEqual({ attention: 0, unread: 0 })+ it('working is 0 when nothing is running', () => {+ const g = group([{ statusKind: 'idle' }, { statusKind: 'done', unread: true }])+ expect(projectSignalCounts(g).working).toBe(0)})})diff --git a/src/renderer/lib/sessionList.ts b/src/renderer/lib/sessionList.tsindex 78f86b9e1..ffd7c1146 100644--- a/src/renderer/lib/sessionList.ts+++ b/src/renderer/lib/sessionList.ts@@ -56,14 +56,22 @@ export function isGroupCollapsed(* an attention session is never double-counted as unread, and a working one isn't* unread yet (a new turn is running; the old mark resurfaces when it ends).*/-export function projectSignalCounts(group: SessionGroup): { attention: number; unread: number } {+/**+ * Header badges for a project group: how many sessions need the user right now+ * (waiting/blocked), how many finished unseen, and how many are actively working right now.+ * Mirrors the row glyph's precedence — an attention session is never double-counted as unread,+ * and a working one isn't unread yet (a new turn is running; the old mark resurfaces when it ends).+ */+export function projectSignalCounts(group: SessionGroup): { attention: number; unread: number; working: number } {let attention = 0let unread = 0+ let working = 0for (const s of [...group.ungrouped, ...group.groups.flatMap((b) => b.sessions)]) {if (s.statusKind === 'attention') attention++else if (s.unread && s.statusKind !== 'working') unread+++ if (s.statusKind === 'working') working++}- return { attention, unread }+ return { attention, unread, working }}export function sessionStatusKind(state: AgentNodeStatus['state']): StatusKind {