# web client `web/` is the browser client: a canvas (Svelte 5, Svelte Flow) where sessions open as panels. It is a client like the TUI, not an extension; it reads the same daemon HTTP API. `albedo web` (`cli/internal/cli/web.go`) finds or starts the daemon, serves `web/dist` (or `ALBEDO_WEB_DIST`, which the Nix package sets to its `web` build, `.#albedo-web`: `buildNpmPackage` over `web/`, so bump `npmDepsHash` in `nix/packages/web.nix` when `package-lock.json` changes) on `127.0.0.1:4317` (`--port`, 0 for any) and, when this machine is on a tailnet, on its tailnet address too (below), prints a launch link and opens it unless `--no-open` or `ALBEDO_NO_BROWSER` is set, then returns after the detached server is ready. Repeating the command reuses the server and link; changing the listen options requires `--stop` first. `--stop` stops it, `--new-link` replaces its sign-in key and signs existing browsers out, and `--foreground` runs the server in the calling terminal until interrupted. Without `--save`, the detached process is not supervised: it does not restart after a crash or reboot. `cli/internal/webui` owns the boundary: - Each browser tab multiplexes its session panels and root-list follow over one WebSocket at `/api/events`, avoiding the HTTP/1.1 six-connection SSE limit across tabs. `stream.ts` sends new follows immediately on an open socket, preserves each session cursor independently, and resubscribes an ended follow. Unsubscribe sends a stop only for a follow actually sent. Hidden tabs stop chat follows but keep one root-list follow for completion alerts; without that background follow they close pending and open sockets and reopen on return. Stale socket callbacks cannot revive them. Older daemons fall back to the existing SSE routes, retaining their connection budget and visibility cancellation. Both the Go proxy and Vite forward WebSocket upgrades with the daemon bearer token. - The daemon token never reaches the browser. The page calls `/api/...` on its own origin; the proxy strips `/api`, drops `Origin`, `Cookie` and `Referer`, and adds `Authorization: Bearer `. Session streams pass through unbuffered. - A request the daemon does not take (refused dial, or a 401 from a rotated token) makes the proxy look for a restarted daemon (`Connection.Follow`), so the next request lands on its new port. Follow, unlike the TUI's `Refresh`, does not refuse a daemon serving another API digest: the proxy decodes nothing it forwards and the page comes from `web/dist`, built with the daemon, so a long-running `albedo web` built before a protocol change must still follow the daemon after it restarts from a newer checkout (`TestProxyFollowsADaemonRestartedWithAnotherContract`). When no daemon is found the 502 `daemon_unavailable` says why after the dial error. `albedo proxy` follows the same way. - Script on the page could still call `/api` with the cookie, and through it run commands, so the page itself runs nothing it did not ship with: `/` answers with a `Content-Security-Policy` (`appPolicy` in `server.go`) whose `script-src` is `'self'` plus the hash of each inline `