Repository navigation
hqsh 0.1.0: the daemon, the client and resume, for real - #1
Merged
Merged
Conversation
- server: PTY daemon ($SHELL -l via creack/pty) with a 4 MiB resume ring,
one attached client (newer takes over), HELLO/WELCOME with replay and the
gap flag (redraw nudge), INPUT/RESIZE/ACK/PING, EXIT with the shell's
status; attach starts the daemon detached (setsid) when absent; a lock
keeps one daemon per session; the socket comes back if its dir is removed
- server list [--json]: live sessions as [{"name","attached"}], stale
sockets removed (new local-only STATUS frame)
- proto: HELLO carries the client's TERM after a 0 byte (old HELLOs still
decode); WELCOME/ACK/EXIT helpers
- client: raw mode after the first WELCOME, Ctrl-^ . detach, Ctrl-^ Ctrl-^
literal, SIGWINCH resize (polling on Windows), ping/15 s watchdog,
reconnect with backoff and the status in the window title, gap clears the
screen, exit status passed through; falls back to ~/.local/bin/hqsh and
says how to install hqsh when the host has none
- tests: HELLO TERM, list output, and real-shell integration tests over
pipes (resume without loss or duplicates, takeover, exit; the real
client reconnecting)
- release workflow: raw binaries for linux/darwin amd64+arm64 and
windows/amd64 plus SHA256SUMS on v* tags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
Turns the 0.0.1 stub into a working hqsh:
hqsh dev2gives a persistent shell that survives disconnects and passes the raw byte stream (Kitty / iTerm2 image escapes included).What's in it
hqsh server daemon):$SHELL -lin a PTY, 4 MiB resume ring, one attached client (a newer one takes over), HELLO → WELCOME + replay with the gap flag (and a resize nudge so the screen redraws), INPUT / RESIZE / ACK / PING, EXIT with the shell's status. A lock file allows one daemon per session, and the socket is recreated if its dir is removed.hqsh server attach): bridges ssh stdio to the socket. If no daemon is running it starts one (setsid, /dev/null stdio) and waits up to 3 s for the socket.hqsh server list [--json]: prints[{"name":"main","attached":true}]and removes stale sockets. This uses a new local-only STATUS frame.Ctrl-^ .detaches andCtrl-^ Ctrl-^sends a literal Ctrl-^. Resizes come from SIGWINCH (polled on Windows). A ping and a 15 s watchdog trigger reconnects with backoff, and the reconnect status goes only in the window title. A gap clears the screen. The client exits with the shell's status. If the host has nohqshon its PATH, the client tries~/.local/bin/hqsh, and if that also fails it prints thecurl -fsSL https://hqterm.sh/install | shhint.v*tag it builds rawhqsh-<os>-<arch>binaries for linux/darwin amd64 and arm64, plus windows/amd64.exe, and aSHA256SUMSfile.Tests
/bin/shand a real daemon process, over pipes and without ssh. They cover:echo hi, disconnect, output produced while detached, reconnect with lastSeq (replay is contiguous and has no duplicates), takeover, andexit 3→ EXIT 3 with the socket removed. The real client is also tested reconnecting after its transport dies.ssh localhost, inside a real PTY:Ctrl-^ .detached, and list showed the session detached;exit 5made the client exit 5, and list then showed[].🤖 Generated with Claude Code