feat(portless): register vnc-<box>.localhost alias for every box#9
Merged
Conversation
Mints a second Portless alias per box at create time alongside the existing `<box>.localhost` web alias, pointing at the noVNC port. Gives the user a stable, memorable URL for the VNC viewer instead of a random loopback port that re-rolls on every stop/start. Wired uniformly across docker, daytona, and hetzner — naturally no-ops on backends whose `previewUrl()` isn't loopback (Daytona), same as the existing web alias. Re-registers on `start` (host port can change) and drops both aliases on `destroy`. Reuses `portlessAlias` / `portlessUnalias` from `@agentbox/sandbox-docker` and `parseLoopbackPort` from `@agentbox/sandbox-cloud`; no new helpers beyond a small `registerHostPortlessAlias` extraction in the cloud provider. Adds `--kind <web|vnc>` to `agentbox url` and makes `agentbox screen` + `agentbox inspect` prefer the new URL.
c99ec63 to
fcafdc9
Compare
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
<box>.localhostweb alias:vnc-<box>.localhostpoints at the noVNC port (container 6080 on docker, the SSH-forwarded local port on Hetzner). Gives the user a stable URL for the noVNC viewer instead of a random ephemeral loopback port that re-rolls on every stop/start.previewUrl()isn't loopback (Daytona), mirroring the existing web alias. Re-registered onstart(host port reallocation) and dropped ondestroy.agentbox screenandagentbox inspectnow prefer the new URL on non-OrbStack engines;agentbox urlgrew a--kind <web|vnc>flag.Test plan
pnpm typecheckcleanpnpm test— all 515 tests green (5 new for the VNC URL preference matrix inendpoints.test.ts, 1 state round-trip case)agentbox create -y --portlessregisters both<box>.localhostandvnc-<box>.localhost(visible increate.log)curl https://vnc-<box>.localhost/vnc.html -kreturns 200 (noVNC loads)agentbox screen <box> --printreturns the Portless URL with?autoconnect=1&password=…agentbox url <box> --kind vnc --printreturnshttps://vnc-<box>.localhostagentbox stop && agentbox startre-registers after host port re-rolls; noVNC still serves 200agentbox destroy -yremoves both routes from~/.portless/routes.jsonagentbox prepare --provider hetzner; logic mirrors docker, gated on the same--portlessopt-in)parseLoopbackPortreturns undefined for Daytona's signed preview URL, same as today's web path)Note
Low Risk
Best-effort Portless registration with existing fallbacks; no auth or data-model breaking changes beyond new optional record fields.
Overview
Adds a second Portless alias per box —
vnc-<name>.localhost→ the noVNC port — alongside the existing web alias, persisted onBoxRecordasportlessVncAlias/portlessVncUrl. Docker registers it at create; cloud (Hetzner loopback previews) registers at create/start via a sharedregisterHostPortlessAliashelper; both aliases are re-pointed afterstartwhen host ports change and removed ondestroy.CLI / UX:
agentbox urlgains--kind web|vnc(with VNC guards).agentbox screenand DockergetBoxEndpointsnow prefer Portless → OrbStack → loopback for VNC on non-OrbStack engines (stable URL across restarts). CloudresolveUrlandlist/inspectsurfaces include Portless VNC when present.Tests: State round-trip and endpoint preference matrix for VNC Portless URLs.
Reviewed by Cursor Bugbot for commit c99ec63. Configure here.