Repository navigation
hqsh 0.2.0: shared attach, like tmux (--steal, --read-only) - #2
Merged
Merged
Conversation
Several clients can now attach to one session at once. Every client gets all output and any client can type; the PTY is the smallest cols and rows among them. --steal (-d) detaches the others (they get the new DETACHED frame and exit instead of reconnecting); --read-only (-r) watches only. - HELLO carries an optional flags byte after a second 0 byte; with no flags the HELLO is byte for byte the 0.1 one. WELCOME bit1 marks a shared-attach daemon. STATUS adds a client count; server list --json keeps "attached" and adds "clients". - Each client has its own writer and its own cursor into the shared ring, so a slow client never stalls the PTY or the others. The PTY is paced to the most caught-up client (2 MiB window), so a single slow client still gets plain backpressure as in 0.1; a client that falls off the ring or cannot take a frame for 5 s is dropped and resumes via the gap path. - ACK trims the ring only to the lowest ACK across attached clients. - Release workflow: one run per tag (concurrency), after v0.1.0 got two racing runs. CI: go test -race on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Several clients can attach to one session at once, tmux style.
Behaviour
--steal/-d(tmux attach -d): the others get a newDETACHEDframe (type 11) and exit with "detached by another client" instead of reconnecting. Sent on the first connection only; reconnects never steal.--read-only/-r: the daemon ignores this client's INPUT (and the client does not send keys).Ctrl-^ .still detaches.server list --json: keepsattached(bool), addsclients(count). Text:attached (N clients)when N > 1.Wire compatibility
Tests
minSize,minAck, ACK-min trim against the ring,mustWaitpacing, ringBehind/First, HELLO flags and STATUS encodings.stty sizefollows the min rule through resize and detach; read-only input is ignored;--stealsends DETACHED and drops the others; a stalled client is dropped while the other receives all 6 MB contiguous; a realclient.Runpair plus a stealer (the stolen ones exit 0 with one dial each).ssh localhost: 2 clients + a read-only one + a stealer; a 0.2 client on a running 0.1 daemon; a 0.1 client alongside a 0.2 client on a 0.2 daemon.Also
concurrencygroup per tag. v0.1.0 got two push events for one tag 2 s apart (the workflow has a single trigger), so two runs raced to create the release.go test -raceon Linux.🤖 Generated with Claude Code