feat(serve): node name, LAN IP hints, and token URL auto-login#86
Merged
Conversation
Make remote `hk serve` usable across multiple nodes: - Node identity: `hk serve --name <label>` (defaults to hostname) is exposed via a new `GET /api/server_info` endpoint and shown in the web sidebar and browser tab title, so tabs pointing at different remote nodes are distinguishable. - LAN access: when bound to 0.0.0.0, print the machine's actual LAN IPs instead of the unreachable 0.0.0.0 address. - Token auto-login: embed the access token in the printed URL (`?token=β¦`); the frontend consumes it on load, stores it, then strips it from the address bar via replaceState. Mirrors Jupyter's flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Improves the
hk serveweb-mode experience when working with remote or multiple nodes.hk serve --name <label>(defaults to the machine hostname), exposed via a newGET /api/server_infoand shown in the sidebar and the browser tab title. When several browser tabs each point at a different machine, you can tell them apart at a glance.0.0.0.0, print the machine's actual LAN IP(s) instead of the unreachable0.0.0.0address.?token=β¦); the frontend reads it on load, stores it, then strips it from the address bar viareplaceState(the same pattern Jupyter uses). Previously a non-localhost bind required a token but the web UI had no way to supply one.Relates to #39
#39 raises the cross-device case: managing agents on several machines means juggling browser tabs and wanting an "ζε±δΈ»ζΊ" (host) label to know which machine is which. This adds that per-node label (sidebar + tab title) so multiple tabs are easy to distinguish. The broader aggregation dashboard and cross-host deploy from #39 are out of scope here.
Testing
server_infoendpoint test; fullhk-websuite green.consumeUrlToken(store + strip + preserve other params);tscandbiomeclean.--host 0.0.0.0prints real LAN IPs + a?token=URL; opening it auto-logs-in and the token disappears from the address bar; sidebar and tab title show the node name; clearing the token yields 401s.π€ Generated with Claude Code