feat(ssh): support file transfers over system ssh (#7804)

* feat(ssh): support file transfers over system ssh

* fix(ssh): harden system file transfers

* test(runtime): stub getRepo in headless mobile tab cwd test

The mobile-session selector validator (getValidatedExplicitWorktreeIdSelector,
from main) calls this.store?.getRepo to reject repo ids passed as worktree ids.
The store stub only implemented getWorkspaceSession, so the guarded call threw
'getRepo is not a function' once main merged into this branch. Add a getRepo
that returns null (wt-1 is a worktree, not a repo).

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
gatsby74
2026-07-12 01:29:55 -07:00
committed by GitHub
co-authored by Orca Jinjing
parent 3472acfb22
commit c2aa9c2ead
16 changed files with 1092 additions and 312 deletions
+8 -2
View File
@@ -90,7 +90,9 @@ function wrapChildProcess(proc: ChildProcess): SystemSshProcess {
function wrapCommandProcess(proc: ChildProcess): SystemSshCommandChannel {
const duplex = new Duplex({
read() {},
read() {
proc.stdout?.resume()
},
write(chunk, encoding, cb) {
proc.stdin!.write(chunk, encoding, cb)
}
@@ -128,7 +130,11 @@ function wrapCommandProcess(proc: ChildProcess): SystemSshCommandChannel {
duplex.destroy(err)
}
const onStdoutData = (data: Buffer): void => {
duplex.push(data)
// Why: file downloads can outpace the local destination; pause OpenSSH
// instead of buffering the producer-consumer lag in the main process.
if (!duplex.push(data)) {
proc.stdout!.pause()
}
}
const onStdoutEnd = (): void => {
duplex.push(null)