midnight-saci

Web console

The backend serves a browser console at /ui/ on the same address as the REST API. It submits runs, follows them live, shows reports with their criteria and evidence, cancels runs, runs a finished plan again, and reviews outcome actions. It uses only the client routes; it adds no capability the API and the CLI do not have.

Opening it

Start the backend (saci backend start, command line) and open http://<backend.listen>/ui/; / redirects there. When the backend requires a client token (backend.auth.token_env, authentication) the console asks for it before showing anything else.

A backend built without the console answers /ui/ with a short page that says how to build it; the API is unaffected.

What it shows

Evidence is shown as recorded: commands, requests and outputs exactly as retained, with truncation and byte counts, [REDACTED:NAME] markers highlighted, and control characters (terminal escapes, bidirectional overrides) shown as visible symbols rather than interpreted. Recorded URLs are never fetched or turned into links.

Decisions it asks for

Submissions and lost answers

Each submission carries a random Idempotency-Key, kept for as long as the request stays the same. When the backend’s answer is lost (network failure or a 5xx), the console says the run may exist, keeps the key, and Retry start resends the identical request, so the backend returns the original run instead of starting another. Changing the plan or settings afterwards starts a new submission with a new key. While a submission is unconfirmed, leaving the page asks for confirmation.

The token

The client token is kept in memory only: never in local or session storage, cookies, the address or logs. Reloading the page or a 401 forgets it, together with every response the console holds, and asks for it again. Disconnect on the connection screen does the same. The console sends the token only to its own origin.

Deployment

The console is served by the backend from files built into its binary, so API calls are same-origin: no CORS configuration, and the backend’s TLS and network policy apply unchanged. Responses carry a restrictive Content-Security-Policy ('self' only, no inline scripts or styles, no framing), X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer and X-Frame-Options: DENY. Files under /ui/assets/ are named by content hash and cached for a year; index.html is revalidated on every load. Any other path under /ui/ answers index.html, so deep links reload; paths under /api/v1 always answer JSON.

The container image (Containerfile) builds the console in a Node stage and embeds it in saci-backend. The Helm chart needs no change: the console is on the backend’s service port.

Next steps