Skip to content

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.

feat(sidebar): needs-you and unread counts on project group headers

enesf5a3b0cbc349
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index 4f5000a14..53a115fbe 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -1,7 +1,12 @@
import { useEffect, useMemo, useState } from 'react'
-import { buildSessionList, isGroupCollapsed, type SessionNodeInput } from '../lib/sessionList'
+import {
+ buildSessionList,
+ isGroupCollapsed,
+ projectSignalCounts,
+ type SessionNodeInput
+} from '../lib/sessionList'
import { SessionRow } from './SessionRow'
-import { IconPin } from './icons'
+import { IconBellFilled, IconCircleCheck, IconPin } from './icons'
import { useProjects } from '../state/projects'
import { useAgentStatus } from '../state/agentStatus'
import { useSessionNaming } from '../state/sessionNaming'
@@ -201,6 +206,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
{groups.length === 0 && <div className="sessions-sidebar__empty">No sessions yet.</div>}
{groups.map((g) => {
const isCollapsed = isGroupCollapsed(overrides, g.projectId, g.isActive)
+ const signals = projectSignalCounts(g)
return (
<div key={g.projectId} className={`ss-group${g.isActive ? ' is-active' : ''}`}>
<div
@@ -215,6 +221,18 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
{branches[g.projectId] && (
<span className="ss-group__branch">⎇ {branches[g.projectId]}</span>
)}
+ {signals.attention > 0 && (
+ <span className="ss-group__sig ss-group__sig--attention" title="Sessions that need you">
+ <IconBellFilled />
+ {signals.attention}
+ </span>
+ )}
+ {signals.unread > 0 && (
+ <span className="ss-group__sig ss-group__sig--unread" title="Finished — new for you">
+ <IconCircleCheck />
+ {signals.unread}
+ </span>
+ )}
<span className="ss-group__count">{projectCount(g)}</span>
<button
className="ss-group__add"
diff --git a/src/renderer/lib/sessionList.test.ts b/src/renderer/lib/sessionList.test.ts
index 06cd46ab6..729747bfd 100644
--- a/src/renderer/lib/sessionList.test.ts
+++ b/src/renderer/lib/sessionList.test.ts
@@ -1,5 +1,11 @@
import { describe, it, expect } from 'vitest'
-import { buildSessionList, sessionStatusKind, isGroupCollapsed, type ProjectInput } from './sessionList'
+import {
+ buildSessionList,
+ sessionStatusKind,
+ isGroupCollapsed,
+ projectSignalCounts,
+ type ProjectInput
+} from './sessionList'
import type { AgentNodeStatus } from '../state/agentStatus'
const node = (id: string, over: Partial<ProjectInput['nodes'][number]> = {}) => ({
@@ -126,3 +132,44 @@ describe('buildSessionList', () => {
expect(unfiltered.length).toBe(2) // both projects kept when no filter
})
})
+
+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 })
+ })
+
+ 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 })
+ })
+})
diff --git a/src/renderer/lib/sessionList.ts b/src/renderer/lib/sessionList.ts
index 9c030f9b3..6fc47d294 100644
--- a/src/renderer/lib/sessionList.ts
+++ b/src/renderer/lib/sessionList.ts
@@ -47,6 +47,22 @@ export function isGroupCollapsed(
return projectId in overrides ? overrides[projectId] : !isActive
}
+/**
+ * Header badges for a project group: how many sessions need the user right now
+ * (waiting/blocked) and how many finished unseen. 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 } {
+ let attention = 0
+ let unread = 0
+ for (const s of [...group.ungrouped, ...group.groups.flatMap((b) => b.sessions)]) {
+ if (s.statusKind === 'attention') attention++
+ else if (s.unread && s.statusKind !== 'working') unread++
+ }
+ return { attention, unread }
+}
+
export function sessionStatusKind(state: AgentNodeStatus['state']): StatusKind {
switch (state) {
case 'working':
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 42dc0c3af..03631bee6 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -4241,6 +4241,12 @@ body,
.ss-group.is-active .ss-group__name { color: var(--accent); }
.ss-group__branch { font-size: 10px; color: rgba(180, 180, 185, 0.8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-group__count { font-size: 10px; color: rgba(180, 180, 185, 0.8); }
+/* Signal badges on the project header: 🔔 needs-you count / ✓ unread count. Visible even
+ while the group is collapsed — that's their main job. */
+.ss-group__sig { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; flex: 0 0 auto; line-height: 0; }
+.ss-group__sig svg { width: 11px; height: 11px; }
+.ss-group__sig--attention { color: #ff453a; }
+.ss-group__sig--unread { color: var(--accent); }
.ss-group__add { margin-left: auto; opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.ss-group__head:hover .ss-group__add { opacity: 0.7; }
.ss-group__add:hover { opacity: 1 !important; color: var(--accent); }