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(ui): scrollable tab strip + instant terminal preview on switch
enese586ab129ad3
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex 1865b0d5b..cffb1d8ab 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -1,4 +1,4 @@-import { useMemo, useState } from 'react'+import { useEffect, useMemo, useRef, useState } from 'react'import { createPortal } from 'react-dom'import { useProjects } from '../state/projects'import { useAgentStatus } from '../state/agentStatus'@@ -87,6 +87,15 @@ export function TabBar({setEditingId(null)}+ // The strip scrolls without a visible scrollbar (see .tabbar__tabs), so keep it navigable:+ // a plain mouse wheel scrolls it horizontally, and the active tab is brought into view.+ const tabsRef = useRef<HTMLDivElement>(null)+ useEffect(() => {+ tabsRef.current+ ?.querySelector('.tab.active')+ ?.scrollIntoView({ behavior: 'smooth', inline: 'nearest', block: 'nearest' })+ }, [activeId, projects.length])+return (<>{(menuId || editingId) && (@@ -124,7 +133,15 @@ export function TabBar({<span className="brand__name">nodeterm</span></div>- <div className="tabbar__tabs">+ <div+ className="tabbar__tabs"+ ref={tabsRef}+ onWheel={(e) => {+ // Translate a vertical mouse wheel into horizontal strip scrolling (trackpads+ // already produce deltaX). Nothing above the canvas scrolls vertically anyway.+ if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) e.currentTarget.scrollLeft += e.deltaY+ }}+ >{projects.map((p) => {const active = p.id === activeIdconst unreadCount = p.nodes.filter((n) => unreadSet.has(n.id)).lengthdiff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex d12638141..f0f4b54f7 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -351,6 +351,17 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasN// instant the session resolves (a cold restart after a reboot recreates the tmux session// empty — see the `fresh` handling below). Cheap no-op ('') when there's no snapshot.const scrollbackPromise = window.nodeTerminal.pty.readScrollback(id).catch(() => '')+ // Paint the persisted snapshot the moment it's read (a file read resolves well before the+ // tmux attach round-trip), so a project switch shows each terminal's last content instantly+ // instead of a blank body. On a warm reattach the live tmux redraw REPLACES it (term.reset()+ // on the first data chunk below); on a cold restore the replay logic reuses it as-is.+ let previewShown = false+ let liveStarted = false+ void scrollbackPromise.then((snapshot) => {+ if (disposed || liveStarted || !snapshot) return+ term.write(snapshot)+ previewShown = true+ })void (async () => {// SSH-project terminal: the project's live ControlMaster controlPath is established by// Canvas's active-project effect. On a cold app load child effects run before that parent@@ -380,6 +391,7 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasNreturn}sessionId = sid+ liveStarted = true // a late-resolving preview must not write over live outputif (fellBack) setAccountFallback(true)// Cold restart: the tmux session (and anything that was running in it) is gone — replay// the last persisted scrollback so the user sees where they left off. Warm reattach@@ -392,7 +404,9 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasNreturn}if (snapshot) {- term.write(snapshot)+ // The instant preview above may have painted this snapshot already — keep it.+ if (!previewShown) term.write(snapshot)+ previewShown = falseterm.write('\r\n\x1b[90m── session restored (process ended by a restart) ──\x1b[0m\r\n')}}@@ -405,6 +419,13 @@ export function TerminalNode({ id, data, selected, parentId }: NodeProps<CanvasNconst LOW_WATER = 1 << 18 // 256 KBcleanups.push(transport.onData(sid, (chunk) => {+ // Warm reattach: the first live chunk is tmux's own full redraw — drop the static+ // snapshot preview so the two don't stack (reset clears buffer + scrollback, which+ // matches the pre-preview behavior of starting the attach from a blank terminal).+ if (previewShown) {+ previewShown = false+ term.reset()+ }pending += chunk.lengthif (!paused && pending > HIGH_WATER) {paused = truediff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 49b8cbbc9..23c447c68 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -110,6 +110,13 @@ body,border: 1px solid var(--border);border-radius: 17px;overflow-x: auto;+ /* Scrollable but without the native scrollbar (foreign-looking in a title-bar tab strip);+ trackpad swipe / wheel still scroll, and the active tab is scrolled into view. */+ scrollbar-width: none;+}++.tabbar__tabs::-webkit-scrollbar {+ display: none;}.tab {