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
Merge remote-tracking branch 'origin/main' into feat/glyphgrid-engine
enesbddda754b0d3
diff --cc src/renderer/App.tsxindex ad485ac83,ee687d7c7..55e526bc1--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@@ -7,9 -7,9 +7,14 @@@ import { localSession } from './sessionimport { useSettings } from './state/settings'import { useViewMode } from './state/viewMode'import { setWebglEnabled } from './terminal/webgl-budget'+import { applyRendererMode } from './terminal/renderer-mode'+import { useSharedGlyph } from './canvas/SharedGlyphLayer'++// `resolveGpuRendering` is gone: 'shared' turned the setting into a renderer CHOICE rather than a++// webgl on/off, so `resolveTerminalRenderer` answers it and `applyRendererMode` owns the ordering++// between the two coordinators.+import { resolveTerminalRenderer } from '../shared/webgl'+ import { resolveTerminalTheme } from './terminal/themes'+ import { useAppTheme } from './state/useAppTheme'-import { resolveGpuRendering } from '../shared/webgl'import { isMacPlatform } from '../shared/platform-utils'export default function App() {@@@ -22,12 -20,28 +27,31 @@@// Subscribed at the root so it holds whatever view is showing.const gpu = useSettings((s) => s.settings.terminalGpuRendering)useEffect(() => {- setWebglEnabled(resolveGpuRendering(gpu, isMacPlatform()))+ applyRendererMode(resolveTerminalRenderer(gpu, isMacPlatform()), {+ setWebglEnabled,+ setSharedEnabled: (on) => useSharedGlyph.getState().setEnabled(on)+ })}, [gpu])+ // Publish the active terminal theme's background as a CSS variable. xterm paints its own+ // background, but the chrome AROUND it does not: the canvas node's body shows through the few px+ // its xterm host is inset by (and through a co-attach letterbox), and the kanban card modal+ // frames its terminal in an 8px pad. Without this both keep the app's colour and every+ // non-default theme renders inside a mismatched frame.+ const terminalTheme = useSettings((s) => s.settings.terminalTheme)+ useEffect(() => {+ const { background } = resolveTerminalTheme(terminalTheme).theme+ if (background) document.documentElement.style.setProperty('--term-bg', background)+ }, [terminalTheme])++ // Publish the resolved appearance as `data-theme` on <html> — what the light palette in+ // styles.css keys off. Absent, or 'dark', leaves every token at its original value, so this one+ // attribute is all that stands between an existing install and the chrome it has always had.+ const appTheme = useAppTheme()+ useEffect(() => {+ document.documentElement.dataset.theme = appTheme+ }, [appTheme])+// Keep the view-mode store's default in sync with the Settings choice, so projects the user// hasn't explicitly toggled follow it (and flip live when the setting changes).const defaultView = useSettings((s) => s.settings.defaultProjectView)diff --cc src/renderer/canvas/Canvas.tsxindex beb7718aa,3c71c9ad7..9365bfe1f--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@@ -7549,13 -7458,10 +7551,15 @@@ export function Canvas()variant={BackgroundVariant.Dots}gap={settings.gridSize || GRID}size={2.5}- color="#4a4a4a"+ /* React Flow paints the dots from a JS prop, so this can't be a rule — it reads the+ token instead. On white the dark-mode grey reads as noise rather than as a grid. */+ color="var(--canvas-dot)"/>+ {/* The shared glyph canvas: a <ReactFlow> child (so it is a sibling of the background+ and of the node renderer) at z-index 0 — above the dot grid, below every node. Only+ mounted in the experimental 'shared' renderer mode; nothing about it exists for the+ default modes. */}+ {glyphLayerActive && <SharedGlyphLayer />}<Controls showInteractive={false} position="bottom-left" onFitView={fitAll}><ControlButtonclassName={`canvas-lock-btn${canvasLocked ? ' locked' : ''}`}diff --cc src/renderer/components/settings/sections/TerminalSection.tsxindex e085cab59,11048f2fb..a7afd31cf--- a/src/renderer/components/settings/sections/TerminalSection.tsx+++ b/src/renderer/components/settings/sections/TerminalSection.tsx@@@ -6,27 -9,72 +9,84 @@@ import { SectionReset } from '../Sectioimport { Switch } from '@renderer/ui/Switch'import { Select } from '@renderer/ui/Select'import { NumberField } from '@renderer/ui/NumberField'+ import { SegmentedPill } from '@renderer/ui/SegmentedPill'+ import { TERMINAL_RESET_KEYS } from '@renderer/lib/settingsReset'+ import {+ TERMINAL_LETTER_SPACING_MAX,+ TERMINAL_LETTER_SPACING_MIN,+ TERMINAL_LINE_HEIGHT_MAX,+ TERMINAL_LINE_HEIGHT_MIN+ } from '@renderer/terminal/terminal-config'-import { resolveGpuRendering } from '@shared/webgl'++// No `resolveGpuRendering`: the renderer row is a four-way CHOICE now (the 'shared' mode), so the++// row renders the raw setting and `App.tsx` resolves it through `resolveTerminalRenderer`.import { isMacPlatform } from '@shared/platform-utils'- import type { Settings } from '@shared/types'-import type { TerminalCursorInactiveStyle, TerminalCursorStyle } from '@shared/types'++import type { Settings, TerminalCursorInactiveStyle, TerminalCursorStyle } from '@shared/types'+ /**+ * Row metadata for the settings search. Keywords matter as much as titles: an appearance setting+ * is far more often looked for by symptom ("colors", "flicker", "spacing") than by our label.+ *+ * Rows that carry two related controls (size+weight, line+letter) list the keywords for BOTH, so+ * searching either word still surfaces the row that holds it.+ */const ROWS = {- fontSize: { title: 'Font size', keywords: ['font', 'size', 'text'] },- fontFamily: { title: 'Font family', keywords: ['font', 'family', 'typeface', 'monospace'] },- cursorBlink: { title: 'Cursor blink', keywords: ['cursor', 'blink'] },+ theme: {+ title: 'Colour theme',+ keywords: [+ 'theme', 'color', 'colour', 'scheme', 'palette', 'ansi', 'dracula', 'nord', 'gruvbox',+ 'solarized', 'tokyo', 'catppuccin', 'dark', 'light'+ ]+ },+ fontFamily: {+ title: 'Font',+ keywords: ['font', 'family', 'typeface', 'monospace', 'mono', 'ligature']+ },+ fontSize: {+ title: 'Size and weight',+ keywords: ['font', 'size', 'text', 'zoom', 'weight', 'bold', 'thin', 'light', 'heavy']+ },+ spacing: {+ title: 'Spacing',+ keywords: [+ 'spacing', 'line', 'height', 'leading', 'density', 'letter', 'tracking', 'character'+ ]+ },+ cursor: {+ title: 'Cursor',+ keywords: ['cursor', 'style', 'block', 'bar', 'beam', 'underline', 'blink', 'caret']+ },+ cursorInactive: {+ title: 'Cursor when unfocused',+ keywords: ['cursor', 'inactive', 'unfocused', 'blurred', 'outline']+ },+ boldBright: {+ title: 'Bold text uses bright colours',+ keywords: ['bold', 'bright', 'color', 'colour', 'intense']+ },+ minContrast: {+ title: 'Minimum contrast',+ keywords: [+ 'contrast', 'readable', 'legible', 'accessibility', 'a11y', 'wcag', 'dim', 'unreadable'+ ]+ },gpu: {- title: 'GPU terminal rendering',- keywords: ['gpu', 'webgl', 'renderer', 'flicker', 'performance', 'graphics', 'acceleration']+ title: 'Terminal rendering',+ keywords: [+ 'gpu',+ 'webgl',+ 'renderer',+ 'rendering',+ 'flicker',+ 'performance',+ 'graphics',+ 'acceleration',+ 'shared',+ 'experimental'+ ]+ },+ reset: {+ title: 'Reset terminal appearance',+ keywords: ['reset', 'default', 'defaults', 'factory', 'restore', 'revert', 'undo']}}const ENTRIES = Object.values(ROWS)diff --cc src/renderer/nodes/TerminalNode.tsxindex 3c62f573e,9ab362455..0484e96f0--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@@ -48,31 -48,14 +48,33 @@@ importterminalKey,terminalKeyAction,toXtermText,+ applyLiveOptions,+ xtermOptionsFromSettings,SHIFT_ENTER_SEQ,CO_ATTACH_MOUSE_SEQ,- xtermScrollback,type SessionLife} from '../terminal/terminal-config'+ import { useXtermVisualSettings } from '../terminal/useXtermVisualSettings'import { loseWebglContexts, registerWebglClient, type WebglClientHandle } from '../terminal/webgl-budget'+import { attachGlyphGrid, type GlyphGridAttachment } from '../terminal/glyphgrid-attach'+import type { GridHandle } from '../glyphgrid/engine'+import {+ getSharedGlyphContext,+ nodeIsOpaque,+ nodeZFor,+ sharedGlyphActive,+ sharedGlyphAvailable,+ subscribeNodeZOrder,+ subscribeOpaqueSet,+ useSharedGlyph+} from '../canvas/SharedGlyphLayer'+import {+ bodyPlateRect,+ bodyWorldRect,+ packThemeBg,+ validCellSize,+ type Vec2+} from '../lib/glyphGridNode'import { deliverCommand, type DeliveryIo } from '../terminal/command-delivery'import {guardConcurrentRestart,@@@ -2253,87 -1545,27 +2247,96 @@@ export function TerminalNode(// eslint-disable-next-line react-hooks/exhaustive-deps}, [data.respawnNonce])+ // glyphgrid origin sync. React Flow rewrites these two props per frame while the node is+ // dragged; `setOrigin` is change-gated inside the engine, and a drag is exactly the gesture the+ // shared camera already handles at that rate, so there is deliberately no extra throttling here.+ // Declared AFTER the lifecycle effect so the mount order is register-then-push (that first push+ // is a no-op — the grid was registered at this same origin). For every terminal in the default+ // renderer modes this whole effect is one null check per position change.+ useEffect(() => {+ const grid = glyphGridRef.current+ if (!grid) return+ const nodePos = { x: positionAbsoluteX, y: positionAbsoluteY }+ const origin = bodyWorldRect(nodePos, glyphBodyOffsetRef.current)+ grid.setOrigin(origin.x, origin.y)+ // The PLATE travels with the node too, and from the SAME cached box — a drag moves the node,+ // never the body's offset or size inside it, so this is arithmetic rather than a DOM+ // measurement sixty times a second. Skipped until the body has been measured once (the+ // register path does that), so a drag can never collapse the plate to a zero rect.+ const box = glyphPlateBoxRef.current+ if (!box) return+ const plate = bodyPlateRect(nodePos, box.offset, box.w, box.h)+ grid.setPlateRect(plate.x, plate.y, plate.w, plate.h)+ // DO NOT "fix" this by measuring the DOM here. Reading the offset per frame is the obvious+ // answer to a stale cache and it is the wrong one — this effect runs on every frame of a drag,+ // for every dragged node. The cache is the right structure; what it needed was more occasions+ // to be REFRESHED, which is what the lifecycle effect's two ResizeObservers and the window+ // focus / visibilitychange listeners now provide.+ }, [positionAbsoluteX, positionAbsoluteY])+- // Live-apply font/cursor/scrollback settings to the running terminal, so a Settings change- // reaches the terminals already on the canvas instead of only the next fresh one.+ // Live-apply the appearance settings to the running terminal, so a Settings change reaches the+ // terminals already on the canvas instead of only the next fresh one.+ //+ // This must stay ONE effect that also runs on mount: a terminal ADOPTED from the park cache+ // carries the options it was built with, and this pass is what brings it up to date. Splitting+ // the new options into a second effect would work by accident today and break the moment one of+ // them skips the mount run.//- // A new font size means new cell geometry, i.e. a different grid — route it through applyFit- // (not a bare fit.fit()) so the pty is told the new size like any other resize, instead of- // running at a grid nobody renders. Under co-attach applyFit is also what REPORTS our size, so- // a font change must go through it or this client would silently keep clamping the shared pty- // to its pre-change grid.+ // A cell-geometry change (font, line height, letter spacing) means a different grid — route it+ // through applyFit (not a bare fit.fit()) so the pty is told the new size like any other resize,+ // instead of running at a grid nobody renders. Under co-attach applyFit is also what REPORTS our+ // size, so it must go through it or this client would silently keep clamping the shared pty to+ // its pre-change grid. A palette change costs no resize — just a repaint we force ourselves.useEffect(() => {const term = termRef.currentif (!term) return- term.options.fontSize = fontSize- term.options.fontFamily = fontFamily- term.options.cursorBlink = cursorBlink- term.options.scrollback = xtermScrollback(tmuxScrollback)- applyFitRef.current?.()- }, [fontSize, fontFamily, cursorBlink, tmuxScrollback])+ const { metricsChanged, themeChanged } = applyLiveOptions(term, visual)+ if (metricsChanged) applyFitRef.current?.()+ if (themeChanged) fullRepaintRef.current?.()+ }, [visual])+ // glyphgrid participation — whether this node should hold a grid RIGHT NOW.+ //+ // ORDERING IS THE POINT, and it is why this effect is declared HERE, immediately after the one+ // that writes `term.options.fontFamily/fontSize`. React runs a commit's effects in declaration+ // order, so by the time this runs xterm has already re-measured its character cell and its+ // renderer's `dimensions.css.cell` — the number `setupGlyph` registers the grid with — is the+ // NEW one. A font change reaches us as a `glyphEpoch` bump raised synchronously from the+ // generation notification, i.e. BEFORE that commit; re-registering there would pin the grid to+ // the old cell size forever (a grid's cell size cannot be changed after `register`). The font+ // settings are in the deps as well as the epoch, so the re-setup still lands after the options+ // even if the two ever arrive in separate renders. Do not move this effect above the one above.+ //+ // It also owns every state in which this node must not be on the shared canvas although it is+ // mounted — `glyphOff` names them all (collapsed, ⌘M, stacked over another node, being dragged)+ // and the ref beside it carries the same answer to `setupGlyph`'s own gate. Each drops the grid+ // and re-registers on the way back, through the SAME teardown/setup machinery that collapse and+ // ⌘M have always used: `teardownGlyph` clears `glyphMounted` (so `term-node--glyphgrid` comes off+ // the node root) and removes `glyphgrid-mode` from the xterm element, which is exactly what makes+ // the body opaque and the DOM rows visible again. Nothing here is a special case for stacking.+ //+ // ORDERING, the second time: `glyphOff` is built from a RENDER-TIME read of the opaque set, which+ // Canvas stores during its own render — i.e. before this component rendered at all. So on the+ // commit that ends a drag, `dragging: false` and the post-drop overlap answer arrive TOGETHER,+ // and this effect makes one decision instead of attaching a glyph and tearing it down again a+ // pass later. Do not "simplify" that read into state; state is exactly what lagged.+ //+ // `dragging` (this node's own prop) is kept alongside because it flips synchronously at gesture+ // start and needs nobody else. Children of a dragged GROUP frame never get it — React Flow's+ // `getDragItems` excludes them — which is why the set carries `gestureTerminalIds` too, and why+ // one gesture answer coming from two places is deliberate rather than redundant.+ //+ // No-op (one ref null check) unless this node participates in the shared canvas.+ useEffect(() => {+ glyphSyncRef.current?.(!glyphOff)- }, [glyphOff, glyphEpoch, fontSize, fontFamily])++ // `visual` stands in for what used to be the two font deps. It is the whole appearance bundle++ // (family, size, line height, letter spacing, theme, cursor), so it changes on every setting++ // that moves the character cell — and on a few that do not. A theme-only change therefore costs++ // one grid re-register the old deps would have skipped; that is the safe direction, because the++ // cost is a re-register on a rare user action while the miss would pin the grid to a stale cell++ // size for the life of the context.++ }, [glyphOff, glyphEpoch, visual])+// Kanban board opened/closed: re-evaluate our size vote. Open → applyFit reports null (yield the// grid to a card-modal viewer); close → it re-reports the real fit. On the first run boardOpen// matches the ref's init value, and applyFit is guarded (no-op when nothing changed), so thisdiff --cc src/renderer/styles.cssindex 5d1d16034,24cc15869..e6a3c2efb--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@@ -7501,23 -7577,12 +7648,23 @@@ bodyalign-items: center;gap: 4px;padding: 2px 8px 5px;+ /* Its OWN background, not one inherited from the node root. Visually identical to what it had+ before (the root is var(--panel) too) — but the shared glyph renderer makes that root+ TRANSPARENT so the GPU canvas can show through the body (`.term-node--glyphgrid`), while this+ row sits ABOVE the grid's opaque plate, which only starts at the terminal screen. Without a+ background of its own the whole strip between the header and the terminal became a window onto+ the canvas: the reported "gap under the header, in the label row", which also made the+ terminal's text look like it began well below where the DOM renderer put it. Every other child+ of the node paints its own background for exactly this reason (`.term-node__header`,+ `.term-node__find`); this one was missed because it replaced the old `.node-tags` row, which+ had one. */+ background: var(--panel);}.term-node__labeladd {- background: rgba(255, 255, 255, 0.06);- border: 1px solid rgba(255, 255, 255, 0.1);+ background: rgba(var(--tint-rgb), 0.06);+ border: 1px solid rgba(var(--tint-rgb), 0.1);border-radius: 4px;- color: rgba(255, 255, 255, 0.6);+ color: rgba(var(--tint-rgb), 0.6);font-size: 10.5px;padding: 1px 6px;cursor: pointer;