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
feat(ssh): ask the host which nodeterm tmux sessions it runs
enesdab422982df0
diff --git a/src/core/remote-ssh/control-master.test.ts b/src/core/remote-ssh/control-master.test.tsindex 2e2229566..e65353e9b 100644--- a/src/core/remote-ssh/control-master.test.ts+++ b/src/core/remote-ssh/control-master.test.ts@@ -9,6 +9,8 @@ import {probeSaysAbsent,remoteCapturePaneArgs,remotePaneCommandArgs,+ remoteListSessionsArgs,+ parseRemoteSessionNames,remoteTmuxPtyArgs,listDirArgs,mkDirArgs,@@ -197,6 +199,33 @@ describe('remotePaneCommandArgs', () => {})})+describe('remoteListSessionsArgs', () => {+ it('asks the remote nodeterm tmux socket for session names only', () => {+ const args = remoteListSessionsArgs(conn, '/cm/p1')+ const cmd = args[args.length - 1]+ expect(cmd).toContain('tmux -L nodeterm-rmt list-sessions')+ expect(cmd).toContain('#{session_name}')+ })++ it('routes over the given control path', () => {+ expect(remoteListSessionsArgs(conn, '/cm/p1').join(' ')).toContain('/cm/p1')+ })+})++describe('parseRemoteSessionNames', () => {+ it('returns one entry per non-empty line, trimmed', () => {+ expect(parseRemoteSessionNames('nt-a\nnt-b\n')).toEqual(['nt-a', 'nt-b'])+ })++ it('ignores blank lines and surrounding whitespace', () => {+ expect(parseRemoteSessionNames('\n nt-a \n\n')).toEqual(['nt-a'])+ })++ it('is empty for empty output — a host with no sessions is an answer, not a failure', () => {+ expect(parseRemoteSessionNames('')).toEqual([])+ })+})+describe('remoteTmuxPtyArgs', () => {it('runs the remote tmux command as a forced-TTY child (-t then childArgs)', () => {const args = remoteTmuxPtyArgs(conn, '/s.sock', 'nt-x', '/srv/app')diff --git a/src/core/remote-ssh/control-master.ts b/src/core/remote-ssh/control-master.tsindex 1ae7c2385..ec730a3bb 100644--- a/src/core/remote-ssh/control-master.ts+++ b/src/core/remote-ssh/control-master.ts@@ -182,6 +182,32 @@ export function exitMasterArgs(conn: SshConnection, controlPath: string): stringexport function remoteTmuxHasSessionArgs(conn: SshConnection, controlPath: string, sessionId: string): string[] {return childArgs(conn, controlPath, `tmux -L ${RMT_TMUX_SOCKET} has-session -t ${sessionId}`)}+/**+ * Every nodeterm tmux session on the host, by name.+ *+ * The host's own session list is the DURABLE record of which nodes run there. Our live pty map is+ * not: `PtyManager.kill()` forgets a session on detach, so a backgrounded project's nodes vanish+ * from it entirely — which is exactly the state the reconnect resync runs in. `list-sessions`+ * exits non-zero when no server is running; the caller reads that as "no sessions", not an error.+ * The format is single-quoted so `#{…}` reaches the remote tmux verbatim rather than being eaten+ * by the remote shell (same idiom as `remotePaneCommandArgs`).+ */+export function remoteListSessionsArgs(conn: SshConnection, controlPath: string): string[] {+ return childArgs(+ conn,+ controlPath,+ `tmux -L ${RMT_TMUX_SOCKET} list-sessions -F '#{session_name}'`+ )+}++/** One session name per non-empty line. */+export function parseRemoteSessionNames(stdout: string): string[] {+ return stdout+ .split('\n')+ .map((line) => line.trim())+ .filter((line) => line.length > 0)+}+/*** Send literal text (and optionally Enter) into a node's REMOTE tmux session — the remote* counterpart of `PtyManager.sendText`'s local `tmux send-keys` path (dictation insert, /rename,