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(review): worktree root guard, snap-grid bugs, dup Terminal, copilot icon, misc
enes0cca2e01bdb9
diff --git a/src/main/index.ts b/src/main/index.tsindex 118c6f23f..04c13a843 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -428,8 +428,11 @@ function buildAppMenu(win: BrowserWindow): void {click: () => send(IPC.appToggleAutoAlign)},{+ // No accelerator: `installKeydownIntercepts` already claims ⌘0 for zoom-to-100% before the+ // renderer sees it, so labelling this item "⌘0" would show a shortcut that does something+ // else. The item stays click-only; the renderer's own Shift+1 chord is the keyboard route to+ // Fit View.label: 'Fit View',- accelerator: 'CmdOrCtrl+0',click: () => send(IPC.appFitView)},{diff --git a/src/renderer/assets/copilot.svg b/src/renderer/assets/copilot.svgdeleted file mode 100644index f145e3992..000000000--- a/src/renderer/assets/copilot.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">- <path fill="#f0f6fc" d="M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"/>- <path fill="#f0f6fc" d="M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"/>-</svg>diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex dfa85f37c..a5386b7cb 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -4995,7 +4995,12 @@ export function Canvas() {// is safe to run over the whole list. v1: arrange-all-on-enable only — it does not re-snap on// later drags. Turning OFF is a no-op (nodes stay where they were snapped). The transition is// tracked with a ref so a re-render that preserves the ON value doesn't re-arrange.- const prevAutoAlignRef = useRef(false)+ //+ // SEEDED from the persisted setting, NOT `false`: a `false` seed made every app launch with the+ // mode already ON read as an OFF->ON transition, snapping all nodes and rewriting project.json at+ // boot (unsolicited). Seeding from the initial value means only a within-session user toggle+ // arranges — which is what "enable the mode" means.+ const prevAutoAlignRef = useRef(settings.autoAlignGrid === true)useEffect(() => {const on = settings.autoAlignGridif (on && !prevAutoAlignRef.current) {@@ -5781,7 +5786,10 @@ export function Canvas() {{ type: 'separator' },// Canvas actions.{ label: 'Select all', icon: <IconSelectAll />, onClick: selectAll },- { label: 'Fit view', icon: <IconFit />, onClick: fitView },+ // fitAll, NOT the raw fitView: fitAll frames against the CURRENT chrome layout (the same+ // wrapper the command palette's Fit view uses). #227 swapped this to bare fitView, which+ // loses that framing and lets sidebar/HUD chrome cover part of the fitted content.+ { label: 'Fit view', icon: <IconFit />, onClick: fitAll },// Project-wide: restart every idle agent CLI in place (new model pickup). Hidden on a// canvas with no restartable agent node — there it could only ever report "0 restarted"....(hasRestartableAgents()@@ -5803,7 +5811,7 @@ export function Canvas() {addHandlers,addCtx,selectAll,- fitView,+ fitAll,hasRestartableAgents,restartIdleAgents]diff --git a/src/renderer/components/SessionRow.test.tsx b/src/renderer/components/SessionRow.test.tsxindex a39719f66..649d3e13e 100644--- a/src/renderer/components/SessionRow.test.tsx+++ b/src/renderer/components/SessionRow.test.tsx@@ -35,6 +35,6 @@ describe('SessionRow status age', () => {)expect(html).toContain('5m ago')- expect(html).toContain('In this state 5m ago')+ expect(html).toContain('Entered this state 5m ago')})})diff --git a/src/renderer/components/SessionRow.tsx b/src/renderer/components/SessionRow.tsxindex 34337b0af..a931315f0 100644--- a/src/renderer/components/SessionRow.tsx+++ b/src/renderer/components/SessionRow.tsx@@ -164,7 +164,7 @@ export function SessionRow({{row.sshHost && <span className="ss-meta__ssh">⇅ {row.sshHost}</span>}{row.cwd && <span className="ss-meta__cwd">{dirName(row.cwd)}</span>}{stateAgeLabel && (- <span className="ss-meta__state-age" title={`In this state ${stateAgeLabel}`}>+ <span className="ss-meta__state-age" title={`Entered this state ${stateAgeLabel}`}>{stateAgeLabel}</span>)}diff --git a/src/renderer/hud/main.ts b/src/renderer/hud/main.tsindex 613fbf887..1a73de9dd 100644--- a/src/renderer/hud/main.ts+++ b/src/renderer/hud/main.ts@@ -7,6 +7,7 @@ import './hud.css'import { CLAUDE_MASCOT, CODEX_MASCOT, DONE_BLOB } from '../lib/mascot'import { HUD_BRAND_PULSE_CLASS, brandPulseBackground, brandPulsePlan } from '../lib/brandPulse'import { createGrokMarkSvg } from '../lib/grokMark'+import { createCopilotMarkSvg } from '../lib/copilotMark'import { buildIndicator, orderIndicatorAgents } from './indicator'import codexPet from '../assets/pet-codex.webp'@@ -185,7 +186,9 @@ function workingMascot(agentId?: string): Element {const plan = brandPulsePlan(agentId, HUD_QUADRANT_H)if (plan) {return plan.kind === 'inline'- ? createGrokMarkSvg(plan.size, HUD_BRAND_PULSE_CLASS)+ ? plan.mark === 'copilot'+ ? createCopilotMarkSvg(plan.size, HUD_BRAND_PULSE_CLASS)+ : createGrokMarkSvg(plan.size, HUD_BRAND_PULSE_CLASS): brandPulseMascot(plan.src, plan.size)}const dot = document.createElement('span')diff --git a/src/renderer/lib/addMenuSpec.test.tsx b/src/renderer/lib/addMenuSpec.test.tsxindex d5ed34ffa..15d5d3de2 100644--- a/src/renderer/lib/addMenuSpec.test.tsx+++ b/src/renderer/lib/addMenuSpec.test.tsx@@ -101,13 +101,14 @@ describe('contentAddItemsToMenuItems', () => {})describe('contentAddItemsToDockRows', () => {- it('omits the remote picker (the Dock has its own remote-connection flow) but keeps the rest', () => {+ it('omits the Dock-local terminal + remote rows (the Dock renders those itself) and keeps the rest', () => {const rows = contentAddItemsToDockRows(CONTENT_ADD_ITEMS, handlers(), {hasCwd: true,isSshProject: false})+ // NO 'terminal' and NO 'remote': the Dock draws its own Terminal button and its own+ // "New Remote Connection" flow. Emitting a terminal row here duplicated the Terminal entry.expect(rows.map((r) => r.kind)).toEqual([- 'terminal','browser','web','sticky',@@ -116,6 +117,7 @@ describe('contentAddItemsToDockRows', () => {'new-file','worktree'])+ expect(rows.some((r) => r.kind === 'terminal')).toBe(false)expect(rows.some((r) => r.kind === 'remote')).toBe(false)})diff --git a/src/renderer/lib/addMenuSpec.tsx b/src/renderer/lib/addMenuSpec.tsxindex fd8840091..5ca6b9d37 100644--- a/src/renderer/lib/addMenuSpec.tsx+++ b/src/renderer/lib/addMenuSpec.tsx@@ -191,7 +191,9 @@ export function contentAddItemsToDockRows(for (const item of items) {switch (item.kind) {case 'terminal':- out.push({ kind: 'terminal', label: 'Terminal', icon: <IconTerminal />, onClick: () => handlers.terminal() })+ // The Dock renders its OWN "Terminal" button (agents have bespoke account flyouts beside+ // it, so the whole session cluster is Dock-local — see Dock.tsx). Emitting a terminal row+ // here too produced a duplicate "Terminal" entry. Skip, exactly like `remote` below.breakcase 'remote':// The Dock uses its own "New Remote Connection" affordance, not the remote picker. Skipdiff --git a/src/renderer/lib/agentIcons.tsx b/src/renderer/lib/agentIcons.tsxindex ceb00a014..ebbfb7d06 100644--- a/src/renderer/lib/agentIcons.tsx+++ b/src/renderer/lib/agentIcons.tsx@@ -2,6 +2,7 @@ import { capabilityAgentId, type AgentId } from '@shared/agents/config'import { IconTerminal } from '../components/icons'import { BRAND_PULSE_CLASS, brandLogoSrc, brandPulsePlan } from './brandPulse'import { GROK_MARK_PATH, GROK_MARK_VIEWBOX } from './grokMark'+import { COPILOT_MARK_PATHS, COPILOT_MARK_VIEWBOX } from './copilotMark'// The logo map itself lives in the REACT-FREE lib/brandPulse.ts, because the notch HUD needs the// same assets and must not import React. Re-exported here so React callers have one import for@@ -45,12 +46,47 @@ export function GrokMark({** A thin renderer on purpose: every decision is in the pure plan, which the notch HUD shares.*/+/**+ * The official GitHub Copilot mark, inlined rather than shipped as an asset — geometry from+ * `lib/copilotMark.ts`, which the notch HUD's imperative renderer shares. Monochrome, so+ * `currentColor` lets it follow the theme (the asset's fixed #f0f6fc was invisible on light).+ */+export function CopilotMark({+ size,+ className+}: {+ size: number+ className?: string+}): React.JSX.Element {+ return (+ <svg+ width={size}+ height={size}+ viewBox={COPILOT_MARK_VIEWBOX}+ fill="currentColor"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden+ className={className}+ style={{ display: 'block' }}+ >+ {COPILOT_MARK_PATHS.map((d) => (+ <path key={d.slice(0, 12)} d={d} />+ ))}+ </svg>+ )+}+export function BrandPulse({ agentId, size }: { agentId?: AgentId; size: number }): React.JSX.Element | null {const plan = brandPulsePlan(agentId, size)if (!plan) return null// Grok keeps carrying the class on the <svg> itself — no wrapper — so its `currentColor` fill and// its drop-shadow bloom resolve exactly as they did before the class was generalized.- if (plan.kind === 'inline') return <GrokMark size={plan.size} className={BRAND_PULSE_CLASS} />+ if (plan.kind === 'inline')+ return plan.mark === 'copilot' ? (+ <CopilotMark size={plan.size} className={BRAND_PULSE_CLASS} />+ ) : (+ <GrokMark size={plan.size} className={BRAND_PULSE_CLASS} />+ )return (<span className={BRAND_PULSE_CLASS} aria-hidden style={{ display: 'block', lineHeight: 0 }}><img src={plan.src} width={plan.size} height={plan.size} alt="" style={{ display: 'block' }} />@@ -64,6 +100,7 @@ export function AgentIcon({ agentId, size = 16 }: { agentId: AgentId; size?: num// reflected on the next render without duplicating custom-agent lookup logic in every menu.const iconAgentId = capabilityAgentId(agentId)if (iconAgentId === 'grok') return <GrokMark size={size} />+ if (iconAgentId === 'copilot') return <CopilotMark size={size} />// `brandLogoSrc`, not `AGENT_LOGO[iconAgentId]`: the id can be anything a hand-edited// project.json says, and a prototype key ('constructor') would hand back a Function as the image// source.diff --git a/src/renderer/lib/brandPulse.test.tsx b/src/renderer/lib/brandPulse.test.tsxindex 5465dad01..d1c8c0ae4 100644--- a/src/renderer/lib/brandPulse.test.tsx+++ b/src/renderer/lib/brandPulse.test.tsx@@ -26,7 +26,7 @@ import { BrandPulse } from './agentIcons'*/describe('brandPulsePlan', () => {it('gives mascot-less asset agents their own mark', () => {- for (const agentId of ['gemini', 'opencode', 'copilot'] as const) {+ for (const agentId of ['gemini', 'opencode'] as const) {const plan = brandPulsePlan(agentId, 16)expect(plan, agentId).toEqual({ kind: 'asset', src: expect.any(String), size: 16 })// A real, non-empty URL — an asset import that silently resolved to '' would render an@@ -35,11 +35,12 @@ describe('brandPulsePlan', () => {}})- it('keeps grok on its INLINE mark, not an asset', () => {- // Grok's mark is a single monochrome path drawn in `currentColor`; loading it through `<img>`- // would paint it black and lose it on the dark theme. This is the pre-existing behaviour the- // generalized pulse must not change.- expect(brandPulsePlan('grok', 16)).toEqual({ kind: 'inline', size: 16 })+ it('keeps grok AND copilot on their INLINE marks, not assets', () => {+ // Both marks are monochrome paths drawn in `currentColor`; loading them through `<img>` would+ // fix the fill to one theme's colour (grok black on dark, copilot near-invisible on light).+ // The generalized inline plan carries WHICH mark so each surface draws the right geometry.+ expect(brandPulsePlan('grok', 16)).toEqual({ kind: 'inline', mark: 'grok', size: 16 })+ expect(brandPulsePlan('copilot', 16)).toEqual({ kind: 'inline', mark: 'copilot', size: 16 })})it('answers nothing for an agent with no mark, so the caller falls back to the dot', () => {@@ -59,7 +60,7 @@ describe('brandPulseBackground', () => {// marks (backgroundImage came back ''), because Vite inlines them as data URIs carrying literal// `'` and, for three of them, literal `(`/`)`. The notch strip would have shown an empty box.it('survives a real CSS parser for every mark', () => {- for (const agentId of ['claude', 'codex', 'gemini', 'opencode', 'copilot'] as const) {+ for (const agentId of ['claude', 'codex', 'gemini', 'opencode'] as const) {const plan = brandPulsePlan(agentId, 13)const src = plan?.kind === 'asset' ? plan.src : ''const el = document.createElement('span')diff --git a/src/renderer/lib/brandPulse.ts b/src/renderer/lib/brandPulse.tsindex d107bdb40..3876e5f91 100644--- a/src/renderer/lib/brandPulse.ts+++ b/src/renderer/lib/brandPulse.ts@@ -11,7 +11,6 @@ import claudeIcon from '../assets/claude.svg'import codexIcon from '../assets/codex-color.svg'import geminiIcon from '../assets/gemini-color.svg'import opencodeIcon from '../assets/opencode.svg'-import copilotIcon from '../assets/copilot.svg'// Brand logo per builtin agent; custom/unknown agents have none (callers fall back to the terminal// glyph, or to the plain pulsing dot).@@ -25,8 +24,7 @@ export const AGENT_LOGO: Partial<Record<string, string>> = {claude: claudeIcon,codex: codexIcon,gemini: geminiIcon,- opencode: opencodeIcon,- copilot: copilotIcon+ opencode: opencodeIcon}/**@@ -42,8 +40,13 @@ export const brandLogoSrc = (agentId: AgentId): string | undefined =>/** Does this agent have a brand mark to draw? grok is inlined rather than an asset, so it is not in* AGENT_LOGO — ask through here rather than testing that map directly. */+export const INLINE_MARK_AGENTS = ['grok', 'copilot'] as const+export type InlineMark = (typeof INLINE_MARK_AGENTS)[number]+export const inlineMarkFor = (agentId: AgentId): InlineMark | null =>+ (INLINE_MARK_AGENTS as readonly string[]).includes(agentId) ? (agentId as InlineMark) : null+export const hasBrandLogo = (agentId: AgentId): boolean =>- agentId === 'grok' || brandLogoSrc(agentId) !== undefined+ inlineMarkFor(agentId) !== null || brandLogoSrc(agentId) !== undefined/** Canvas RUNNING-badge class (styles.css). */export const BRAND_PULSE_CLASS = 'term-node__mascot--pulse'@@ -55,7 +58,7 @@ export const HUD_BRAND_PULSE_CLASS = 'mascot mascot--pulse'* lib/grokMark.ts (monochrome, painted in `currentColor`), `asset` = the brand file at `src`.*/export type BrandPulsePlan =- | { kind: 'inline'; size: number }+ | { kind: 'inline'; mark: InlineMark; size: number }| { kind: 'asset'; src: string; size: number }/**@@ -79,7 +82,8 @@ export type BrandPulsePlan =*/export function brandPulsePlan(agentId: AgentId | undefined, size: number): BrandPulsePlan | null {if (!agentId || !hasBrandLogo(agentId)) return null- if (agentId === 'grok') return { kind: 'inline', size }+ const mark = inlineMarkFor(agentId)+ if (mark) return { kind: 'inline', mark, size }const src = brandLogoSrc(agentId)return src ? { kind: 'asset', src, size } : null}diff --git a/src/renderer/lib/copilotMark.ts b/src/renderer/lib/copilotMark.tsnew file mode 100644index 000000000..72ee01fee--- /dev/null+++ b/src/renderer/lib/copilotMark.ts@@ -0,0 +1,39 @@+// The GitHub Copilot mark, as raw geometry so BOTH renderers can draw it: the React `AgentIcon` /+// `BrandPulse` in the canvas, and the plain-DOM notch HUD, which builds its nodes imperatively and+// cannot use JSX.+//+// Like grok's, Copilot's mark is MONOCHROME — the official asset is a single fill (#f0f6fc, the+// on-dark colour). Shipped as an `<img src>` it is an isolated document where that fixed light fill+// paints on every theme, leaving it near-invisible on the light theme. Inlined with+// `fill="currentColor"` it takes the surrounding label colour instead (black-on-light,+// white-on-dark), exactly as grok's mark does.++/** The mark's own aspect box (24×24, GitHub's octicon grid). */+export const COPILOT_MARK_VIEWBOX = '0 0 24 24'++/** Two subpaths: the head/body glyph and the two eyes. Both painted in `currentColor`. */+export const COPILOT_MARK_PATHS = [+ 'M23.922 16.992c-.861 1.495-5.859 5.023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z',+ 'M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z'+]++/**+ * Build the mark as a real SVG element, for the imperative renderer (the notch HUD). Mirrors+ * `createGrokMarkSvg` — `createElementNS`, self-describing `fill="currentColor"`, both subpaths.+ */+export function createCopilotMarkSvg(size: number, className: string): SVGSVGElement {+ const NS = 'http://www.w3.org/2000/svg'+ const svg = document.createElementNS(NS, 'svg')+ svg.setAttribute('width', String(size))+ svg.setAttribute('height', String(size))+ svg.setAttribute('viewBox', COPILOT_MARK_VIEWBOX)+ svg.setAttribute('fill', 'currentColor')+ svg.setAttribute('aria-hidden', 'true')+ svg.setAttribute('class', className)+ for (const d of COPILOT_MARK_PATHS) {+ const path = document.createElementNS(NS, 'path')+ path.setAttribute('d', d)+ svg.appendChild(path)+ }+ return svg+}diff --git a/src/renderer/nodes/SubagentNode.tsx b/src/renderer/nodes/SubagentNode.tsxindex 1913eed2b..d0903e309 100644--- a/src/renderer/nodes/SubagentNode.tsx+++ b/src/renderer/nodes/SubagentNode.tsx@@ -60,7 +60,7 @@ export function SubagentNode({ id, data, selected }: NodeProps<CanvasNode>) {return (<div onPointerDownCapture={select} className={`subagent-node${working ? ' working' : ' done'}`}>- <NodeResizer isVisible={selected} minWidth={180} minHeight={84} color="#d97757" />+ <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.subagent.width} minHeight={NODE_MIN_SIZES.subagent.height} color="#d97757" /><Handle type="target" position={Position.Top} isConnectable={false} /><div className="subagent-node__head nodrag" onClick={toggle} style={{ cursor: 'pointer' }}><buttondiff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsxindex c5a27dcc9..57b2a1f0f 100644--- a/src/renderer/nodes/WebNode.tsx+++ b/src/renderer/nodes/WebNode.tsx@@ -102,7 +102,7 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {className={`term-node web-node${selected ? ' selected' : ''}`}style={{ borderTopColor: data.color }}>- <NodeResizer minWidth={320} minHeight={200} isVisible={selected} color={data.color} />+ <NodeResizer minWidth={NODE_MIN_SIZES.web.width} minHeight={NODE_MIN_SIZES.web.height} isVisible={selected} color={data.color} />{/* Invisible target handle so a rope from the agent node that opened this can attach. */}<Handleid="flow-in"diff --git a/src/renderer/nodes/status-lifecycle.test.ts b/src/renderer/nodes/status-lifecycle.test.tsindex de7f14af0..c53aa6583 100644--- a/src/renderer/nodes/status-lifecycle.test.ts+++ b/src/renderer/nodes/status-lifecycle.test.ts@@ -1,14 +1,57 @@import { readFileSync } from 'node:fs'import { join } from 'node:path'-import { describe, expect, it } from 'vitest'+import { afterEach, describe, expect, it } from 'vitest'+import { useAgentStatus } from '../state/agentStatus'+import { useAgentNodes } from '../state/agentNodes'-const SOURCE = readFileSync(join(__dirname, 'TerminalNode.tsx'), 'utf8')+// The behaviour under test: leaving a project unmounts its TerminalNodes, and that unmount must+// NOT clear their live agent status — the sidebar spans projects, so a live `working`/`waiting`+// state has to survive a project switch. Only an explicit delete (Canvas.deleteNodes /+// closeSession → useAgentStatus.remove) or a real hook transition may change it.+//+// TerminalNode itself is impractical to mount in jsdom (xterm, a live PTY, dozens of stores), so+// the two store CONTRACTS the fix depends on are exercised directly — behavioural coverage of the+// mechanism, not a re-grep of the source. The source guard below is kept as a cheap secondary+// tripwire for the exact line that was removed.-describe('TerminalNode status lifecycle', () => {- it('does not clear live status when a project switch unmounts the node', () => {- // The sidebar spans projects, so leaving one canvas is not a session-state transition. Actual- // deletion owns status removal in Canvas.deleteNodes, and hooks own live state changes.- expect(SOURCE).not.toContain('useAgentStatus.getState().setState(id, undefined)')- expect(SOURCE).toContain('useAgentNodes.getState().clearForParent(id)')+describe('agent status survives an unmount that is not a deletion', () => {+ afterEach(() => {+ for (const id of Object.keys(useAgentStatus.getState().byId)) useAgentStatus.getState().remove(id)+ useAgentNodes.getState().clearForParent('parent-a')+ useAgentNodes.getState().clearForParent('parent-b')+ })++ it('keeps a live status until remove() is called — an unmount alone never clears it', () => {+ useAgentStatus.getState().setState('node-x', 'working')+ expect(useAgentStatus.getState().byId['node-x']?.state).toBe('working')++ // Whatever an unmount does, it does NOT call remove(); the entry must still be here.+ expect(useAgentStatus.getState().byId['node-x']).toBeDefined()++ // The ONLY sanctioned clear (deleteNodes / closeSession) removes it.+ useAgentStatus.getState().remove('node-x')+ expect(useAgentStatus.getState().byId['node-x']).toBeUndefined()+ })++ it("clearForParent drops a node's subagent cards without touching sibling parents", () => {+ useAgentNodes.getState().start('tool-a1', { parentNodeId: 'parent-a', label: 'sub' })+ useAgentNodes.getState().start('tool-b1', { parentNodeId: 'parent-b', label: 'sub' })+ expect(useAgentNodes.getState().byId['tool-a1']?.parentNodeId).toBe('parent-a')++ // The unmount clears only the leaving node's fan-out (this is the one thing the unmount DOES do).+ useAgentNodes.getState().clearForParent('parent-a')+ expect(useAgentNodes.getState().byId['tool-a1']).toBeUndefined()+ // A sibling parent's cards are untouched.+ expect(useAgentNodes.getState().byId['tool-b1']?.parentNodeId).toBe('parent-b')+ })+})++describe('TerminalNode unmount source guard (secondary tripwire)', () => {+ it('has no unmount-scoped status clear, and still clears its subagent fan-out', () => {+ // Proves the removed line stays removed; it cannot prove behaviour (a different spelling would+ // pass), which is why the store-contract tests above exist.+ const source = readFileSync(join(__dirname, 'TerminalNode.tsx'), 'utf8')+ expect(source).not.toContain('useAgentStatus.getState().setState(id, undefined)')+ expect(source).toContain('useAgentNodes.getState().clearForParent(id)')})})diff --git a/src/shared/worktree.test.ts b/src/shared/worktree.test.tsindex aac0e425a..b5f11ba6e 100644--- a/src/shared/worktree.test.ts+++ b/src/shared/worktree.test.ts@@ -104,6 +104,17 @@ describe('computeWorktreePath', () => {expect(computeWorktreePath(' ', 'x')).toBe('')expect(computeWorktreePath('/src/repo', '')).toBe('')})+ it('refuses a template that climbs past the repo to the filesystem root', () => {+ // `../../../../..` clamps at `/`, which on a root-running Server Edition would make+ // `git worktree add` create a directory at the filesystem root. Suggest nothing instead.+ expect(computeWorktreePath('/src/repo', 'topic/a', '../../../../../..')).toBe('')+ // One level under root is still refused (a single top-level segment).+ expect(computeWorktreePath('/repo', 'b', '/${branch}')).toBe('')+ // But a legitimate absolute base with depth is allowed.+ expect(computeWorktreePath('/src/repo', 'b', '/srv/worktrees/${branch}')).toBe(+ '/srv/worktrees/b'+ )+ })})describe('resolveWorktreePath', () => {diff --git a/src/shared/worktree.ts b/src/shared/worktree.tsindex c7b0bfeed..2ae3e5f0c 100644--- a/src/shared/worktree.ts+++ b/src/shared/worktree.ts@@ -107,6 +107,14 @@ function resolvePathFromRepo(repoRoot: string, configuredPath: string): string {}parts.push(part)}+ // Refuse a result that lands at (or directly under) the filesystem root. A pathological template+ // such as `../../../../..` climbs past the repo and clamps at `/`, yielding `/branch-x`; the+ // Server Edition often runs as root and `git worktree add /branch-x` would cheerfully create that+ // at the filesystem root. The original template code guarded this explicitly (see the historical+ // computeWorktreePath comment); the rewrite dropped it. A rooted path needs at least two segments+ // (e.g. `/srv/worktrees` is fine, `/worktrees` is not) — a Windows drive root is refused the same+ // way. Callers already treat '' as "no default / no writable base".+ if ((rooted || drive) && parts.length < 2) return ''const prefix = drive ? `${drive}/` : rooted ? '/' : ''return `${prefix}${parts.join('/')}`}