Files
magpie/internal/gui/assets/plugins/usage
yetone b0674b9ec4 providers: a key's balance shows on its row, as Usage last read it
lyj1115 on X: magpie found the relay's balance (the probe), but the
Providers row showed only the API key; the figure was on Usage alone.

The row's quiet facts line (host · models) now ends in " · $10472.14",
in the line's own colour and size, with "Balance $…" as its tooltip.
Several keys' balances are added up as the Usage card's head adds them
(shared balances counted once), else the key in use's. A failed read, a
signed-in account (its windows are on Usage) and Usage turned off show
none. Opening Providers asks for Usage's own read (never ?asked=1, so
"read only when asked" holds) when it is over a minute old, as Routing
does (#1833); rows are marked after the list is drawn and after a read.

rowBalance, markBalances and keysSum/keysSumTip live in
plugins/usage/page.js (keysSum moved out of app.js) so app.js stays
under its code budget without a raise; app.js calls markBalances?.().
No new words, no CSS.

Run (mote, at this tree rebased on origin/main 6cc7402bd):
- provider-row-balance.test.cjs: 24/24 green, chromium and webkit,
  en zh zh-TW ja de at 900 and 420px, and Usage off.
- Broken by hand: against origin/main's assets (MAGPIE_ASSETS) it is
  22 of 24 red (no .pv-bal); only the Usage-off cases pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|I18n|Words|Asset|Budget': ok.
- i18n-keys, i18n-en-no-cjk and 12 provider-*.test.cjs files: 329 pass,
  1 red: i18n-keys "a plugin's words are its own" (routing's ", with an
  image"), red the same on origin/main 6cc7402bd, filed as #6877.
- A 218-file GUI batch (provider, routing, balance, usage-keys,
  usage-shared-balance, i18n) was still running on mote at push time;
  new reds against origin/main get issues when it ends.
Not tried: the real app with a real relay's probed balance.
2026-11-16 23:11:36 +08:00
..