Local web dev previously required scraping a one-time, 5-minute
/pair#token URL from dev-runner stdout for every fresh browser context,
which made parallel-instance work and agent browser verification
painful. The web app now authenticates automatically against eligible
dev servers via a guarded dev-only endpoint.
Server: POST /api/auth/dev-pairing-token mints a one-time administrative
credential (subject dev-auto-bootstrap, hidden from pairing-link
listings) only when the server is web-mode, loopback-bound
(loopback-browser policy), and configured with a loopback dev URL.
Requests must carry an Origin exactly matching the dev origin (survives
the Vite proxy, unlike Host) and a loopback Host header (DNS-rebinding
defense). Ineligible configs answer an explicit 404 — the handler is
always mounted so the SPA/redirect wildcard can't shadow it.
Startup: eligible dev servers now open the plain dev URL instead of
minting a startup pairing credential the silent path would leave
unconsumed in the URL and scrollback.
Web: the auth-gate bootstrap silently tries the endpoint when
unauthenticated in dev (never in hosted/desktop contexts, never when an
explicit #token is present) and falls back to the pairing screen on any
failure. import.meta.env.DEV keeps the request out of prod bundles.
Extracted host parsing into netHost.ts (auth/http.ts importing the old
helper from http.ts would have been a module cycle; the old helper also
mishandled Host headers with ports).
Docs: AGENTS.md browser-verification section, dev-instance auth notes in
scripts.md (plus stale T3CODE_STATE_DIR fix), and a security spec in
environment-auth.md.
Co-Authored-By: Claude Fable 5 <[email protected]>