Expand description
Admin web UI: a single signed-in /admin dashboard that consolidates the admin actions
(service registry, background jobs, system health, settings, API docs, and “add a corpus”) which
previously sprinkled the public homepage. Access uses the lightweight token scheme — an
AdminSession cookie (frontend::actor), set on the sign-in page below.
Structs§
- Activity
Message Dto - One recent conversion message (fatal/error/warning) for the
LiveActivityDtostream — read from thelog_*rows the dispatcher’s finalize thread already persists, joined to the task’s entry/corpus/service. The live signal of a run’s health. - Admin
Status Dto - At-a-glance operational snapshot for the admin live ops console — the small-table signals
(plus the one pending-task backlog count) the dashboard polls every few seconds and renders
server-side on first paint. Every field is best-effort: a database hiccup degrades it to
0/Nonerather than failing the screen. Deliberately excludes the dispatcher-port / corpus-storage probes (those are the System Health screen’s job — and too slow to poll). Agents get this same snapshot from the token-gatedGET /api/status(api_status) or the Prometheus gauges at/metrics. - Fleet
Worker Dto - One worker’s live activity row for the
LiveActivityDtofleet feed — the “what the fleet is doing now” signal, read straight from theworker_metadatarows the dispatcher already keeps. - Last
RunDto - The latest run’s headline, with live task tallies overlaid while it is still open (so the card shows real progress, not a frozen-at-completion zero).
- Live
Activity Dto - The admin live activity feed: the actively-converting fleet plus the most recent conversion problems. Every field is read-only over data the dispatcher already writes to Postgres as its normal work — the frontend polls it and the dispatcher is never in the request loop, so a slow or absent UI can never back-pressure or endanger the conversion hot path.
- Login
Form - The sign-in form fields.
Functions§
- admin_
login - Processes sign-in (
POST /admin/login): validates the token againstauth.rerun_tokens; on success opens a server-side session and sets theADMIN_COOKIEcookie to its random opaque id (HttpOnly, SameSite=Lax) — the cookie no longer carries the token — then redirects to the validatednextdestination (default/admin). A bad token (or a DB hiccup opening the session) returns to the sign-in page flagged, preservingnext. - admin_
login_ page - The sign-in page (
GET /admin/login?<bad>&<next>): a form to enter an admin token, plus a “sign in with a passkey” affordance when passkeys are enabled.?bad=trueflags a failed previous attempt;?next=is the destination to return to after signing in (carried through the form). - admin_
logout - Signs out (
POST /admin/logout): revokes the server-side session (so the id is dead even if the cookie lingers), clears the cookie, and returns to the sign-in page. - admin_
logs_ feed GET /admin/logs.json— the live-activity panel’s poll feed: theLiveActivityDtoas JSON. Cookie-gated (a signed-inAdminSession); an expired session returns401so the page keeps its last-good values. The agent twin isapi_logs(GET /api/logs).- admin_
page - The admin dashboard (
GET /admin): the consolidated home for admin actions. Signed-in admins only — an unauthenticated browser is redirected to the sign-in page (Err(Redirect)). - admin_
status - Gathers the
AdminStatusDtoover one pooled connection (plus the in-memory pool counters). Shared by the HTML dashboard’s first paint and the/admin/status.jsonpoll feed so both show identical state. Mostly cheap small-table reads (plus the onetasks_todobacklog count) — no dispatcher/storage probe. - admin_
status_ feed GET /admin/status.json— the live ops console’s poll feed: theAdminStatusDtoas JSON, for the dashboard’s few-second auto-refresh. Cookie-gated (a signed-inAdminSession); an expired session returns401so the page simply keeps its last-good values rather than redirecting an XHR. Same-origin only — the agent twin (token-gated, same DTO) isapi_status(GET /api/status); the Prometheus gauges are at/metrics.- api_
logs GET /api/logs— the agent twin of the dashboard’s/admin/logs.jsonfeed: the live fleet activity plus the most recent fatal/error conversion messages as one structured JSON call a monitoring agent can poll. Token-gated via theActorguard.- api_
status GET /api/status— the agent twin of the dashboard’s/admin/status.jsonfeed: theAdminStatusDtosystem snapshot (corpus count, the worker fleet, background-job activity, the pending-conversion backlog, and the latest run) as one structured JSON call a monitoring agent can poll. Complements the Prometheus/metricsgauges — it carries the structuredlast_rundetail (owner / description / timing) the gauges can’t, and matchescortex status --json. Token-gated via theActorguard (401without a valid token).- live_
activity - Gathers the
LiveActivityDtoover one pooled connection. Likeadmin_status, every read is best-effort (degrades to an empty list) and read-only — the dispatcher is never involved, so the live feed cannot perturb the conversion hot path. - routes
- The route set for the admin web UI.