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(dock): keep the add menu inside short windows
Dev Goswamic26461fa978a
diff --git a/src/renderer/components/Dock.tsx b/src/renderer/components/Dock.tsxindex 45bc392a1..ea70ef730 100644--- a/src/renderer/components/Dock.tsx+++ b/src/renderer/components/Dock.tsx@@ -1,4 +1,5 @@-import { useState } from 'react'+import { useRef, useState } from 'react'+import { createPortal } from 'react-dom'import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type AgentId, type BuiltinAgentId } from '@shared/agents/config'import type { CanvasLayout } from '@shared/canvas-layout'import type { CustomAgent } from '@shared/types'@@ -17,6 +18,9 @@ import { Tooltip } from './Tooltip'const isMac = /Mac/i.test(navigator.platform || navigator.userAgent)+/** How long a flyout stays open after the pointer leaves its row (see `closeFlyoutSoon`). */+const FLYOUT_CLOSE_DELAY_MS = 200+interface DockProps {dirty: booleanzoomPct: number@@ -119,6 +123,32 @@ export function Dock({// ≥1 inheriting custom agent (one with a `baseAgent` matching it); otherwise it stays a flat// button, byte-identical to before this nesting existed.const [openSub, setOpenSub] = useState<BuiltinAgentId | null>(null)+ // The add menu scrolls its rows when the window is too short to show them all, and a scroller+ // clips anything that pokes out of it. So the flyout is portaled into the menu box (outside the+ // scrolling list) and placed beside its row. It stays a React child of the row, so moving the+ // pointer from the row into the flyout is not a mouseleave.+ const [addMenuEl, setAddMenuEl] = useState<HTMLDivElement | null>(null)+ const [subPos, setSubPos] = useState<{ top: number; left: number } | null>(null)+ // Leaving the row closes its flyout after a short delay, not at once: the list's scrollbar sits+ // between the row and the flyout (always on Windows/Linux, while visible on macOS), and crossing+ // it is a mouseleave. Entering the row or its flyout again cancels the close.+ const closeTimer = useRef<number | undefined>(undefined)+ const cancelFlyoutClose = (): void => window.clearTimeout(closeTimer.current)+ const closeFlyoutSoon = (aid: BuiltinAgentId): void => {+ cancelFlyoutClose()+ closeTimer.current = window.setTimeout(+ () => setOpenSub((cur) => (cur === aid ? null : cur)),+ FLYOUT_CLOSE_DELAY_MS+ )+ }+ const openFlyout = (aid: BuiltinAgentId, row: HTMLElement): void => {+ cancelFlyoutClose()+ // The row's offsetParent is the menu box (the list is not positioned), and offsetTop ignores+ // the list's scroll, so subtract it. The 6px matches the flyout's own top padding.+ const scrolled = row.parentElement?.scrollTop ?? 0+ setSubPos({ top: row.offsetTop - scrolled - 6, left: row.offsetLeft + row.offsetWidth })+ setOpenSub(aid)+ }// The registry's first effective `speech.dictation` binding, `''` when the user unbound it.// The selector returns a STRING, so zustand's default equality keeps an unrelated settings// write from re-rendering the dock.@@ -229,128 +259,137 @@ export function Dock({<div className="dock">{menuOpen && (- <div className="dock-menu">- <button onClick={pick(onAddTerminal)}>- <TerminalIcon />- <span>Terminal</span>- </button>- <button onClick={pick(onAddRemote)}>- <TerminalIcon />- <span>Remote…</span>- </button>- {BUILTIN_AGENT_IDS.filter((aid) => !disabledAgents.includes(aid)).flatMap((aid) => {- const inheriting = inheritingByBase.get(aid) ?? []- // No inheriting customs → the builtin stays a flat button (with Claude's account- // rows), byte-identical to before nesting existed.- if (inheriting.length === 0) {- const base = (- <button key={aid} title={AGENT_CONFIG[aid].notice} onClick={pick(() => onAddAgent(aid))}>- <AgentIcon agentId={aid} size={18} />- <span>{AGENT_CONFIG[aid].label}</span>- </button>- )- if (aid !== 'claude') return [base]- // SSH project with no accounts on its host: a disabled row saying where this- // host's accounts come from (local accounts are correctly invisible here).- const acctHint = sshAccountsHint(activeProject, localAccounts)- if (acctHint) {- return [- base,- <button key={`${aid}-acct-hint`} disabled title={acctHint}>+ <div className="dock-menu dock-add-menu" ref={setAddMenuEl}>+ <div+ className="dock-menu__list nowheel"+ onScroll={() => {+ cancelFlyoutClose()+ setOpenSub(null)+ }}+ >+ <button onClick={pick(onAddTerminal)}>+ <TerminalIcon />+ <span>Terminal</span>+ </button>+ <button onClick={pick(onAddRemote)}>+ <TerminalIcon />+ <span>Remote…</span>+ </button>+ {BUILTIN_AGENT_IDS.filter((aid) => !disabledAgents.includes(aid)).flatMap((aid) => {+ const inheriting = inheritingByBase.get(aid) ?? []+ // No inheriting customs → the builtin stays a flat button (with Claude's account+ // rows), byte-identical to before nesting existed.+ if (inheriting.length === 0) {+ const base = (+ <button key={aid} title={AGENT_CONFIG[aid].notice} onClick={pick(() => onAddAgent(aid))}><AgentIcon agentId={aid} size={18} />- <span>No accounts on this host yet</span>+ <span>{AGENT_CONFIG[aid].label}</span></button>+ )+ if (aid !== 'claude') return [base]+ // SSH project with no accounts on its host: a disabled row saying where this+ // host's accounts come from (local accounts are correctly invisible here).+ const acctHint = sshAccountsHint(activeProject, localAccounts)+ if (acctHint) {+ return [+ base,+ <button key={`${aid}-acct-hint`} disabled title={acctHint}>+ <AgentIcon agentId={aid} size={18} />+ <span>No accounts on this host yet</span>+ </button>+ ]+ }+ // Claude picks up one flat entry per logged-in local account.+ if (localAccounts.length === 0) return [base]+ return [+ base,+ ...localAccounts.map((a) => (+ <button key={`${aid}-${a.id}`} onClick={pick(() => onAddAgent(aid, a.id))}>+ <AgentIcon agentId={aid} size={18} />+ <span>+ Claude — {a.label}+ {a.id === defaultAccountId ? ' ✓' : ''}+ </span>+ </button>+ ))]}- // Claude picks up one flat entry per logged-in local account.- if (localAccounts.length === 0) return [base]+ // Has inheriting customs → render as a flyout submenu. The parent button still+ // launches the base harness in one click (preserving today's behavior); hovering it+ // reveals the base's variants — its account rows (Claude) and the inheriting customs.+ const acctHint = sshAccountsHint(activeProject, localAccounts)return [- base,- ...localAccounts.map((a) => (- <button key={`${aid}-${a.id}`} onClick={pick(() => onAddAgent(aid, a.id))}>+ <div+ key={aid}+ className="dock-menu__has-sub"+ onMouseEnter={(e) => openFlyout(aid, e.currentTarget)}+ onMouseLeave={() => closeFlyoutSoon(aid)}+ >+ <button title={AGENT_CONFIG[aid].notice} onClick={pick(() => onAddAgent(aid))}><AgentIcon agentId={aid} size={18} />- <span>- Claude — {a.label}- {a.id === defaultAccountId ? ' ✓' : ''}- </span>+ <span>{AGENT_CONFIG[aid].label}</span>+ <span className="dock-menu__chevron">▸</span></button>- ))+ {openSub === aid && addMenuEl && createPortal(+ <div className="dock-menu__sub" style={subPos ?? undefined}>+ {aid === 'claude' && localAccounts.length > 0 && (+ <>+ <div className="dock-menu__sub-label">Accounts</div>+ {localAccounts.map((a) => (+ <button+ key={a.id}+ onClick={pick(() => onAddAgent(aid, a.id))}+ >+ <AgentIcon agentId={aid} size={18} />+ <span>+ {a.label}+ {a.id === defaultAccountId ? ' ✓' : ''}+ </span>+ </button>+ ))}+ </>+ )}+ {aid === 'claude' && acctHint && (+ <button disabled title={acctHint}>+ <AgentIcon agentId={aid} size={18} />+ <span>No accounts on this host yet</span>+ </button>+ )}+ <div className="dock-menu__sub-label">Custom</div>+ {inheriting.map((c) => (+ <button key={c.id} onClick={pick(() => onAddAgent(c.id))}>+ <AgentIcon agentId={c.id} size={18} />+ <span>{c.label}</span>+ </button>+ ))}+ </div>,+ addMenuEl+ )}+ </div>]- }- // Has inheriting customs → render as a flyout submenu. The parent button still- // launches the base harness in one click (preserving today's behavior); hovering it- // reveals the base's variants — its account rows (Claude) and the inheriting customs.- const acctHint = sshAccountsHint(activeProject, localAccounts)- return [- <div- key={aid}- className="dock-menu__has-sub"- onMouseEnter={() => setOpenSub(aid)}- onMouseLeave={() => setOpenSub((cur) => (cur === aid ? null : cur))}+ })}+ {baselessCustoms.map((c) => (+ <button key={c.id} onClick={pick(() => onAddAgent(c.id))}>+ <AgentIcon agentId={c.id} size={18} />+ <span>{c.label}</span>+ </button>+ ))}+ {contentRows.map((row) => (+ <button+ key={row.kind}+ disabled={row.disabled}+ title={row.hint}+ onClick={pick(row.onClick)}>- <button title={AGENT_CONFIG[aid].notice} onClick={pick(() => onAddAgent(aid))}>- <AgentIcon agentId={aid} size={18} />- <span>{AGENT_CONFIG[aid].label}</span>- <span className="dock-menu__chevron">▸</span>- </button>- {openSub === aid && (- <div className="dock-menu__sub">- {aid === 'claude' && localAccounts.length > 0 && (- <>- <div className="dock-menu__sub-label">Accounts</div>- {localAccounts.map((a) => (- <button- key={a.id}- onClick={pick(() => onAddAgent(aid, a.id))}- >- <AgentIcon agentId={aid} size={18} />- <span>- {a.label}- {a.id === defaultAccountId ? ' ✓' : ''}- </span>- </button>- ))}- </>- )}- {aid === 'claude' && acctHint && (- <button disabled title={acctHint}>- <AgentIcon agentId={aid} size={18} />- <span>No accounts on this host yet</span>- </button>- )}- <div className="dock-menu__sub-label">Custom</div>- {inheriting.map((c) => (- <button key={c.id} onClick={pick(() => onAddAgent(c.id))}>- <AgentIcon agentId={c.id} size={18} />- <span>{c.label}</span>- </button>- ))}- </div>- )}- </div>- ]- })}- {baselessCustoms.map((c) => (- <button key={c.id} onClick={pick(() => onAddAgent(c.id))}>- <AgentIcon agentId={c.id} size={18} />- <span>{c.label}</span>- </button>- ))}- {contentRows.map((row) => (- <button- key={row.kind}- disabled={row.disabled}- title={row.hint}- onClick={pick(row.onClick)}- >- {row.icon}- <span>{row.label}</span>+ {row.icon}+ <span>{row.label}</span>+ </button>+ ))}+ <button onClick={pick(onConnectRemote)}>+ <RemoteIcon />+ <span>New Remote Connection</span></button>- ))}- <button onClick={pick(onConnectRemote)}>- <RemoteIcon />- <span>New Remote Connection</span>- </button>+ </div></div>)}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 657eb3e36..0fda23345 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -1045,6 +1045,24 @@ body,box-shadow: 0 12px 36px rgba(0, 0, 0, calc(0.55 * var(--shadow-k)));}+/* The add menu lists every node kind and agent (860px+ on a stock setup), so on a short window its+ top ran up under the tab bar and off the screen, where those rows could not be clicked. It is+ capped to the space between the tab bar and the dock, and its rows scroll inside an inner list:+ scrolling the menu box itself would scroll its glass `::before` layer away with the rows. 54px+ is the dock's measured height, 16px the menu's gap above the dock plus a margin below the tab+ bar. The agent flyouts are portaled out of the list (Dock.tsx). */+.dock-add-menu {+ max-height: calc(100vh - var(--tabbar-h) - var(--float-gap) - 54px - 16px);+}+.dock-menu__list {+ display: flex;+ flex-direction: column;+ gap: 2px;+ min-height: 0;+ overflow-y: auto;+ overscroll-behavior: contain;+}+.dock-menu button {display: flex;align-items: center;