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
fix(sessions): pinned sidebar stays open; AI naming survives close
enese8345b7a55a7
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 160ea2ecb..110ae064d 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -87,6 +87,7 @@ import { AgentIcon } from '../lib/agentIcons'import { branchClaudeSession } from '../lib/claudeBranch'import { useSettings } from '../state/settings'import { useContextWindow } from '../state/contextWindow'+import { useSessionNaming } from '../state/sessionNaming'import { useSshServers } from '../state/sshServers'import { requireProOr } from '../state/upgradeGate'import type { SshServer } from '@shared/ssh'@@ -154,7 +155,9 @@ export function Canvas() {})const [sessionsHover, setSessionsHover] = useState(false)const [sessionsDismissed, setSessionsDismissed] = useState(false)- const sessionsOpen = (sessionsPinned && !sessionsDismissed) || sessionsHover+ // When pinned the sidebar is docked and stays open (mouse-leave never closes it); `dismissed`+ // hides it until the next hover/click. When unpinned it is a pure hover-peek.+ const sessionsOpen = sessionsPinned ? !sessionsDismissed : sessionsHover// When set, add a terminal to this project once its nodes have loaded into React Flow// (cross-project "add" from the sidebar, which must switch projects first).const pendingAddRef = useRef<string | null>(null)@@ -366,9 +369,9 @@ export function Canvas() {} catch {// ignore}- if (!next) setSessionsHover(false)return next})+ // Re-show on (re)pin; on unpin, leave hover as-is so it stays a peek until the cursor leaves.setSessionsDismissed(false)}, [])@@ -398,6 +401,9 @@ export function Canvas() {sessionsCloseTimer.current = null}setSessionsHover(true)+ // Hovering re-opens a dismissed sidebar; when pinned this re-docks it so it then stays+ // open after the cursor leaves (open = !dismissed), instead of collapsing like a peek.+ setSessionsDismissed(false)}, [])const closeSessionsPeekSoon = useCallback(() => {if (sessionsCloseTimer.current) clearTimeout(sessionsCloseTimer.current)@@ -1838,8 +1844,15 @@ export function Canvas() {// (same BYO-agent path as the terminal node's ✦), then apply it via renameSession.const aiNameSession = useCallback(async (projectId: string, id: string, cwd?: string) => {- const r = await window.nodeTerminal.pty.generateName(id, cwd ?? '')- if (r.ok) renameSession(projectId, id, r.message)+ // Track progress in a store keyed by node id so the spinner survives the row/sidebar+ // unmounting mid-request; this Canvas-level call completes and applies the name anyway.+ useSessionNaming.getState().set(id, true)+ try {+ const r = await window.nodeTerminal.pty.generateName(id, cwd ?? '')+ if (r.ok) renameSession(projectId, id, r.message)+ } finally {+ useSessionNaming.getState().set(id, false)+ }},[renameSession])diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsxindex fe916abeb..6f26ffbe3 100644--- a/src/renderer/components/SessionRow.tsx+++ b/src/renderer/components/SessionRow.tsx@@ -1,6 +1,7 @@import { useState } from 'react'import type { SessionRowVM } from '../lib/sessionList'import { useContextWindow } from '../state/contextWindow'+import { useSessionNaming } from '../state/sessionNaming'export interface SessionRowProps {row: SessionRowVM@@ -33,7 +34,9 @@ export function SessionRow({}: SessionRowProps): JSX.Element {const [editing, setEditing] = useState(false)const [draft, setDraft] = useState(row.title)- const [naming, setNaming] = useState(false)+ // Naming progress lives in a store keyed by node id, so the spinner persists across the row+ // unmounting (sidebar close / hover-peek collapse) while the name is still generating.+ const naming = useSessionNaming((s) => !!s.byId[row.id])const usage = useContextWindow((s) => (row.sessionId ? s.bySessionId[row.sessionId] : undefined))const commit = (): void => {@@ -42,15 +45,10 @@ export function SessionRow({setEditing(false)}- const aiName = async (e: React.MouseEvent): Promise<void> => {+ const aiName = (e: React.MouseEvent): void => {e.stopPropagation()if (naming) return- setNaming(true)- try {- await onAiName()- } finally {- setNaming(false)- }+ void onAiName()}return (diff --git a/src/renderer/state/sessionNaming.ts b/src/renderer/state/sessionNaming.tsnew file mode 100644index 000000000..4b3bf6268--- /dev/null+++ b/src/renderer/state/sessionNaming.ts@@ -0,0 +1,22 @@+import { create } from 'zustand'++// Transient "AI naming in progress" flag per node id. Kept in a store (not in the SessionRow+// component) so the spinner survives the row unmounting — e.g. when the sidebar closes or a+// hover-peek collapses while the name is still being generated. The generate-name request runs+// at the Canvas level and applies its result regardless of the row's mount state.+interface SessionNamingState {+ byId: Record<string, boolean>+ set(id: string, naming: boolean): void+}++export const useSessionNaming = create<SessionNamingState>((set) => ({+ byId: {},+ set: (id, naming) =>+ set((s) => {+ if (!!s.byId[id] === naming) return s+ const byId = { ...s.byId }+ if (naming) byId[id] = true+ else delete byId[id]+ return { byId }+ })+}))