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: record deleted sessions into per-project closed-session history
Mina Sameha1bcc1dffc42
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex e1836b311..eda4b6378 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -385,6 +385,7 @@ import { freeSpot } from '../lib/placement'import { pushSessionRename } from '../lib/sessionRename'import { useReopenHistory } from '../state/reopenHistory'import { snapshotNode, recreateNodeFromSnapshot } from '../lib/reopenNode'+import { buildClosedSessionEntries } from '../lib/closedHistory'import { planReopen } from '../lib/reopenPlan'import { oneLine } from '@shared/one-line'import { parseLenses, verifyLensPrompt, verifySynthesisPrompt } from '../lib/verifyPanel'@@ -4572,6 +4573,19 @@ export function Canvas() {nodes: snapshots})}+ const deletedAt = Date.now()+ const closedEntries = buildClosedSessionEntries(+ set,+ nodesRef.current,+ deletedAt,+ () => crypto.randomUUID()+ )+ if (closedEntries.length) {+ useProjects.getState().recordClosedSessions(+ useProjects.getState().activeProjectId ?? '',+ closedEntries+ )+ }}nodesRef.current.forEach((n) => {if (!set.has(n.id)) returndiff --git a/src/renderer/canvas/canvas-wiring.test.tsx b/src/renderer/canvas/canvas-wiring.test.tsxindex 68d269a9b..94d85bf1c 100644--- a/src/renderer/canvas/canvas-wiring.test.tsx+++ b/src/renderer/canvas/canvas-wiring.test.tsx@@ -168,6 +168,30 @@ describe('breadcrumb wiring the CLAUDE.md bullet calls load-bearing', () => {})})+describe('deleteNodes also records persisted closed-session history', () => {+ it('builds entries from the full pre-delete tree and the same "now"/ids used for reopenHistory', () => {+ expect(CANVAS_SRC).toContain('const deletedAt = Date.now()')+ expect(CANVAS_SRC).toContain('buildClosedSessionEntries(')+ expect(CANVAS_SRC).toContain('set,\n nodesRef.current,\n deletedAt,')+ })++ it('records into the store only when entries were actually built', () => {+ expect(CANVAS_SRC).toContain('if (closedEntries.length) {')+ expect(CANVAS_SRC).toContain('.recordClosedSessions(')+ })++ it('sits inside the same `opts?.record !== false` guard as the reopenHistory push', () => {+ // The bug this pins: recording closed-session history OUTSIDE the guard would enter it for+ // the account-removal cleanup delete too, which reopenHistory deliberately excludes.+ const guardBlock = CANVAS_SRC.slice(+ CANVAS_SRC.indexOf('if (opts?.record !== false) {'),+ CANVAS_SRC.indexOf('if (opts?.record !== false) {') + 1500+ )+ expect(guardBlock).toContain('useReopenHistory.getState().push(')+ expect(guardBlock).toContain('buildClosedSessionEntries(')+ })+})+describe('reopen-last-closed records and dispatches through the shared history stack', () => {it('records a project close before hiding it', () => {expect(CANVAS_SRC).toContain('useReopenHistory.getState().push({ kind: \'project\'')