Skip to content

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.

Merge remote-tracking branch 'refs/remotes/pr/1412' into carry/pr-1412

review8ab93a8fa0f0
diff --cc CLAUDE.md
index f7075f1e7,24f71dce2..61744fbb8
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -4636,20 -4594,17 +4636,31 @@@ command-bearing opens; this does not ad
terminal equivalent. Surfaces: Desktop + Server Edition identical (dictation and uploads already
bridge — `files.saveUpload`, `speech.*`); SSH nodes upload to the host; kanban card modal shares
ChatPanel and wires both props; relay tabs keep the panel's existing refusal; mobile N/A.
+ **Its height** (`lib/chatComposerHeight.ts`): the textarea grows with the draft until the whole
+ composer fills half the INNER space (top of `.term-chat__thread` to the bottom of the composer,
+ never the whole panel), or keeps the height the user dragged the grip on its top edge to
+ (localStorage, one value for every composer; double-click / Enter on the grip = auto again). The
+ `/` and `@` menu takes at most 240px, half the inner space and the room above the composer
+ (`completeMenuMax` → `--chat-complete-max`), so a tall box cannot push it under the panel header.
+ Heights are layout pixels: a drag divides by the canvas zoom.
+ **The draft is not component state** (`state/chatDraft.ts`): ChatPanel unmounts on every project
+ switch, and a `useState` draft was lost with it. It is keyed by node id (the canvas node and the
+ card modal share one draft) and persisted to localStorage (`nodeterm.chatDrafts`, machine-local),
+ so it survives a reload and a restart as the TUI's own input box does in tmux. Writes are
+ debounced, flushed on pagehide, and merge only this window's changes into the stored map (two
+ Server Edition tabs); bounded by age (30 days), count (50) and size (32,000 chars stays in memory
+ only). Pruned by age, not node existence: a closed project still holds its nodes.
+ **Shell mode is drawn as Claude Code's TUI draws it** (`lib/chatShellMode.ts`, claude and custom
+ agents built on it; MEASURED on 2.1.319): a draft starting with `!` — typed into an empty box or at
+ the start of existing text, the TUI's rule — shows its `!` in `--sys-pink` beside the textarea, not
+ in it, with a pink border and the TUI's own "! for shell mode" under the box; Backspace at the very
+ start leaves it. The DRAFT keeps the `!` (it is what the send types and what puts the TUI in shell
+ mode); only the display changes, and the completion/highlight stand down (the caret snapshot holds
+ the shown text, not the draft). The `!` slot is always rendered so the textarea is never remounted.
+ A `!` command in the THREAD (`nodes/ChatShellCommand.tsx`) is the TUI's `! cmd` with its output's
+ first line under a `⎿`, opening to the whole output: the reader keeps a bash-family output's lines
+ (`BASH_OUTPUT_MAX`, 16384) instead of `summarizeResult`, and gives a command that printed nothing
+ `result: ""` (chat-fixtures README rules 4-5).
Fix-round rules (same day): the composer is its OWN component (`nodes/ChatComposer.tsx`) so the
thread and the composer restyle independently. A label click is an explicit "go to the
terminal", so the flip FOCUSES the xterm whatever its entry state was
diff --cc src/renderer/nodes/ChatComposer.tsx
index 5c9da2128,3d02dc3b9..58fdd8f05
--- a/src/renderer/nodes/ChatComposer.tsx
+++ b/src/renderer/nodes/ChatComposer.tsx
@@@ -28,13 -27,7 +28,14 @@@ import { Spinner } from '../components/
import { builtinSlashCommands, sanitizeChatCatalog, type ChatCatalogEntry } from '@shared/chat-catalog'
import { prepareQuickOpenFiles, type QuickOpenIndexedFile } from '../lib/quickOpenSearch'
import { commandSegments, mentionsSlashToken } from '../lib/chatComposerHighlight'
+ import { SHELL_MODE_HINT, draftFromDisplay, isShellDraft, shellDisplayText, showsShellMode } from '../lib/chatShellMode'
+import {
+ KEYBOARD_STEP_PX,
+ completeMenuMax,
+ composerHeight,
+ readComposerHeight,
+ writeComposerHeight
+} from '../lib/chatComposerHeight'
import {
CATALOG_REUSE_MS,
applyCompletion,
@@@ -659,26 -557,14 +687,34 @@@ export function ChatComposer(
onDragLeave={onDragLeave}
onDrop={onDrop}
>
+ <div
+ className="term-chat__composer-grip"
+ role="separator"
+ aria-orientation="horizontal"
+ aria-label="Resize the message box"
+ title={
+ setHeight === null
+ ? 'Drag to resize the message box'
+ : 'Drag to resize the message box. Double-click to let it grow with your text again.'
+ }
+ tabIndex={0}
+ // Keep the caret in the textarea, and start no text selection.
+ onMouseDown={(e) => e.preventDefault()}
+ onPointerDown={onGripPointerDown}
+ onPointerMove={onGripPointerMove}
+ onPointerUp={onGripPointerEnd}
+ onPointerCancel={onGripPointerCancel}
+ onDoubleClick={() => resizeInput(null, true)}
+ onKeyDown={onGripKeyDown}
+ />
+ <div className="term-chat__composer-row">
+ {/* Always this slot, so the field after it keeps its position and the textarea is never
+ remounted (which would drop the keyboard) when shell mode starts or ends. */}
+ {shell && (
+ <span className="term-chat__shell-mark" aria-hidden="true">
+ !
+ </span>
+ )}
<div className="term-chat__composer-field">
{segments !== null && (
<div ref={highlightRef} className="term-chat__composer-highlight" aria-hidden="true">