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 origin/main into fix/adopt-legacy-rmt-sessions

review262b06b1f941
diff --cc src/core/pane-input.test.ts
index df329749b,0c562df4f..0c1004d71
--- a/src/core/pane-input.test.ts
+++ b/src/core/pane-input.test.ts
@@@ -13,8 -13,8 +13,8 @@@ import
remoteKeysArgs,
remotePasteArgs
} from './pane-input'
- import { SESSION_SOCKET_REF, sessionSocketProbe } from '../remote-ssh/control-master'
- import { remoteTmuxPathPrologue } from '../../shared/ssh'
-import { RMT_TMUX_SOCKET } from './remote-ssh/control-master'
++import { SESSION_SOCKET_REF, sessionSocketProbe } from './remote-ssh/control-master'
+ import { remoteTmuxPathPrologue } from '../shared/ssh'
const CONN = { host: 'h.example.com', user: 'deploy', port: 2222, identityFile: '/k/id' }
const CM = '/cm/p1'
diff --cc src/core/pane-input.ts
index 96525a59b,05eaae2ad..6bba8369f
--- a/src/core/pane-input.ts
+++ b/src/core/pane-input.ts
@@@ -82,35 -83,13 +83,13 @@@ import
localTmuxDeleteBufferArgs,
pasteBufferName,
type PasteDelivery
- } from '../tmux-naming'
- import { SESSION_SOCKET_REF, childArgs, remoteDeleteBufferArgs, sessionTmuxCmd } from '../remote-ssh/control-master'
+ } from './tmux-naming'
-import { RMT_TMUX_SOCKET, childArgs, remoteDeleteBufferArgs, tmuxCmd } from './remote-ssh/control-master'
++import { SESSION_SOCKET_REF, childArgs, remoteDeleteBufferArgs, sessionTmuxCmd } from './remote-ssh/control-master'
- /** One unit of a controller's input. `keys` are typed byte for byte; `paste` is text tmux frames
- * per the pane's own bracketed-paste state. */
+ /** One unit of pane input. `keys` are typed byte for byte; `paste` is text tmux frames per the
+ * pane's own bracketed-paste state. */
export type ControlInputChunk = { kind: 'keys'; data: string } | { kind: 'paste'; text: string }
- /**
- * How a controller's input reaches a session's pane (`PtyManager.watcherInputRoute`):
- * - `tmux` — the local tmux, by the plans in this file;
- * - `ssh` — the same plans on the host, over the project's ControlMaster;
- * - `write` — PtyManager's ordinary write path (the Windows session host, a direct Windows pane,
- * the plain-shell fallback: there is no tmux client in between to reach a key table);
- * - `none` — refused (Zellij: its key bindings are session-wide; an unknown session).
- */
- export type WatcherInputRoute = 'tmux' | 'ssh' | 'write' | 'none'
- /** Every route, for a reader that must check one it did not produce (link-host.ts `normalizeJoin`). */
- export const WATCHER_INPUT_ROUTES = ['tmux', 'ssh', 'write', 'none'] as const satisfies readonly WatcherInputRoute[]
-
- /**
- * How long one chunk of a controller's input may take, from the moment it is HANDED OVER: the link
- * host gives up on it then (INPUT_DELIVERY_TIMEOUT_MS is this value) and tells its controller it was
- * dropped, and `PtyManager.controlInput` answers false at the same instant — a chunk that waited
- * behind a slow one gets only what is left — and moves the session's chain on. So a delivery that
- * never answers cannot hold every later chunk behind it, and a chunk with nothing left when its turn
- * comes is never delivered at all.
- */
- export const PANE_INPUT_DEADLINE_MS = 20_000
-
/** Bytes per `send-keys -H` line: 3 characters each on the line, so ~3 KiB a line. */
export const KEYS_PER_COMMAND = 1024
diff --cc src/core/remote-ssh/control-master.ts
index 12c358fb4,f1ac0ab1e..c20684dbf
--- a/src/core/remote-ssh/control-master.ts
+++ b/src/core/remote-ssh/control-master.ts
@@@ -674,49 -589,10 +673,11 @@@ export function remoteCaptureVisibleArg
return childArgs(
conn,
controlPath,
- tmuxCmd(
- `tmux -L ${RMT_TMUX_SOCKET} capture-pane -p -e -t ${target} ';' ` +
+ sessionTmuxCmd(
+ sessionId,
+ `tmux -L ${SESSION_SOCKET_REF} capture-pane -p -e -t ${target} ';' ` +
`display-message -p -t ${target} ${posixQuote(VISIBLE_CAPTURE_FORMAT)}`
)
- )
- }
- /**
- * A live link watcher's OWN client on the host, for a node no Session is held for: a tty-allocating
- * ssh child (`-t`, like `remoteTmuxPtyArgs`) running `attach-session -E -f ignore-size,read-only` on
- * the exact target — never creating, never touching the session env, and out of the window's sizing
- * while an unflagged client is attached anywhere on the server (tmux honours `ignore-size` only then;
- * the caller spawns it at the window's current size and keeps it synced — `watch-link/watcher-client.ts`). Deliberately NOT wrapped like the owner's
- * interactive command: a host without tmux gets a failed command, never a plain login shell — a
- * watcher must not get a shell. An old remote tmux (< 3.2) rejects `-f` with a usage error: the
- * command fails and nothing attaches. Proven under a real /bin/sh in watcher-attach.realsh.test.ts
- * and on a real tty in watcher-client.realtty.test.ts.
- */
- export function remoteTmuxWatcherArgs(conn: SshConnection, controlPath: string, sessionId: string): string[] {
- return [
- '-t',
- ...childArgs(
- conn,
- controlPath,
- sessionTmuxCmd(
- sessionId,
- `tmux -L ${SESSION_SOCKET_REF} attach-session -E -f ${posixQuote(WATCHER_CLIENT_FLAGS)} ` +
- `-t ${posixQuote(capturePaneTarget(sessionId))}`
- )
- )
- ]
- }
-
- /** The REMOTE window size of exactly this session, so a watcher's client is spawned at it. */
- export function remoteWindowSizeArgs(conn: SshConnection, controlPath: string, sessionId: string): string[] {
- return childArgs(
- conn,
- controlPath,
- sessionTmuxCmd(
- sessionId,
- `tmux -L ${SESSION_SOCKET_REF} display-message -p -t ${posixQuote(capturePaneTarget(sessionId))} ` +
- posixQuote(WINDOW_SIZE_FORMAT)
- )
)
}
/**