Suggestion: let terminal backends receive per-spawn parameters — unblocks out-of-tree SSH backends and persistent remote sessions #5672
cryptocurpays
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Title
Suggestion: let terminal backends receive per-spawn parameters — unblocks out-of-tree SSH backends and persistent remote sessionsShort version
TerminalSpawnRequestcarries onlytype/name/cwd. A backend outside theofficial tree (e.g. an SSH backend) needs a generic way to receive per-spawn data
— "which host should this session connect to?" — and currently has no clean
channel for it. I propose a small, backward-compatible, backend-agnostic
paramsfield.
Background
ctx.terminalsis the shared entry point for persistent PTY sessions. Communitybackends — which the project explicitly encourages via the ecosystem-plugin path —
currently have no way to pass backend-specific arguments through
ctx.terminals.spawn. An SSH backend can only smuggle the target throughcwdora process-local side-channel registry, both fragile (colliding under concurrent
spawns) and semantically wrong.
Proposed change (6 lines, additive, not SSH-specific)
arguments (e.g. a container-exec or remote-shell backend) can use the same
channel.
Why this matters in practice
I run a fleet of remote application servers (several machines, each hosting
multiple long-lived services) and regularly do cross-host operations — checking
logs, comparing service health, chasing issues across hosts. With an out-of-tree
bundle I maintain (
dsh-remote-tools,tagged
dsh-plugin), the workflow is:remote_search(discover hosts) →remote_open(open a persistent SSHsession) → repeated
remote_exec(sessionId)(reuse the session, zerore-authentication) →
remote_close.Compared to spawning a fresh
sshper command (each with its own TCP handshake +auth round trip), keeping the session alive is noticeably faster for both "many
commands against one host" and "the same check across many hosts", and it
preserves shell state (cwd, environment) across steps — which matters for
multi-step investigation flows.
The 6-line
paramschannel is the enabler: without it, the SSH backend cannotlearn which host a given spawn should target, so this whole pattern is blocked at
the seam.
Current state / ask
Since the repository does not currently accept external pull requests, I carry
these 6 lines as a local patch alongside the plugin (documented in the plugin
repo). If the direction seems reasonable, I'd welcome the team considering it —
implemented internally, or merged once external contributions open — so community
terminal backends (my SSH backend being the first) don't each have to maintain
their own patch.
Happy to provide any further detail (exact diff, plugin usage, more scenarios)
here.
All reactions