/** * Serves the built Vite SPA from dist/web. Falls back to a placeholder page * when the web bundle hasn't been built yet (e.g. `pnpm dev` without a prior * `pnpm build:web`), so the server is still useful for API/WS-only testing. * * Privileged bootstrap: only a browser request carrying the separate UI * launch credential receives `window.__HARNESS__.token`. A coding-agent PTY * knows this server's origin for `/ingest`, so an unconditional token-bearing * index page would let the model upgrade its ingest-only capability into full * `/api` mutation authority. A valid launch query establishes an HttpOnly, * same-site session cookie, then redirects to remove the UI credential before * any app/analytics code runs. Reloads and deep SPA routes stay authorized * without ever placing that UI credential in browser JavaScript. * * PostHog config injection (SAP-1988): the same `