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
refactor(delivery): move the echo-verified command writer to @shared
review7315db9c0828
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 06638515b..c70dccb2e 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -134,7 +134,7 @@ import {cleanEcho,deliverCommand,type DeliveryIo-} from '../terminal/command-delivery'+} from '@shared/command-delivery'import { terminalKillLine } from '../terminal/terminal-kill-line'import {RESUME_MISS_WINDOW_MS,diff --git a/src/renderer/terminal/agent-restart.test.ts b/src/renderer/terminal/agent-restart.test.tsindex de2c7de2d..cfeb5ddb0 100644--- a/src/renderer/terminal/agent-restart.test.ts+++ b/src/renderer/terminal/agent-restart.test.ts@@ -1070,7 +1070,7 @@ describe('performRestartResume — the delivery await is bounded', () => {})afterEach(() => {vi.useRealTimers()- vi.doUnmock('./command-delivery')+ vi.doUnmock('@shared/command-delivery')vi.resetModules()})@@ -1080,7 +1080,7 @@ describe('performRestartResume — the delivery await is bounded', () => {// locked out by guardConcurrentRestart for the app's life and the bulk loop hung with no// summary. The transport is fixed in command-delivery.ts; this is the belt to that braces —// NOTHING may wait forever, whatever the delivery does.- vi.doMock('./command-delivery', () => ({+ vi.doMock('@shared/command-delivery', () => ({VERIFY_TIMEOUT_MS: 2000,DELIVERY_ATTEMPTS: 3,KILL_LINE: '\x15',diff --git a/src/renderer/terminal/agent-restart.ts b/src/renderer/terminal/agent-restart.tsindex 2db0830a3..dbf495a2d 100644--- a/src/renderer/terminal/agent-restart.ts+++ b/src/renderer/terminal/agent-restart.ts@@ -18,7 +18,7 @@ import {VERIFY_TIMEOUT_MS,deliverCommand,type DeliveryIo-} from './command-delivery'+} from '@shared/command-delivery'/** In-band exit command per agent CLI. Only agents listed here can be restarted in place —* an unknown CLI has no safe way to be asked to quit. One entry turns on both surfaces at once:diff --git a/src/renderer/terminal/launch-command.test.ts b/src/renderer/terminal/launch-command.test.tsindex 07354bbdc..661a159b1 100644--- a/src/renderer/terminal/launch-command.test.ts+++ b/src/renderer/terminal/launch-command.test.ts@@ -2,7 +2,7 @@ import { commitLaunchAttempt } from './launch-attempt'import type { PendingLaunch } from '@shared/types'import { afterEach, describe, expect, it, vi } from 'vitest'import { createLaunchWriter, deliverInitialLaunch, launchCommand, registerLaunchWriter, trustsFreshShell } from './launch-command'-import { KILL_LINE, WINDOWS_KILL_LINE, VERIFY_TIMEOUT_MS, DELIVERY_ATTEMPTS } from './command-delivery'+import { KILL_LINE, WINDOWS_KILL_LINE, VERIFY_TIMEOUT_MS, DELIVERY_ATTEMPTS } from '@shared/command-delivery'function fixture(attempted = false, killLine = KILL_LINE) {const cleanups: Array<() => void> = []diff --git a/src/renderer/terminal/launch-command.ts b/src/renderer/terminal/launch-command.tsindex 7ec00d914..55e4956b8 100644--- a/src/renderer/terminal/launch-command.ts+++ b/src/renderer/terminal/launch-command.ts@@ -1,6 +1,6 @@import type { LaunchClaim } from './launch-attempt'import type { PendingLaunch } from '@shared/types'-import { deliverCommand, type DeliveryIo, type DeliveryOutcome } from './command-delivery'+import { deliverCommand, type DeliveryIo, type DeliveryOutcome } from '@shared/command-delivery'// A writer belongs to the PTY lifetime (including a parked view), not a Canvas render.// A durable write-ahead claim distinguishes a never-attempted warm launch from an uncertaindiff --git a/src/renderer/terminal/relay-initial-launch.ts b/src/renderer/terminal/relay-initial-launch.tsindex c8a9e6209..3a814c99d 100644--- a/src/renderer/terminal/relay-initial-launch.ts+++ b/src/renderer/terminal/relay-initial-launch.ts@@ -1,6 +1,6 @@import type { PendingLaunch } from '@shared/types'import { createLaunchWriter } from './launch-command'-import type { DeliveryOutcome } from './command-delivery'+import type { DeliveryOutcome } from '@shared/command-delivery'// Transient proof is scoped to this connection, never restored from workspace data. Consume// before settle so a parked/remounted view cannot retry even if no bytes ultimately arrived.diff --git a/src/renderer/terminal/resume-fallback.test.ts b/src/renderer/terminal/resume-fallback.test.tsindex 76e609f6d..e4e58e847 100644--- a/src/renderer/terminal/resume-fallback.test.ts+++ b/src/renderer/terminal/resume-fallback.test.ts@@ -6,7 +6,7 @@ import {detectsResumeMiss,resumeSessionMissing} from './resume-fallback'-import { cleanEcho } from './command-delivery'+import { cleanEcho } from '@shared/command-delivery'const DEAD = '6c0e1b2a-1111-4222-8333-444455556666'/** Verbatim, from `claude --resume <unknown-uuid>` on claude 2.1.266 (exit 1). */diff --git a/src/renderer/terminal/command-delivery.test.ts b/src/shared/command-delivery.test.tssimilarity index 100%rename from src/renderer/terminal/command-delivery.test.tsrename to src/shared/command-delivery.test.tsdiff --git a/src/renderer/terminal/command-delivery.ts b/src/shared/command-delivery.tssimilarity index 97%rename from src/renderer/terminal/command-delivery.tsrename to src/shared/command-delivery.tsindex 2eb25c164..345379d34 100644--- a/src/renderer/terminal/command-delivery.ts+++ b/src/shared/command-delivery.ts@@ -8,14 +8,17 @@// fail-open, a terminal whose echo we can't recognize must never block the launch (that// worst case is exactly the pre-fix behavior).//+// Lives in @shared (not the renderer) because the headless launcher in core (#925) runs the same+// delivery with a core-side io — one writer, not two copies that drift.+//// The ONE exception to failing open is a line the tty could not physically have taken: a// canonical-mode buffer silently drops everything past its cap (1024 bytes on macOS), so an// over-cap command is truncated mid-quote and Enter would strand the shell at `quote>` with the// agent never launched (#706). That case is refused, not submitted — see `DeliveryOutcome` and// @shared/canonical-line.-import { fitsLaunchLine } from '@shared/canonical-line'-import { KILL_LINE, WINDOWS_KILL_LINE } from '@shared/shell-kill-line'+import { fitsLaunchLine } from './canonical-line'+import { KILL_LINE, WINDOWS_KILL_LINE } from './shell-kill-line'export const VERIFY_TIMEOUT_MS = 2000export const DELIVERY_ATTEMPTS = 3