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 main

enesd4be728140fb
diff --cc src/renderer/nodes/TerminalNode.tsx
index 577747186,ba442db6a..1be7b8595
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@@ -1782,22 -1699,18 +1787,32 @@@ export function TerminalNode(
persistKey: id,
agentId: data.agentId,
accountId: data.accountId,
- sshRemote
+ sshRemote,
+ // Belt AND braces: the guard above cannot see a `ssh` executable that has gone missing,
+ // which is core's other route into the local branch.
+ requireRemote: sshRemoteTmux
})
- .then(async ({ sessionId: sid, fresh, accountFallback: fellBack, closed, screen, coAttachMouse, unavailable }) => {
+ .then(
+ async ({
+ sessionId: sid,
+ fresh,
+ accountFallback: fellBack,
+ closed,
+ screen,
+ cursor,
- coAttachMouse
++ coAttachMouse,
++ unavailable
+ }) => {
+ // REFUSED: `requireRemote` and core could not spawn remotely (the master died inside our
+ // round-trip, or `ssh` is missing). Nothing was spawned — land in the same offline state
+ // the near-side guard above produces, retry included.
+ if (unavailable) {
+ setCo(termKey, { offline: true })
+ if (!disposed)
+ term.write('\r\n\x1b[90m[not connected — nothing was started locally]\x1b[0m\r\n')
+ if (sshProjectId) reportSshDrop(sshProjectId, id)
+ return
+ }
// REFUSED: core's tombstone says another client deleted this node while we weren't
// subscribed (our project was closed/inactive, so no `pty:closed` could reach us). Nothing
// was spawned — land in the same "closed by <name>" state a subscribed co-viewer gets.
diff --cc src/shared/types.ts
index 94b175afc,3cad58a56..a0cf9ac4a
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@@ -39,22 -39,16 +39,30 @@@ export interface PtyCreateOptions
* `remoteHome` is the connection's resolved `$HOME`, used to build an ABSOLUTE remote
* `CLAUDE_CONFIG_DIR` for a managed remote account (tmux `-e` values are not shell-expanded). */
sshRemote?: { controlPath: string; conn: import('./ssh').SshConnection; remoteCwd: string; hookEndpointPath?: string; tmuxConfPath?: string; remoteHome?: string }
+ /**
+ * This node BELONGS to a remote host: never spawn it locally.
+ *
+ * `sshRemote` says "here is the master to run over"; this says "and if there isn't one, spawn
+ * NOTHING". Without it, a create with no `sshRemote` falls straight through to the local
+ * tmux/plain-shell branches — which is how an SSH project's terminal, opened while the
+ * ControlMaster was down (no network, laptop asleep, host unreachable), quietly became a LOCAL
+ * shell in the local `$HOME`: same node id, same `SSH user@host` header chip, the remote
+ * session's own scrollback snapshot replayed into it, and — for an agent node — a cold-restore
+ * `claude --resume <remote session id>` running on the WRONG MACHINE, under the local account.
+ * The refusal (`PtyCreateResult.unavailable`) is the honest answer: the node shows a
+ * "not connected" overlay and re-spawns when the master is back.
+ */
+ requireRemote?: boolean
}
+ /** A tmux pane's cursor, as tmux reports it: 0-based column/row within the pane, plus whether the
+ * application currently wants it shown (`#{cursor_flag}`). */
+ export interface PaneCursor {
+ x: number
+ y: number
+ visible: boolean
+ }
+
/**
* Result of creating a PTY session. `fresh` distinguishes a tmux session that had to be
* created anew (cold start — e.g. after a machine reboot killed the tmux server) from a