Compare commits

...
Author SHA1 Message Date
iris
6a7c0bcad8 docs(web-ui): matrix-accounts picker reads state.containers
The M4TR1X ACC0UNTS section said the agent picker is populated from
`state.agents`, which never existed on /api/state — the same stale
field the code read. Sync the doc to the live roster field.
2026-06-18 13:02:02 +02:00
iris
d8d589ccb2 dashboard(matrix-accounts): populate agent picker from state containers
The agent dropdown read a non-existent `agents` field on /api/state, so
it always rendered empty ("— no agents —"). The endpoint exposes the
live roster under `containers` (each entry an object with `.name`).
Read that instead; the existing string-or-object map keeps it robust.
2026-06-18 13:02:02 +02:00
2 changed files with 5 additions and 2 deletions

View file

@ -214,7 +214,7 @@ title). Its own esbuild bundle (`matrix-accounts.js`); no SSE — it reads
`/api/state` once for the agent picker and otherwise works off two
purpose-built endpoints.
An agent picker (populated from `state.agents`) drives a list of that
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 —
read from `GET /api/matrix-accounts?agent=<name>`
`{ accounts: [ { name, homeserver, token_present } ] }`. The status

View file

@ -31,7 +31,10 @@ async function loadState() {
if (!resp.ok) return;
const s = await resp.json();
renderServerWarnings(s.server_warnings);
agents = (s.agents || [])
// `/api/state` exposes the live roster under `containers` (each entry an
// object carrying `.name`); there is no top-level `agents` field, so the
// picker stays compatible with both string + object shapes defensively.
agents = (s.containers || [])
.map((a) => (typeof a === 'string' ? a : a && a.name))
.filter(Boolean)
.sort();