mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 16:02:24 +00:00
Add a native (pure-Rust) SSH path for daemon panes, replacing shell-out `ssh` for managed connections. A russh shell channel is bridged into the existing pane byte pipeline so it is indistinguishable from a local PTY: the reader thread, 8 MiB replay ring, OutputGate backpressure, and OSC 7/133 sniffer are reused unchanged. Only the handle-owning methods (resize→window-change, kill→channel close, foreground pgid→None) dispatch on a new PaneBackend seam. Engine (`src/daemon/ssh/`): - Per-daemon tokio runtime owning all russh connections; the rest of the daemon stays std-threads and crosses in via blocking Read/Write adapters over bounded/unbounded channels (backpressure reaches the SSH window). - Connection registry keyed by host/port/user/proxy/jump chain with reuse (new tab = new channel, no re-auth) and documented blast-radius semantics. - Transports: direct TCP, ProxyCommand (%h/%p/%r substituted), SOCKS5, HTTP CONNECT, and jump host via direct-tcpip (multi-level chains). - Auth (Tabby-ordered): none-probe, publickey (multi-identity, %h/%r, .pub-misconfig skip, encrypted-key passphrase), agent, password, keyboard-interactive (zero-prompt quirk, password auto-fill). - known_hosts: plaintext + hashed (HMAC-SHA1) + @revoked + @cert-authority skip; append preserves the file. Self-contained SHA-1/HMAC/base64. - Interactive prompt broker: AuthPrompt/AuthResponse/SshStatus over the pane's connection; blocks auth with a 120s per-prompt timeout. Protocol (`daemon::protocol`): - New kinds: SPAWN_NATIVE_SSH(14), AUTH_RESPONSE(15) client->daemon; AUTH_PROMPT(13), SSH_STATUS(14) daemon->client. New kind so a pre-WS2 daemon rejects rather than mis-spawns. - NativeSshSpec wire type (redacted Debug + without_secrets), prompt/host-key enums, RemoteKind::NativeSsh. Session restore: `SessionPane::Leaf.ssh_spec` (secret-free) so a dead native pane can be respawned by WS6; live panes reattach for free. Docs: `docs/ssh-native-architecture.md` (protocol, broker flow, the connection-registry API WS4/WS5 use, and the forwards/X11/SFTP seams). Tests: known_hosts parse/check/append, spec serde + redacted Debug, ProxyCommand %h/%p substitution, blocking adapter EOF + backpressure, connection-key identity, prompt-broker delivery/cancel. Full suite green.