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(chat-view): keep tool names on one line; show loading state for ⌘M
reviewade06cd0191d
diff --git a/src/renderer/components/Spinner.test.tsx b/src/renderer/components/Spinner.test.tsxnew file mode 100644index 000000000..5a293addc--- /dev/null+++ b/src/renderer/components/Spinner.test.tsx@@ -0,0 +1,36 @@+// @vitest-environment jsdom+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { createRoot, type Root } from 'react-dom/client'+import { act } from 'react'+import { Spinner } from './Spinner'+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++let host: HTMLDivElement+let root: Root+beforeEach(() => {+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ host.remove()+})++describe('Spinner', () => {+ it('with a label, is its own polite status region named by that label', () => {+ act(() => root.render(<Spinner label="Loading conversation" />))+ const el = host.querySelector('.nt-spinner') as HTMLElement+ expect(el.getAttribute('role')).toBe('status')+ expect(el.getAttribute('aria-live')).toBe('polite')+ expect(el.getAttribute('aria-label')).toBe('Loading conversation')+ expect(el.textContent).toBe('')+ })++ it('without a label, is decorative — the visible text beside it is what gets announced', () => {+ act(() => root.render(<Spinner />))+ const el = host.querySelector('.nt-spinner') as HTMLElement+ expect(el.getAttribute('aria-hidden')).toBe('true')+ expect(el.hasAttribute('role')).toBe(false)+ })+})diff --git a/src/renderer/components/Spinner.tsx b/src/renderer/components/Spinner.tsxnew file mode 100644index 000000000..8493ca4d1--- /dev/null+++ b/src/renderer/components/Spinner.tsx@@ -0,0 +1,18 @@+/**+ * The app's one loading spinner: a CSS-only rotating ring (`.nt-spinner` in styles.css — no+ * dependency), frozen to a static ring under `prefers-reduced-motion`.+ *+ * Two ways to use it, and the difference is who speaks to a screen reader:+ * - `label` given → the spinner IS the status: a polite live region named by the label. Use it+ * where nothing beside it says what is happening.+ * - no label → decorative (`aria-hidden`). Use it beside visible text ("Capturing…") and put the+ * `role="status"` on the element holding that text, so the words are announced once — a labelled+ * spinner next to the same words would be read twice.+ */+export function Spinner({ label }: { label?: string }) {+ return label ? (+ <span className="nt-spinner" role="status" aria-live="polite" aria-label={label} />+ ) : (+ <span className="nt-spinner" aria-hidden="true" />+ )+}diff --git a/src/renderer/components/kanban/CardModal.tsx b/src/renderer/components/kanban/CardModal.tsxindex 5a827f600..dd2768848 100644--- a/src/renderer/components/kanban/CardModal.tsx+++ b/src/renderer/components/kanban/CardModal.tsx@@ -49,6 +49,7 @@ import { canChat } from '@shared/agents/config'import { effectiveAccountId } from '../../lib/accountChip'import { useSettings } from '../../state/settings'import { chipFor, commandTooltip } from '../../lib/keybindingOverrides'+import { ChatPanelFallback } from '../../nodes/ChatPanelFallback'// Code-split exactly like the canvas node's: ChatPanel carries the markdown renderer, and the// card modal must not pull it onto the board's first paint.@@ -532,7 +533,7 @@ export function CardModal({ session, columnTitle, board, onChangeBoard, onClose,re-attach — and its grid does not resize — every time the view flips. */}{mdOpen &&(useChat ? (- <Suspense fallback={null}>+ <Suspense fallback={<ChatPanelFallback />}><ChatPanelkey={session.id}nodeId={session.id}diff --git a/src/renderer/nodes/ChatPanelFallback.test.tsx b/src/renderer/nodes/ChatPanelFallback.test.tsxnew file mode 100644index 000000000..5600ec20e--- /dev/null+++ b/src/renderer/nodes/ChatPanelFallback.test.tsx@@ -0,0 +1,60 @@+// @vitest-environment jsdom+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'+import { createRoot, type Root } from 'react-dom/client'+import { act } from 'react'+import { ChatPanelFallback } from './ChatPanelFallback'+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++let host: HTMLDivElement+let root: Root+beforeEach(() => {+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})+afterEach(() => {+ act(() => root.unmount())+ host.remove()+})++describe('ChatPanelFallback', () => {+ it('is the panel shell — same container classes, so it covers the terminal exactly as the panel will', () => {+ act(() => root.render(<ChatPanelFallback hint="⌘M to exit" />))+ const shell = host.firstElementChild as HTMLElement+ expect(shell.classList.contains('term-chat')).toBe(true)+ expect(shell.classList.contains('nodrag')).toBe(true)+ expect(shell.classList.contains('nowheel')).toBe(true)+ expect(shell.querySelector(':scope > .term-chat__bar')?.textContent).toContain('Chat')+ expect(shell.querySelector('.term-chat__hint')?.textContent).toBe('⌘M to exit')+ expect(shell.querySelector(':scope > .term-chat__msgs')).toBeTruthy()+ })++ it('says it is loading, with a spinner, inside a polite status region', () => {+ act(() => root.render(<ChatPanelFallback />))+ const status = host.querySelector('[role="status"]') as HTMLElement+ expect(status).toBeTruthy()+ expect(status.getAttribute('aria-live')).toBe('polite')+ expect(status.textContent).toBe('Loading conversation…')+ expect(status.querySelector('.nt-spinner')).toBeTruthy()+ })+})++// Both mount sites of the lazy ChatPanel (canvas node + kanban card modal) must show the shell+// while the chunk loads; `fallback={null}` is what left the ⌘M face blank.+describe.each([+ ['TerminalNode.tsx', join(__dirname, 'TerminalNode.tsx')],+ ['CardModal.tsx', join(__dirname, '../components/kanban/CardModal.tsx')]+])('%s lazy ChatPanel', (_name, file) => {+ const src = readFileSync(file, 'utf8').replace(/\r\n/g, '\n')+ it('suspends into ChatPanelFallback, never into nothing', () => {+ const at = src.indexOf('<ChatPanel\n')+ expect(at).toBeGreaterThan(0)+ const opener = src.lastIndexOf('<Suspense', at)+ expect(opener).toBeGreaterThan(0)+ const wrapper = src.slice(opener, at)+ expect(wrapper).toContain('fallback={<ChatPanelFallback')+ expect(wrapper).not.toContain('fallback={null}')+ })+})diff --git a/src/renderer/nodes/ChatPanelFallback.tsx b/src/renderer/nodes/ChatPanelFallback.tsxnew file mode 100644index 000000000..c64e163e0--- /dev/null+++ b/src/renderer/nodes/ChatPanelFallback.tsx@@ -0,0 +1,38 @@+import { Spinner } from '../components/Spinner'+import { chipFor } from '../lib/keybindingOverrides'++/**+ * What the ⌘M face shows while the lazy `ChatPanel` chunk (it carries the markdown renderer) is+ * still loading — the `<Suspense>` fallback at BOTH of its mount sites, the canvas terminal node+ * and the kanban card modal.+ *+ * It used to be `fallback={null}`, which rendered nothing: the terminal stayed visible under a+ * face that had "opened", then the panel popped in over it — read as a blank or broken ⌘M. This+ * is the panel's own shell instead: the same `.term-chat` container (absolutely positioned over+ * the whole terminal, same z-index, same background — so it covers the terminal exactly where the+ * panel will, with no flash of the xterm underneath), the same bar, and a centred spinner with+ * "Loading conversation…" in the message area.+ *+ * Deliberately free of any transcript logic and of ChatPanel's props: it must stay tiny, because+ * it lives in the STARTUP chunk with the node that imports it — the whole point of the split.+ */+export function ChatPanelFallback({ hint }: { hint?: string }) {+ // Same bar text ChatPanel renders by default, so the swap is not a visible jump.+ const mdChip = chipFor('node.toggleMarkdown')+ return (+ <div className="term-chat nodrag nowheel">+ <div className="term-chat__bar">+ <span>Chat</span>+ <span className="term-chat__bar-end">+ <span className="term-chat__hint">{hint ?? (mdChip ? `${mdChip} to exit` : 'Exit')}</span>+ </span>+ </div>+ <div className="term-chat__msgs">+ <div className="term-chat__fallback-status" role="status" aria-live="polite">+ <Spinner />+ Loading conversation…+ </div>+ </div>+ </div>+ )+}diff --git a/src/renderer/nodes/TerminalMarkdownView.test.tsx b/src/renderer/nodes/TerminalMarkdownView.test.tsxindex b04142fe6..2ffc04ce1 100644--- a/src/renderer/nodes/TerminalMarkdownView.test.tsx+++ b/src/renderer/nodes/TerminalMarkdownView.test.tsx@@ -90,6 +90,33 @@ describe('TerminalMarkdownView', () => {expect(host.querySelector('.term-md__hint')?.textContent).toBe('⌘M to exit')})+ it('shows a spinner beside the initial "Capturing…", announced politely, gone once the output lands', async () => {+ mount()+ const status = content().querySelector('[role="status"]') as HTMLElement+ expect(status).toBeTruthy()+ expect(status.getAttribute('aria-live')).toBe('polite')+ expect(status.querySelector('.nt-spinner')).toBeTruthy()+ pending[0].resolve('done')+ await settle()+ expect(host.querySelector('.nt-spinner')).toBeNull()+ })++ it('shows a spinner beside the bar\'s refresh "Capturing…" status, gone once it settles', async () => {+ mount()+ pending[0].resolve('first')+ await settle()+ expect(host.querySelector('.nt-spinner')).toBeNull()+ act(() => refresh().click())+ const status = host.querySelector('.term-md__bar [role="status"]') as HTMLElement+ expect(status).toBeTruthy()+ expect(status.getAttribute('aria-live')).toBe('polite')+ expect(status.textContent).toContain('Capturing…')+ expect(status.querySelector('.nt-spinner')).toBeTruthy()+ pending[1].resolve('second')+ await settle()+ expect(host.querySelector('.nt-spinner')).toBeNull()+ })+it("says so when the capture is empty — '' is an answer, not a blank page", async () => {mount()pending[0].resolve('\n\n \n')diff --git a/src/renderer/nodes/TerminalMarkdownView.tsx b/src/renderer/nodes/TerminalMarkdownView.tsxindex 9006133e2..9d89b7f86 100644--- a/src/renderer/nodes/TerminalMarkdownView.tsx+++ b/src/renderer/nodes/TerminalMarkdownView.tsx@@ -1,6 +1,7 @@import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'import { IconReload } from '../components/icons'import { Tooltip } from '../components/Tooltip'+import { Spinner } from '../components/Spinner'/*** The ⌘M "output" face of a terminal: its captured scrollback rendered as readable markdown.@@ -106,7 +107,12 @@ export function TerminalMarkdownView({ nodeId, capture, hint }: TerminalMarkdown<span className="term-md__title">Markdown{capturing && view.kind !== 'loading' && (- <span className="term-md__status"> · Capturing…</span>+ // A refresh keeps the old output on screen, so this bar line is the only sign one is+ // running — hence the spinner. The status role sits on the text; the spinner is mute.+ <span className="term-md__status" role="status" aria-live="polite">+ {' · '}+ <Spinner /> Capturing…+ </span>)}{view.kind === 'ready' && view.dropped > 0 && (<span className="term-md__status">@@ -135,13 +141,18 @@ export function TerminalMarkdownView({ nodeId, capture, hint }: TerminalMarkdown<div ref={contentRef} className="term-md__content" dangerouslySetInnerHTML={{ __html: view.html }} />) : (<div className="term-md__content term-md__content--placeholder">- {view.kind === 'loading'- ? 'Capturing…'- : view.kind === 'empty'- ? 'Nothing captured from this terminal.'- : view.stage === 'render'- ? 'Could not render this terminal’s output.'- : 'Could not capture this terminal’s output.'}+ {view.kind === 'loading' ? (+ <span className="term-md__capturing" role="status" aria-live="polite">+ <Spinner />+ Capturing…+ </span>+ ) : view.kind === 'empty' ? (+ 'Nothing captured from this terminal.'+ ) : view.stage === 'render' ? (+ 'Could not render this terminal’s output.'+ ) : (+ 'Could not capture this terminal’s output.'+ )}</div>)}</div>diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 94144ea2b..f1c624ee5 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -23,10 +23,13 @@ import { Terminal } from '@xterm/xterm'import { FitAddon } from '@xterm/addon-fit'import { SearchAddon } from '@xterm/addon-search'import { WebglAddon } from '@xterm/addon-webgl'+import { ChatPanelFallback } from './ChatPanelFallback'// ChatPanel (the ⌘M transcript view) is code-split with the markdown renderer it uses: neither is// on the path to painting a terminal, and both were in the startup chunk purely by being imported-// here. `lazy` + a null fallback — the panel replaces the terminal body on a keypress, and a-// one-frame spinner in that slot reads as a glitch.+// here. The fallback is the panel's own shell (`ChatPanelFallback`: bar + spinner + "Loading+// conversation…"), NOT null: a null fallback was chosen on the theory that the chunk arrives in a+// frame, but in use the ⌘M face sat blank long enough to be reported as broken (2026-09-26). The+// shell has the panel's exact geometry, so a fast load still reads as the panel appearing.const ChatPanel = lazy(() => import('./ChatPanel').then((m) => ({ default: m.ChatPanel })))import { LocalTransport } from '../terminal/local-transport'import { clipboardImages, droppedPaths, pasteHasText, pastedFiles } from '../terminal/file-drop'@@ -6019,7 +6022,7 @@ export function TerminalNode({)}{mdMode &&(useChat ? (- <Suspense fallback={null}>+ <Suspense fallback={<ChatPanelFallback />}><ChatPanelnodeId={id}sessionId={status?.sessionId}diff --git a/src/renderer/styles.chat-view.test.ts b/src/renderer/styles.chat-view.test.tsnew file mode 100644index 000000000..b7b5335e2--- /dev/null+++ b/src/renderer/styles.chat-view.test.ts@@ -0,0 +1,56 @@+import { describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { join } from 'node:path'++// Same idiom as styles.kanban.test.ts: read the checked-in stylesheet (CRLF-normalized, comments+// stripped so a rule's own comment cannot satisfy — or break — the match) and pin the declarations+// a layout depends on.+const CSS = readFileSync(join(__dirname, 'styles.css'), 'utf8')+ .replace(/\r\n/g, '\n')+ .replace(/\/\*[\s\S]*?\*\//g, '')++/** The body of the FIRST rule whose selector is exactly `selector`. */+function ruleBody(selector: string): string {+ const esc = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')+ const m = CSS.match(new RegExp(`(?:^|\\n)${esc}\\s*{([^}]*)}`))+ expect(m, `rule not found: ${selector}`).toBeTruthy()+ return m![1]+}++describe('⌘M chat tool row layout (tool name rendered one letter per line)', () => {+ it('the summary row is a flex row — the reason the two children below must be sized explicitly', () => {+ expect(ruleBody('.term-chat__tool summary')).toMatch(/display:\s*flex;/)+ })++ it('never shrinks or wraps the tool NAME, however long the argument beside it', () => {+ const name = ruleBody('.term-chat__tool-name')+ expect(name).toMatch(/flex:\s*0 0 auto;/)+ expect(name).toMatch(/white-space:\s*nowrap;/)+ })++ it('lets the ARGUMENT shrink below its content width, so its own ellipsis does the truncating', () => {+ const arg = ruleBody('.term-chat__tool-arg')+ expect(arg).toMatch(/flex:\s*1 1 auto;/)+ expect(arg).toMatch(/min-width:\s*0;/)+ expect(arg).toMatch(/text-overflow:\s*ellipsis;/)+ expect(arg).toMatch(/white-space:\s*nowrap;/)+ })+})++describe('nt-spinner', () => {+ it('spins with a CSS keyframe (no dependency) that honours the app-wide animation pause', () => {+ const body = ruleBody('.nt-spinner')+ expect(body).toMatch(/animation:\s*nt-spinner-rotate\b[^;]*infinite;/)+ expect(body).toMatch(/animation-play-state:\s*var\(--nt-anim-state\);/)+ expect(CSS).toMatch(/@keyframes nt-spinner-rotate\s*{/)+ })++ it('is a STATIC indicator under prefers-reduced-motion — still visible, no rotation', () => {+ const blocks = [...CSS.matchAll(/@media \(prefers-reduced-motion: reduce\)\s*{([\s\S]*?)\n}/g)].map((m) => m[1])+ const mine = blocks.find((b) => /\.nt-spinner\s*{/.test(b))+ expect(mine, 'no reduced-motion rule for .nt-spinner').toBeTruthy()+ expect(mine).toMatch(/\.nt-spinner\s*{[^}]*animation:\s*none;/)+ // Not hidden: a frozen ring still says "working", an absent one says nothing.+ expect(mine).not.toMatch(/\.nt-spinner\s*{[^}]*(display:\s*none|visibility:\s*hidden|opacity:\s*0;)/)+ })+})diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 10e74316b..c87a10a89 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -3202,11 +3202,21 @@ body,cursor: pointer;list-style: none;}+/* The summary is a flex row, and a flex item's automatic minimum width is its min-content width.+ Before these two sizings, a long argument (a `Bash` command line) could not shrink below its+ unbroken nowrap text, so the row's overflow was taken out of the NAME instead — whose+ min-content is one character — and "Bash" rendered one letter per line. The name is fixed at its+ own width and never wraps; the argument takes the rest and is allowed (`min-width: 0`) to shrink+ below its content, so its own ellipsis does the truncating. */.term-chat__tool-name {+ flex: 0 0 auto;+ white-space: nowrap;font-weight: 600;color: var(--accent);}.term-chat__tool-arg {+ flex: 1 1 auto;+ min-width: 0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;@@ -3220,6 +3230,52 @@ body,font-size: 11px;opacity: 0.85;}+/* Shared loading spinner (`components/Spinner.tsx`). CSS-only: a ring with one transparent+ quarter, rotated. It inherits `currentColor` and scales with the surrounding font size, so the+ same element sits beside 11px bar text and 12px placeholder text without per-site sizing.+ `--nt-anim-state` is the app-wide pause every looping animation honours. */+.nt-spinner {+ display: inline-block;+ flex: 0 0 auto;+ box-sizing: border-box;+ width: 1em;+ height: 1em;+ border-radius: 50%;+ border: 2px solid currentColor;+ border-top-color: transparent;+ opacity: 0.7;+ vertical-align: -0.15em;+ animation: nt-spinner-rotate 0.8s linear infinite;+ animation-play-state: var(--nt-anim-state);+}+@keyframes nt-spinner-rotate {+ to {+ transform: rotate(360deg);+ }+}+/* Reduced motion: a STATIC indicator, not an absent one — the frozen ring (with its gap) plus the+ text beside it still says "working"; hiding it would make a slow load read as a blank panel. */+@media (prefers-reduced-motion: reduce) {+ .nt-spinner {+ animation: none;+ }+}++/* ⌘M chat panel shell shown while the lazy ChatPanel chunk loads (`nodes/ChatPanelFallback.tsx`). */+.term-chat__fallback-status {+ margin: auto;+ display: flex;+ align-items: center;+ gap: 8px;+ font-size: 12px;+ color: rgba(var(--tint-rgb), 0.45);+}+/* The ⌘M output view's initial "Capturing…" placeholder, spinner beside the text. */+.term-md__capturing {+ display: inline-flex;+ align-items: center;+ gap: 6px;+}.term-chat__compose {flex: 0 0 auto;padding: 8px;