Skip to content

local website

Hanwen Cheng edited this page Nov 29, 2026 · 14 revisions

The console uses one server-provided backend configuration. The browser client and gateway client consume the same selected backend and origin. Reusing a built website with another local broker does not require rebuilding its JavaScript.

Prepare and start

Local, from the public repository root, after installing the pinned Rust toolchain, its WASM target and wasm-pack:

npm ci --ignore-scripts
python3 scripts/build-browser-core.py
npm --prefix apps/parent-control run build

After preparing the local service binaries, local from the public repository root:

./terrier stack start --website
./terrier stack status

The website URL appears under services.services.website.url. An optional --web-port with --website selects the port on the first start. Otherwise a free loopback port is chosen and persisted in the existing service manifest. Later starts and restarts retain that origin because browser storage belongs to it. A changed port is refused; use separate state for another website port. Stop the service group before enabling the website on an already-running stack. The terminal manager uses the same saved configuration.

New website configurations use http://localhost:<port> while the server listens only on IPv4 loopback. Browser passkey relying-party IDs must be domain names; localhost is the supported local HTTP exception (Chrome RP ID guidance, Chromium origins). The local browser setup flow creates a public request and requires CLI approval against that origin, followed by browser passkey sign-in. That handoff and the listed application journeys have virtual-authenticator acceptance; physical passkeys and unlisted workflows remain unqualified.

Existing configurations that recorded only a port retain their original http://127.0.0.1:<port> origin. Changing the host is explicit and requires stopped services. Local, from the same public checkout and selected state directory:

./terrier stack stop
./terrier stack start --website --web-host localhost

The port, chain, owner keys and application data are retained. Browser storage stays with its original origin, and passkeys remain scoped to their original relying-party ID. They are not transferred; the new origin needs its own browser setup. --web-host accepts only localhost and 127.0.0.1, requires --website, and is also available to services start. A running service group refuses an origin change without changing its saved configuration. Later starts without that flag preserve the explicit selection. Broker, signer and worker access is rebuilt for the selected exact origin; the old origin is not kept as an implicit alias. The local signer reuses its shared CORS layer and still requires a valid actor-bound session before signing. Without website configuration it permits no browser origin.

The existing service supervisor owns the website process group, private logs and isolated home. It starts the prepared Next server with the active broker origin and permits exactly the website origin on the broker, signer, storage workers and classifier. It never builds or installs dependencies implicitly and refuses .env* files in the application or repository root. A port owned by another process is left untouched; partial startup cleans up only owned children. No second supervisor, backend-address resolver or Docker controller is added.

status and doctor check a bounded, uncached website health response against the current instance and selected backend. This proves website delivery and configuration, not authenticated browser readiness. The protected local audit archive is configured by the supervisor; physical authenticator acceptance remains open; the local classifier is supervised and qualified separately. stack stop and restart include the website and preserve data. The signer and browser-facing workers retain their saved loopback ports, so a still-open browser keeps reaching the same services when retrying a pending metadata save. Check confirmation refreshes the existing signed operation through the broker receipt route before retrying metadata, so the broker can restore its runtime after restart. It never resubmits that operation. A failed recovery stays pending; metadata is not reported complete. Stopping an older running service group first records its current ports; an already-stopped older group receives ports once on migration. Occupied saved ports cause startup to fail without selecting replacements or stopping the unrelated listener. Reloading or signing out still discards in-memory pending transactions; keep the tab open until they finish. Private diagnostics are included in services logs and stack logs.

Standalone website process

Local, in apps/parent-control inside that same checkout, set AGENT_TERRIER_WEB_BROKER_URL to the broker URL reported by terrier services status and choose AGENT_TERRIER_WEB_PORT:

AGENT_TERRIER_WEB_BACKEND=core \
  AGENT_TERRIER_WEB_BROKER_URL="${AGENT_TERRIER_WEB_BROKER_URL:?Set the local broker origin}" \
  npx --no-install next start --hostname 127.0.0.1 \
  --port "${AGENT_TERRIER_WEB_PORT:?Choose the local website port}"

This starts the website only. The broker and workers must separately permit the exact website origin for cross-origin browser requests. The managed startup above owns that wiring. Browser enrollment uses the managed flow above. Complete auxiliary-service integration remains open; successful HTML delivery is not an authenticated application acceptance result.

Configuration ownership

lib/backendConfiguration.ts owns the public shape, validation and default native endpoint. The server reads these settings for each dynamically rendered page:

Setting Meaning
AGENT_TERRIER_WEB_BACKEND core for the browser client, daemon for an existing native client, or empty; default daemon
AGENT_TERRIER_WEB_BROKER_URL Required origin for core
AGENT_TERRIER_WEB_DAEMON_URL Optional native origin; default is the shared DEFAULT_DAEMON_URL constant

Only the selected kind and public origin are serialized into the page. No key, token, environment inventory or service credential belongs in this configuration. URLs must be HTTPS or loopback HTTP origins without user information, paths, queries or fragments. Unknown backends, invalid configuration and unexpected fields fail. An absent or invalid page configuration cannot make the gateway silently contact a local daemon.

The former NEXT_PUBLIC_AGENTKEYS_BACKEND, NEXT_PUBLIC_AGENTKEYS_BROKER_URL and NEXT_PUBLIC_AGENTKEYS_DAEMON_URL settings are refused with migration guidance. Remove them and use the server settings above. The console needs its Node server; the old static-export switch is refused. Next.js runtime environment guidance explains why public build-time variables cannot select a new endpoint after compilation.

The broker's console configuration reports audit_url: null when no audit archive is configured and no endpoint can be derived. This does not prevent sign-in configuration or access to unrelated services. Required service URLs and cross-stack validation still apply. Archive append and envelope retrieval return “Audit archive is not configured” before making a request; there is no substitute archive or silently successful write. On-chain audit history retains its authenticated broker route. The managed local stack explicitly selects the broker origin for archive access; authenticated append/fetch requests are forwarded to the private archive with current chain authority checks. The service credential is never browser configuration. See the audit flow.

Verification

Local, from the prepared public repository root:

./terrier test focused --component ui
./terrier test qualification --component ui
./terrier test qualification --component website

The fast lane uses component tests without a browser. Explicit qualification builds once, starts the actual server twice with different runtime broker origins and verifies unchanged build identity, uncached configuration, HTML and executable assets. Removed development proxy routes must return 404 without contacting a controlled bridge. Test servers have owned process groups and are stopped through the shared cleanup implementation. This checks configuration and delivery; it does not claim browser passkey, signing or full user-journey acceptance.

The explicit website qualifier reuses real local chain/service scenario helpers and the same lifecycle commands. It checks an occupied port with an untouched positive listener, exact-origin headers and foreign-origin absence, unauthenticated session rejection, unchanged origin/configuration across restart, fresh instance identity and confirmed shutdown. This lane requires the prebuilt website and native service binaries; it does not start a browser. Failed runs retain private diagnostics outside the checkout.


Canonical source · revision 883a09ee4a93a4420c28f1dba75077c7046500de.

Clone this wiki locally