Commit Graph
562 Commits
Author SHA1 Message Date
yetone 380032cda1 providers: Send requests unmasked is the user's switch at any address, with a caution while on for one not local (AcMilan)
AcMilan (Discord) runs a vLLM at http://llm.corp.lan:8000, and the
editor never offered "Send requests unmasked": the switch showed only
for a localhost, *.local or private-IP address. Asked, he said the
choice should be the user's for each provider.

provider.SkipsRedaction is now: Unredacted, no signed-in account, not
another magpie, and at least one address. Nothing is looked up on the
request path. The editor shows the row for every provider but an
account or remote magpie. While it is ticked, an amber caution under it
names an address not on this computer or the local network (awayHost).
A name of the user's own DNS is asked about, only while ticked, through
POST /api/local-hosts (provider.LocalHost -> netproxy.LocalName: every
address loopback, private or link-local, 400ms lookup, kept 1 minute).
That answer only words the caution. CLI help and `provider show` say
the same. The 'away' i18n line is in zh, zh-TW, ja and de. To stay
inside the core script budget, a few nearby editor comments were cut
down (no raise).

Run (logs in the worktree's logs/):
- Full Go suite on mote at base 024393fbb (go test ./... -timeout 45m).
  Every package is ok except internal/gui. Its reds are the AppKit
  window tests (#4125, #2645, #1936, #3949, #3178) and
  TestRestartHandsTheGatewayOver (#4167), plus TestCoreScriptBudget,
  which was mine and is fixed. At the pushed head (rebased on
  995f84a0f): the gui, provider, netproxy, gateway and cli tests for
  this area, with TestCoreScriptBudget and TestI18n: ok.
- GOOS=linux go vet -tags nogui ./internal/... and GOOS=windows go vet
  on the touched packages: ok. gofmt -l is clean.
- provider-unmasked.test.cjs and decide-endpoint-label.test.cjs: 34/34
  in Chromium and 34/34 in WebKit (Linux, wsl-run), on the final app.js.
- The 155 GUI files that open a provider editor, both engines (WebKit
  on Linux, Chromium on mote). Each file red there was rerun on Linux
  beside the base 024393fbb. The one red this change caused was
  decide-endpoint-label: a /api/local-hosts fetch cut off by navigation
  showed as a console error. That is why names are now asked only while
  the switch is on. The rest are red on the base too and have issues
  (#4431 and others). mote's browsers were crashing (#4125), so
  Chromium was compared on Linux.

Broken by hand:
- The old local-only gate put back in SkipsRedaction: TestSkipsRedaction
  (lan name, vendor, public IP, own proxy) and
  TestLANNameUnredactedProvider went red.
- awayHost returning "": 12 caution tests went red.
- The "only while on" guard removed: 4 "nothing is asked while the
  switch is off" tests went red.

Not tried: a real LAN DNS server, or AcMilan's own setup; WebKit on
macOS (mote's WebKit can't launch, #4125); the Windows app; the whole
GUI suite beyond the provider-editor files.
2026-10-31 00:44:59 +08:00
yetone 995f84a0f9 codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before
it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in
settings.json (minutes, 15 to 1440). Unset, out of range or unreadable
reads as 30m, never 0, and magpie never writes it unless the user does.

- settings: CodexResetLead and Settings.ResetLead(); the menu's values
  are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h.
- provider: the spend (expiringResetSpent) and routing
  (Allowance.Restarts, through nextResetLook) read the same resetLead(),
  so they still agree (#717, #718). The "near" look cadence follows it:
  lead + 30m, at least 1h, so a look lands inside a long lead.
- GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex:
  how early before one expires" with an app menu (no <select>), and the
  sub text says spending earlier loses what the windows have left. The
  four "before it expires" strings say the chosen lead. POST
  /api/settings/codex-reset-lead; the general save keeps the field.
  en, zh, zh-TW, ja, de.
- CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default].
- app.js budget: the auto-use rows moved out to lazy autoresetown.js
  (painted in the same draw once loaded), so app.js and the core script
  stay under their budgets with no raise. The button sizes to its widest
  label (a grid of every label), so picking one never rewraps the row.

Run (all on mote through mote-run):
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build.
- go test -tags nogui -timeout 45m ./... at 3955adccf (this change
  before the paint and sizer fixes, which touch only GUI assets): 81 ok.
  go test ./internal/gui at this head: ok.
- GUI, Chromium: codex-reset-lead, codex-auto-reset,
  codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62.
  WebKit: every case of those files failed at browserType.launch
  (180s timeout) before a page loaded, both runs; mote's browser
  launches hang under #4125 (load ~26), so WebKit is not run.
- Rebased onto f7f2d75f2 (old-webkit's lazy list now has traywindows.js
  too): go build ./..., go vet -tags nogui ./internal/..., go test
  internal/gui (budgets included), cli, settings, gateway: ok. provider:
  ok but TestQuotaSpanCarriesEveryWindowField, red on main since
  7d4a63148 (#4457, fixed in ccbefe2a2). GUI old-webkit, i18n-keys,
  codex-reset-lead in Chromium: pass.
- Rebased again onto 62a1dcdd7 (clean): go test internal/gui (budgets)
  and internal/provider: ok; i18n-keys and Chromium codex-reset-lead
  12/12 pass; old-webkit 9/10, its Safari 15.0 case a WebKit launch
  timeout (#4125).

Broken by hand, each went red:
- resetLead() pinned to 30m: all 3 provider tests.
- resetExpiryNear pinned to 1h: the long-lead look test.
- ResetLead's range check turned into m == 0: TestResetLeadUnreadIsDefault.
- GUI resetLeadMinutes returning 30: codex-reset-lead in every language.
- The button without the sizer: de at 420px, "no click moved the page".

Not tried: a real Codex account spending a card at a non-default lead;
Windows and Linux runs (vet only). The whole GUI suite in Chromium on
mote has ~45 tests in 31 files crash with "browser has been closed" on
untouched origin/main c84c3e1c0 too (reducedMotion files, #4458).
2026-10-31 00:41:29 +08:00
yetone 7d4a631480 tray: pick which of a subscription's windows the menu bar shows (StrikingRaw on X)
Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).

Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
  CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
  ./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
  draws through AppKit: Claude's card one line ("42%"), both windows two;
  the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
  webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
  Windows / single-window / no cards; 360px narrow), i18n-keys,
  old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on ec5571d6f: the focused Go run above, davsync and vet of
the touched packages ok on mote; tray-windows, i18n-keys, old-webkit,
tray-usages 27/27 in chromium and webkit on the Linux VM.
Broken by hand: the row filter in trayCardText off -> TestTrayWindowsPicked
and TestTrayImageOneWindow red; trayWindows out of prefsKeep ->
tray-windows.test.cjs red in every language. Restored, green.
Not run: the full Go suite (owner: ship each verified fix at once; mote
was at load 20-27 under another session's full GUI suite) and the whole
GUI suite. The GUI ran on the Linux VM because mote's browsers crash or
hang under that load (#4125; TestTrayCellClickReleasedPanel is red the
same way on origin/main c84c3e1c0 there).
Not tried: the live app's real menu bar with a signed-in Claude account
(the AppKit drawer was exercised in-process instead); Linux tray label
on a real desktop.
2026-10-30 23:14:08 +08:00
yetone e0ad48641e panel: the tray panel opens the window from its header icon only, no second "Open magpie" in its foot
yogurt36 on Discord: the menu bar panel had a button to open the window
at the top (the header's open-as-a-window icon, #open) and another at
the bottom (the foot's "Open magpie", #openMain). Both called
api("window/main"). The foot's button is gone; the foot keeps what is
its own: Profiles, the status line and Quit. The four "Open magpie"
strings it alone used are out of i18n.js (the tray menu's own
"Open magpie" lives in traymenu.go and is unchanged).

Test: internal/gui/tests/panel-open-once.test.cjs, both engines, all five
languages: the header's icon opens the window, the foot's buttons are
Profiles and Quit only, Quit worded in each language.

Run:
- panel-open-once, Chromium on mote: 5/5 ok; i18n-keys on mote: 4/4 ok.
- panel-open-once, WebKit on Linux (wsl-run, magpie-desktop): 5/5 ok.
  WebKit does not launch on mote right now (several pw_run.sh from other
  sessions hung for hours; a bare webkit.launch() times out at 80s).
- Broken by hand: the test against the old assets (origin/main
  0a9d9702f) is red in every language, "the foot's buttons" lists
  'openMain'.
- Every GUI file that loads the panel, its foot or i18n (146 files),
  both engines, on Linux WSL: 2170 tests, 2107 ok, 63 red. The 12 red
  files run alone at concurrency 1: 62 red with this change, 64 red at
  0a9d9702f without it, the same tests (agent-panel-name-width,
  redact-rule-edit, remote-magpie, text-size, tray-totals and others).
  Filed: #4120 and #4400 (Linux WSL reds at main), #3407, #4398, #4203,
  #4082, #3501, #1866.

At the pushed head (rebased on 30939aa84^): panel-open-once
Chromium + i18n-keys on mote 9/9 ok, WebKit on Linux 5/5 ok.

Not run: the whole GUI suite (mote and WSL both had other sessions'
full GUI suites running), the Go suite (no Go changed). Not tried in
the real tray panel on a Mac.
2026-10-30 20:30:38 +08:00
yetoneandYangHonghang 9e73f69af4 providers: rate windows bill a provider's hours at its own rate (#2463)
A provider can have up to 8 rate windows: days, a span that may cross
midnight (on this computer's clock), and a rate. Inside a window a call
costs the base price times the rate. The base is the user's model price
as set, or the list price times PriceRate with the vendor's own peak
(DeepSeek, Command Code, OpenCode Go) already in it. The author gave
this order as the spec: a 0.8 window on a shared DeepSeek key takes 0.8
off the peak price at peak. The editor's hint says not to set the
official peak hours again as a window, in every language.

Each call is priced at its own time on the Usage page and its CSV, in
the Requests tab's rows, and against a gateway key's cost limit. The
Sessions page, group templates and the model list written into an
agent's own config use the base price. /v1/models prices at now.

Ported from YangHonghang's 2c9d459ff (rate-windows-2463-v2). The Go
pricing, its tests and the translations are theirs. Changed here:
- No budget raised. Their commit raised appScriptBudget and
  coreScriptBudget; core_budget_test.go is main's again. The editor's
  window rows, time menus, validation and hint moved to ratewindows.js,
  which app.js imports when the field is drawn (as signsheets.js is).
  The sliding-thumb and modalDepth comments were cut down to make room.
  The core is 1,535,528 of 1,536,586 and app.js 1,312,242 of 1,315,316.
  Until the script has loaded, a save leaves rateWindows out, and the
  server keeps the saved ones.
- Their unrelated TestAssetsHaveNoConflictMarkers is dropped (one
  commit, one goal).
- The row badge shows only for a provider with windows. Before, every
  provider with a price rate alone got a new ×badge. Its title is
  shorter, and so are its translations.
- AgentPricer (agent model files: Pi, omp, OpenCode cost) uses the base
  price. Nothing rewrites those files when a window opens or closes, so
  a price taken at Sync stayed on outside the window.
- internal/budget gets a TestMain through testenv, so the new test
  runs in a home of its own.
- old-webkit's list of lazily loaded scripts names ratewindows.js.
- The draft keeps each window as a shallow copy, and a day chip
  replaces its days array, so the saved provider is never changed.
- The GUI test waits for the lazy script's hint, not a fixed 300ms.
  It also checks the peak note in each language.

Run first on 2f5a3f1c0, then again after rebasing on 70d9996c5,
8acb0d3a7 and d609729cf. The rebase onto 70d9996c5 met main's ruleedit.js in
old-webkit's list, and both are listed.
- gofmt -l internal: clean at 8acb0d3a7 (129578c3d gofmt'd main's
  pi_api_test.go).
- mote, on 8acb0d3a7: go vet on usage, provider and gui
  ok; GOOS=linux and GOOS=windows go vet -tags nogui ./... ok.
  go test -tags nogui for internal/usage, provider, gui, budget and
  sessions: ok. The five internal/agent tests that are red on WSL
  (below) pass on mote there. On d609729cf (a one-line mover min in
  internal/provider), internal/provider again: ok.
- On 2f5a3f1c0: internal/provider, usage, budget and sessions, and the
  gui RateNow|PriceRate|CoreScript|Budget tests, each under TZ=UTC,
  Asia/Shanghai and America/Los_Angeles: all ok.
- wsl-run (magpie-desktop, Playwright chromium and webkit) on
  70d9996c5: provider-rate-windows, old-webkit, i18n-keys,
  provider-price-rate, provider-advanced-fold, agent-hides-editor,
  key-box-once, provider-many-keys, nokey-editor and
  editor-short-window: 200/200. On 2f5a3f1c0 the first five and
  model-price-edit: 132/132. On mote the same files hit WebKit launch
  timeouts (180s) under another session's full GUI suite (load 30), and
  that run was stopped.
- Full suite, wsl-run (mote was running another session's full suite),
  go test -tags nogui -count=1 -timeout 45m ./... at 6e534f546 (this
  change on 70d9996c5): every package ok except internal/agent.
  internal/agent fails TestInstalledVersion, TestGrokInstalled,
  TestCursorFolderFromTheEditorIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath. This change doesn't touch internal/agent. At
  origin/main 8acb0d3a7 on the same box, TestInstalledVersion,
  TestGrokInstalled and TestOmpDetectedWithPiDir fail too: a fake CLI
  in /tmp exec'd with "Invalid argument". That is #4033 and #3548
  (WSL2 binfmt interop).
- Broken by hand, red each time:
  - Pricer without the window: TestPricerRateWindows,
    TestBlockRowsTakeTheirRateWindow, TestCostLimitCountsTheRateWindow.
  - Block rows without atWindow: TestBlockRowsTakeTheirRateWindow.
  - AgentPricer at now: TestAgentPricerLeavesTheRateWindowOut.
  - Badge for a price rate alone: TestRateNowOf.
  - Peak note removed: provider-rate-windows, 10 of 10 chromium
    layouts.
  - ratewindows.js not in old-webkit's list: old-webkit.

Not tried:
- A real relay billed by the hour.
- The real desktop app (WebKitGTK, WKWebView).
- The full GUI suite (mote was running another session's).
Known limits:
- No rate is stored per record, so changing the windows reprices
  history, as a changed PriceRate does.
- Windows follow this computer's zone, with no zone of their own.
- The Sessions page uses the base price.

Co-authored-by: YangHonghang <honghang.yang@qq.com>
2026-10-30 18:55:51 +08:00
yetone 46fb0c1b93 gui: the tray panel switches a Claude Code's or Codex's account (shuizhuyu on X)
shuizhuyu asked for a global shortcut to switch accounts. v0.1.2143's
Quick panel shortcut opens the tray panel, but the panel had no account
switch: switchable() returned null there, because the panel reads no
provider list (a fresh /api/providers reads every sign-in, seconds after
a start, #1519).

Now a Claude Code or Codex not connected has an "account" line in its
opened panel row (switchEntry, the window's Switch accounts only menu).
The line is drawn from the list kept from the last read
(GET /api/providers?last=1, no keychain read; panelAccounts in app.js),
read fresh only when nothing is kept. Opening the menu does one fresh
read and opens on what it says. Manage accounts… and a lapsed pick open
the window's Providers (window/main?view=providers). The provider and
login actions now keep their answer as the last list (keepProviders), so
a switch made in the window or the panel is in the next kept read.

app.js stays under its budget with no raise: my own comments and two
older ones (the usage accounts note, the sidebar note) were cut down.

Run:
- GUI, Windows box (xiaomi-gpu, win-run), Chromium + WebKit: 31 files
  (panel-*, panel-switch-accounts, agent-switch-accounts, switch-only,
  claude-switch-only, keep-login, agent-failover, agent-row-disclose,
  getting-started, click-scroll, i18n-keys, gui-zh-tw, gui-ja, gui-de):
  503 of 503 pass. Not the whole GUI suite.
- mote: no browser could launch there (pboard down, #4125; every WebKit
  and later Chromium launch timed out at 180s), so the GUI runs there
  were cut short. agent-panel-name-width, red there in both engines, is
  red on origin/main too (#4304, #4203), and this change doesn't draw
  the closed rows it measures.
- mote: go vet ./internal/gui; go test -run 'TestKeptProvidersFollowActions|
  TestLastKnownProviders|Budget|TestProvider' ./internal/gui ok (includes
  TestCoreScriptBudget). gofmt -l clean. GOOS=windows go vet ./... ok.
  GOOS=linux go vet ./... fails only in wails/v3 pkg/application (cgo
  off when cross-compiling), the same on origin/main 32f5c3369 (#4406).

At the pushed head (rebased on origin/main 32f5c3369, whose switchEntry
now leaves setup-token logins out of the menu; kept): the Go run above
again ok, TestCoreScriptBudget at the new 1,536,586 included, app.js
1,314,856 of 1,315,316; on the Windows box, panel-switch-accounts,
agent-switch-accounts, switch-only, claude-switch-only, keep-login,
agent-failover, i18n-keys, panel-fold and panel-effort: 178 of 178.

Broken by hand:
- panel-switch-accounts on origin/main's assets: 12 of 12 red in
  Chromium (no account line).
- Panel always reading fresh (laziness removed): 11 of 12 red.
- keepProviders removed from the provider action:
  TestKeptProvidersFollowActions red.

Not tried: real Claude Code or Codex accounts; the real Wails panel
opened by the shortcut; the login/{action} keep has no test of its own.
2026-10-30 15:26:03 +08:00
yetone 1bbaded622 usage: an agent's call to magpie's own MCP tools is a row of Requests
ferock (Discord) asked to see calls to magpie's MCP tools, such as
magpie-image's generate_image, generate_video and generation_result, in
Routing > Requests.

Each tools/call to magpie's own MCP servers (image, vision, web search,
tools and the Library hub) is now a row of the request log. The row has
Source and Kind "mcp", the tool as its model, the server as its host,
how long the call took, and its error if it failed. The provider and
model it shows are those of the model requests the call made, collected
through the request's context in appendUsage. generation_result names
the model of the job it answers. The stdio Magpie Image server reports
each call it answered to the gateway as "magpie/toolCalled". That report
carries the tool, ms, model and error, never the prompt.

The arguments are never stored at all, so there is nothing to mask. The
rows go down the probe lane: they are listed, but no total, host list,
budget or key limit counts them. The model requests a call made are rows
of their own.

In the GUI the row reuses the Requests list. It gets a muted "MCP" badge
with a tooltip, the server beside the provider, and a Succeeded/Failed
status. The Purpose filter gains "MCP tool" in every language. There is
no new page, no <select> and no left border.

The core scripts went over their budget with the new purpose.
genpurposes now writes purposes.js as compact JSON, which makes the core
448 bytes smaller than main in all, and coreScriptBudget is lowered to
the new total, 1,538,975. No room is added.

Run on mote, at the rebased head:
- gofmt -l: clean. go vet -tags nogui ./... with GOOS darwin, linux
  and windows: ok.
- go test -tags nogui -timeout 45m: ./internal/usage, ./internal/imagemcp,
  ./internal/usageapi and ./internal/gui ok. internal/budget has no test
  files. ./internal/gateway (805s): every test ok except five Antigravity
  and Codex/Grok tests. They fail the same on a clean origin/main
  3bebc3839 and are filed as #4362.
- GUI, the usage-ledger*, routing-request*, purpose*, i18n* and
  gui-zh/ja/de files (25). On mote, Chromium: 32 of 32 ok; WebKit
  could not launch (10 other sessions' suites on mote). On Linux
  (wsl-run), both engines: 335 of 355 ok. The 20 reds are
  routing-request-model, usage-ledger, -ttft, -chart and
  -open-settled, which fail the same at the parent 1534474c8 (#4120).
  usage-ledger-mcp, purpose-filter and i18n-keys are ok in both.
  The whole GUI suite runs after the push, and each red it finds gets
  an issue.
- At the pushed head, rebased on 0804f2d97: ./internal/gui (the
  budget and purpose asset tests among them), ./internal/usage,
  ./internal/imagemcp and ./internal/usageapi ok, and ./internal/gateway
  -run "MCP|Purpose|Probe" ok.
- usage-ledger-mcp.test.cjs covers 5 languages, widths 1180 and 420,
  light and dark, with no sideways scroll.

Broken by hand. Each break went red:
- sawHost's MCP skip removed: TestMCPCallRowsListedNotCounted (the hosts
  list had magpie-image).
- Row/Record.IsProbe's MCP case removed: the same test (3 calls counted),
  and TestMCPCallCountsInNoKeyLimit (Calls: 1).
- The callMCPTool hook removed: TestMCPToolCallIsARequestRow and its
  siblings (no rows).
- The appendUsage hook removed: the row had no provider or model.
- imagemcp's report removed: TestToolCallsAreReported.
- The gateway's magpie/toolCalled case removed:
  TestMCPCalledFromStdioIsARow.
budget's in-memory counts() now skips these rows too. Breaking only that
stays green, because budget.Of reads the file through usage.Visit, which
already skips probes, and limits count tokens and cost.

Not tried:
- no real agent calling a real vendor's drawing;
- no test run on Windows or Linux;
- the page not checked in the real app or in WebKitGTK.
A generate call that answers while its drawing still runs has no model on
its row. The generation_result row that follows names it.
2026-10-30 15:00:16 +08:00
yetone f2c6831a31 gateway: a read-only gateway key reads quotas and usage and uses nothing (Steven on Discord)
Steven's ESP32 desk display polls magpie (Docker, on his LAN) every 15s
on GET /v1/magpie/quotas and /v1/magpie/usage and never sends a model
request. Only a key held to nothing was told the usage summary, so the
key kept in the device's flash had to be one that could spend every
account.

A gateway key can now be read-only (access.Key.ReadOnly):
- `magpie gateway-key add <name> --read-only`, `magpie gateway-key access
  <id> [read-only|full]` (`gateway-key --help` lists it; `list` has an
  ACCESS column), and "Make read-only" / "Give full access" in the key's
  menu in Gateway -> Gateway keys, with a "Read only" tag on its row.
- readOnlyGuard (internal/gateway/readonly.go), after callerGuard and
  before withCaller/keyLimited, judges the pattern ServeMux.Handler routes
  the request to. A read-only key is answered GET /, /v1, the quotas,
  their history and cards, the usage summary and its requests, its limit
  and the concurrency. Every other route is refused with 403
  gateway_key_read_only: every model route, count_tokens, the Responses
  WebSocket's upgrade, every MCP server, Codex's and Gemini's backends,
  /v1/models and the Ollama routes, the catch-all, the trace and route,
  debug profiles, and every write (usage ingest, quotas refresh). It is
  default deny, so a route added later is refused until it is classified.
- The key is held to nothing else, so heldKey leaves it alone: it reads the
  usage summary and every account's quotas, as a key held to nothing does.
  None of those routes holds a key's secret.
- The sharing key can't be made read-only, since magpie gives it to its own
  agents (LANSecret). Update refuses it, and the GUI item is off with why.

Older versions: a magpie from before this commit doesn't know `readOnly`
and treats such a key as a full one, so downgrading magpie widens the key.

Tests:
- TestReadOnlyKeyEveryRoute (internal/gateway/readonly_test.go) takes the
  patterns from the router itself (routes() records each HandleFunc). It
  fails when a pattern is in neither readOnlyRoutes nor its refused list.
  It sends every refused pattern, by each method it takes, from
  192.168.1.9 and from loopback, plus a WebSocket upgrade and an unclean
  chat path, and expects 403 gateway_key_read_only with the upstream never
  reached. It checks that every allowed route answers, that no body holds
  any key's secret or the upstream key, that the usage summary names the
  other key's use, and that a full key and a key made full again still
  reach the model.
- TestReadOnlyKey (access) covers add-key and access-key on and off,
  Authenticate, List, and the sharing key refused.
- TestGatewayKeyCLIReadOnly covers --read-only before and after the name
  and beside --key, access, the list column, bad values, and --help.
- gateway-key-readonly.test.cjs runs Chromium and WebKit, 1100 and 420px,
  in en/zh/zh-TW/ja/de. It covers the tag, both menu items and what they
  post, the status line, the sharing key's item off with its why, no
  scroll on click, no sideways scroll, no select, and no left stripe.
  gateway-card.test.cjs now expects the menu's 4th item.
- TestClientPathCoversHandler takes the patterns from routes() instead of
  parsing Handler's source, which moved into routes().

Broken by hand:
- readOnlyGuard passing everything: TestReadOnlyKeyEveryRoute red (103
  lines, /v1/models 200 onward).
- A new `POST /v1/new-thing` route in routes(): red, "in neither
  readOnlyRoutes nor readOnlyRefused".
- The GUI item not off for the sharing key: gateway-key-readonly red 10 of
  10 in Chromium.

Run at the pushed head (on origin/main 0911a65e7), on mote: TestReadOnly*,
TestHeldKey*, TestClientPathCoversHandler, TestGatewayKey*, TestCaller*
in access, cli and gateway ok; TestCoreScriptBudget ok; on Linux
(wsl-run, both engines) gateway-key-readonly, gateway-card, i18n-keys,
gateway-caller-keys and gateway-key-quotas 68/68.

Full Go suite on mote (macOS) at the same change on origin/main
dca3e2d71 (94630237d), -timeout 45m: 78 packages ok; internal/gateway
red only on the four TestAntigravityTurned* and
TestCodexSpentGrokFailingIsTold (red the same at origin/main, #4362);
internal/gui red only on ten AppKit window tests that hit their 30s
bar while mote's launchd throttled every app launch (#4125).

Run on mote (macOS) on origin/main dca3e2d71:
- go test ./internal/access ./internal/cli ./internal/gateway: access ok;
  cli red only on TestLibraryMCPHub's TempDir cleanup (#4140); gateway
  red only on the four TestAntigravityTurned* and
  TestCodexSpentGrokFailingIsTold, red the same at origin/main (#4362).
  TestReadOnly*, TestHeldKey*, TestClientPathCoversHandler,
  TestGatewayKeyCLIReadOnly pass.
- TestCoreScriptBudget ok (no budget raised). gofmt clean; go vet
  darwin (access, cli, gateway), GOOS=windows ./... and GOOS=linux
  -tags nogui ./... clean.
- GUI, earlier at 807048470 on mote: gateway-key-readonly,
  gateway-key-quotas, i18n-keys, gateway-card, api-key-theme,
  gateway-connect-keys and gateway-caller-keys 34/34 in both engines.
  At this tree mote's WebKit hung at launch for every test (#4125), so
  the 43 gateway-*/key-*/api-key-*/caller-*/menu-*/i18n-* files ran on
  Linux (wsl-run, both engines): 501 of 514. The reds in api-key-theme,
  gateway-key-limit, gateway-key-models, key-replace and menu-input-scroll
  are red the same at origin/main e8d42c02d (#4120, #3523, #4081, #4126,
  #3402); gateway-keys-empty's WebKit wait was red 1 in ~13 runs here and
  0 in 4 at main, filed as #4383 (this change doesn't touch its path).
- Full Go suite on Linux (wsl-run, at 807048470 with this change): reds
  only where Linux can't build the GUI (no gtk4/webkitgtk) and in
  internal/agent's install tests (#4033) and the gateway reds above,
  each red the same at origin/main dca3e2d71; plus
  TestClientPathCoversHandler, which parsed Handler's source and is now
  read from routes() (fixed here).

Not tried: a real ESP32 or Docker magpie; a remote client against a
running gateway (only httptest through lanGuard/Handler); the Windows
test runs (vet only); the whole GUI suite (mote's WebKit hung, #4125).
2026-10-30 14:33:01 +08:00
yetone 3bebc38393 gui: a key combination opens the quick panel from any app (ben hanks)
ben hanks on Discord asked for a global shortcut that opens the menu bar
or tray panel. Settings › General has a new row, Quick panel shortcut,
with none set by default. Clicking its field records the next combination:
a letter, a digit, Space or F1–F20 with Ctrl, Alt/Option or Cmd/Win, or an
F key on its own. Esc or a click elsewhere stops recording, and the cross
clears the shortcut. It is shown the system's way (⇧⌘K on a Mac,
Ctrl+Alt+K elsewhere).

POST /api/settings/panel-shortcut checks the combination, has the running
app bind it through Wails' GlobalShortcut (Carbon hot keys on the Mac,
RegisterHotKey on Windows, XGrabKey on X11), and saves it only once it is
bound. One the system refuses is not saved, the old one stays bound, and
the status line says why. A pressed shortcut toggles the panel as a tray
click does. The shortcut belongs to each computer (KeepOwn), the Settings
page's own save leaves it alone, and the old Mac process lets go of it as
it hands over. On Wayland no app may grab keys, so the field is turned off
and the row names the command (`magpie panel`) to bind in the desktop's
own keyboard settings.

Every string is in en, zh, zh-TW, ja and de. No size budget was raised:
app.js is 1,315,252 of its 1,315,316 after older comments were cut.

Run at this head (rebased on origin/main 1534474c8):
- mote (macOS 27): gofmt; go vet for darwin, GOOS=linux -tags nogui and
  GOOS=windows on internal/gui and internal/settings; go build ./...:
  ok. go test: settings ok; gui ok except TestMainWindowCorners/
  macOS_26_SDK, red on macOS 27 already (#3949).
- Windows (xiaomi-gpu, win-run): go test internal/gui internal/settings.
  settings ok; gui has 5 reds, the same 5 on origin/main d19afb4c9
  (TestGatewayHeldByAContainer #2107/#3649; TestLodyImportHandoff,
  TestImportStatusUnreadableIsUnknown, TestAionUiImportRow and
  TestUpdateThatWontStart #4115).
- Linux (WSL magpie-desktop, wsl-run -tags nogui): internal/gui (the
  Wayland branch included) and internal/settings: ok.
- GUI: panel-shortcut.test.cjs (new) in Chromium and WebKit, in all 5
  languages, faking both a Mac and Windows: ok. Whole suite (make test-ui)
  on mote: unfinished at the push. Three other sessions' suites were on
  the same box (load 130 to 250), and after 1605 tests it was still in
  the "c" files. Its reds so far are agent-panel-name-width and
  connect-snippet-shell and context-map (each on #4304), and allow-ips
  zh, which is red alone on origin/main too (#4357).

Broken by hand, each red:
- leaving the shortcut out of the general Settings save:
  TestPanelShortcutSetting "the Settings page's save changed the
  shortcut";
- dropping KeepOwn's line: "a synced setup took this computer's shortcut";
- dropping the recorder's stopImmediatePropagation: panel-shortcut.test.cjs
  "a key typing needs was sent, or a window key ran".
TestSettingsSaveKeepsWhatItDoesNotSend now sets the new field.

Real build on mote: a dev build in a sandbox HOME bound a saved
Ctrl+Option+Shift+Cmd+F18 as it started, and a POST of F16 saved it and
bound it.

Not tried:
- a real key press on any system: mote gives ssh no Accessibility access
  to post events, and Windows' ssh session has no desktop;
- the Windows and X11 refusal of a combination another app holds (only
  the fake). On the Mac, Carbon takes a combination a second app
  registered too, so both apps get it and magpie can't say so. This was
  checked on mote with a helper holding F17;
- Wails' GlobalShortcuts portal on Wayland, which isn't used;
- a Linux GUI-tag build (WSL has no gtk4/webkitgtk-6.0).
2026-10-30 12:06:33 +08:00
yetone 4a4a90c237 gui: the sidebar's button stays in one place whether the sidebar shows or not (ztf4080 on X)
ztf4080: "左侧栏收起按钮在左上角,但是收起后展开按钮变了右下角". The button
to hide the sidebar sat in the page header to the right of the sidebar
(x=232 at 1280), and once hidden it was in the title bar after the magpie
(Mac x=175; Windows 14; Linux 93/14/40 as the brand folds). Each click
moved it.

Now #sideToggle is first in the title bar in both layouts, as Finder's,
Notes' and Mail's: layoutNav moves it with the brand, into .side-top when
the sidebar shows and to the front of .top when it doesn't. .side-top has
the header's height and left padding (Mac: after the traffic lights at
96px/zoom, as .top), so the button keeps its x, y and size. A sidebar too
narrow for the name keeps the bird (fitTop sets .side-top.tight). Windows'
10px .side-top is gone: the button needs that row there too. Nothing else
in the sidebar changed.

Run (on mote, through mote-run; NODE_PATH playwright 1.62.0, chromium and
webkit):
- Repro before the fix: a probe at 1280/900/640, en/zh/de, Mac/Windows/
  Linux chrome, gave the positions above.
- side-toggle.test.cjs gains "<os>: the button stays where it was" for
  Mac, Windows and Linux: every language (en, zh, zh-TW, ja, de) at 1280,
  900, 640 and a 168px sidebar; hide then show, x/y/w/h within 0.5px, the
  header fits, .side-top doesn't overflow.
- Broken by hand: the new test against origin/main's assets fails all 3
  OS subtests in both engines (18 pass, 8 fail); reverting layoutNav's
  append/prepend fails them too.
- side-toggle, side-width, header-centre: 49 pass, 1 fail (header-centre
  webkit, the ResizeObserver page error, #3479; the same on the base).
- The 22 GUI files that touch the sidebar, brand or toggle
  (--test-concurrency=2): 335 pass, 11 fail: header-centre webkit (#3479)
  and mobile-web's desktop compare against HEAD~1, which moved on purpose.
- mobile-web.test.cjs: until BASE_REF has the move, its desktop compare
  leaves the button, the magpie and the header out of both pictures, like
  its other "until BASE_REF has it" cases. Run in a git checkout on mote
  with BASE_REF=HEAD~1: 30 pass, 0 fail in chromium and webkit.
- At the head rebased on 9e8c22dad: side-toggle.test.cjs 26 pass, 0 fail;
  go test -run TestCoreScriptBudget ./internal/gui ok (app.js 1,315,308 of
  1,315,316, no raise; a comment in fitTop cut to fit after the rebase).
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, #3949
  (macOS 27 box), not this change.

Not run: the whole GUI suite (mote was busy with other sessions' full
suites, load 45-110); the real app on Windows and Linux (the probe used
their chrome classes in Playwright).
2026-10-30 10:55:05 +08:00
yetone 55299ee304 agents: Switch accounts only, the account a Claude Code or Codex not connected is signed in to, a click from another
Users asked for an entry named 仅切换账号 (growaiskills), for the current
account to always show, for a clear sign that a switch took, and for the
switch away from the proxy settings that put them off (Rennix7t). The owner
said to build it.

On the Agents page, a Claude Code or Codex row that magpie doesn't connect now
shows the account the agent is signed in to as a button in its status line
(switchEntry). Clicking it opens the app menu, headed "Switch accounts only",
with:
- every sign-in;
- "Only switch {agent}'s sign-in", a ticked item (menuitemcheckbox). Claude
  always gets it; Codex gets it only with more than one usable account;
- "Manage accounts…", which opens the provider editor.
Picking another account goes through /api/login/switch, or through
/api/provider/keeplogin when the provider keeps a login. The button then
shows "Switched" for 5s, and the status line says that new sessions use the
account and an open one keeps its account until it is restarted. A pure
switcher (Claude kept to its own accounts with nothing else in magpie, the
"empty" connect kind) used to show only "Add a key or a subscription
first", so it couldn't switch from the page. It now gets the entry, and
switch-only reads "Not connected · switching accounts only". The failover
line's "ChatGPT accounts" button is gone, since this entry replaces it. A
connected agent, the tray panel and the WSL twin get no entry. Strings are
in zh, zh-TW, ja and de. Docs: providers-accounts.md and reference.md.

The core budget is raised by this change's bytes only (app.js 1,315,316,
core 1,536,357), after cutting comments and dropping a key.

Run on mote at 9f299d54e (rebased on 0c12662f2):
- GUI files agent-switch-accounts, agent-failover, i18n-keys, gui-zh-tw,
  gui-ja, gui-de, click-scroll, agent-connect-no-models, switch-only,
  claude-switch-only and keep-login: 177 of 177 pass. agent-panel-name-width,
  run beside them, is 0 of 32, the same on origin/main 0c12662f2 alone
  (#4203, commented)
- go test ./internal/gui: only TestMainWindowCorners/macOS_26_SDK red, #3949
- Earlier, at ad9f269c9 on 8cbd0a9c9, the whole GUI suite (concurrency 4)
  ran 508 tests before I stopped it, since it ran very slowly under load.
  The only red was agent-panel-name-width (chromium and webkit), a
  panel-only test where this entry is never drawn. It is #4203, and it is
  still red at this head and on main with 0f391a7a7 (above). The rest of
  the suite was not reached.
- A Linux full run (wsl-run, magpie-desktop) is not a valid environment:
  410 GUI reds at concurrency 8, mostly WebKit timeouts, and the Go builds
  fail without gtk4/webkitgtk. internal/gateway passed; internal/agent had
  6 that need tools installed there (TestInstalledVersion,
  TestGrokInstalled, …). Nothing in this change touches Go.

Broken by hand, each turned red, then restored:
- not setting accountSwitched: "Switched shows on the button" went red in
  every engine and language;
- login/switch in place of keeplogin: the kept-login test went red;
- removing the empty-kind bypass: 11 of 12 chromium tests went red.

Not tried:
- a real switch with real accounts in a sandbox HOME. On macOS Claude
  Code's credentials are in the login Keychain, which a sandbox HOME doesn't
  isolate, and the Linux box has no signed-in accounts. The endpoints are
  unchanged and were already used by Settings' switch.
- the real app on Windows and Linux (WebKitGTK);
- the tray panel, which reads no provider list, and the WSL twin rows,
  which get no entry;
- the rest of the whole GUI suite past 508 tests.
2026-10-30 04:01:35 +08:00
yetone 2d9a89b9f6 gui: an account row's ⋯ shows on hover in Safari before 15.4 again
18005c803 put `.acc .acc-more:focus-visible` in one selector list with
the hover and tools-open selectors. Safari before 15.4 doesn't know
:focus-visible and drops the whole rule, so the ⋯ never showed there,
on hover either. The focus selector is its own rule now, as
.update-hide's is.

Run on mote (macOS 27): old-webkit.test.cjs was red at origin/main
405425186 ("app.css:~2423 :focus-visible in a selector list (Safari
15.4 drops the rule)") and passes here; with it, 18005c803's own
tests (account-cap, account-models, account-row-line, codex-signout,
lane-limit, own-signin-remove): 84 pass, 0 fail.
2026-10-30 02:56:32 +08:00
yetone 81bdca1fe9 gui: a narrow weighted key list keeps the key's name on hover (00e0fd11b)
00e0fd11b put Switch off beside Remove on a key's row, shown on hover.
In a weighted list about 480px wide (the editor beside the list at a
900px window), the weight pill, Make first, Remove and now Switch off
left the name nothing: key-weight-fit's "hovering squeezes the name to
nothing" went red, en 900px, Chromium and WebKit. That red came from
this change, found in the full GUI suite run after the push.

There, under 520px of list, Switch off isn't shown on an on key's
hover; the tick dot still switches it, and an off key's Switch on is
always shown. Elsewhere nothing changes. The key list is an inline-size
container for it.

key-weight-fit measured "Remove" as the row's first .text.quiet, which
is now Switch off; it names Remove itself.

Run (mote):
- key-weight-fit, key-switch: 36/36 ok, Chromium + WebKit.
- key-weight-fit at 00e0fd11b: chromium/webkit en 900px red, as in the
  full run; ok with this.
- With key-replace, key-weight, provider-many-keys, routing-keys-fold,
  key-copy: the only reds are key-replace 420px (#4126 scroll hold,
  #3476 under load), the same on 00e0fd11b~1's assets.
- Full GUI suite on Linux (wsl-run magpie-desktop) at 00e0fd11b: 379
  of 15055 red in 80 files. The key-adjacent ones were rerun on mote
  at 00e0fd11b and at its parent: the same tests red on both (under
  load, #4304 on mote, #4120/#4121 on Linux), except key-weight-fit,
  fixed here.
Not tried: the real desktop app.
2026-10-30 01:07:14 +08:00
yetone 44d6979930 gui: a page scrolls rather than squeeze its heads, so opening the Gateway page's models moves nothing over them
The owner, 10-29: 展开模型的时候,这块部分会整体向上移动几个像素. A view is a flex column (since 50db5ccbe), and every box in it has flex-shrink 1. Once the open models list made the Gateway page taller than its window, flex shrank each box of a set height down to its content. Connect's head went from 26px to 21.4, the models' head to its search field's 24, and the models' label moved up 5.6px. Every view's direct children now have `:where(.view) > * { flex-shrink: 0 }`, so the view scrolls instead. :where() weighs nothing, so a box that sets its own flex (.view-room's none) keeps it. This reaches every page: any head or box of a set height on a page taller than its window was squeezed the same way.

gateway-models-open-steady.test.cjs opens the folded models with 30 of them, in Chromium and WebKit, en and zh, in the window and in magpie web. Connect's head, the models' head and its label keep their top and height, every head on the page keeps its height, and folded again the label is back.

Run on mote (node 22, Playwright 1.62.0):
- gateway-models-open-steady: 8 of 8. With app.css put back to origin/main's, 8 of 8 red ("opening took connect from 26px to 21.390625px").
- A measuring script on origin/main c46829e0b, before the fix: connect 26 → 21.4, models 26 → 24, label 286 → 280.4. After the fix: all unchanged, in both engines, window and web.
Rebased onto f5806ed21 and pushed without the rest: the whole GUI suite
(this change reaches every page) was still running on mote at 936bc67ee,
the same tree before the rebase. Its result goes on an issue when it ends,
with every new red against #4119's run.
2026-10-30 00:39:03 +08:00
yetone d4c05ca114 gui: a status line longer than its place floats wrapped, whole (littleHong)
littleHong on Discord: Test models in OfficeAce's editor failed on every
model, and the red status pill was one line ending in "…", so the part of
the error saying what to do ("请在 OfficeAce 客户端完成「接入华为云 MaaS
模型」后重试…") was cut off.

status() now lifts the pill (the floating .lift it already had over a
dialog) whenever its text is wider than the footer, too. A lifted pill
wraps (white-space normal, overflow-wrap anywhere), is up to
min(560px, 100vw - 32px) wide and min(166px, 40vh) tall (ten lines),
and scrolls inside itself past that (overscroll contained). One line is
still a 22px pill; its corners went from 999px to 11px so several lines
don't read as a capsule. It stays while the pointer is on it and clears
2s after it leaves, and a long line stays msg.length * 80 ms at least.
The text stays selectable; no border accent.

Siblings: every toast (ok, warn, err) goes through status(), in the
window, over dialogs and in the tray panel's footer
(body.panel .foot .status is overridden by body .foot .status.lift).
A short line stays in the footer as before.

Test: internal/gui/tests/status-long.test.cjs. The reporter's literal
OfficeAce error from /api/provider/test on 10 models, in en, zh, zh-TW,
ja and de, light at 900 wide and dark at 390: lifted, not cut either way,
wraps, in the viewport, user-select text, no left border, last character
inside the pill. In en and zh: err/warn/ok long lines float and a short
one stays in the footer; a very long line holds to ten lines and wheel
scrolls to its end without moving the page; hover holds it, leaving
clears it.

Run (mote-run):
- status-long: 32/32 in Chromium and WebKit.
- Broken by hand in Chromium: old CSS+JS 0/16, old CSS only 2/16 (the
  hover cases), old JS only 10/16 (footer, scroll and hover cases fail).
- i18n-keys, sessions-reads, session-terminal, account-discovery,
  settings-general: ok in both engines.
- go test ./internal/gui: ok except TestMainWindowCorners/macOS_26_SDK,
  open as #3949. TestCoreScriptBudget ok: app.js 1,310,377 bytes
  (budget 1,311,735), budgets unchanged.
- Screenshots looked at: zh light 900, zh dark 390, scroll dark 390.

Not tried: the real app; Windows WebView2 and Linux WebKitGTK.
2026-10-30 00:15:46 +08:00
yetone 18005c8039 gui: a provider editor's account rows end at one edge, their settings under ⋯
The owner, 10-29, on Claude Code's editor sheet: its left and right edges
weren't the same, Make first sat alone on a line under the name, and a
band of hover pills took room it didn't show.

Each account row is now a line (dot, name, plan, what is set, then the
status and First or Make first at the right end) and the quota under it.
The settings that aren't set (models, usage cap, requests at once) and
Remove or Sign out wait under ⋯ on a line of their own, which ⋯ opens and
closes. The editor remembers that per row across redraws. A set pill stays
on the line, and a lane pill moves between them as its account starts or
stops running, but not while its menu or box is open. A signed-out
account keeps Sign in again and Remove on its line, wrapping under the
name where they don't fit. The editor's label column fits its labels,
a list's label stands on its first row, every row of the accounts box is
ruled off from the one above, and in the web layout ⋯ is always shown. New
string "Settings for {user}" is in all five languages.

core_budget_test: app.js stays in its budget (1,311,731, comments cut
down). The core's scripts go to 1,532,459. Main had 233 bytes of room
there, so the budget is raised to the exact size with no room added,
as the 10-28/29 editor entries did.

Run (on mote, at this tree, rebased on abd94e0b1):
- go test -run Budget ./internal/gui/: ok.
- node --test on account-row-line (new), account-cap, account-models,
  lane-limit, codex-signout, own-signin-remove, i18n-keys and i18n:
  82 pass, 0 fail.
- The full GUI set of 70 files, at base 2da7293d4 before the trim: 1227
  pass, 17 fail. Every red also fails on main:
  - gateway-caller-keys (#3797);
  - gateway-key-models webkit en (#4081);
  - key-replace 420 webkit (#4126);
  - rest-try-now 420 (#4127);
  - key-weight-fit en 900 in both engines (#4295, filed now). That is
    the key rows' own hover squeeze, which this change leaves alone.

Broken by hand: account-row-line on main's assets (MAGPIE_ACC_ASSETS) is
red in both engines: Make first on a line of its own, and hidden pills
taking room.

Not run: the full GUI set again after the comment trim and the move to
abd94e0b1. A provider's key rows (renderKeyAccounts) keep the old hover
layout (#4295). On a phone, the sheet's two edges aren't compared,
because a phone's scroll bar takes no room. Headless WebKit draws a
classic bar there.
2026-10-29 22:58:08 +08:00
yetone 75a7db27b9 usage: an allowance card can be hidden from the Overview (whqtian_07012 on Discord)
whqtian wanted StepFun's plan card on Usage › Overview without its
balance card. Right-click a card (or long-press it on a touch screen)
and the app menu offers "Hide from Overview". With several accounts on
one card it says "Hide this account from Overview". A plan card that
carries its key's balance also offers "Hide its balance from Overview",
which keeps the plan. Each hidden card is saved as its tray card id plus
its kind (stepfun|balance, kimi|me@x|plan) in settings.UsageCardsHidden,
through POST /api/usage/arrange (cardsHidden). The Settings save keeps
it. Under the cards, a quiet "{n} hidden" line opens them, each with
Unhide, and Show all from two. It is the same pattern as the Agents
list's hide.

Display only: routing, caps, counting, the Accounts list, the tray
panel's Allowances (it has its own Arrange) and the menu bar cells
never see it. A cell clicked for a hidden card shows it until the page
is left (usagePeek). UI: the app menu, not a native select, no
coloured stripes, no new button on the cards.

Run at this head (rebased on 96a703a59):
- mote: go test -timeout 45m ./internal/gui ./internal/settings.
  settings ok. gui: only TestMainWindowCorners/macOS_26_SDK red, and it
  is red on origin/main 96a703a59 too (#3949, macOS 27).
  TestUsageArrangeCardsHidden and TestSettingsSaveKeepsWhatItDoesNotSend
  pass.
- Linux box (wsl-run): 107 GUI files that reach the Usage page, the
  quotas, the panel, i18n and gui-de/ja/zh-tw, in Chromium and WebKit:
  1362 of 1419 pass. usage-cards-hide passes in both engines, in en, zh,
  zh-TW, ja and de, at 1200px, 560px and 390px (touch, magpie web).
  i18n-keys passes. The 9 red files were run alone at origin/main
  96a703a59 and are red there too (57 red at the base, 51 at the head).
  #4120 has 7 of them. usage-ledger-open-settled (#4262) and
  usage-ledger-chart (#4263) are newly filed.

Rebased again on 9f36d768d, which changed app.js elsewhere. At this
head: usage-cards-hide, i18n-keys, usage-arrange, panel-arrange,
key-balance-card and usage-shared-balance on the Linux box, 72 of 72
pass. On mote, go test -run 'TestUsageArrange|TestSettingsSave'
./internal/gui: ok.

Not tried: a real StepFun account in the real app. The fixture is a
StepFun plan card with its key's balance plus a balance-only card. Not
run on Windows.
2026-10-29 18:52:05 +08:00
yetone 1801c96bfb warm-up: Warm up now sends one account its warm-up at once (Codex and Claude)
A Windows user on Discord asked for a manual warm-up of a Codex account.
Settings > Warm-up and check-in now ends both the ChatGPT and the Claude
tab with a "Warm up now" row. Its text button sends the account's warm-up
right away. With one account it sends straight off. With several it opens
the app menu ("Warm up which account"), not a select. The row then says
"Warmed up {who} {when}", or "Couldn't warm up {who}: {why}" in red, and
the status line says the same.

What is sent: provider.WarmNow(agent, user) sends the scheduled warm-up's
own request to that one account and to no other. For Codex that is
warmCodexLogin; for Claude it is warmClaudeLogin over the gateway's
warmClaude (Claude Code's run in that account's config directory), set
through WarmClaudeVia. It works whether the warm-ups are on or off. An
account whose sign-in lapsed is refused with the reason. Afterwards the
allowance is read again (StaleAllowance / claudeWarmedNow), as after a
scheduled warm-up. The schedule's file is left to the schedule. The
Codex prompt, identity and base_instructions are unchanged: it is the
same body. The route is POST /api/warm-now, and /api/settings carries
claudeUsers beside codexUsers.

Claude gets the item too. It shares the warm-up engine and the same tab,
and the send is the same warmClaude the schedule uses.

No size budget was raised.

Run:
- WSL (wsl-run), Chromium and WebKit, with the GUI test
  warm-now.test.cjs in en/zh/zh-TW/ja/de at 900px and 440px: 22/22.
  The pressed button stays in place within 1px after two frames.
- WSL, the related files (warm-now, warm-at-own, warm-at-times,
  warm-reset-asleep, settings-groups, settings-search, i18n-keys):
  102/102.
- WSL, the other files that touch these lists (checkin-account,
  checkin-reason, checkin-reason-once, plugin-checkin, segs-press-redraw,
  settings-sections, usage-checkin): 169/170. The red is segs-press-redraw
  "webkit ja 440px: every Settings option..." with "could not bring the
  option into view" after 103s under load. It passed 3/3 alone and is
  filed as #4189.
- mote (macOS) at the final tree: go vet for internal/gui, provider and
  gateway; go test -run 'WarmNow|Budget|Warm' ./internal/gui
  ./internal/provider: ok. An earlier mote run, before the route move,
  ran go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./..., go build ./... and the budget tests: ok.
- Windows (win-run): go test -run 'TestWarmNow|TestCodexWarm|TestClaudeWarm'
  ./internal/provider/ ./internal/gui/: ok.
- WSL: go vet -tags nogui ./... is ok and gofmt -l is empty.
  go test -tags nogui -timeout 45m ./...: 75 packages ok, including
  internal/gui and internal/provider. internal/agent has 4 reds on the WSL
  box (TestInstalledVersion, TestGrokInstalled,
  TestCursorFolderFromTheEditorIsNotTheCLI, TestOmpDetectedWithPiDir). They
  are already filed as #4033 and #3548 (fake binaries hit WSL interop).
  internal/gateway has 1 red, TestUnroutedRequestShownThenAnswered: giveUp
  answers the 504 before it marks the route done. That is not this change,
  and it is filed as #4200.

At the head rebased on origin/main 9474eaf9c:
- mote: gofmt -l is empty. go vet passes for gui, provider and gateway,
  and GOOS=windows go vet passes for gui and provider. go test -run
  'WarmNow|Budget|Warm|I18n' ./internal/gui ./internal/provider: ok.
- WSL: warm-now, i18n-keys and warm-at-own GUI tests: 44/44.

Broken by hand (each was red, then restored and checked with cmp):
- WarmNow swallowing the Codex error: TestWarmNowSendsTheScheduledWarmUp
  went red on the refused request.
- Running Claude in ls[0]'s directory: TestWarmNowClaudeRunsClaudeCode
  went red.
- Dropping the lapsed check: TestWarmNowLapsedAccount went red.
- The menu always sending users[0]: warm-now.test.cjs went red (timed
  out) in both engines.

Not tried:
- A warm-up of a real account. The request-equality test compares
  against the scheduled warm-up's request through a fake vendor.
- Breaking the request-equality check by changing the body itself.
- The GUI suite on macOS, because mote's browsers hang (#4125).
2026-10-29 15:39:31 +08:00
yetone b4267de595 gateway: a provider's fallback can be a routing group, routed as the group
01huadalang on Discord: "还有备用模型增加路由组的选择,现在只能选模型". A
provider's Fallback list held models only; a "group/<id>" entry resolved
to the group's first member alone. Now such an entry is served through the
group, as a request to the group would be:

- plan → planPaused: a fallback naming a group (provider.FallbackGroup,
  the group as routed, Live) hands its members to planLevel
  (planFallbackGroup): the group's own routing, its sink and asides, and
  its pause rules (serve passes provider.PausedOut for the agent's folder).
  Its trace rows are marked Fallback with the group in Via.
- No loop, each provider/model once a round: a member that is the primary,
  a model named earlier, or another fallback group's member is left out
  where it comes second. Groups have no fallbacks of their own and a
  member's fallbacks are not followed, so nothing leads back. A group that
  is gone or off is passed over, as a model none serves is.
- Every sibling that reads p.Fallback now reads a group's members through
  provider.FallbackModels: redaction (unredactedRoute: an unmasked
  provider with a fallback group holding a remote model is masked),
  careful accounts (carefulOf), native compaction, Codex's own turns
  (codexFallsBack) and Claude's auto-mode review (claudeReviewed, which
  moves from provider.Resolve to ResolveRoute, as the gateway reads
  fallbacks).
- CLI: `magpie provider fallback` already took group/<id> (Resolve knows
  groups); its usage and error now say so. Pinned by
  TestFallbackCmdTakesGroup.
- GUI: the provider editor's Fallback picker lists the routing groups
  (providers.gateway.groups) beside the models as chips with the Routing
  fan and a muted "routing group" tell; a picked group's row has the same
  fan and tell, and a gone one says "No routing group {id} now; it is
  skipped". A filter matches a group's name, id and its members'
  providers. New strings in zh, zh-TW, ja and de.
- app.js budget raised 187 bytes on main (1,311,922; core 1,531,060), the core's
  own editor, no room added; the addition was cut from ~900 bytes first.
- docs/subsystems/gateway-routing.md: the Candidates row says all this.

Not done: a fallback group's turn rules (ruleFor/ruleOver, which can ask
a classifier) are not applied. The plan is made before the primary is
tried, so they would cost a classifier call on every request the primary
answers. Its routing order, sink and pause rules are applied.

Run (at f6e7214af; after the rebase, the last bullet):
- gofmt -l: clean. mote: go build ./...; go vet on the touched packages;
  GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...: ok.
- mote: go test -timeout 45m ./...: every package ok except internal/gui:
  TestCoreScriptBudget (fixed above, then ok) and ten AppKit window tests
  (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt, TestMainWindowCorners
  …) killed at their 30s bars while four other sessions' GUI suites held
  mote at load 70-110. Run alone, all ten
  pass (TestDockJoinLeadsCommandTab skips) except TestMainWindowCorners,
  red at base f6e7214af too (#3949); the load kills are #2645.
- GUI: the whole suite (962 files, node --test --test-concurrency=8) on the
  Linux box (WSL magpie-desktop, chromium + webkit): 14,217
  tests, 305 red in 99 files. Those 99 files rerun at base f6e7214af: 156
  red; at this head: 159; the ~20 that differ either way are flakes (the
  head-only ones, key-replace and vertex-editor, rerun twice on each: the
  same reds at base). Filed as #4120.
  fallback-group.test.cjs (new), fallback-more and i18n-keys: ok in
  chromium and webkit on mote and on Linux.
  After the app.js cut, at the final head: the three files 12 of 12 on
  Linux; webkit ok on mote, chromium there failed only at browser launch
  under load.
- Broken by hand, each red, then restored:
  - the group branch in planPaused off: all five gateway group tests red
    (TestFallbackToGroupServedByMember is red on the old code: only the
    first member was tried).
  - the dedup off: TestFallbackGroupWithThePrimaryTriesItOnce and
    TestFallbackGroupSharedModelTriedOnce red.
  - the pause filter off: TestFallbackGroupPauseHolds red.
  - redact.go from origin/main: TestFallbackGroupKeepsMasking red.
  - the GUI's group list off: fallback-group.test.cjs red in all four
    (chromium/webkit × en/zh).
- After the rebase onto 0daf36332 (18 commits, gateway.go among them;
  the budget test conflicted, kept main's and measured again): gofmt -l
  clean; mote: go build ./..., vet of the touched packages, linux and
  windows vet ok; go test internal/provider, internal/cli, internal/agent
  ok, and internal/gateway and internal/gui -run with Fallback, Redact,
  Unredacted, Careful, Compaction, CodexFalls, Budget, Rest and Probe ok; fallback-group, fallback-more, i18n-keys
  and rest-probed 52 of 52 on Linux.

Not tried: a real request through a real group fallback with real
accounts (the tests use fake upstreams); the Windows GUI; the TUI has no
fallback editor.
2026-10-29 05:19:28 +08:00
yetone f004072007 agents: More in Plugins is in sight with Install another agent folded
The owner: 插件中还有更多,不应该折叠在安装更多Agent里. e8e9245ec put the
row naming the agents Plugins has at the end of Install another agent,
inside its fold, so with the commands folded (as they are once any agent
is here) nobody saw it. It now follows the section whether that is
folded or open, 6px under the header; the header counts the install
commands only, and with no command left the row stands alone with no
header over it.

Budgets: app.js 1,311,735 and the core 1,530,861 (+54 each), no room
added.

Run at this head (rebased on ddf31ca30), on mote:
- agent-plugin-agents, agent-cli-missing, agent-prefs, agent-stale-copies,
  agent-tweak-fold, agent-unreachable, agent-update-all,
  agent-visibility-saving, click-scroll, page-width, page-width-steady,
  i18n-keys, one file at a time, both engines and the files' languages:
  294 of 297, the 3 reds a chromium launch timing out at 180s and one
  zh-TW 420 click waiting for the header under load 95; those two files
  run again alone: 54 of 54.
- An earlier run of every agent-* file plus those, 4 at a time at load
  100, timed out in 36 places across the files above; the run above is
  the record.
- go test ./internal/gui -run Budget: ok.
Broken by hand: with the row back inside the fold,
agent-plugin-agents goes red in every language and width.
Not tried: the real app on Windows and Linux.
2026-10-29 03:44:36 +08:00
yetone 89f3865efa about: the Version row and the title bar hold still while the update's state comes in (#4057)
#4057 lists four jumps on Settings › About and the title bar. Each was
reproduced in Chromium and WebKit (update-row-steady.test.cjs) before
the fix:

1. Opened cold (no state read yet), the Version row drew with no line
   under its name, 48px, and grew to 60px when the read came in. The
   line is now kept, empty (a no-break space), until the answer.
2. Opened with a state read long ago, the row drew it first: "Up to
   date" and Check, then "0.1.x is downloaded" a moment later. A state
   is drawn early only when read in the last 30s (#3469's case, a row
   drawn again within Settings, still is); an older one may be old
   news, so the line waits empty for the answer.
3. The header's Update pill showing pushed the Settings search in the
   title bar beside the sidebar ~80px left in one frame, through the
   ResizeObserver that sets --tools-r. The pill now opens from nothing
   (max-width and padding from 0 in update-in), so the search slides
   over with it during the pill's .45s entrance instead. It still ends
   ~80px left: the pill needs the room, and holding it empty for a pill
   that is usually not there would take it from the title.
4. Not changed: a failed download's reason still wraps (sub.wraps).
   It is a new state, not a flicker, and the reason is shown in full on
   purpose: the network case says what to do (Click Check, or the
   release page), which a one-line cut would hide. A Check from there
   keeps the class until its answer, so the row doesn't shrink and grow
   on each try.

No new strings. app.js grows 26 bytes over origin/main 11cbf4de1,
which had filled its budget to the byte; it fits TestCoreScriptBudget
with renderUpdate's doc comment shortened and u.at set with ??= instead
of a guard. No budget raised.

Run on mote (macOS 27), at this tree:
- update-row-steady.test.cjs, both engines, en and zh: 14 of 14 pass.
- The same file over the old app.js/app.css: every case red in both
  engines. Cold: "the row is 60.28125px with its answer; 21 of 22
  frames drew it otherwise". Stale: '"Up to date", a minute old, was
  drawn in 21 of 22 frames'. Pill: "the search moved 79px in the pill's
  first frame" (zh 61px).
- go test -run Budget ./internal/gui: ok.
- go test -run Budget ./internal/gui at this head: ok. The update
  tests of the commit before (internal/gui, internal/update) at the
  rebased tree: ok.
- update-*, about-* and models-fold at this head, both engines: 318
  of 320. The two reds are models-fold webkit en/zh "the click
  scrolled" ('0 ebody holds:289'), red the same alone at origin/main
  11cbf4de1 (#4071).
- The whole GUI suite (953 files, both engines, --test-concurrency=4)
  at 1b01e7e4f, this change on 56d26f0bb, mote at load ~40: 13908 of
  14019, 111 reds in 29 files, none in a file this change touches.
  The 29 files rerun at concurrency 2 at that head and at origin/main
  11cbf4de1 gave 93 and 89 reds, in the same files. Each red file has
  its issue: gateway-key-models #4081, header-centre #3479, key-replace
  #3476, library-row-remove #3099, menu-input-scroll #3402, mobile-web
  #3952, rest-try-now #2564, routing-many-keys #4082, routing-row-swap
  #3799, routing-rule-drag #3789, routing-rule-remove #3094/#3096,
  routing-rules-line #3593, routing-steady #3412, routing-story-shrinks
  #3954, s3-sync #3413/#2448, search-first #3795, usage-agents-hide
  #3414, usage-ledger #1876, models-fold #4071, quota-count-wrap #3404,
  model-suffix-own #1671, signin-closes-sheet #2628,
  signin-paste-import #4035, key-import #4086, revoked-signin-account
  #4083, search-instead #4084, signin-paste-codex #4085. i18n-keys'
  red (#4053, since fixed on main) passes at the rebased tree, and
  quota-count-wrap passed there too.

Not tried: the real Linux app under WebKitGTK (the entrance animates
max-width, a layout change, no compositing); the whole GUI suite again
at the rebased head after the 23-byte trim (budget, update-*, about-*
were rerun there).
2026-10-28 23:22:14 +08:00
yetone 96115018cf gateway: a key's Limit and Models keep their room unhovered (#4072)
f835bd713 gave the Gateway page's key list the Providers keys list's
class (.accts.keys), whose rules squeeze Models, Limit and the quiet
words to no width until the row is hovered. On the Gateway page that
left Limit at 0px wide: Playwright called it "not visible", and a real
row reflowed sideways under the pointer. The list is .accts.gw-keys
only now; narrow, the masked key gives up its room first (flex 0 6,
ellipsis, 3em at least) before the key's name does.

Tests brought up to the redesign:
- gateway-older and web-page waited on #gateway .dot, gone since
  f835bd713; they wait on the mark (#gateway > .gw-mark).
- gateway-key-limit's window is 560 tall, not 420: in webkit the limit
  editor ended at 462px, so Playwright's own check() scrolled the box
  into view and the test read that as "Cancel moved the page".

Run at this head on mote (both engines, en+zh where the files have it):
gateway-*.test.cjs (all 26), web-page, api-key-theme, click-scroll,
i18n-keys: all pass except the 560-wide reads right after a resize
that are already filed (#3523 key-limit, #3797 caller-keys, and
key-models' same check). go test ./internal/gui -run Budget: ok.
Broken by hand: with the keys class put back, gateway-key-cycle and
gateway-key-limit go red on "element is not visible".
Not tried: the real app on Windows and Linux.
2026-10-28 22:55:23 +08:00
yetone 11cbf4de1d usage: Sessions' agent filter is a menu, as the model and folder ones beside it
The owner (10-28, screenshot of Usage › Sessions with 13 agents in a strip
across the page): "这应该是个 Combo Box". The agent filter was a segmented
strip, one segment per agent in range, that scrolled sideways in itself
once it ran past the window (#929). It is now the same sessPick button
as 全部模型 and 全部文件夹, with the same searchable menu: "All agents",
then every agent with sessions or usage in the range, the most used
first, each with its tokens under the other two filters. One agent in
range still leaves it hidden; the pick still resets to All when its agent
leaves the range. The request ledger's agent filter was already this menu.

#sessAgent left the CSS rules for scrolling strips; the strip's own test
(sess-agent-strip, #929's sideways scroll) is gone with the strip, and
usage-sessions-agents-fit now checks the menu: no sideways scroll at 860
and 560 wide, the three filters on one line inside the window, the
menu's order, search, a pick shown on the button and kept when the page
is drawn again, All clearing it, one agent hidden. sessions-empty-range
and sessions-overview-once pick their agent from the menu.

Run on mote (node 22, Playwright 1.62.0):
- usage-sessions-agents-fit, sessions-empty-range, sessions-overview-once:
  24 of 24, Chromium and WebKit, every language they cover.
- usage-sessions-agents-fit against origin/main's page.js, client.js and
  app.css: red in all four (BUTTON.sess-pick expected, a div of segments).
- go test -tags nogui -run Budget ./internal/gui: ok.
- 122 other GUI files that touch Usage, sess-pick or i18n, concurrency 3,
  beside another session's full GUI suite (load 36-75): 1944 pass, 24
  fail in gateway-caller-keys, gateway-key-cycle, i18n-keys,
  mcp-oauth-app, usage-ledger and web-page. Rerun alone at concurrency
  1 on this tree and on origin/main (d4f1d6480, then c4972b36e after the
  rebase): the same reds on both. gateway-key-cycle is #4072,
  gateway-caller-keys #3797, usage-ledger's "newest live route" #4078,
  web-page's #gateway .dot #4079. i18n-keys' "masking…" was fixed on
  main in 174250b27. mcp-oauth-app passes alone on both.
- At this tree, rebased onto 6ecc65b6d (the pushed tree):
  usage-sessions-agents-fit, sessions-empty-range,
  sessions-overview-once, i18n-keys and click-scroll 50 of 50, and
  go test -tags nogui -run Budget ./internal/gui ok.
Not run: the whole GUI suite (another session's was running on mote).
2026-10-28 22:52:30 +08:00
yetone 2ff85f8a2b gui: a page's bar room comes out of its right padding, so both sides match
v0.1.1904 had every page keep its scrollbar's room, so nothing moves
when a page grows past the window. The owner asked whether the clear
bar now makes the sides uneven: it did, by the bar's width (8px on the
Mac, 10px on Windows and Linux), and the centred pages sat 4px to the
left.

layout.js measures the bar of a .view into --bar (again on resize, so
a text-size zoom is followed), and app.css takes it from each page's
right padding: the panel's 12px, the window's 16px, the centred pages'
max(16px, 50% - 600px) and the phone web's safe-area right. The heads
and strips that reach over the padding (Library's and Settings' sticky
heads, Providers' after-list fade, the masking record's bar) reach that
much less on the right, or they would run the page sideways. A plugin's
page, whose frame scrolls itself, shows a bar only when it needs one.

layout.js's measuring adds 254 bytes to the core's scripts; the budget is
raised by exactly that, with no room added.

page-width-steady.test.cjs now checks every page's left gap against its
right gap with the bar (chromium and webkit, the Mac's 8px bar and the
10px one, 1100 and 1600 wide) and that no page scrolls sideways; that
check found Providers' after-list fade running 4px past the page. With
v0.1.1904's CSS it is red ("agents: 16px on the left, 24px on the
right (bar 8px)", 26px with the 10px bar, 94/102 centred). page-width's
"centred" check compared paddings only, and now counts the bar too.

Run on mote at this head (f70cb6825's tree, on origin/main 174250b27):
page-width-steady, page-width, inner-scroll-contain, settings-tabs-stick,
library-all, agent-layout, i18n-keys, text-size, view-scrollbar: 168 of
168 pass; go test ./internal/gui -run Budget ok. Before the last rebase,
209 GUI files that reach pages, heads, panels, providers, masking,
library, settings and the gateway (3087 tests) had 29 reds; the same
files on origin/main d4f1d6480 had the same ones, apart from flakes:
gateway-key-limit and gateway-key-cycle (#4072, from f835bd713),
gateway-older (waits for #gateway .dot, which f835bd713 replaced; filed
with #4072's fix next), menu-input-scroll (#3402), header-centre webkit
(a ResizeObserver loop message, red on main too), account-mask chromium
zh, and gateway-caller-keys / gateway-key-models reading the page right
after a resize to 560 (#3523, #3797).
Not tried: the real Windows and Linux apps.
2026-10-28 22:44:22 +08:00
yetone e8e9245ecf agents: Install another agent says Plugins has more agents, and opens them
The owner, on the Agents page: 因为我们支持Agent插件了,这里是不是也应该
显示插件中有更多? Install another agent listed only the agents magpie has
an install command for; the agents a plugin adds were nowhere on that page.

- GET /api/plugins/agents names the suggested agent plugins (the market's
  kind "agent") not installed here. One installed but turned off, or
  pinned to a version, counts as installed: Plugins turns it on.
- Install another agent counts them in its header and ends with one row,
  "More in Plugins" with their names, as the Providers add sheet does for
  subscriptions. The row opens Plugins › Discover scrolled to its Agents,
  only while the click is fresh (scrollOnPurpose), on the section drawn
  last, since npm's answers draw it again.
- The list is fetched beside the install commands, not before them, so a
  slow market never holds the commands back. With no install command left,
  the section shows the plugins' row alone and no install note.
- Budgets: app.js 1,311,681 and the core 1,530,449 (+1,430 / +2,408 over main),
  the Agents page and Plugins page are the core's own, no room added.

Run at this tree, rebased on e2efbd357 (on mote):
- go test -tags nogui ./internal/gui -count=1: ok (budgets included);
  GOOS=linux and GOOS=windows go vet ./internal/gui: ok; gofmt -l: none.
- TestPluginAgentsNotInstalled: a fake registry with every kind, installed,
  turned-off and pinned agents; all installed gives [], never null.
- agent-plugin-agents.test.cjs: chromium and webkit, en zh zh-TW ja de,
  1100 and 420px: count, row order, words, tooltip, one line, name not cut,
  no sideways scroll, the click landing Agents at the top and staying.
- 69 GUI files that reach this (install section, Plugins Discover, strict
  fixtures, i18n), 1044 tests: 1033 pass. The reds were i18n-keys' #4053
  (fixed in the next commit) and mobile-web, whose copy had no .git for
  origin/main; run again with one fetched (d4f1d64): 30/30.

Broken by hand: main's assets under the new GUI test, 11/11 red; the
scroll line taken out, 11/11 red (webkit); the Go installed filter taken
out, TestPluginAgentsNotInstalled red.

Not run: the whole GUI suite (mote was busy with other sessions' suites),
and the real app with the live market.
2026-10-28 22:34:52 +08:00
yetone b586fdf1eb gui: every page keeps its scrollbar's room, so nothing opening in it narrows the page
The owner, on Agents: opening an agent's details ran the page past the
window, the scrollbar appeared, and the whole page went 8px narrower in
one frame (and back when it closed). Every page had this; only Usage
and Routing kept the bar's room (87d83e7ab).

- .view is overflow-y: scroll everywhere, so the bar's room is always
  kept. Its track is transparent (the app's own thin bar, 8px on the
  Mac, 10px on Windows and Linux), so a page that fits shows nothing
  there. The Usage/Routing rule it replaces is gone.
- A framed dialog's fields did the same on Windows and Linux; they keep
  the 10px too, out of their right padding, as the Mac's already did.
- Between 601 and 640px the agent row's start-model picker is 184px,
  not 196px, so the name keeps the 150px agent-layout holds it to.

Test: page-width-steady, both engines, Mac's bar and Windows' bar:
every page this fixture opens (>= 8) grown past the window keeps its
width, and so does a framed dialog's body; an agent's details opened
past the window move its row by 0px, in all five languages.

Run on mote at this head (29181eb78 + this): page-width-steady,
agent-layout, heatmap-scrollbar, routing-ctx-still 40 of 40; go test
-run Budget ./internal/gui ok. Before the last rebase, 49 GUI files
that measure widths or scrollbars (panel-*, gui-* languages and
others), both engines: 593 of 600; the reds were agent-layout webkit
en at 601px (fixed above, then 24 of 24) and usage-ledger's "newest
live route" in both engines, red the same on the base (#3104).

Broken by hand: the old app.css with the new test is red in all 16
(8px narrower on the Mac, 10px with Windows' bar); without only the
dialog rule, the two Windows cases are red (fields 10px narrower).

Not tried: the whole GUI suite (mote is running another session's;
it runs after this push), and the real Windows and Linux apps.
2026-10-28 21:26:37 +08:00
yetone 012c584cc1 usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one
model's, to measure a local model fresh after deploying it.

The Usage page's Models list has a "…" on each row (and a right-click
menu) with "Clear usage…", and "Clear all usage…" sits under the lists
below the "Counted from…" note. Each asks first, in a confirmation that
says what is deleted, that it can't be undone, and that key spending
limits and allowances still count the calls.

A clear is a mark in settings (usageCleared: provider, model, unix ms),
read at read time; usage.jsonl is never rewritten. The Overview hides
calls up to the mark in summarizeFrom; the Requests page, heatmap and
ledger/CSV hide them in Filter.keepsRow, their one choke point, and the
request index's meta carries the marks so its cache is dropped. Key
budgets, window holds and Codex reads go through usage.Visit and the raw
log, so a clear never resets a key's spending limit or a quota. A later
clear of the same model or of everything takes the place of an earlier
one. The marks ride the settings part of a sync (sync-backup.md) and a
save of the Settings page keeps them (api.go's keep list; the guard
test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing).
gateway-sessions.md and sync-backup.md say so.

Run on mote (mote-run) at this tree, rebased on origin/main c26b2992e
(the Go packages and usage-clear.test.cjs; vet and the 68 GUI files
ran at the earlier base f835bd713, four commits behind):
- go test -tags nogui -timeout 45m ./internal/usage ./internal/settings
  ./internal/usageapi ./internal/gui: all ok after the
  keep-list fix (before it, TestSettingsSaveKeepsWhatItDoesNotSend red).
- gofmt -l: clean. GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: exit 0. (Linux vet without nogui fails in
  wails' cgo, as on main.)
- usage-clear.test.cjs: 32/32 in Chromium and WebKit, en/zh/zh-TW/ja/de,
  at 1200, 560 and 390 (web). With the old page.js/client.js/i18n.js it
  fails (TimeoutError).
- 68 GUI files the change can reach (every usage-*, gui-de/ja/zh-tw,
  i18n-keys, click-scroll, idle-ticks, mobile-web, panel-usage,
  sessions-purge): 941/980. The reds are filed and red on main
  (usage-ledger run alone at origin/main 84a6a2c42 too): i18n-keys "masking…" (#4053), mobile-web
  (#3952), usage-agents-hide (#2276, #3414), usage-ledger "newest live
  route needs no return-to-live button" (#3104, run alone at main too).
  i18n-keys first also named "Clear usage…" in Go comments of this
  change; reworded.
Broken by hand, each red: hides() always false (usage and gui tests),
keepsRow's clear check removed ("Requests after the clear: 5 rows"),
clearedKey out of the request meta ("after clearing everything: 3"),
the api.go keep line removed (UsageCleared [] after a save).

Not tried: the full go ./... suite and the whole GUI suite (mote was
busy with other sessions' full suites), the real app, a sync between
two computers. usage.jsonl doesn't shrink, and the Sessions tab's
figures are not cleared.
2026-10-28 21:13:09 +08:00
yetone f835bd713d gui: the Gateway page is one compact card, shares on the network from itself, and a key's copy sits by the key
The owner on the Gateway page: "一点都不精致、优雅", the key row's copy
button "很奇怪的位置,太突兀了", the gateway icon ugly, Connect should
start folded, and "Share on local network" should be picked on this page
with the LAN addresses shown. Agreed on a canvas first.

- The status row has the sidebar's server glyph in a 28px tile with two
  lights (green running, amber not), the state beside it and the fix
  button at the right. The address pill left the row.
- Under it, in the same card: Share on local network as This computer /
  Local network segments (settings/lan, as Settings does), and every
  address the gateway answers on, each with its own copy: this computer
  (or the public address on the web), then the LAN addresses, or a line
  saying there are none. Settings' container note comes from the same
  lanShown(). The "open LAN settings" button is gone.
- A key's row: its copy right after the masked key; Rotate key and
  Remove moved into a "…" (Key actions) row menu at the end.
- Connect starts folded; opening it is remembered
  (magpie.gwConnectFolded).
- At narrow widths the status row wraps and the address list is a
  label/value grid, so no language overflows at 420px.

Tests: new gateway-card (5 languages x 1100/420 x chromium/webkit): the
lights, Connect folded, sharing from the card with every address and a
copy of a LAN one, no scroll, the copy within 6px of the key, the … last
with its menu, nothing overflowing, no left borders. Tests that used
Connect open now open it; Rotate/Remove go through the menu
(fixtures' keyAction).

Run on mote, at the tree before the last rebase (51e3169fb + this):
gateway-card 52 of 52 over both engines; every GUI file this touches
in both engines green except gateway-caller-keys' webkit en 560px
overflow, red 3 of 3 at the base too (#3797). go test ./internal/gui:
budgets ok; TestMainWindowCorners/macOS_26_SDK red on mote's macOS 27
alone (#3949). At this head (0dc4cec85 + this; main touched no GUI
file since): gateway-card, gateway-fold, gateway-caller-keys 26 of 26,
go test -run Budget ./internal/gui ok.

Broken by hand: the copy moved after the spacer -> "the copy follows
the masked key" red; the fold default put back -> gateway-card and
gateway-fold red; the LAN addresses not rendered -> gateway-card times
out.

Screenshots looked at: zh 1100 and de 420, shared.

Not tried yet: the whole GUI suite (mote was busy with another
session's; it runs after this push), and the real Linux/Windows apps;
the change is CSS and DOM in a page the GUI suite loads as the app does.
2026-10-28 20:46:38 +08:00
yetone 33af28ed6b gui: the add sheet's Partners heading lights once an opening
The owner asked for an elegant light on the Partners heading each time
Add provider takes the view to the sheet, and picked the traced outline
of three drafts. A 1px hairline (a conic gradient on an animated
@property angle, masked to the border) runs once round the heading's
words over 1.8s and fades, over a faint wash of the accent; it follows
--accent, so it reads in both themes, and keeps to the heading's own
padding box, inside the sheet.

It plays when the heading is fully in view (an IntersectionObserver on
the providers view), once per opening of the sheet: a search or a reload
drawing the sheet again doesn't play it, closing and opening it does
(partnersShone, reset where partnersCounted is). With the system's
reduced motion or Settings' Reduce motion (#3813, calm() and holdStill)
it isn't drawn. The outline's elements are <i>, so the heading's hint
stays its only span, which the add-sheet and partners tests read.

The core's scripts are 1,528,076 bytes, their budget raised to it with
no room added; app.js stays under its own.

Run at this head, on mote: TestCoreScriptBudget ok; the 59 GUI files
that open the add sheet (grep addProvider|#addSheet) and
reduce-motion and settings-general, chromium and webkit: 826 of 826 ok
(at --test-concurrency=2; at 4, on mote at load ~230 from other runs,
8 chromium sign-in cases timed out at 5s and passed 28 of 28 alone).
add-partners-shine.test.cjs: en zh ja de at 900 and 440px, lit once on
open, not again after a search, again after close and reopen, the
outline round the words and inside the sheet, none under either reduced
motion.
Broken by hand: without the partnersShone check every redraw lights it
again, and the test is red in all 8 language/width cases.
Not run: the whole GUI suite (the change adds no API call and its
classes are scoped to the add sheet's heading); not seen on Windows'
WebView2 or WebKitGTK, where @property and mask-composite are supported
but the motion wasn't watched.
2026-10-28 17:52:16 +08:00
yetone be0fbfe08d gui: a menu with nothing to tick keeps no tick column in Safari 15.0 too (#4020)
v0.1.1855's old-webkit check failed on app.css's
`.proto-menu:not(:has(.on, [role=menuitemcheckbox])) .pm-tick` rule:
:has() is Safari 15.4+, so on macOS 12's Safari 15.0 the whole rule is
dropped and every plain menu kept an empty tick column. openProtoMenu
and the sessions combo's draw() now set .pm-bare on the box when no
item is on or a checkbox, and the CSS hides .pm-tick under it. The
three commits before this one dedupe app.js to make the room; the core
script budget is not raised.

Run at the pushed head (this commit + the old-webkit test fix after it,
on aca0f0d8a), on mote at load ~150:
- go test -run 'TestCoreScriptBudget|TestAppScriptBudget' ./internal/gui: ok
- node --test old-webkit, signin-paste-import, menu-scroll,
  proto-menu-overflow, sessions-convert, account-cap, window-cap,
  warm-at-own, model-price-edit, signin-close: 152 pass, 0 fail
One rebase earlier (on eb6d1d8d9), also: sess-agent-strip, purpose-filter,
side-effort, signin-paste-key, signin-proxy, copilot-ghe,
plugin-other-ways, zcode-site-layout, settings-groups, settings-search,
pool-ends, routing-held-member: pass; signin-paste-import's no-address
cancel timed out once at load 163 and passed 3 of 3 alone (#4035).

Red on clean origin/main e23ddddd5 too, not from this change:
menu-input-scroll (#3402) and gateway-key-models webkit en (#2648).
Not tried: a real macOS 12 Safari 15.0; old-webkit's checks stand in.
2026-10-28 17:22:10 +08:00
yetone a1f06bd780 gui: a browser tab offers the fonts of the computer it runs on (Norcleeh)
Norcleeh (Discord #general): magpie in Docker, used through the web GUI,
Settings' font menu doesn't list the fonts he installed on his own
computer; the app does. Cause, confirmed in the code: a tab's list is
/api/fonts, the server's families (none in a nogui build such as Docker)
plus commonFamilies, filtered by what the browser draws. A family that
is only on the browser's computer was never offered, and a choice the
server doesn't list was dropped by desktopFonts.available.

Now (webfonts.js, which only a browser tab loads; the app's windows are
unchanged):
- Where the Local Font Access API is (Chromium on https or localhost),
  the press that opens a family menu calls queryLocalFonts() once a
  page, and at load when the local-fonts permission is already given.
  The families join the list with their real styles ("SemiBold
  Condensed Italic" -> weight 600, 75%, italic).
- Elsewhere (Safari, Firefox, a plain-http LAN address, a refused
  permission) the menu's search says "Search or type a font name…" and
  offers Use "name" for a family the list lacks, enabled when the canvas
  probe says this browser draws it, greyed with "This browser can't find
  this font" when not; Enter takes it.
- A chosen family the server doesn't list stays in the tab's list on
  later loads while the browser draws it, so it keeps being applied.
- The app's menu (openProtoMenu), never a <select>. Strings in zh,
  zh-TW, ja and de. docs/subsystems/gui-shell.md says so.
Budget: no raise. here() moved out of fonts.js into webfonts.js, which
isn't a core script: loadFonts import()s it in a tab only (the page has
no CSP). The core is 106 bytes smaller than origin/main's.

Run (mote-run). At this head on e8c7dddcb: gofmt, go build ./... and
-tags nogui, go test -run 'Font|Budget|Boot|Asset' ./internal/gui
./internal/fonts ok; fonts, i18n-keys, web-page, settings-general,
inner-scroll-contain 114/114. Earlier, on 6af83172d (with a <script>
loader in place of the import):
- fonts, font-cascade, win-fonts, i18n-keys, settings-* (10 files),
  text-size, web-page, web-app-standalone, mobile-web, gui-de, gui-ja,
  gui-zh-tw, menu-scroll, omarchy, proto-menu-overflow: 311 tests
  before the rebase, 300 ok. Red: mobile-web's 8 "desktop
  matches origin/main" subtests (they read origin/main through git, and
  a mote-run copy has no .git), and settings-lines-wrap webkit zh 440px
  (a Models tab press timing out at 8s under load). At the rebased
  head: fonts, i18n-keys, settings-general, web-page,
  settings-lines-wrap: fonts' WebKit half and a lines-wrap zh-TW press
  timed out at mote load ~210 (the box then rebooted); rerun at load
  ~14, fonts WebKit 21/21 and settings-lines-wrap 20/20, the rest of the
  first run ok. The 8s press is filed as #4026.
- New tests in fonts.test.cjs, Chromium and WebKit, en and zh, 1000px
  and 440px: "a browser tab lists the fonts of the computer it runs on"
  (queryLocalFonts stubbed: not asked before the press, asked once in
  it, families and real styles offered, applied, no settings POST) and
  "a browser tab takes a typed font when the API is missing/refused".
  All 16 red on origin/main's assets (MAGPIE_FONT_ASSETS): this
  computer's families not offered, the search not taking a name.
- Broken by hand: merge() without the tab's own chosen families: the
  typed tests go red at "kept across a reload, though the server lists
  no such font" in all 8 cases.
- go build ./... and -tags nogui, gofmt -l, GOOS=linux go vet -tags
  nogui ./internal/gui, GOOS=windows go vet ./internal/gui ok; go test
  -tags nogui -run 'Font|Budget|Boot|Asset' ./internal/gui
  ./internal/fonts ok.
- Real use on mote: a nogui `magpie web` in a sandbox HOME (server list
  57 common families). Chromium with local-fonts granted: 204 families,
  185 only on this Mac; Baskerville picked, drawn, kept across a reload.
  WebKit (no API): typed Didot, offered and taken, kept across a reload.

Not tried: Chromium's real permission prompt (Playwright grants it),
Firefox, a browser on another computer than magpie's, a Docker image
run, the full Go suite (no Go change).
2026-10-28 16:55:01 +08:00
yetone e8c7dddcb4 notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs
alpha.11 compiles Intl's data in, which carries its own notices).
THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and
handed to internal/notices; `magpie licenses` prints it, GET /api/notices
serves it, and Settings › About has an Open-source licenses row that
opens it in a dialog, in every language. `make app` copies the file into
the .app's Resources too. The core's scripts are 1,527,245 bytes, their
budget raised to it with no room added; app.js stays under its own.

Run at this head (rebased on origin/main):
- win-run (Windows 11): go vet -tags nogui . ./internal/notices
  ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli,
  TestCoreScriptBudget (./internal/gui): ok.
- wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags
  nogui: ok.
Run at the pre-rebase head 14e2d13fb, on mote (macOS):
- gofmt; make app's copy byte-identical to the file; `magpie licenses`
  output equal to the file; GOOS=linux/windows vet and build;
  go test . ./internal/cli: ok. ./internal/gui: only
  TestMainWindowCorners red, the same on origin/main (#3949).
- about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100
  and 420px: all ok.
Broken by hand: TestNoticesFollowMoejs red with the embedded file cut.
Not run: the GUI suite at this head. The rebase met main's cancelAsk
helper where showNotices sat, and the dialog's Done now uses it (the
same stopPropagation + closeConfirmAsk). The whole GUI suite at
14e2d13fb was cut off when mote went down at load ~50: the files it
reached outside About had reds, most of them 180s browser-launch
timeouts, the rest passing in other languages or the other engine; they
are run again once mote is back, and any that stay red are filed.
2026-10-28 16:40:03 +08:00
yetoneandJoeyWu-tech 63aca1802e gui: PenguinHarness's logo is a tile, and the app's own icons are no logos (#3858)
icon-tile was red on main: PenguinHarness's logo (3fd7e1698) is solid
to its edges but app.css's tile rule didn't name it, so it was drawn a
size bigger than a line logo beside it. It now has its alphabetical
place in the rule. The test also measured apple-touch-icon.png and
icon-512.png, the app's own icons that manifest.json lists for a
phone's home screen, which no .ic ever draws; it now leaves
manifest.json's icons out.

Patch from Coffemon (JoeyWu-tech) on #3858, 70707eed, reviewed line by
line and taken as is.

What was run (mote, Playwright 1.62.0, at origin/main f02d92c7b):
- origin/main: icon-tile red ("apple-touch-icon is solid to its edges
  but not in app.css's tile rule").
- This change: icon-tile 3 runs, 3 of 3 each; mono-icon-redraw 5,
  models-add-and-icons 4 and agent-grip 10, all pass.
- Broken by hand: penguin-color out of the rule: red, "penguin-color is
  solid to its edges but not in app.css's tile rule"; the manifest
  filter out is main's red above.

Not tried: looked at by eye with PenguinHarness installed.

Co-authored-by: JoeyWu-tech <joey110551567@gmail.com>
2026-10-28 16:27:00 +08:00
yetone d74ef5e04c gui: an inner list wheeled to its end keeps the wheel; the page stays put
碳碳双键 (ysm119, Discord): wheeling the Usage page's request list to its
top or bottom carried on into the whole page, and "this happens in many
places". It is the class: every box that scrolls inside a scrolling page.

app.js marks such a box `.holds` while it overflows vertically, on
pointerover and on each wheel (the box under the pointer and its
ancestors up to the .view), and app.css gives `:where(.holds)`
overscroll-behavior-y: contain, which keeps the Mac's bounce on the box.
Not one CSS rule for every overflow:auto box: in Chromium `contain` holds
the wheel even in a box that doesn't overflow, or is overflow:hidden, or
only scrolls sideways, so short lists and the heatmap's and ledger's
sideways scrollers would have stopped the page. The .view itself is never
marked. :where() weighs nothing, so .mchips in a short window
(@media max-height 640px, #833) still passes the wheel on.

The new test, inner-scroll-contain.test.cjs, wheels the Routing page's
requests list past each end (en and zh, 900x560 and 1300x600, under
"By session" / 未提供会话标识), and ten kinds of inner box, and asserts
the page's scrollTop didn't move. A short list, heat-scroll, led-wrap and
snip must still pass the wheel to the page. routing-scroll-end now wheels
over the page's gutter: at its view centre the pointer sat on the
requests' list, which now keeps the wheel at its end (600 of 1066).

Run (mote, Playwright 1.62, Chromium and WebKit):
- inner-scroll-contain 40/40.
- 17 files: inner-scroll-contain, click-scroll, routing-scroll-end,
  routing-sessions, view-wheel-after-click/-after-redraw/-unheard,
  heatmap-scrollbar, ledger-hscroll, ledger-hscroll-foot,
  context-scroll-end, menu-scroll, provider-levels-scroll, panel-usage,
  panel-routing, qoder-cn-tile, agent-disconnect: 268/287. Reds were
  routing-scroll-end (this change, fixed above) and panel-usage webkit zh
  (#3311, commented). Rerun of routing-scroll-end, panel-usage and
  inner-scroll-contain: 66/66.
- go test -tags nogui ./internal/gui ok (TestCoreScriptBudget passes at the rebased head:
  core under 1,526,556, app.js under 1,310,460; no budget raised).
Broken by hand: the old app.js and app.css: the requests list and every
held box red in both engines (mchips aside, it had contain already).
Only the CSS rule removed: red, "the page didn't move" x8 plus each held
box x2. Only the overflow check removed: a short rt-reqs red (Chromium),
led-wrap and snip red in both engines.
Not run: full GUI suite (mote was busy with another session's suite).
Not tried: WebKitGTK on Linux, WebView2 on Windows, a real Mac's
trackpad rubber band and momentum in the app, older macOS WKWebView,
touch; zh-TW/ja/de (no strings changed).
2026-10-28 14:54:09 +08:00
yetone 7323255b4e gui: the Windows app's confirmation backdrop goes without blur too (#3980)
Henry-916's change (the commit before) took the blur off the provider
editor's full-window backdrop in the Windows app, where WebView2 on an
Intel UHD D3D11 GPU stalled under it. The Remove/Sign out confirmation
(.action-confirm, a <dialog>) blurs the whole window behind it the same
way through ::backdrop, so it is scoped out by the same win/web rule.
modal-backdrop.test.cjs now shows that dialog and checks its ::backdrop.

Not changed: .pop, the panel's open profile chips and Settings' sticky
header blur too, but over a popover's or a header strip's area, not the
window's; nothing measured them as slow.

Run at this head (mote):
- node --test modal-backdrop: 24 of 24 ok. Broken by hand (the
  ::backdrop selector dropped): both Win32 desktop cases fail "nor the
  confirmation's".
- chromium: modal-backdrop, dialog-backdrop-drag, segment-press-dialog,
  gui-zh-tw, gui-ja, gui-de, i18n-keys, codex-signout,
  account-discovery: 93 ok, 0 fail. The same less modal-backdrop and
  i18n-keys with BROWSER=webkit: 37 ok, 0 fail.
- go test ./internal/gui: one red, TestMainWindowCorners/macOS_26_SDK on
  macOS 27, filed as #3949; nothing in it reads CSS.

Not tried: the real Windows app; the reporter measured the modal's
blur there (67 → 165 rAF callbacks a second).
2026-10-28 14:24:40 +08:00
Henry-916 824100f30f gui: keep Windows modal backdrops responsive without blur
Disable full-window modal backdrop filtering in Windows desktop windows
and tray panels, retaining the dimming veil. Browser pages and other
platforms keep their existing blur through the existing win/web markers.
Document the platform behavior in the GUI shell reference.

On an affected 0.1.1805 installation with WebView2 155.0.4283.62 and Intel
UHD D3D11, disabling the filter made provider tests visibly responsive.
The reporter confirmed the improvement. Scripted scrolling measured
roughly 67 to 165 rAF callbacks/s, not presented FPS.

Verification: modal-backdrop.test.cjs fails on the original CSS in both
Windows desktop Chromium cases (blur instead of none), with the other
10 cases passing. After the fix, 45 targeted tests pass across
Chromium and WebKit: modal-backdrop, dialog-backdrop-drag,
segment-press-dialog, gui-zh-tw, gui-ja and gui-de. node --check and
git diff --check pass. The full GUI suite, Go vet/build/test matrix and
native macOS/Linux tests were not run.
2026-10-28 14:24:40 +08:00
yetone 8b95f7c3a9 usage: a subscription's windows are grids of their own, not a rows subgrid (#3955)
Each quota window was a subgrid of three rows of .quota-windows, so the
bars of two windows side by side lined up when one's name wrapped. That
is the layout that crashed Safari 16's WebKit sizing the Routing
requests (#3731). Now each window is a grid of its own. fitQuota, which
already runs a frame after the windows' ResizeObserver to stack the
counts, also gives each window's names the height of the tallest beside
them. The subgrid left 9px between a bar and its reset line, not the
4px the CSS declares, in both engines; kept, so the card looks as it
did.

quota-window-rows (new) checks that no rule of the windows says
subgrid, and at 1100, 700, 390 and 1100 again, in both engines and
every language, that the bars of each row start at one y with a long
name wrapped beside a short one, that the names sit above the bar, and
that a reset line starts 13px under its bar's top.

Run on mote at this head (on 6e331afb4):
- quota-window-rows: 11/11. At origin/main's assets 10/11, only the
  subgrid check red, so the bars and spacing are the same. Broken by
  hand (no min-height): 10 of 11 red, bars at 391 and 377.
- The 90 quota-, panel-quota-, usage-, balance-parts, plugin-plan,
  account-mask and i18n-keys files: 1146 pass, 43 fail. The red files
  are red alone on origin/main too, the same counts: quota-count-wrap
  2 (#3404), quota-refresh-order 9 (#3679), usage-agents-hide 22
  (#3414), usage-ledger 6 (#1876). usage-overview-fold is flaky on
  both: 2 and 3 red on main, 3 and 5 here (#3947).
- node --check app.js: ok. go test -run Budget|Asset|CSS ./internal/gui:
  ok; TestCoreScriptBudget held without a raise (the addition was
  compacted to fit, 1526556 bytes or under).
- After that compaction: quota-window-rows and account-mask 15/15; all
  quota-* files plus i18n-keys 163 pass, 11 fail, the same
  quota-count-wrap and quota-refresh-order reds as above.

Not tried: a real Safari 16 (no macOS 13 machine).
2026-10-28 13:05:14 +08:00
yetone 7b63feb908 gui: a browser tab's font rows show on a nogui magpie, and Text size no longer flashes
Norcleeh (Discord #general, after v0.1.1788): in magpie's web GUI the
interface-font and code-font rows "flash once and disappear" on refresh.

Cause, reproduced on a real nogui `magpie web` on mote in Chromium and
WebKit, at 127.0.0.1, localhost and the LAN address: a nogui build
(Docker, magpie-cli) has fonts.Available false, so boot.js carried no
`fonts` flag and app.js never showed the font rows at all. What flashed
was the Text size row: index.html shows it, and renderSettings hid it
for a browser tab 40-120ms later (`#textSizeRow.hidden = web`).

Fix:
- A browser tab always gets the font rows. Its /api/fonts answers the
  server's families plus a common list (Arial, Menlo, Consolas, PingFang
  SC, Microsoft YaHei, Noto Sans CJK SC, JetBrains Mono, ...) and never
  errors for a tab; fonts.js keeps only what this browser can draw, and
  "System default" is always offered, so with nothing kept the rows still
  show with it.
- The app-only rows (Text size, tray, login, tray usage) carry
  .app-only, which `body.web .app-only` hides before first paint, so none
  of them paints in a tab.
- The boot `fonts` flag is gone. app.js and core both got smaller; no
  budget changed.
- docs/subsystems/gui-shell.md "Desktop fonts" says so.

Run (mote-run, at this head rebased on 98e23350f):
- go build ./... and -tags nogui; gofmt -l clean; GOOS=linux go vet
  -tags nogui ./internal/gui and GOOS=windows go vet ./internal/gui
  ./internal/fonts ok (at the pre-rebase head).
- go test -tags nogui -run 'Font|Budget|Boot' ./internal/gui
  ./internal/fonts ok (and with cgo before the rebase); the new
  TestBrowserTabFontsWithoutInstalledFonts covers nogui, a failed read
  and a merge with the server's own families.
- fonts, i18n-keys, settings-general, text-size, web-page: 76/76.
- Before the rebase, 20 files (fonts, font-cascade, win-fonts,
  login-allow, omarchy, settings-general/-search/-sections/-groups/
  -lines-wrap/-tabs-stick, text-size, tray-usages, web-page,
  web-app-standalone, gui-de, gui-ja, gui-zh-tw, i18n-keys) 259 tests,
  all ok but i18n-keys' "Runs as" (#3897, green now on main).
- Whole GUI suite before the rebase, --test-concurrency=4 beside other
  sessions' load: 13,626 tests, 160 red in 31 files. Those 31 files
  run alone at head and at base 0a7633136: 166 vs 157 red, the same
  tests at other widths/languages (routing-*, segs-press-redraw's
  webkit 900/440px, usage-*); mobile-web's "matches origin/main" needs
  .git, which a mote-run copy lacks; old-webkit's :has() is on base.
  segs-press-redraw alone: 7 red at head, 8 at base.
- New GUI test, both engines, en and zh: "a browser tab's font rows show
  on a nogui magpie and nothing flashes" records every rAF frame. Red on
  the old assets (uiFontRow never shows). Broken by hand: without the
  .app-only CSS rule it goes red with textSizeRow painting ~20 frames
  then going away (the reported flash); with
  `row.hidden = web && fontList?.length === 0` it goes red.
- Real servers on mote, both engines, 3 origins: nogui shows the rows
  (19 families in Chromium, 21 in WebKit), Text size never shown; a cgo
  desktop server 204/181 families.

Not tried: a Windows server with the fix (old code showed the rows),
WebKit over a LAN tunnel, Brave/Safari fingerprinting modes, the full
Go suite.
2026-10-28 12:25:39 +08:00
yetone 0c973cd9a4 usage: the Sessions bars are rows of their own, not a subgrid (#3955)
The Sessions overview's bars (Projects, Models, Tool use) and Top
skills were each a subgrid of their card, the same layout that crashed
Safari 16's WebKit sizing the Routing requests (#3731). Each row is now
a grid of its own. sessLineUp reads each column's width with the rows at
their natural width, once, when the card is first shown, and sets it on
the card as --sb<i>. The widths don't change with the window's, and text
size is the window's zoom, so it never measures again on a resize. The
@supports not (subgrid) fallback is gone: Safari 16 has subgrid, so it
never helped.

sessions-bar-names now checks that no rule of the bars says subgrid,
that every row's bar starts and ends at one x (wide, at 420 and wide
again), and runs in every language, not only en and zh.

Run on mote at this head:
- sessions-bar-names: 41/41 pass. At origin/main's assets
  (MAGPIE_SESS_ASSETS) 40/41: only the subgrid check fails, so the bars
  line up as they did.
- Broken by hand (sessLineUp returns at once): 20 of 21 red, bars' left
  at 527,338.
- sessions-overview, account-mask-sessions, i18n-keys: pass.
- go test -run 'Budget|Asset|CSS' ./internal/gui: ok.
- node --check page.js: ok.

Not tried: a real Safari 16 (no macOS 13 machine). Next for #3955:
.quota-windows .quota's rows subgrid.
2026-10-28 12:09:02 +08:00
yetone 396e0e4638 usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.

Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.

Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.

Run (mote, at this tree on d50f84c9f):
- go test -tags nogui -timeout 45m ./... : every package ok, exit 0.
- GOOS=linux and GOOS=windows go vet -tags nogui on usage, usageapi,
  provider, gui, gateway: ok. gofmt -l clean.
- New: TestDeletedProviderMergedIntoAnother (usage: cost 306 before and
  after the merge, 3 calls under main, coster/pricer price a relay call
  at its own price, a new "relay" keeps only its own call, rename and
  delete of the target, undo), TestDeletedProviderNamedAndMerged
  (usageapi), TestUsageDeletedProviderRoutes (gui).
- GUI: usage-ledger-deleted-merge.test.cjs, chromium and webkit, en zh
  zh-TW ja de at 1400 and 760px: ok. All 63 usage-*/ledger-* files and
  i18n-keys, both engines: 923 of 954 ok. The reds are red the same on
  origin/main c3b0484a9 run alone: usage-agents-hide (#3414),
  usage-fold (#3415), usage-ledger's "newest live route needs no
  return-to-live button" (#3104), and i18n-keys' "a plugin's words are
  its own" on library's "Runs as" (#3897).

After rebasing on origin/main 3e96197da (i18n.js merged with c3b0484a9's
balance keys): go build ./..., go test of internal/usage/...,
usageapi/..., provider/..., gui/... ok; the new GUI file in both
engines and every language ok; i18n-keys only #3897's red.

Broken by hand:
- Both returning (to, to): TestDeletedProviderMergedIntoAnother red,
  "cost 900, before 306".
- renamesOf not setting into: both Go tests red (relay still listed).
- ledProviderMore returning at once: the GUI test red (timeout waiting
  for the …), 5 of 5 subtests in chromium.
- On the old code the new tests don't compile (no MergeDeleted).

Not tried: the real app on a real providers.json with a deleted
provider; Linux/Windows GUI. gateway_sessions still prices by the raw
id, and a deleted provider's per-provider price stops applying once its
id is reused (both before this change, unchanged by it).
2026-10-28 11:15:57 +08:00
yetone 08b02cf18c providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.

- Stop at the caps (Provider.CapStop, off by default): once every account
  in use is held at its cap, the request is answered 429 rather than going
  on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
  internal/gateway/cap_careful.go): before planning, a capped account's
  usage is read again when its reading is over 15s old within 5 points of
  a cap, or over 5m old at all; the request waits at most 10s, and a
  failed account is asked again at most every 15s. An account whose usage
  was never read, whose last read failed, or whose reading is still that
  old is then held as one at its cap is (capHold "unread", traced as
  Weighed.Unread, named in the 429 with "--careful off"). Generic: it
  goes by provider.UsageRead/ReadUsageNow, so every subscription that
  reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
  keeps the last good reading's time. ReadUsageNow no longer reports
  false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
  either is on), two ticks for the above, and a note naming the accounts
  in use with no cap ("used to 100% of each window"). Accounts, order and
  caps stay where they were in that list. zh, zh-TW, ja, de added.
  app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
  per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
  [--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.

Run (mote, before the rebase at 8bade6c5e + this change):
- go test -tags nogui -timeout 45m ./...: exit 0, 76 packages ok, no
  FAIL (log grepped).
- GOOS=linux and GOOS=windows go vet of cli, gateway, provider, gui: ok.
- pool-ends.test.cjs: 32/32, Chromium and WebKit, en zh ja de, 1100 and
  420 wide.
- The 81 GUI files whose fixtures have accounts or caps, plus i18n*,
  6 at a time at load ~130: 76 pass. i18n-keys is red on the base too
  (#3897). account-mask (#3951), account-alias (#2984),
  signin-closes-sheet and signin-again timed out under load and pass
  run again, as on the base; signin-again filed as #3960.
- Real plugin host: TestPluginCarefulPool runs the fake plugin under Bun
  as Factory with two accounts capped at 90%: a failing usage call gives
  429 with nothing sent upstream while careful is on, the last reading
  is used with it off, a good read sends to A again, and with both at
  their caps the fallback serves unless Stop is on.
- CLI binary in a sandbox HOME on mote: unknown provider, a bad --stop
  value and no id each refuse and change nothing.
At the rebased head (0a7633136 + this): gofmt -l
clean, go build ./..., the new Go tests and the budget tests, and
pool-ends.test.cjs 32/32.

Broken by hand, each seen red, then restored:
- the CapStop line in plan: TestCapStopSkipsTheFallbacks and
  TestPluginCarefulPool red;
- the careful hold in capHeld: the three careful tests and
  TestPluginCarefulPool red;
- careful always on: TestCarefulOffByDefault red;
- readCareful not called: the failed, never-read, stale and re-read
  subtests red;
- a failed read not keeping the good time, or not counted as failed,
  and ReadUsageNow's early return forced false: TestUsageReadAndReadAgain
  red;
- the ticks' onchange emptied: pool-ends.test.cjs 16 of 16 red.

Not tried: a real Factory or any real account (fake plugin only); the
whole GUI suite (932 files, ~5h at this load), only the 81 files that
reach the account list; Linux WebKitGTK and Windows; the 15s/5m/5-point
figures against a real vendor's usage endpoint latency.
2026-10-28 09:29:44 +08:00
yetone 34d38ed669 hermes: each profile picks its own model on the Agents page
dongshanfengdongshizhcn on Discord: "我的 hermes 有多个 profile,但现在
agent 的配置里面,似乎只能配置默认的 profile". magpie gave Hermes one model
picker, for the connected profile's config.yaml. A bot under
<root>/profiles/<name> could only follow it or keep its own model.

Hermes's layout comes from its own source (hermes-agent e5ea5fd9,
hermes_cli/profiles.py and main.py): named profiles live in
<root>/profiles/<name> (PROFILE_ID_RE, a .deleted tombstone, the identity
files), active_profile is the sticky one, "default" is the root, and a
profile's model is model.default/model.model under model.provider. magpie
already found these profiles (hermesProfiles/hermesOthers).

Now each profile other than the connected one has a field,
"profile:<name>" (hermesProfileFields). The opened Hermes row draws them as
Other profiles, one line per profile: its name, the app's model picker, and
`hermes -p <name>`. They are never a square of the row's own, and with one
profile only nothing new shows. Nothing needs setting up:
- a magpie model stashes the profile's own provider and model, then puts
  magpie's provider and the model into that profile only;
- a model of its own is written as model.default and gives back the stashed
  provider;
- Default puts back the profile's model from before magpie, or keeps the one
  it has. Disconnect sends the same empty value, so a profile never loses
  its model;
- a bot picked there is recorded (hermes:<path>:picked) and doesn't follow
  the connected config's next model (hermesFollow);
- a sync keeps magpie's provider current in a bot on magpie while the
  connected config isn't on it.
app.js stays under its budget through the previous commit; no budget was
raised. New string: "Other profiles" (zh, zh-TW, ja, de).

Run:
- go test ./internal/agent ./internal/gui ./internal/profile ./internal/tui
  ./internal/cli (-count=1). gui, profile and cli are ok. Two reds were already
  filed: TestFolderVarsAreListed (CARGO_HOME, fixed on main by 3116b8f58,
  which this is rebased on) and TestTUIFetchesSubscriptionModels/agent
  (#3919). Neither touches Hermes.
- TestHermes* ok after the rebase. gofmt -l is clean. go vet and GOOS=windows
  go vet pass on agent, gui and profile. GOOS=linux go vet passes on agent and
  profile; gui needs cgo for wails and doesn't cross-vet from macOS.
- GUI: new hermes-profiles.test.cjs (en, zh, zh-TW, ja, de; 1100px and 560px;
  chromium and webkit; 20/20) plus i18n-keys, claude-auto-mode,
  claude-subagents-pick, claude-subagent-effort-row, tier-effort,
  click-scroll, every agent-*.test.cjs, and the previous commit's Settings
  files: 899 of 900. The one red is the known #3897.

Broken by hand:
- origin/main's hermes.go fails TestHermesProfileModels ("pickers []").
- Without the picked guard in hermesFollow, coder followed main to
  deepseek/max.
- With Default deleting model.default, writer lost gpt-5.5.
- With the sync of bots on magpie turned off, writer's provider lacked a new
  model.
- origin/main's app.js fails hermes-profiles.test.cjs 10 of 10 in chromium.

Not tried: a real Hermes. By rule it isn't run under a sandbox
HERMES_HOME, since that rewrites the live ~/.hermes launcher. The layout was
read from Hermes's source, and the configs were written as its
_seed_model_config does. profile.yaml's display_name is not used; the line
shows the folder name, which is what `hermes -p` takes.
2026-10-28 00:17:40 +08:00
yetone a47596ea61 privacy: AstrLink Guard is the default local model; its menu stands apart from the switch
Settings > Privacy's "Find with a local model" row put the model menu 2px
from the Off/On switch (.prefs .val's gap): two bordered boxes touching.
The row's .val now has an 8px gap.

With no model picked, pii.Choose is AstrLink Guard. Before, it was Privacy
Filter whenever the model was on or Privacy Filter was on disk. Now
Privacy Filter is chosen only while the model is on, Privacy Filter is
downloaded and AstrLink Guard isn't, so a request isn't held back. In
that case masking.picked starts AstrLink Guard's 38 MB download
(toGuard, tried again an hour after a failure). Once it is on disk,
AstrLink Guard is saved as the pick, unless the user picked a model in
between, and Privacy Filter is let go.

Existing users:
- Privacy Filter on with no pick: moved to AstrLink Guard after the
  download. Privacy Filter stays on disk and can be picked again.
- Privacy Filter explicitly picked: unchanged.
- Model off: the menu now shows AstrLink Guard.

Run at this tree, on origin/main:
- go test ./internal/pii ./internal/masking: ok. TestChoose is updated,
  with Privacy Filter on disk both off (Guard) and on (PF).
- go test ./internal/gui -run 'Budget|I18n': ok.
- privacy-model.test.cjs, chromium + webkit, every language, 1100/640:
  64/64. The new gap check fails with the CSS line removed (gap 2).
- gofmt, vet (darwin, linux nogui, windows), linux and windows builds:
  ok.

Not tried: toGuard's real download and switch-over. It needs the
network, and no test covers it.
2026-10-27 23:18:24 +08:00
yetone e056779a67 gui: the app serves its page to a browser, behind its key (Settings › Browser access)
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app,
to manage it through a Cloudflare tunnel. Settings › Network and sharing ›
Browser access now has the app serve the same page itself: Off, This
computer (127.0.0.1, for a tunnel or SSH forward) or Local network.

Access is magpie web's, unchanged: the key in the link is traded for the
cookie (webGuard), the allow list holds, and the gateway's client routes
on the page's port need a gateway key (onePort). A rebound Host and
Origin: null get no cookie. There is no way to serve it without the key.
The key and choice live in web-page.json (0600) beside settings.json, so
a sync never carries them. GET/POST /api/web-page are the app windows'
alone: a browser on the page can't read the key or turn the page off. A
busy port (magpie web, the magpie before an update) is tried every 4s;
`magpie web` on the same port opens the app's link instead.

Run at d43b7c40d (this change on ef155a5ca), then rebased onto the four
newer main commits, which touch gateway, usage, proc and library only:
- gofmt -l internal/gui internal/cli: nothing. go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet of internal/gui and internal/cli:
  clean. go build: ok.
- go test -timeout 45m ./internal/gui/ ./internal/cli/: ok (180s, 70s).
- GUI, alone: browser-access.test.cjs and model-test-one.test.cjs pass in
  both engines; i18n-keys 23 of 24, its red is #3897 ("Runs as" from
  7f827b3b0), not this change. agent-stale-copies.test.cjs 80 of 80 at
  8d343a811 (this change before the rebase).
- Full GUI suite at 8d343a811: cut short. The disk filled (708MB free):
  browsers failed to launch with ENOSPC in agent-stale-copies, which then
  passed 80 of 80 alone, and node ended with exit 7 before the rest of
  the files ran. There is no full GUI record for this change.

Not tried: a real Cloudflare tunnel to the page, and Local network from
another machine.
2026-10-27 18:58:16 +08:00
yetone 66061fd4df gui: the tray panel's Usage cards have the same per-account eye as the window (yogurt36)
yogurt36 on Discord asked for Hide accounts per account wherever people
take a screenshot: the menu bar panel's usage as well as the window's
providers, with one logic and one interaction. d3191a51c gave the
window's provider rows and Usage cards an eye and left the panel always
masked. Now each panel Usage card has the same eye beside its name
(hideAccounts.eye in a .pq-who wrapper, so the name still ellipsizes and
the eye keeps its place), going through the same shown set that hits()
skips, with the same look: hidden with Hide accounts off, quiet until
the card is hovered or the eye has focus, in sight while it shows its
account. A click shows that account, its name and address together
(kin), on its card and in the card's tooltip; the others stay masked.

How long: until the panel is put away. The panel's page stays loaded
while hidden, so its visibilitychange (the one that already drops
panelPeek when the panel is put away) calls hideAccounts.closed(), which
now does nothing when nothing is shown. Memory only, never stored.

Shared or not: not shared. The window and the panel are separate pages
with separate sets, and that is kept on purpose: one shown in the window
for a screen share stays masked in the panel and the other way round,
so a screenshot of either shows only what was shown there, right in
front of the user. A shown account leaking into the other surface
would be the surprise a privacy switch can't afford.

Run (macOS, playwright 1.62.0, at d4699c00a; rebased on origin/main
1885c607e, which touched i18n.js, routing/client.js and providers.go
only, and the lines below marked "after rebase" were run again there):
- account-eye.test.cjs: 15/15 in chromium and 15/15 in webkit, en zh
  zh-TW ja de; the new panel test at 360px and 440px (no select, no
  stripe, no sideways scroll, the eye inside its card, a click scrolls
  nothing, the window still masks an account shown in the panel and
  the panel one shown in the window). After rebase: both engines again.
- Red on the old code (app.js/app.css from d4699c00a): the new panel
  test fails ("the panel's card has an eye").
- Broken by hand, each red, then restored: no closed() in the panel's
  visibilitychange; no .pq-card:hover rule; the shown check in hits().
- 35 GUI files that open the panel with its cards or masking
  (account-alias, account-mask*, mask-*, masking-records, window-mask,
  provider-unmasked, panel-*, quota-*, tray-*, codex-*, usage-fold,
  click-scroll, i18n-keys and others), both engines: 550/552. The two
  reds are usage-fold's "the view didn't scroll" (184 !== 180) in
  chromium en and zh; they fail the same, 3 runs of 3, with d4699c00a's
  own app.js and app.css: #2163, untouched here.
- go test ./internal/gui: ok (TestCoreScriptBudget included; app.js
  1,317,850 bytes, no budget raised). After rebase: ok.
- gofmt -l clean; go vet ./internal/gui on darwin, GOOS=linux -tags
  nogui and GOOS=windows: ok.

No new strings: the eye reuses "Show this account" / "Hide this
account", already in zh, zh-TW, ja and de.

Not run: the whole GUI suite and go test ./... (another session may be
running them). Not tried: the real tray panel being put away in the
Wails app on macOS, Windows (WebView2 is hidden through chromium.Hide)
and Linux; the visibilitychange it relies on was dispatched by hand.
2026-10-27 04:20:57 +08:00
yetone ed5cc959a7 gui: every slow page's skeletons get magpie's bird hopping bar to bar
The owner, after the Plugins page's README bird (722483c08): every
skeleton loader should have it, the slow pages most of all (Sessions,
Usage, Masking, Library).

app.js keeps one bird for the window (skelBird). Every 250ms it looks
for .skeleton and the Plugins page's ghost cards' .sk bars. When some
have stayed 450ms or more and at least one can be seen (in the
viewport, elementFromPoint at the bar landing on it or a box it sits
in, since ghost bars let clicks through), the bird drops onto one. The
bar dips under it, and it hops to the next bar it can see, in page
order. When the bars are gone it flaps off up and to the right and is
removed. It is position: fixed with pointer-events none, so nothing
under it moves or stops taking clicks. A quick load (under 450ms)
never shows it. A hidden window and reduced motion skip it.

The README's bird (plugins.js bounceLoader) now draws from the same
markup (BIRD) and styles (.sk-bird, sk-flap in app.css). plugins.css
loses its .pm-bird copy.

Budgets: app.js 1,321,319 -> 1,325,845, core 1,537,645 -> 1,541,967,
the exact bytes, no room added.

Run at origin/main 9809a8ac9 (load 100-150):
- skeleton-bird.test.cjs (new), both engines: a held market read
  shows the bird within 3s, over 30 places and dips, and gone 2s after
  the reply. A 150ms reply shows none. Reduced motion: no bird, no dip.
- plugin-readme-bird, i18n-keys, gateway-key-limit, the Budget tests:
  ok (the README bird's one webkit red is main's too, fixed in the
  next commit but one).
- Probe with every /api read but state held, per page: the bird shows
  on Sessions (4 bars), Library (31), Providers (20), Gateway (39),
  Usage (15), Masking (2) and Plugins (48). Screenshots looked at for
  Library, Usage and Sessions.
- The whole GUI suite at a6c808b68 (concurrency 6, load ~170): 128
  reds on this branch, 130 on main, over the same 36 files. Run alone
  twice per tree, the only test red on this branch and not on main was
  gateway-key-limit's chromium narrow check, a ResizeObserver race,
  fixed in the next commit.
Broken by hand: with the bird never spawned, the slow test is red.
Not tried: the Routing window page, which draws its stage at once and
has no skeleton (the tray panel's routing tab does); the tray panel
itself; the real app (only Playwright's engines).
2026-10-26 23:10:08 +08:00
yetone d3191a51c8 gui: with Hide accounts on, an account's eye shows that one account in this window (yogurt36)
yogurt36 on Discord, for a screen share: with Hide accounts on, one
account should be readable while the others stay masked. Now an
account's name on the provider editor's row (accountNameButton and the
one-account line) and on its Usage card (quotaWho) has a quiet eye, in
sight on hover or keyboard focus, with an aria-label. A click shows
that account, its address and the name the user gave it together
(kin), everywhere the window draws it, tooltips included: the shown
set is skipped in hits(), which every mask goes through. It lives in
memory only. The tray panel keeps hiding it, and closing the window
hides it again: the page stays loaded while the window is hidden, so
hideMain runs mainClosedJS (hideAccounts.closed) first. With Hide
accounts off there is no eye. Strings in zh, zh-TW, ja and de.

Run (macOS, playwright 1.62.0, rebased on 630fd1d69; at push 0f6615ffc, site only, came under it):
- account-eye.test.cjs: 20/20 in chromium and webkit, en zh zh-TW ja
  de, 900px and 360px (no select, no stripe, no sideways scroll, a
  click scrolls nothing, Tab (Alt+Tab in WebKit) reaches the eye).
- Red on the old code (feature stashed): both tests fail.
- Broken by hand, each red, then restored: the shown check in hits();
  closed() without shown.clear(); kin() returning only the address.
- TestClosingHidesShownAccounts (new): red without shown.clear() and
  without the ExecJS(mainClosedJS) call in hideMain.
- go test -run 'TestCoreScriptBudget|TestBuiltinClientsLoaded|
  TestClosingHidesShownAccounts' ./internal/gui: ok. app.js
  1,306,355 bytes, under 1,321,319; budgets not raised.
- i18n-keys.test.cjs: 4/4.
- gofmt -l clean; go vet (mac), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet ./internal/gui; go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: ok.

After the last rebase one chromium en/zh run of account-eye showed 1
fail of 4 with 179MiB free on the disk; its log wasn't kept, so the
test is unnamed. Every run since, with its log kept, passed: 4/4 and
then 20/20 in both engines.

Not run: the whole GUI suite and the full go test ./internal/gui
(another session's suite held the machine and the disk was full; one
link hit ENOSPC and passed on retry). They run after the push.
Not tried: the real Wails window's close (hideMain) by hand.
2026-10-26 18:18:24 +08:00
yetone a5ce158e54 gui: a logo solid to its edges is drawn at the size of a line logo beside it
The owner saw the Agents list's logos at two sizes. They were: every logo
is drawn to its 16-22px box, and a tile or disc logo (Codex, WorkBuddy,
ZCode, Qoder) inks ~96% of that box edge to edge, while a line logo (Pi,
OpenCode, Hermes, Grok) inks ~40% and Alma's and Cindy's tiles bring their
own margin (82% of the box). Measured on every file in icons/ at 256px.

The 25 logos solid to their edges (inked to within 7% of each edge, 70% or
more of the box) are now drawn at 82%, Alma's and Cindy's size. The list
is a data-icon rule in app.css, so app.js and its budget are unchanged.
icon-tile.test.cjs measures every file in icons/ and fails when a tile
logo is missing from the rule or a line logo is in it, and checks in the
Agents list that Codex and ZCode draw at 82%, centred, and Pi whole.

Run:
- icon-tile, mono-icon-redraw, models-add-and-icons, plugin-own-icon and
  i18n-keys GUI tests, chromium and webkit: 38 of 38.
- go test -run Budget ./internal/gui: ok.
- Broken by hand: codex-color taken out of the rule, the test goes red
  on both the list and the drawn size (22/22).
- Before/after screenshot of the screenshot's 11 agents, dark, zh: the
  tiles now match Alma's and Cindy's.

Not run: the whole GUI suite. A plugin's own icon or a user's file: icon
that is a tile is not measured and stays full size.
2026-10-26 17:46:12 +08:00
yetone ef0a03e137 otel: Langfuse is set up from its host and the project's two keys
A user on X asked for Langfuse built in. magpie could already export to
Langfuse over OTLP, but Settings › Observability had the user type the
endpoint .../api/public/otel and a percent-encoded
Authorization=Basic%20<base64(pk:sk)> header by hand.

Settings › Observability now has a Collector row: OTLP or Langfuse.
With Langfuse, the user picks the host (Cloud EU, Cloud US, or
Self-hosted with an address, which also covers Langfuse's JP and HIPAA
regions) and fills in the public and secret keys. Once both keys are
there, magpie saves:
- the endpoint <host>/api/public/otel;
- Authorization: Basic base64(pk:sk), in otel.headers as before, so the
  secret is stored where it was and a backup without keys leaves it out;
- on a first setup, also x-langfuse-ingestion-version: 4, metrics off and
  export on. langfuse.com/docs/opentelemetry/get-started (read 10-26)
  gives the same header for every region and for self-hosted, and says
  that without it OTLP data can arrive up to 10 minutes late.
A Langfuse endpoint set up by hand opens in this view with its keys
decoded into the fields. Opening it saves nothing. Changing a key or the
host keeps the user's other headers, their metrics and export choices,
and an ingestion header they set or left out. Switching from another
collector leaves that collector's headers behind and does not send them
to Langfuse.

The Observability page moved from app.js into the otel plugin
(assets/plugins/otel/page.js, with i18n.js for its words, in Client),
because app.js had 13 bytes of budget left. The app.js and core budgets
are lowered to what is left (1,321,319 and 1,537,645; app.js is
1,321,313 after rebasing on 2620dc319). "Collector" and "Secret key" go
in the core i18n.js because other files use the same words.

Docs: reference.md's Langfuse paragraph (with the env form for magpie
serve) and the en/zh/ja privacy pages.

Run (macOS):
- go test ./... -timeout 45m -count=1 at the pre-rebase head (parent
  e5dd86965): every package ok but internal/provider, which crashed in
  TestUnreadLoginsWriteErrorsKeepCredentials with "close of synctest
  channel from outside bubble" in filememo.Forget. That is #3632, red on
  main since 091153bf7.
- The whole GUI suite (make test-ui, concurrency 4, Chromium and WebKit)
  at the same head: 16 reds. Each red file was run alone here and at the
  parent e5dd86965. The same reds came back at both: menu-input-scroll
  (#3402), old-webkit (#3403) and plugin-card-update's webkit Update
  (#3079). The parent also failed fonts' webkit run. page-width,
  api-key-theme, panel-arrange, panel-balance-order, own-requests,
  library-mcp-health-wsl and plugin-list-error passed alone here: 137
  passes, 7 fails, all of them the three filed above.
- At the pushed head (rebased on origin/main c87a0179b): the budget
  tests; otel, otel-langfuse, i18n-keys, settings-sections, builtins,
  idle-ticks and page-width, both engines, 58 pass; go test
  ./internal/otlp ./plugins/otel ./internal/gui, all ok except
  TestRestartHandsTheGatewayOver (#3451). That test failed 1 of 8 here
  and 1 of 8 on origin/main dce7fe609.
- Before the rebase: otel-langfuse (new: first setup, US, self-hosted,
  hand setup kept, another collector's headers dropped, 5 languages at
  1100/520/360px) with otel, i18n-keys, settings-sections, builtins,
  readable-focus, segs-press-redraw, ux-safety, dialog-backdrop-drag and
  mono-icon-redraw: 113 pass. go vet for darwin, linux and windows on the
  touched packages; gofmt -l clean.
- Broken by hand: with every save treated as a first setup and the old
  collector's headers carried over, otel-langfuse's "set up by hand keeps
  its values" and "another collector's headers" went red.
- New TestOTelLangfuseSetup: settings saved as the page writes them reach
  a fake collector at /api/public/otel/v1/traces with the Basic header and
  ingestion version 4, and nothing on /v1/metrics.
- Real app: a -tags dev build in a sandbox HOME (ports 3461/3462). I
  drove its real Settings page with Playwright: Langfuse, then
  Self-hosted http://127.0.0.1:3463, then both keys. settings.json got the
  endpoint, Basic header, version 4 and enabled. A gateway request then
  reached a local fake collector at /api/public/otel/v1/traces with
  Authorization Basic base64(pk-lf-real-ui:sk-lf-real-ui) and
  x-langfuse-ingestion-version 4.

Not tried: a real Langfuse Cloud or self-hosted project (no account here),
so Langfuse accepting the spans and how they show in its UI aren't checked.
The TUI and magpie serve still have no Langfuse shortcut; serve takes the
env form in reference.md. The Linux app (WebKitGTK) and Windows weren't
tried; the change is form fields and segs, with no motion.
2026-10-26 15:11:37 +08:00
yetone 39fed471cc gui: a connected agent's changes read before → now, not as disconnecting undoes them
Zhenzhen (Discord, 0.1.1521, omarchy, Pi on DeepSeek's API) opened Pi's
row: "改动了 ~/.pi/agent/settings.json · models.json", and every line
magpie had added (defaultModel/defaultProvider "magpie", the whole
"magpie" provider in models.json) was red, "−" and struck through, with
`"providers": {}` tagged "接入前的值". The row drew DisconnectPreview in
its own direction, what disconnecting does, so it read as magpie
deleting their config.

changesList now draws the forward view by default: a line magpie added
is a green "+", a value it replaced is "−" old then "+" new, nothing is
struck, and a file magpie created is tagged Created. The restore view
(↺ value before connecting, struck lines, Deleted) stays where it
belongs, in 断开并还原's dialog (askDisconnect passes back=1). Both
callers are the only ones: the row's connectPanel, which every
connected agent's row goes through, and askDisconnect. No new strings;
Created/Deleted/"value before connecting" already exist in every
language. app.js stays under its budget without a raise: eight
el+svg+append triples on the Agents page fold into one el call (same
DOM).

Test: agent-changes-before-now.test.cjs, a wired Pi with the preview
built from the real diffLines output for Pi-shaped files (captured with
a throwaway Go test). Chromium and WebKit, en/zh/zh-TW/ja/de, 890 and
420 wide: the row reads before → now, + green and − red, nothing
struck, magpie.json Created; the dialog keeps ↺, struck lines and
Deleted. Broken by hand: with origin's app.js and app.css it fails
("settings.json reads before → now"); with only the CSS reverted it
fails on the colours.

Run at 7ad6df865 (one rebase back): 128 GUI files that reach the
Agents page, the row, the diff or disconnect, plus gui-*.test.cjs and
i18n-keys, one file at a time, Chromium and WebKit: 125 green (951 +
886 tests). Red: gateway-mode (#3586), routing-steady (#3412) and
routing-live-patch's folded cases (#2174), all three red the same at
7ad6df865 without this change. Run at this head (parent 4b3bdbe28,
which changed 24 masking lines of app.js): agent-changes-before-now,
agent-disconnect-preview, agent-disconnect, agent-connected-unfolded,
i18n-keys green; go test -tags nogui ./internal/gui ok (budgets
included, app.js 1,325,719 of 1,326,105); gofmt clean.

Not tried: a real Pi connect and disconnect in a sandbox HOME, the full
go test ./..., Linux/Windows vet (no Go changed), and the whole GUI
suite at this head.
2026-10-25 21:31:23 +08:00