matrix-accounts dashboard: live status + homeserver from daemon snapshot (be-4)

This commit is contained in:
damocles 2026-06-22 12:42:56 +02:00 committed by mara
commit f38bc13293
5 changed files with 286 additions and 14 deletions

View file

@ -226,12 +226,19 @@ title). Its own esbuild bundle (`matrix-accounts.js`); no SSE — it reads
purpose-built endpoints.
An agent picker (populated from `state.containers`, the live roster) drives a list of that
agent's configured accounts — name, homeserver, and a token-status dot —
agent's accounts — name, homeserver, user id, and a status dot —
read from `GET /api/matrix-accounts?agent=<name>`
`{ accounts: [ { name, homeserver, token_present } ] }`. The status
reflects only whether a token is **stored** (labelled "token stored",
not "online"); a true live up/down indicator needs the matrix daemon's
account registry and is a follow-up.
`{ accounts: [ { name, homeserver, token_present, live, user_id } ], as_of_unix }`.
`token_present` is whether a token is **stored**; `live`, `homeserver`,
and `user_id` are backfilled from the matrix daemon's
`matrix-accounts.json` snapshot — a host-visible file the daemon writes at
startup after its sessions restore (an account with a token but absent
from the snapshot reports `live: false`). `as_of_unix` is the snapshot's
mtime (null when absent), so the dot can show "live as of N ago". The
snapshot is rewritten each daemon (re)start, so an old `as_of_unix` is
ambiguous (stable uptime vs dead daemon) — the live-status dot rendering
(3-state + snapshot-age tooltip, cross-referencing container-running
state) is the dashboard-side follow-up.
The provision form (account name, homeserver, login method) posts
`POST /matrix-account-login` (`x-www-form-urlencoded`, operator-auth):