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): show session state age
Darren Kattanb725beca83d3
diff --git a/CLAUDE.md b/CLAUDE.mdindex 67b16ac1a..4cb897c5e 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -921,7 +921,16 @@ persisted — only `unread`/`session`/`sessionId` go to localStorage under(shown only when `mainWin.isFocused()` is false); clicking it focuses the window and sends`app:focus-node` → `Canvas.focusNodeById` (selects + centers, switching projects via`pendingFocusRef` if needed). A one-time consent prompt gates notifications; toggle in- Settings (`notifyOnClaudeDone`). Unread clears on focus/select.+ Settings (`notifyOnClaudeDone`). Selecting, focusing, dwelling into, or opening a session card+ clears `unread` and ACKs the finish across phone/notch surfaces — existing read-on-view behavior.+ This NEVER changes the workflow bucket: read state is independent from agent state.+- **Status-grouped sessions** — three always-visible sections: **Waiting for your response** maps+ internal `done`, `waiting`, and `blocked` together (a completed turn, question, or approval all+ need the user); **Running** maps `working`; **Unknown** means no live hook state is available.+ There is no Done bucket: a normal `done` hook means the turn ended and the agent is waiting for+ another user prompt. Within each section rows sort newest-first by `lastEventAt`, the transition+ clock (same-state hook freshness is `stateAt`), and show its short relative age. Missing clocks+ stay last with no made-up timestamp. A click may clear the glow but cannot move the row.- **Session name ⇄ node title** — **two lists, because the two directions are separate facts**:`TITLE_READ_CAPABLE` (`canReadTitle` — claude, grok, **gemini**) is the READ leg, `RENAME_CAPABLE`(`canRename` — claude, grok) the WRITE leg, and **read ⊇ write** is an invariant pinned indiff --git a/src/renderer/components/SessionRow.test.tsx b/src/renderer/components/SessionRow.test.tsxnew file mode 100644index 000000000..a39719f66--- /dev/null+++ b/src/renderer/components/SessionRow.test.tsx@@ -0,0 +1,40 @@+import { renderToStaticMarkup } from 'react-dom/server'+import { describe, expect, it, vi } from 'vitest'+import { SessionRow } from './SessionRow'+import type { SessionRowVM } from '../lib/sessionList'++const row: SessionRowVM = {+ id: 'nt-1',+ title: 'Investigate status',+ color: '#888',+ isAgent: true,+ statusKind: 'attention',+ stateLabel: 'Waiting for your response',+ statusUpdatedAt: 1,+ unread: false,+ usesContext: false,+ projectId: 'p1',+ projectName: 'Project',+ projectColor: '#123'+}++describe('SessionRow status age', () => {+ it('renders the relative state age supplied by status-group mode', () => {+ const html = renderToStaticMarkup(+ <SessionRow+ row={row}+ stateAgeLabel="5m ago"+ onClick={vi.fn()}+ onClose={vi.fn()}+ onRename={vi.fn()}+ onAiName={vi.fn()}+ onContextMenu={vi.fn()}+ onDragStart={vi.fn()}+ onDragEnd={vi.fn()}+ />+ )++ expect(html).toContain('5m ago')+ expect(html).toContain('In this state 5m ago')+ })+})diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsxindex 0e4706880..34337b0af 100644--- a/src/renderer/components/SessionRow.tsx+++ b/src/renderer/components/SessionRow.tsx@@ -13,6 +13,8 @@ export interface SessionRowProps {onContextMenu(e: React.MouseEvent): voidonDragStart(): voidonDragEnd(): void+ /** Status-group mode only: elapsed time since the current state began. */+ stateAgeLabel?: string}function ctxColor(pct: number): string {@@ -35,7 +37,8 @@ export function SessionRow({onAiName,onContextMenu,onDragStart,- onDragEnd+ onDragEnd,+ stateAgeLabel}: SessionRowProps): JSX.Element {const [editing, setEditing] = useState(false)const [draft, setDraft] = useState(row.title)@@ -155,11 +158,16 @@ export function SessionRow({×</button></div>- {(row.projectName || row.cwd || row.sshHost) && (+ {(row.projectName || row.cwd || row.sshHost || stateAgeLabel) && (<div className="ss-meta">{row.projectName && <span className="ss-meta__project">{row.projectName}</span>}{row.sshHost && <span className="ss-meta__ssh">⇅ {row.sshHost}</span>}{row.cwd && <span className="ss-meta__cwd">{dirName(row.cwd)}</span>}+ {stateAgeLabel && (+ <span className="ss-meta__state-age" title={`In this state ${stateAgeLabel}`}>+ {stateAgeLabel}+ </span>+ )}</div>)}</div>diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsxindex 0afdaf5a6..41d16b2e0 100644--- a/src/renderer/components/SessionsSidebar.tsx+++ b/src/renderer/components/SessionsSidebar.tsx@@ -11,6 +11,7 @@ import {projectHeadClickAction,projectSignalCounts,pruneCollapsedItems,+ sessionStateAgeLabel,type GroupBucket,type SessionNodeInput,type SessionRowVM,@@ -78,6 +79,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | nullconst { api } = useSession()const [filter, setFilter] = useState('')+ const [statusNow, setStatusNow] = useState(() => Date.now())const [branches, setBranches] = useState<Record<string, string>>({})// Drag-to-group: the object being dragged, and the current drop target for highlighting.// A group drag also remembers its parent frame, so a sibling-reorder drop zone can refuse a@@ -148,6 +150,15 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null[open, grouping, projects, liveActiveNodes, activeProjectId, statusById, filter])+ // Relative state ages need to advance even when no hook event arrives. Keep the clock dormant+ // unless the status view is visible; 30s catches minute boundaries without per-row timers.+ useEffect(() => {+ if (!open || grouping !== 'status') return+ setStatusNow(Date.now())+ const timer = window.setInterval(() => setStatusNow(Date.now()), 30_000)+ return () => window.clearInterval(timer)+ }, [open, grouping])+const projectCount = (g: (typeof groups)[number]): number =>g.groups.reduce((n, b) => n + groupSessionCount(b), 0) + g.ungrouped.lengthconst total = groups.reduce((n, g) => n + projectCount(g), 0)@@ -434,6 +445,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | nullonContextMenu={(e) => props.onRowContextMenu(e, row.projectId!, row.id)}onDragStart={() => {}}onDragEnd={() => {}}+ stateAgeLabel={sessionStateAgeLabel(row.statusUpdatedAt, statusNow)}/></div>)diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 3187a29ee..c59c9e3aa 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -6382,6 +6382,7 @@ body,.ss-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); min-width: 0; }.ss-meta__cwd { font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.ss-meta__ssh { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; }+.ss-meta__state-age { margin-left: auto; flex: 0 0 auto; font-variant-numeric: tabular-nums; }.ss-ctx { font-size: 9.5px; padding: 0 5px; border-radius: 4px; color: #000; font-weight: 600; flex: 0 0 auto; }.ss-row__ai { margin-left: auto; opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 12px; line-height: 1; padding: 0 2px; flex: 0 0 auto; }.ss-row:hover .ss-row__ai { opacity: 0.6; }