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(sessions): default-pinned sidebar + per-row AI name action

enesf440d3a6db43
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index df397a773..160ea2ecb 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -141,16 +141,20 @@ export function Canvas() {
// Reveal-in-Explorer target (relative to the active project cwd). The nonce makes each reveal
// distinct so revealing the same file twice still re-fires the Explorer effect.
const [reveal, setReveal] = useState<{ path: string; nonce: number } | null>(null)
- // Sessions sidebar (left): hover-to-peek + click-to-pin (persisted).
+ // Sessions sidebar (left): pinned (docked) by default; unpin is a persisted preference.
+ // hover-to-peek when unpinned. `dismissed` is a transient "hide for now" (the × button)
+ // that does NOT change the pin preference — so a pinned sidebar reopens pinned next launch.
const [sessionsPinned, setSessionsPinned] = useState(() => {
try {
- return localStorage.getItem('nodeterm.sessionsPinned') === '1'
+ const v = localStorage.getItem('nodeterm.sessionsPinned')
+ return v === null ? true : v === '1'
} catch {
- return false
+ return true
}
})
const [sessionsHover, setSessionsHover] = useState(false)
- const sessionsOpen = sessionsPinned || sessionsHover
+ const [sessionsDismissed, setSessionsDismissed] = useState(false)
+ 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)
@@ -352,6 +356,8 @@ export function Canvas() {
return ephemeralEdges.length ? [...decorated, ...ephemeralEdges] : decorated
}, [linkEdges, ephemeralEdges, accent])
+ // Header pin button (and ⌘⇧L): toggle the persisted pin preference. Clears the transient
+ // dismiss so (re)pinning shows the docked panel; unpinning collapses it to hover-peek.
const toggleSessionsPin = useCallback(() => {
setSessionsPinned((v) => {
const next = !v
@@ -363,8 +369,25 @@ export function Canvas() {
if (!next) setSessionsHover(false)
return next
})
+ setSessionsDismissed(false)
}, [])
+ // Top-left icon click: when pinned, toggle the transient hide/show (keeps the pin); when
+ // unpinned, promote the hover-peek to a docked pinned panel.
+ const onSessionsIconClick = useCallback(() => {
+ if (sessionsPinned) {
+ setSessionsDismissed((d) => !d)
+ } else {
+ setSessionsPinned(true)
+ try {
+ localStorage.setItem('nodeterm.sessionsPinned', '1')
+ } catch {
+ // ignore
+ }
+ setSessionsDismissed(false)
+ }
+ }, [sessionsPinned])
+
// Hover-peek: the sidebar overlaps its trigger icon, so leaving the icon (mouseleave)
// must not close the peek while the cursor moves onto the sidebar body. A single shared
// timer lets entering either surface cancel a pending close from the other.
@@ -1811,6 +1834,16 @@ export function Canvas() {
[activeProjectId, setNodes, markDirty, writeDisk]
)
+ // Sidebar "Name with AI": generate a title from the session's captured terminal output
+ // (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)
+ },
+ [renameSession]
+ )
+
const addToProject = useCallback(
(projectId: string) => {
if (projectId === activeProjectId) {
@@ -2186,7 +2219,7 @@ export function Canvas() {
onMouseEnter={openSessionsPeek}
onMouseLeave={closeSessionsPeekSoon}
>
- <button title="Sessions (⌘⇧L)" onClick={toggleSessionsPin}>
+ <button title="Sessions (⌘⇧L)" onClick={onSessionsIconClick}>
<IconSessions />
</button>
</div>
@@ -2339,17 +2372,14 @@ export function Canvas() {
liveActiveNodes={liveActiveNodes}
onTogglePin={toggleSessionsPin}
onClose={() => {
+ // Transient "hide for now" — does NOT touch the pin preference.
setSessionsHover(false)
- setSessionsPinned(false)
- try {
- localStorage.setItem('nodeterm.sessionsPinned', '0')
- } catch {
- // ignore
- }
+ setSessionsDismissed(true)
}}
onFocusNode={focusNodeById}
onCloseSession={closeSession}
onRenameSession={renameSession}
+ onAiNameSession={aiNameSession}
onRowContextMenu={onRowContextMenu}
onAddToProject={addToProject}
onMouseEnter={openSessionsPeek}
diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsx
index 742fafaee..fe916abeb 100644
--- a/src/renderer/components/SessionRow.tsx
+++ b/src/renderer/components/SessionRow.tsx
@@ -7,6 +7,7 @@ export interface SessionRowProps {
onClick(): void
onClose(): void
onRename(title: string): void
+ onAiName(): void | Promise<void>
onContextMenu(e: React.MouseEvent): void
}
@@ -22,9 +23,17 @@ function dirName(p?: string): string {
return parts[parts.length - 1] || p
}
-export function SessionRow({ row, onClick, onClose, onRename, onContextMenu }: SessionRowProps): JSX.Element {
+export function SessionRow({
+ row,
+ onClick,
+ onClose,
+ onRename,
+ onAiName,
+ onContextMenu
+}: SessionRowProps): JSX.Element {
const [editing, setEditing] = useState(false)
const [draft, setDraft] = useState(row.title)
+ const [naming, setNaming] = useState(false)
const usage = useContextWindow((s) => (row.sessionId ? s.bySessionId[row.sessionId] : undefined))
const commit = (): void => {
@@ -33,6 +42,17 @@ export function SessionRow({ row, onClick, onClose, onRename, onContextMenu }: S
setEditing(false)
}
+ const aiName = async (e: React.MouseEvent): Promise<void> => {
+ e.stopPropagation()
+ if (naming) return
+ setNaming(true)
+ try {
+ await onAiName()
+ } finally {
+ setNaming(false)
+ }
+ }
+
return (
<div className="ss-row" onClick={onClick} onContextMenu={onContextMenu}>
<span className={`ss-dot ss-dot--${row.statusKind}`} title={row.stateLabel} />
@@ -75,6 +95,14 @@ export function SessionRow({ row, onClick, onClose, onRename, onContextMenu }: S
{Math.round(usage.usedPercent)}%
</span>
)}
+ <button
+ className="ss-row__ai"
+ title="Name with AI (from terminal output)"
+ disabled={naming}
+ onClick={aiName}
+ >
+ {naming ? '…' : '✦'}
+ </button>
<button
className="ss-row__close"
title="Close session"
diff --git a/src/renderer/components/SessionsSidebar.tsx b/src/renderer/components/SessionsSidebar.tsx
index aa565e7c8..786aa596d 100644
--- a/src/renderer/components/SessionsSidebar.tsx
+++ b/src/renderer/components/SessionsSidebar.tsx
@@ -35,6 +35,7 @@ export interface SessionsSidebarProps {
onFocusNode(id: string): void
onCloseSession(projectId: string, id: string): void
onRenameSession(projectId: string, id: string, title: string): void
+ onAiNameSession(projectId: string, id: string, cwd?: string): void | Promise<void>
onRowContextMenu(e: React.MouseEvent, projectId: string, id: string): void
onAddToProject(projectId: string): void
onMouseEnter?(): void
@@ -158,6 +159,7 @@ export function SessionsSidebar(props: SessionsSidebarProps): JSX.Element | null
onClick={() => props.onFocusNode(row.id)}
onClose={() => props.onCloseSession(g.projectId, row.id)}
onRename={(title) => props.onRenameSession(g.projectId, row.id, title)}
+ onAiName={() => props.onAiNameSession(g.projectId, row.id, row.cwd)}
onContextMenu={(e) => props.onRowContextMenu(e, g.projectId, row.id)}
/>
))
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 03dcd1186..c8df1167d 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -3904,7 +3904,11 @@ body,
.ss-meta__cwd { font-family: var(--mono, 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-ctx { font-size: 9.5px; padding: 0 5px; border-radius: 4px; color: #000; font-weight: 600; flex: 0 0 auto; }
-.ss-row__close { margin-left: auto; opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; 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; }
+.ss-row__ai:hover { opacity: 1 !important; color: var(--accent); }
+.ss-row__ai:disabled { opacity: 0.6; cursor: default; color: var(--accent); }
+.ss-row__close { opacity: 0; border: none; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; flex: 0 0 auto; }
.ss-row:hover .ss-row__close { opacity: 0.6; }
.ss-row__close:hover { opacity: 1 !important; color: #ff453a; }