Skip to content

Hosts

A host is the machine a repository lives on. Resource access only uses the Host interface (src/access/hosts/host.ts): run a command, read, write, move and delete files.

HostImplementation
LocalLocalHost — the platform’s file system and processes
WSLShellHost over wsl.exe -d <distro> -e sh
SSHShellHost over ssh -T -o BatchMode=yes <host> sh

Each host also says how to start an interactive shell in a repository (terminalCommand, built in src/access/hosts/terminal-commands.ts). The shell runs on a pseudo-terminal of this machine:

HostCommand
LocalThe user’s shell in the repository folder: pwsh.exe -NoLogo, powershell.exe -NoLogo or COMSPEC on Windows, $SHELL -l or /bin/sh -l elsewhere
WSLwsl.exe -d <distro> --cd <path>
SSHssh -t -- <host> with the remote command cd '<path>' && exec "$SHELL" -l, the path quoted for sh

Unlike the backend’s own connection, the terminal’s ssh runs without BatchMode, so the user can answer password and host key prompts.

WSL and SSH share one implementation. ShellSession keeps a single sh running on the target and sends each request as a subshell script. Output goes to temporary files and comes back with a length-prefixed header, so binary content is safe and one connection serves all requests.

sh on the remoteShellSessionGit accesssh on the remoteShellSessionGit accessrun git status( cd repo && exec git status … ) >"$T/o" 2>"$T/e"GDK 0 512 0512 bytes of stdout{ code: 0, stdout, stderr }
sh on the remoteShellSessionGit accesssh on the remoteShellSessionGit accessrun git status( cd repo && exec git status … ) >"$T/o" 2>"$T/e"GDK 0 512 0512 bytes of stdout{ code: 0, stdout, stderr }

File content is written with printf and octal escapes, which only needs a POSIX shell — no extra tools on the remote. Requirements on the remote: sh, git, and the usual cat, wc, mktemp, mkdir, mv, rm.

RemoteFolders (src/access/hosts/remote-folders.ts) lists a folder on WSL or SSH in one request: a single sh script enters the folder, prints pwd -P, and loops over * and .*, keeping entries for which [ -d ] holds (so linked folders count) and marking those with a .git entry. Records end with NUL, so any file name survives. The session of the machine last browsed stays open between listings; browsing another machine, a minute without listings, or closing the backend ends it.