Repository navigation
feat(client,link,proto): open a remote terminal without streaming the screen - #145
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
A remote terminal: when you only want to run command-line programs on the other computer (
claude,codex,pi, builds, logs…), open a terminal there instead of streaming the desktop. Nothing is captured or encoded, so it uses next to no bandwidth and the remote screen doesn't wake up.terminal_shellinconfig.tomlpicks another shell.airhand.exe --terminalas the user signed in on the console session (WTSQueryUserToken,CreateEnvironmentBlock), passing only two pipes (PROC_THREAD_ATTRIBUTE_HANDLE_LIST). The terminal runs in the helper, which talks to the host over its stdin / stdout. If nobody is signed in, no terminal can be opened.remote_terminalinconfig.toml). Turning it off refuses terminal sessions in the handshake and ends open terminals and terminal sessions right away. The tray marks controllers with a terminal "(terminal)". Disconnecting all controllers or changing the control code ends all terminals.caton a big file doesn't pile up in the relay / controller service / browser, and Ctrl+C works right away.terminalUnavailableproblem.Protocol
Still v10, no version bump. Host and controller must come from the same build, as before.
ControllerIntro::terminal(n(7)) marks a terminal session. The host refuses withRefusal::TerminalUnavailable(→Problem::TerminalUnavailable, final, no auto-reconnect) when it doesn't offer a terminal (Gate::terminal, off by default).airhand_proto::terminal:TermRequest/TermEvent, carried inControllerMsg::Terminal(n(14)) /HostMsg::Terminal(n(17)) on the control lane. Unknown variants are skipped viacbor::opt.tests/v10.rs.protocol.jsonandprotocol-contract.tsare regenerated with theterminal*commands; UI JSON usestermfor the terminal id, becauseidis the console's request id.Implementation
airhand-link::host::terminal:TermHost(all terminals, including ones kept after a drop) andSessionTerms(one session's terminals), with flow control, resume tokens and expiry. Platforms implementShells/PtyControl. Each terminal has three threads (read / write / wait).host::servehandlesRequest::Terminalitself, andPlatform::terminals()supplies theTermHost.host::Eitherlets the desktop pick a different platform part for terminal sessions.airhand-link::controller:Command::Terminal{Open,Input,Resize,Ack,Close}andSessionEvent::Terminal{Opened,Output,Exited,Failed}. Output is decoded to text, and a UTF-8 character split across messages waits for the rest.client/src-tauri/src/host/terminal/:conpty.rs(Windows),helper.rs(--terminal, service mode),unix.rs(openpty+ login shell; the reader polls so killing the terminal hangs up promptly), andTerminalSession(Helloonly).power::stay_up()adds a system-only power request / assertion.lib/terminal.ts(TerminalSession: connect / retry / pairing likeRemoteSession, xterm, acks, resume),components/TerminalView.tsx, andstore.Session = RemoteSession | TerminalSession. The grid and popouts only show desktop sessions.@xterm/xterm,addon-fit,addon-unicode11) loads lazily in its own chunk, so the main bundle doesn't grow.Testing
cargo test --workspace,client/src-tauricargo test --lib,npm test(138), and AndroidProtocolTest/MessagesTestall pass.cargo clippyandcargo fmt --checkare clean;host/session.rshas one formatting difference that was already there before this PR.host::terminal: echo / exit after output, ack window, resume by the same controller only, KEEP trimming, limits.conpty::tests::runs_a_shell), Unix PTY (run in WSL Ubuntu: shell + resize + exit code, hang-up on kill), config.tests/terminal.test.ts.e2e_terminal, run on Windows with a real relay: refused when turned off, then echo + ack + exit, and turning it off ends the session.exit 3overlay and restart, closing the tab ends the terminal on the hostpirenders correctly, and Ctrl+C interrupts a loop--terminalhelper protocol was tested by spawning it directly (resize, input, exit code 5).CreateProcessAsUseras the user) needs an installed service. macOS was only compile-checked (aarch64-apple-darwin).