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: surface closed sessions and projects in the sessions sidebar
Mina Samehff5ba5642836
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex ff6089fea..d7133a919 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -11792,6 +11792,13 @@ export function Canvas() {onProjectContextMenu={onProjectContextMenu}onSwitchProject={switchProject}onAddToProject={addToProject}+ onReopenProject={reopenProject}+ onDeleteProject={requestDeleteClosed}+ onReopenClosedSession={reopenClosedSessionCommand}+ onDiscardClosedSession={(projectId, entryId) => {+ useProjects.getState().discardClosedSession(projectId, entryId)+ void writeDisk()+ }}onMouseEnter={openSessionsPeek}onMouseLeave={closeSessionsPeekSoon}/>diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsxindex 1082a41ca..2c6b28df4 100644--- a/src/renderer/components/SessionsSidebar.tsx+++ b/src/renderer/components/SessionsSidebar.tsx@@ -19,6 +19,7 @@ import {} from '../lib/sessionList'import { SessionRow } from './SessionRow'import { ProjectGlyph } from './ProjectGlyph'+import { ClosedHistorySection } from './ClosedHistorySection'import { IconBellFilled, IconCircleCheck, IconPin } from './icons'import { useProjects } from '../state/projects'import { useSettings } from '../state/settings'@@ -26,6 +27,8 @@ import { useAgentStatus } from '../state/agentStatus'import { useSessionNaming } from '../state/sessionNaming'import { useSession } from '../session/session'+const HISTORY_COLLAPSE_KEY = 'history'+export interface SessionsSidebarProps {open: booleanpinned: boolean@@ -63,6 +66,12 @@ export interface SessionsSidebarProps {/** Reorder a project to sit before another (null = to the end). Shared order with the* tab bar: both render the projects array, so one drag updates both surfaces. */onReorderProject(draggedId: string, beforeId: string | null): void+ /** Reopen a closed project (Welcome screen's existing action, now also reachable here). */+ onReopenProject(id: string): void+ /** Permanently delete a closed project (Welcome screen's existing action). */+ onDeleteProject(id: string): void+ onReopenClosedSession(projectId: string, entryId: string): void+ onDiscardClosedSession(projectId: string, entryId: string): voidonMouseEnter?(): voidonMouseLeave?(): void}@@ -167,11 +176,16 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null// forever, and a canvas churns through group ids.const toggleCollapse = (key: string, currentlyCollapsed: boolean): void => {const current = useSettings.getState().settings.sidebarCollapsedItems- const pruned = pruneCollapsedItems(current, liveCollapseKeys(groups), key)+ const pruned = pruneCollapsedItems(+ current,+ new Set([...liveCollapseKeys(groups), HISTORY_COLLAPSE_KEY]),+ key+ )useSettings.getState().update({sidebarCollapsedItems: { ...pruned, [key]: !currentlyCollapsed }})}+ const historyCollapsed = collapsedItems[HISTORY_COLLAPSE_KEY] ?? false// Drop-target wiring shared by the project header (ungroup) and group sub-headers (add).// Only reacts while dragging a session that belongs to the same project.@@ -693,6 +707,17 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null}))}</div>++ <ClosedHistorySection+ projects={allProjects}+ nowMs={statusNow}+ collapsed={historyCollapsed}+ onToggleCollapse={() => toggleCollapse(HISTORY_COLLAPSE_KEY, historyCollapsed)}+ onReopenProject={props.onReopenProject}+ onDeleteProject={props.onDeleteProject}+ onReopenSession={props.onReopenClosedSession}+ onDiscardSession={props.onDiscardClosedSession}+ /></aside>)}diff --git a/src/renderer/components/SessionsSidebar.wiring.test.ts b/src/renderer/components/SessionsSidebar.wiring.test.tsnew file mode 100644index 000000000..f456f4396--- /dev/null+++ b/src/renderer/components/SessionsSidebar.wiring.test.ts@@ -0,0 +1,46 @@+import fs from 'fs'+import path from 'path'+import { describe, it, expect } from 'vitest'++const SIDEBAR_SRC = fs.readFileSync(path.join(__dirname, 'SessionsSidebar.tsx'), 'utf8')+const CANVAS_SRC = fs.readFileSync(path.join(__dirname, '../canvas/Canvas.tsx'), 'utf8')++describe('SessionsSidebar renders and wires the Recently closed history section', () => {+ it('declares the new props', () => {+ expect(SIDEBAR_SRC).toContain('onReopenProject(id: string): void')+ expect(SIDEBAR_SRC).toContain('onDeleteProject(id: string): void')+ expect(SIDEBAR_SRC).toContain('onReopenClosedSession(projectId: string, entryId: string): void')+ expect(SIDEBAR_SRC).toContain('onDiscardClosedSession(projectId: string, entryId: string): void')+ })++ it('renders ClosedHistorySection off its own unfiltered project list, not a new prop', () => {+ expect(SIDEBAR_SRC).toContain('<ClosedHistorySection')+ expect(SIDEBAR_SRC).toContain('projects={allProjects}')+ expect(SIDEBAR_SRC).toContain('onReopenSession={props.onReopenClosedSession}')+ expect(SIDEBAR_SRC).toContain('onDiscardSession={props.onDiscardClosedSession}')+ // The redundant prop this codebase's SessionsSidebar never needed — allProjects is already+ // a local variable in this file.+ expect(SIDEBAR_SRC).not.toContain('allProjects: Project[]')+ })++ it('keeps the history disclosure key alive across prunes even though it is not a project/frame key', () => {+ expect(SIDEBAR_SRC).toContain("const HISTORY_COLLAPSE_KEY = 'history'")+ expect(SIDEBAR_SRC).toContain('new Set([...liveCollapseKeys(groups), HISTORY_COLLAPSE_KEY])')+ })+})++describe('Canvas wires the history callbacks into SessionsSidebar', () => {+ it('reuses the existing reopenProject/requestDeleteClosed callbacks and the new reopen/discard commands', () => {+ expect(CANVAS_SRC).toContain('onReopenProject={reopenProject}')+ expect(CANVAS_SRC).toContain('onDeleteProject={requestDeleteClosed}')+ expect(CANVAS_SRC).toContain('onReopenClosedSession={reopenClosedSessionCommand}')+ })++ it('flushes a discard to disk immediately, since the discarded project may not be the active one', () => {+ const fnStart = CANVAS_SRC.indexOf('onDiscardClosedSession={')+ expect(fnStart).toBeGreaterThan(-1)+ const fnBody = CANVAS_SRC.slice(fnStart, fnStart + 250)+ expect(fnBody).toContain('.discardClosedSession(projectId, entryId)')+ expect(fnBody).toContain('void writeDisk()')+ })+})