Commit Graph
272 Commits
Author SHA1 Message Date
yetone b0d634b850 routing: Expand picks how far the stage opens, models or accounts (ipsikent on X)
ipsikent asked on X for a setting for how deep the Routing page opens:
often only which model a route uses matters, not which provider's account
it went to. Expand, at the end of the stage's top line, opens a menu
(openProtoMenu) with Automatic (as before: long lists folded, short ones
open), Models (two or more accounts or keys of one provider fold into the
row naming the model, and start folded) and Accounts (every fold starts
open). Models and Accounts open every group in the group. The pick is
kept in localStorage magpie.routingDepth; picking one forgets the stage's
remembered folds, so every row follows it at once, and a row clicked
after it is kept as before. Accounts and keys isn't changed. Display only:
the gateway's choice of seat is untouched.

It sits in the stage card's top line, not the page head: in the head it
pushed Hide accounts onto a second line at 420px in English. "Expand" is
in the core dictionary, since i18n-keys finds the word in plugged.go.

Run (mica, at this tree on 2649d5d72):
- node --test routing-depth.test.cjs: 20 of 20, Chromium and WebKit, en,
  zh, zh-TW, ja, de, at 1100 and 420. Red on origin/main's routing files
  (no #rtDepth).
- i18n-keys, i18n-en-no-cjk, routing-group-fold, routing-keys-fold,
  routing-fold-accounts-together: ok.
- Screenshots at 1100 (zh) and 420 (en, de): one-line page head, Expand
  at the card's right.
The whole GUI suite is queued on mote behind another session's (suite
lock); its reds get issues.

Not tried: the real app, WebKitGTK.
2026-11-15 17:49:41 +08:00
yetone 5bccfb4ef2 usage: a table's provider with several accounts is one folded row; an empty Account column is left out (#6740, jay68xu on X)
jay68xu on X: the Usage page gets hard to scan with many providers and
accounts. This change covers the table view only, as the issue's comment asks.

In the Allowances table (Usage > Overview, Table), a provider with
several accounts is now one row. The row shows the chevron, the
provider's icon and name, "N accounts" (a string every language already
has), and each window column's mean share over the accounts. A failed
read counts for nothing in the mean. The provider's accounts sit under
it, folded until the row (or its button, with Enter or Space) is
clicked. Each provider's open state is kept in localStorage
magpie.quotaTableOpen, the way the cards' folds are kept. A provider
with one account is one row, as before. Sorting orders accounts within
a provider, then providers by their mean (window columns) or by their
first row. The Account column is left out when no row names an account.
Window columns and Other already appear only when some row has one.
There is no motion: a toggle redraws the table, and the chevron turns.
app.js is untouched (quotatable.js loads lazily), and there are no new
strings.

Run at this tree (base origin/main d99762075):
- usage-table-groups.test.cjs (new, 40 tests: both engines x en, zh,
  zh-TW, ja, de x 1100px and 420px): all 20 chromium cases are red on
  the old quotatable.js and app.css (0 pass, 20 fail).
- The 4 table files (usage-table-groups, usage-quota-table,
  usage-table-acct-lines, usage-account-subcards), both engines, on
  mote: 102 pass, 0 fail.
- Every usage-*.test.cjs plus i18n-keys and i18n-en-no-cjk, both
  engines, on mote: 1597 pass, 106 fail. All of the reds are in 11
  files that don't touch the table. Run alone, those 11 files give the
  same not-ok list on this tree and on origin/main d99762075 (diffed).
  Their issues are #3414, #6003, #6294, #3415, #2163, #6295, #4263,
  #5048, #6499 and #5834. The three files with no issue were filed as
  #6743 (usage-chart-line, usage-upload, usage-quiet-refresh).
- go test ./internal/gui/ on mica: ok (153.8s), which includes
  TestCoreScriptBudget. The budget was not raised.
- gofmt -l: clean (no Go changed).

Not tried: the real app, WebKitGTK on Linux, Windows, real accounts.
The issue's 代理出口 and 管理页 columns aren't magpie's. No GUI table
or i18n string has them.
2026-11-15 15:54:29 +08:00
yetone dd89f12556 gui: the no-activate hook's handle is swapped atomically, and the Windows exit doc says what the unhook leaves to endProcess (#6705)
On top of wizd's unhook (#6705, afe3b3ff7, kept as authored with its test): noActivateHook becomes an atomic.Uintptr
that unhookNoActivate swaps to 0, so the three places that unhook
(OnShutdown, the main-thread window's WM_DESTROY, Run's return) take it
off once without a racy read-then-clear. Nothing hooks it again:
hookNoActivate runs its SetWindowsHookEx under noActivateOnce, and
noActivateHooked stays true after the unhook.

07dfd0bb8's endProcess (TerminateProcess on itself) and awaitExit are
kept and the gui-shell doc says why: they still cover the other DLL
detaches, an os.Exit while the app runs (Wails' fatal error, which this
unhook doesn't reach), and an update from a version before the fix.

Exit paths reviewed: Quit (tray, page) runs Wails' cleanup, whose
shutdown tasks run on the main thread (InvokeSync), so OnShutdown
unhooks on the hook's thread before Run returns into endProcess. A
restart to update quits the same way. Wails' SingleInstance os.Exit in a
second instance comes in application.New, before any window exists, so
no hook is on. SIGINT/SIGTERM in the app go to Wails (ownSignals), so
through OnShutdown. The handover's quitBy exitNow is Mac/Linux only.

Run at this tree on base 72e06980e (the rebase onto 028b07b4b adds only
routing JS and docs), on xiaomi-gpu (Windows 11 26200,
Go 1.26.8) through win-run:
- TestUnhookNoActivatePreventsExitDeadlock -count=3: PASS 3/3.
- broken by hand (unhookNoActivate returning at once), at the tree before
  the rebase: unhook and destroy-main both FAIL "process hung in
  ExitProcess (stderr=fatal error: exitsyscall: syscall frame is no longer
  valid ...)".
- go test ./internal/gui: 11 reds. TestCoreScriptBudget (app.js 10 bytes
  over its budget) is red the same on macOS at 72e06980e with no script
  touched here; filed as #6733. The other 10 (TestGatewayHeldByAContainer,
  TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
  TestAionUiImportRow, TestCherryStudioImportRow, TestProviderSaveClientCert,
  TestPageAwayLetsStatsGo, TestPluginAgentMissingSaysSo,
  TestGatewayModeStatsNameTheGatewaySessions, TestUpdateThatWontStart) fail
  the same on origin/main 9cd5f3652 run alone there, and are filed in
  #6068 (also #5324, #5928, #6059).
- In the signed-in session (scheduled task /IT, where msctf is loaded):
  TestRestartBySelfAsksNoAttention (window, tray),
  TestRestartBySelfComesBackQuietly and TestUnhookNoActivatePreventsExitDeadlock
  pass.
- A real build (go build -tags production -H windowsgui) run as `magpie
  app` in a sandbox profile (USERPROFILE/APPDATA/LOCALAPPDATA redirected,
  MAGPIE_ADDR :3461, page on :3462) in the signed-in session, quit four
  times through POST /api/window/quit?now=1: each exited in 51-62ms. The
  magpie:// handler it registered was put back afterwards.
On mica: gofmt -l clean, go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.

Not tried: a restart to update of a real build on Windows (needs a staged
update); the wedge itself in a real app (07dfd0bb8's endProcess already
ends the normal quit without ExitProcess, so it can't be brought on at
will); Windows on arm64.
2026-11-15 12:39:32 +08:00
Wizard 7ce93508f0 gui: unhook noActivateHook before process exit on Windows (#6705)
Two full-memory dumps on Windows 11 (magpie.DMP on v0.1.4196 and magpie2.dmp on v0.1.4185) show why ExitProcess throws in exitsyscall and wedges with one thread left (#5922, #6678, #6705):

1. hookNoActivate installs a thread-local WH_CBT hook (noActivateCBT, Go callback #93) on Wails' main thread and never unhooks it.
2. When the process exits through runtime.exit(0) -> ExitProcess (for example from Wails' SingleInstance handover os.Exit, Wails' fatal os.Exit, or before 07dfd0bb8's endProcess), runtime.exit(0) acquires runtime.finlock and enters ExitProcess via runtime.stdcall with g1.syscallsp set.
3. Inside ExitProcess -> RtlExitUserProcess -> LdrShutdownProcess -> RtlpFlsDataCleanup -> msctf!CicFlsCallback -> msctf!SYSTHREAD::DestroyThreadMessageWindow -> win32u!NtUserDestroyWindow, Windows dispatches HCBT_DESTROYWND (nCode=4) to noActivateCBT on the main thread.
4. noActivateCBT calls w32.CallNextHookEx, whose nested Go syscall clears g1.syscallsp = 0 on return. When cgocallbackg then calls runtime.exitsyscall, gp.syscallsp < sp triggers 'fatal error: exitsyscall: syscall frame is no longer valid'.
5. runtime.fatalthrow.func1 calls runtime.exit(2) on the same thread (m0), which attempts to lock runtime.finlock a second time and self-deadlocks forever while still holding Wails' single-instance mutex and WebView2 profile handles.

Fix: unhook noActivateHook (w32.UnhookWindowsHookEx) when Wails' main-thread window receives WM_DESTROY in appWndProc, in OnShutdown, and when Run returns.

TestUnhookNoActivatePreventsExitDeadlock reproduces the exact FLS window-destruction callback on ExitProcess's last thread: without unhookNoActivate the child process throws 'exitsyscall: syscall frame is no longer valid' and wedges with 1 thread left; with unhookNoActivate (or WM_DESTROY on the main-thread window) it exits 0 cleanly.

Fixes #6705
2026-11-15 12:39:32 +08:00
yetone 028b07b4bd routing: a folded fold of accounts on one plan shows its bar in the app (Sdsi134a on X)
Sdsi134a on X: on the Routing stage, "Command Code Plan · 3 accounts" folded
said only "3 available", with no quota, though the accounts are on one plan.
foldQuota (ea1a8ae80, chen2652) was meant to show that figure and bar, but
it never could in the app: cardFor matched only cards whose kind is
"subscription", and /api/usage/quotas sends this computer's cards with no
kind (SubscriptionQuota.Kind is omitempty and set only on a remote magpie's
cards). The tests' fixtures carried kind: "subscription", so they passed.
cardFor now takes a card of this computer whose kind is subscription or
none. This also lets the accounts list's per-account windows (#1833) and
the failed-read line (dd9cd59a1) find their cards in the app.

The fold's figure now also says when its window starts again, the soonest
of the accounts' ("5 hours 40% used · renews in 2 h 10 min"), as an account
row does; no new strings. Hide plans on the groups page
(magpie.routingGroupPlans, f362d3b9a) folds the figure and bar away here
too (plansHidden). Mixed plans: nothing, as before.

Run (base 9cd5f3652; rebased onto 72e06980e, whose new commits touch no
routing or GUI file):
- routing-fold-accounts-together.test.cjs, its cards now in the API's shape
  (no kind), plus the reset and the Hide plans case: 22/22 on mote,
  chromium + webkit, en zh zh-TW ja de, 1100 and 420px. With the old
  client.js: 22/22 red (the figure never appears). With the plansHidden gate
  taken out by hand: 11/11 chromium red ("hidden plans").
- With it, on mica: routing-account-windows, -card-error, -group-plans,
  -free-seat, -groups-page, -pooled-card, -remote-windows, -read-allowances,
  -seat-windows, -wallet-lapse, -fold-all, -folder, i18n-keys,
  i18n-en-no-cjk: 306/306.
- go test -count=1 ./internal/gui/ on mote: ok.
Not tried: the real app with several real accounts on one plan (the owner
has none such); the whole GUI suite.

Reported-by: Sdsi134a
2026-11-15 12:35:22 +08:00
yetone 862660144e gui: a page's tabs in the sidebar fold from its own row, with a disclosure chevron (hkwok06 on X)
Opening Settings unrolled its tabs in the window's sidebar and nothing
said they would fold again; only opening another page (the gateway)
put them away. The open page's row now carries a quiet disclosure
chevron, as a Mac sidebar's: turned to its list while the list shows
(down for the pages above, up for Settings, whose list opens above its
row), and clicking the row or the chevron again folds the list and
unfolds it, the page staying open on its tab. A list folded stays
folded, per page, until it is opened again (localStorage
magpie.navFolded). The same holds for Usage, Library and Plugins.
The chevron is muted, turns in 200ms on the strong ease-out, and
doesn't move under prefers-reduced-motion. aria-expanded says the
state; Enter on the focused row toggles it too.

The chevron and the fold live in navicons.js (navFoldRows, navFold),
imported with the first list; app.js keeps 123 bytes (navList shared
with navMine, the two rows' clicks asking navFold first), with the
budgets raised by that and the reason in core_budget_test.go.

Run (mote):
- nav-sub-fold.test.cjs (new), chromium + webkit, en zh zh-TW ja de:
  red on the old code (12 of 12, "Settings' row shows a disclosure
  chevron"), green 12 of 12 on this change.
- After rebasing on origin/main 38a90a34c: nav-sub-fold,
  nav-sub-unroll and i18n-keys: pass 38, fail 0; TestCoreScriptBudget
  ok; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet
  -tags nogui ./..., go build ./... ok; gofmt -l clean.
- 45 GUI files the change can reach (nav-*, sidebar/side-*,
  settings-*, menu-scroll, click-scroll, i18n, gui-*, text-size,
  plugin-panels, ...): all pass except menu-scroll's scrollable
  dropdowns (#6532), nav-timeout (#5425) and settings-groups'
  warm-ups and check-in (#6597), which fail the same 5 tests on clean
  origin/main 38a90a34c (pass 8 fail 31 on both).

Not tried: the whole GUI suite (mote and mica were both loaded by other
sessions' suites), and the real app on Linux WebKitGTK and Windows.
2026-11-15 12:05:32 +08:00
yetone 1ac137e100 update: a version found is downloaded at once, not when Update is clicked
canlee886 on X (11-13, again 11-15): with downloads automatic, magpie
showed a new version and downloaded it only after a click on Update.
0.1.4051 made a click go into the copy downloaded and waiting, but the
clock's check (byClock) also kept that copy, so every version out after
it waited for the click: the pill said Update while the newest had never
been fetched. A failed download likewise waited, as a pill to click, for
the next 6-hour check, and a "found" version stayed found when downloads
were turned back on.

Every check that finds a newer version now downloads it with downloads
automatic: the clock's (5 s after start, then UpdateEvery), Check now,
the Version row's refresh and a page asking for notes in another
language (relang now starts the clock's check when the feed names a
newer version). A newer one replaces the one waiting. Only a restart's
check and the update dialog's (keep: recheck, freshen), a restart
waiting for the gateway to go idle (waiting) and downloads on a click
leave it, so a click on Update still restarts at once.

One download at a time stays (begin refuses a check meanwhile); such a
check now sets again (supersede), and the feed is asked again once the
download is in, so a newer version found then takes its place. The
minute loop fetches what was left (fetchDue): "found" once downloads are
automatic, and a failed download (error with retry) after 30 minutes.
docs/subsystems/gui-shell.md has the rule (When an update downloads).

Tests: TestUpdateClockLeavesWaitingDownload, which held the old rule, is
now TestUpdateClockFetchesNewerThanWaiting; new TestUpdateFetchDue,
TestUpdateCheckDuringDownloadTakesNewer (one download in flight at most)
and TestUpdateWaitingRestartKeepsItsDownload.

Broken by hand: putting u.byClock back in the keep-staged condition
turns TestUpdateClockFetchesNewerThanWaiting red (0.1.12 out, still
0.1.11, 1 download); supersede as a no-op turns
TestUpdateCheckDuringDownloadTakesNewer red (never took 0.1.12);
fetchDue false for found turns TestUpdateFetchDue red; dropping
u.waiting turns TestUpdateWaitingRestartKeepsItsDownload red (0.1.12, 2
downloads).

Run at this tree on
ec8125e68, on mote: go test -count=1 -run 'Update|Restart|Fresh|Download|Notes|
Recheck|Relang|Wait' ./internal/gui/ ok. On mica (mote's load was 24.5
over its 18 cores): go vet ./internal/gui/
./internal/update/, GOOS=linux go vet -tags nogui ./internal/gui/,
GOOS=windows go vet ./internal/gui/ ok; gofmt -l clean;
go test -count=1 -timeout 45m ./... (mica): 101 packages ok, no FAIL
(gateway 945s, agent 296s, gui 187s).

Not tried: a real app updating across two published releases; no GUI
file changed, so no GUI run.
2026-11-15 03:45:30 +08:00
yetone 93762f968a usage: small, idle clients fold into one Other row
WJaunita45604 on X: test runs leave dozens of randomly named clients of
~10K tokens each in the Usage page's Agents list, and the page crawls.
renderUsage draws every Agents row again at each refresh whose summary
changed, at ~0.1ms of DOM and layout a row: with 400 clients a redraw
took 30-54ms in Chromium and 45-66ms in WebKit, with 2000 136-178ms and
224-246ms (probe at 1200px, Bun/SiYuan/translate-web and N clients).

A client not hidden folds when it is past the 5 with the most tokens,
under 1% of the period's tokens, and either made no call in the last 3
days (the agent group's new `last`) or is past the top 20; two or more
fold, or none do. No setting. Other sits at the list's foot with the
folded groups' sums (usageSum), so totals stay exact, and opens with a
click, Enter or Space; open, it draws the folded rows with their own
actions 100 at a time (Show {n} more). Closed they aren't drawn at all:
with 400 or 2000 clients a redraw now fits one frame (~13-20ms in both
engines), as with none.

Run at 442964d70 + this change, on mote (then rebased clean onto
9afec644c, which touches sync/library/update only; go test -run
'Budget|Size|I18n|Css' ./internal/gui ./internal/usage ok there):
gofmt -l clean; go vet ./internal/usage ./internal/usageapi
./internal/gui on darwin, linux (-tags nogui) and windows: ok;
go test ./internal/usage (58s), ./internal/usageapi, ./internal/gui
(137s): ok.
GUI, both engines: usage-*, i18n-*, mobile-web, own-requests and
ledger-cache-unknown files: 1740 tests, 1663 pass, 77 fail. The reds:
usage-agents-hide #6003/#3414, mobile-web #3952, usage-cards-hide
#6294, usage-range-times #6499, usage-hidden-way-back #6295,
usage-fold #3415, usage-speed-all-models #5834 fail the same way at
base 442964d70 (those 7 files there: 152 pass, 70 fail, the same
usage-agents-hide error "536.7 -> 586.98"); usage-ledger's "newest
live route needs no return-to-live button" is #5048/#6003 (the
Requests tab, which this doesn't touch); usage-chart-dates (chromium)
timed out launching the browser (180s) under load.
The new usage-agents-other.test.cjs: 33/33 (chromium + webkit, en zh
zh-TW ja de, three widths).
Perf probe at 1200px, one redraw: 400 clients 30–54ms (Chromium) and
45–66ms (WebKit) before, 2000 clients 136–178ms and 224–246ms; after,
both fit one frame (~13–20ms), the same as no clients.
Broken by hand: USAGE_FOLD_TOP=0 turns the rule test red; dropping the
100-row cap turns the page test red ("151 !== 100").
Not run: the full GUI suite (mote and mica were both running other
sessions' suites).
2026-11-15 02:51:18 +08:00
yetone 07dfd0bb8f update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.

A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.

Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
  TerminateProcess on itself instead of ExitProcess. Everything magpie
  writes is written by then; the kernel closes every handle and no
  detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
  its thread count every 250ms; one thread for a second is a magpie stuck
  in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
  what fixes the update from 0.1.4193 and older, which still exit through
  ExitProcess.

docs/subsystems/gui-shell.md says how a Windows restart waits and ends.

Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
  (os.Exit there hangs with exactly 1 thread left), then that
  endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
  out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
  way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
  "the start went on after 20.022s with the old magpie still stuck".

Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
  ./internal/update all ok but TestPackagedByDpkg, red the same on
  origin/main 442964d70 (#4603, a ':' file name on NTFS).
- mote: gofmt; go vet, GOOS=windows go vet, GOOS=linux -tags nogui go vet
  of internal/cli and internal/update ok.
- mica: full go test ./... -timeout 45m started at this tree; still running
  at push (ship-at-once rule), result to follow on the issue thread if red.

Not tried: a real update restart of the app on Windows with a stuck
WebView2 detach (the hang can't be brought on at will there); the fix is
checked with the FLS stand-in above.
2026-11-15 02:31:56 +08:00
yetone 1edebf0500 tray: a card with more than two windows shows them all, in columns of two (jen_celeus on X) 2026-11-15 01:11:08 +08:00
yetone 221c91fae3 gui: the gateway card opens the chat page
The gateway card gets a "Chat page" button beside Restart gateway while
the gateway runs. It opens <gateway>/deepseek-chat/ in the browser, or,
in web mode, the public URL's chat page. Both buttons sit in one
.gw-acts group, so a narrow card wraps them together, and Restart keeps
its .gw-fix class (the takeover, pause and port-holder tests read the
first .gw-fix). The label is translated in zh, zh-TW, ja and de.

Run: gateway-chat-page.test.cjs in Chromium and WebKit, every language,
at 1100 and 420 wide, on mica: ok. It is red without this change (no
button). At 058119705 + this change, on mica, every gateway-*.test.cjs,
i18n-keys and i18n-en-no-cjk in both engines: 328 of 343 pass in
Chromium. The reds are gateway-card's "7 !== 6" (#6029) and
gateway-key-arrange at 420px (#6268), and in WebKit gateway-pause's
"click moved the row" in one language (#6684). All of them are red the
same on an origin/main 3f09b9ffc copy. go test ./internal/gui (budgets): ok.
Go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and gofmt: clean.
2026-11-14 23:56:19 +08:00
yetone 47684ef176 usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.

columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.

Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
0b8c4bfc3. It covers the previous commit's sub-cards as well. The usage
GUI reds are those named in the previous commit, the same on main.

Not run: the whole GUI suite before the push.
2026-11-14 23:49:02 +08:00
yetone 2a6ab83d8a usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).

- renderQuotas puts each account of a card with several into a
  .subscription-acct box (a provider's keys, a balance a line, stay
  lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
  hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
  so there is no page to move it to.

Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
  0b8c4bfc3. usage-account-subcards.test.cjs (next commit) guards the
  sub-cards; red on origin/main too.
- go test ./internal/gui -run Budget: ok.
- ~110 usage/quota/i18n GUI files: every red is the same on origin/main
  0b8c4bfc3 and filed: usage-agents-hide (#3414), usage-cards-hide de 560
  (#6294), usage-fold webkit (#6003, #3415), usage-hidden-way-back (#6295),
  usage-ledger Requests (#5048), usage-range-times (#6499),
  usage-speed-all-models (#5834).
- usage-fold "most on one screen" is red on main (#4790, 12 chromium of
  15 wanted); with the boxes it is 11, one account fewer.

Not run: the whole GUI suite before the push; the real Linux app.
2026-11-14 23:49:01 +08:00
yetone cfd70c60c2 update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before 3f09b9ffc landed, so they still hold the pill for 3 days. No code changed; nothing run beyond gofmt -l (clean).
2026-11-14 23:48:04 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

Now being behind holds nothing: ready, found and available light the
pill at once. Only the pill's x (or right-click) holds it, for
update.Quiet across the releases out meanwhile (Behind.Hushed), which
keeps 36eebea13's answer to "always lit" (the x used to hold only until
the next release, minutes later). An urgent release still lights it
through that. The old notes' "since" is never read as a dismissal.
Settings > Update button says "Hidden for 3 days" whenever the x holds
(it said "Hidden for <v> until a newer version is out" only while that
exact version was latest), and Show again lifts the hold
(update.Unhush, an empty update-skip). The x's label and toast say
3 days instead of "until the next version" (en, zh, zh-TW, ja, de).

Users on 0.1.3879 to 0.1.4179 get it with their next update: Settings >
About > Restart to update, the tray's Restart to update, or quitting.
0.1.4079 still checks, downloads and verifies the newest release: its
updater code (LatestEvery + Stage, sandbox HOME on mica) fetched
0.1.4178, passed download, verify (SHA256SUMS signature, attestation)
and unpack, and stopped only at the Team ID check because the probe
binary is unsigned.

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00
yetone 90efddabae gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.

The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.

Run (rebased on origin/main e6e0585bd, on mica; mote was over its 18
cores):
- go test -tags nogui ./internal/gui/ ./internal/provider/: ok
  (TestProvidersDeleteSeveral new; TestCoreScriptBudget ok after the raise).
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; go build: ok.
- GUI, chromium + webkit: provider-bulk-remove (new: en, zh, zh-TW, ja,
  de at 420 and 1100px), provider-remove, provider-find, provider-order,
  providers-off-fold, provider-search, provider-list-off,
  group-bulk-remove, library-pick-remove, i18n-keys, i18n-en-no-cjk: ok.
  found-skill-pick-remove's ja/de 420px subtests are red, and red the
  same at origin/main e6e0585bd in a clean worktree (#5013).
Broken by hand: the handler deleting only ids[:1] turns
TestProvidersDeleteSeveral red ("listed after: [b c d]"); the page
posting only the first id turns provider-bulk-remove red in every
language. Restored, green.
Not run: the full Go suite and the full GUI suite (mote overloaded,
mica running another session's GUI suite); not tried in the real app
with real providers.
2026-11-14 22:18:09 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

- The menu bar's cells, its tooltip and Windows' tray figure still showed a
  hidden card and its hidden rows. trayUsageCards now goes through
  trayShown: a cell naming an account takes the card the Overview still
  shows (its balance with its plan hidden), a cell following the account
  in use (`|*`) picks that account among every card as before and is left
  empty while its card is hidden, never moved to another account. Hidden
  rows are left out, a card never left with none. settings.TrayUsages is
  untouched, so the cell comes back with the card.
- POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when
  cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at
  once rather than at the next tick (3 minutes by default).
- The panel hid a card after keyCards had put a key's balance on its plan's
  card, so "Hide its balance from Overview" left the balance on the panel's
  plan card, and a hidden plan took its unhidden balance with it.
  panelPageCut now takes the quotas as read and leaves the hidden out before
  keyCards, as overviewCards does; gone counts a merged card hidden only
  when its plan and balance both are.

The Go hide rule (cardHideKey/usageShown) moved from internal/tui to
internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown,
QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's
daily push still warns about a near-limit hidden card (an alert, not a
display). Docs: settings.go comments, docs/subsystems/gui-shell.md.

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 61e2035d39 gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed
windows-check (amd64 and arm64) at "Launch magpie": the exe logged
"magpie 0.1.4166 started (app, ...)" and the gateway never answered, so
none of those versions has assets.

Cause: 14807bcf2 made a copy still named as the site's download
(magpie-windows-amd64.exe) a download wherever it is kept, asked about
through the install dialog. The release check starts
dist\magpie-windows-amd64.exe, so update.Settle now put up the task
dialog. The question comes before anything starts in gui.Run, the
gateway included (Install opens the installed copy in this one's place),
and on the runner no one answers it, so the app waited on it forever.

Now askInstallFolder leaves update.AskFolder unset when no one can
answer (unanswerable): CI set, as every CI service sets it (GitHub's
CI=true), or a window station no one sees (a service, a start over
SSH; GetUserObjectInformation UOI_FLAGS without WSF_VISIBLE). Unasked,
a copy kept outside Downloads runs where it is with nothing recorded
(isDownload's existing ask=false rule), and one in Downloads installs
to the default as it did with no dialog. A person's start on their own
desktop is asked as 14807bcf2 has it. The gateway can't start before
the answer instead: Install forwards to the installed copy and this one
quits, so its gateway would have to be handed over first.

Also fixes #6648: TestSettleAsksAboutADownloadKeptElsewhere expected
forwards() true on every OS, but forwarding is Windows' alone (as its
sibling checks at install_test.go:382/452 already say), so it was red
on Linux and macOS since 14807bcf2.

Tests: TestNoInstallQuestionOnCI (Windows: CI=true leaves AskFolder
nil) and TestInstallQuestionNeedsSomeoneToAnswer (any OS).

Run:
- Reproduced on xiaomi-gpu (Windows 11) as the CI step does it: the exe
  built with go-winres's manifest (so the task dialog exists), named
  dist\magpie-windows-amd64.exe, started `app` with CI=true in the
  logged-in console session (session 1, through a schtasks /it task),
  sandbox USERPROFILE/LOCALAPPDATA/APPDATA/TEMP, MAGPIE_ADDR on a port
  of its own, polling /v1/models 30x2s. At ee6352b63: RED, "the gateway
  never answered", nothing after the start line. With this change:
  GREEN, "install: not asking where to install: CI=true", gateway
  answered, still up 5s later, nothing installed.
- Over SSH (session 0) with CI unset: the question is skipped ("no one
  sees this desktop"); the app then exits on WebView2's controller
  there (no desktop), which is that session's, not this change's.
- Broken by hand: askInstallFolder reading another variable ->
  TestNoInstallQuestionOnCI red ("asks where to install with CI=true").
- win-run go test -count=1 -run 'TestNoInstallQuestionOnCI|
  TestInstallQuestionNeedsSomeoneToAnswer|TestInstallWords' -v
  ./internal/gui/: ok.
- wsl-run go test -tags nogui -count=1 ./internal/update/ (magpie-desktop,
  Ubuntu 24.04): ok (#6648's red gone).
- mica-run: gofmt -l internal/ clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui ./internal/update/ ./internal/gui/ clean; darwin go
  vet clean.
- win-run go test -count=1 ./internal/update/: ok except
  TestPackagedByDpkg (#4603, open, untouched).
- mica-run go test -count=1 ./internal/update/ (macOS): ok.

Not run before the push: the full suite (mote at load 144) and the
whole ./internal/gui package (running on xiaomi-gpu and mica at push;
the release blocker didn't wait for it). Not tried: a real person's double-click from D:\下载 after this
change (the dialog path itself is unchanged).
2026-11-14 19:28:21 +08:00
yetone ee6352b638 gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme:
「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of
the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots:
black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29),
card (31,30,36), the grey of Graphite's.

Why (appearance.go ground()):
- the dark grounds went down by the same amount on every channel, so
  app.css's cool grey cast stayed: black's page was #000003, its card
  #08080c, a blue-black next to Chrome's #000000;
- how dark a pick is was its mean channel against the page's. #191047's
  mean (37) is above the page's (27), so a deep navy counted as light
  and only got a breath of hue (0.08): the same grey page as Graphite.

What changes:
- darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is
  0.44, every preset 0.51 or more) is how far the dark grounds go
  toward black; 1 for black. #191047 is 0.23, so 0.43.
- as a ground goes down it loses the grey's cool cast by as much, and
  takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page
  is #000000 with neutral steps above it (card #090909); navy's page is
  a near-black navy.
- Graphite, the presets, colours lighter than 0.4 and the light theme
  are unchanged; lifted() (where the ink starts) is unchanged.

Measured (Settings > General zh, dark, 1200px; screenshot pixels, the
same in Chromium and WebKit), before -> after:
- black: page #000003 -> #000000, card #08080c -> #090909
- #191047: page #191821 -> #0c0b17, card #22212a -> #151420
- #130830: page #17161e -> #0b0813, card #201f27 -> #14111c
- Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged

Tests:
- TestDarkPickDarkensPage: black's grounds are neutral greys; three
  dark blues draw a darker, blue page with text >= 7:1 and the accent
  >= 4.4:1; Graphite and the presets have darkness 0.
- TestBlackIsBlack: black's page is #000000 exactly.
- appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a
  dark navy page with Settings' list on its card (dark), and keeps the
  light page's lightness (light). Fixture gains #191047.

Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB
free), at this change on origin/main dbac411b2:
- gofmt -l internal/gui clean; go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gui: ok (112s).
- Whole GUI suite (node --test internal/gui/tests/*.test.cjs, both
  engines, every language): cut short at 8650 of ~8700 results to push
  (coordinator); 8279 ok, 371 not ok. appearance-look 20/20 here and
  every accent, look and Settings case ok. Reds outside this change
  (accounts, keys, Check in, quick panel shortcut, gateway card, under
  the box's load); api-key-theme (#6444) and omarchy (#6027) are the
  reds named on origin/main by 90ad90646. Not rerun on a base copy.
- Broken by hand: with the old ground(), TestBlackIsBlack and
  TestDarkPickDarkensPage are red (#000003, blue-grey grounds), and
  appearance-look's dark case is red in both engines ("black's page is
  black").

Not tried: the real macOS app, WebView2, WebKitGTK; the full Go suite;
the GUI reds' base comparison.
2026-11-14 19:10:06 +08:00
yetone 14807bcf20 update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.

Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).

Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.

The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.

Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.

Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
  ./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
  uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
  gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
  untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
  TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
  (settle = "" want the installed; declined ""); the decline record
  ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
  and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
  (magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
  root guards, the new pattern included): ok.

Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.
2026-11-14 18:20:53 +08:00
yetone 7ea1e6a4b3 usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.

Now the panel leaves out a card whose cardHideKey is in usageCardsHidden
and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does;
a menu bar cell's card still shows (panelPeek). A subscription whose
every card the page hides counts in the foot's "{n} hidden" and shows as
hidden in Arrange; Show there
also drops its keys from usageCardsHidden, since the panel follows the
page. All of it is panelPageCut in the Usage plugin's page.js, which every
window loads, so the core scripts get no bigger (TestCoreScriptBudget
unchanged). Hiding from the panel alone still leaves the page as it is. The
panel reads settings again each time it is shown (loadBack), so a hide or
unhide in the main window reaches it with no restart.

Siblings: magpie tui's Usage page leaves out the same cards and rows
(usageShown, read at every quota read). The menu bar's cells and tooltip
show only the cards picked in Settings, so they keep a hidden card as
before; routing, caps and counting are unchanged.

Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
  pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
  webkit, every language, on mote: 17 files red, rerun alone at
  concurrency 1 here 123/449 red and at origin/main 015860f2d 122/449,
  the same tests but tray-cell-click's chromium en, which is red alone on
  main too (#5215); the rest noted on #5475. tray-cell-click + panel-arrange +
  panel-page-hidden together before the last rebase (no GUI file changed
  in it): 21 of 22, the one red tray-cell-click's (#5215). At this head
  (after the move into page.js): panel-page-hidden, panel-arrange,
  panel-balance-order and i18n-keys green; the reds in key-balance-card
  (de), panel-fold, tray-cell-click (zh) and usage-cards-hide are each
  in the origin/main 015860f2d record above.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) on mica
  under suite.lock at 734f06b64 (this change before the move into
  page.js): 97 packages ok; internal/gui red only on TestCoreScriptBudget
  (fixed by the move), internal/gateway red from "too many open files in
  system" at mica's load ~65. At this head on mote: internal/gateway,
  internal/gui, internal/tui, internal/settings and internal/redact (the
  one commit rebased over) ok; gofmt -l clean; go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet ./... clean; go build ok.
- Rebased onto origin/main 667ac8bd6 (5faed634d): internal/gui (budget
  included), internal/tui and internal/settings ok on mote;
  panel-page-hidden + panel-arrange 18 of 18.
Not tried: the real tray panel by hand on a live install.
2026-11-14 14:10:24 +08:00
yetone 90ad90646a gui: black draws a black dark theme, not Graphite's grey (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS, on v0.1.4124 (tweet 2121468612238266666), with three
dark-theme screenshots of Settings > General, one each with Default,
Graphite and a custom black picked: 「这三个颜色……都显示是一样的」,
「尤其是黑色始终一直是灰色」. Their screenshots show the same page in all
three: ground (25,25,27), card (32,32,34).

Why:
- v0.1.4124 tints the grounds with the pick's hue only (base + k*(c -
  mean(c))), lightness kept. Black and Graphite have no hue, so they
  changed nothing. Default draws no look at all (magpie's own).
- accentOn lifts a dark pick toward white only until it reads at 4.5:1,
  so black's dark ink came out #8a8a8a, next to Graphite's #89898f.

What changes (appearance.go):
- ground(): on the dark theme, a pick darker than the theme's background
  darkens every dark ground by as much (depth()). Black draws a black page
  (#000003), with cards, pills, lines, menus and the tray panel the same
  steps above it as in app.css (card #08080c, line #18181e). Graphite,
  and any colour as light as the ground, draw as before.
- lifted(): black's ink starts most of the way to white, so it is a light
  mono ink (#e0e0e0, dark text on its buttons), not Graphite's grey. On
  the light theme black is #000000, as before. The sibling, white on the
  light theme, now gets a dark ink instead of a mid grey.
- The light theme's grounds keep their lightness: a white pick would melt
  its white cards into the page.
- app.css: a swatch's edge and the chosen ring take a little of the text's
  ink, so the black swatch stays seen on the black page it draws.
- Default stays magpie's own look (grey grounds, indigo accent) for every
  user. Not changed here.

Tests:
- TestBlackIsBlack: black's dark page is black and each ground keeps its
  step; Graphite moves nothing; black's ink is light in dark (>= 1.8:1
  from Graphite's) and #000000 in light; white's light ink is dark; text
  reads >= 7:1 on black's grounds.
- appearance-look.test.cjs: "Default, Graphite and black are three looks",
  light and dark, both engines: three different --accent values; Graphite
  keeps the grey page; in dark, black's page is black, Settings' list sits
  on black's card a step above it, its ink is light; in light, black is
  #000000 ink.
- TestLookFixture's fixture gains #000000 and #52525b.

Run on mote (mote was unreachable for ~20 minutes; the red check ran on
mica), at this commit rebased on origin/main fc896a9f6:
- gofmt -l internal/gui: clean. go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, and GOOS=windows go vet ./internal/gui: ok
  (before the rebase onto fc896a9f6, which touched nothing in gui).
- go test -tags nogui -timeout 45m ./internal/gui: ok (95s, before the
  rebase); at the rebased head go test -run
  'TestAccent|TestLook|TestTint|TestWallpaper|TestBlack|Budget': ok.
- node --test, both engines (the files run every language at 420 and
  1000px where they have that matrix): appearance-look 44/44, i18n-keys
  4/4 at the rebased head; checkbox-look 8/8, seg-contrast 14/14,
  settings-general 20/20, settings-sections 10/10, input-look 20/20
  before the rebase. api-key-theme 0/6 (#6444) and omarchy 8/14 (#6027)
  are red with the same cases on a copy of origin/main fc896a9f6.
- Broken by hand: with origin/main's appearance.go and its fixture
  regenerated for #000000 and #52525b, the new GUI case is red in dark in
  both engines ("black's page is black, not rgb(26, 26, 30)"); light
  passes there, as black was already #000000 ink on the light theme.
- Screenshots, both engines, Settings > General zh at 1200, Default /
  Graphite / black, light and dark, before (origin/main's lookCSS) and
  after (before shots on mica, after on mote): dark black's page goes (26,26,30) -> (0,0,3), card (35,35,39)
  -> (8,8,12); Default and Graphite unchanged; black's ring still shows.

Not tried:
- the real macOS app, WebView2 and WebKitGTK;
- the full Go and GUI suites.
2026-11-14 13:59:58 +08:00
yetone 27c998aba0 usage: the tray panel's and Requests' costs follow each provider's currency
onkashiko on X: with Currency set to By provider, the menu bar panel
still showed every cost in one currency; providers and models were not
each in their own. drawLedColumns and drawLedRank (shared by the tray
panel and the window's Requests tab) formatted every value with no
provider, so fmtCost fell back to the Totals in currency.

- usageapi.Ledger echoes the provider a page is filtered to
  (`provider`, omitempty).
- app.js: ledProv(l, split, id) names the provider of a value: the
  ledger's filter, the row's provider (provider split), the provider
  part of a modelAt id, or for a model split the provider(s) that served
  it when they all share a currency. ledFormat/ledFormatLong take it,
  so the rank's values and sub-lines, the tooltip's rows and the axis
  (when one provider is picked) are in that provider's currency. Sums
  (the panel total, the tooltip total, a model served in two currencies)
  stay in the Totals in currency.
- page.js: the Requests head and the cost head use the filter's
  provider; the heatmap tip too. Other fmtCost calls are sums or
  sessions with no provider and are unchanged.
- core script budget +491 (1,269,040 -> 1,269,531): drawLedColumns and
  drawLedRank are drawn by the panel, so there is no lazy page to move
  this to; packed to the shortest form.
- docs/subsystems/gui-shell.md says how By provider reaches the panel.

Run:
- At 065fb6a8b (rebased on 7d5475769), mote: gofmt clean;
  TestCoreScriptBudget and TestLedgerSaysItsOneProvider ok;
  panel-currency-provider.test.cjs 20/20 (chromium + webkit x en, zh,
  zh-TW, ja, de; panel 440/320px, window 1100/420px, no sideways
  scroll, no page errors).
- At ff3ab573d (same change on 90932ed1f), mica, under suite.lock:
  go vet darwin, linux nogui, windows ok; builds for all three ok;
  go test -tags nogui -count=1 -timeout 45m ./... : 99 packages ok,
  exit 0. mote: go test usageapi, gui, usage ok.
- GUI suite, the 155 files the change can reach, mote: 2581 tests, 105
  failures in 13 files; the same 13 files give 104 at 90932ed1f. The
  one extra is tray-cell-click webkit en, flaky on both trees run
  alone (head green twice, base red once). Filed: grip-inset,
  key-balance-card, panel-fold, tray-cell-click, usage-* (#6293,
  #6294, #6295, #6499, #6003, #5872, #6414, #5869, #5796, #5215,
  #4790); panel-shortcut's 20 reds newly filed as #6606.

Broken by hand:
- panel-currency-provider on the old assets (MAGPIE_ASSETS): 20/20 red,
  with the reporter's symptom (DeepSeek $1.00, SiliconFlow $0.500
  under By provider).
- TestLedgerSaysItsOneProvider red with `out.Provider = f.Provider`
  removed.

Not tried: the real app's tray panel with real yuan and dollar
providers.
2026-11-14 12:42:46 +08:00
yetone 74c94b5db0 gui: a picked accent tints the theme's grounds (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked, on 0.1.4112 and again on 0.1.4116 ("依然没变,是不是
出bug了"), for the dark theme to follow the colour they picked. v0.1.4114
(a83fe2325) tinted only the chosen thumbs (--mark-fill). Their 0.1.4116
screenshot shows those thumbs purple, but the page, sidebar and cards are
still neutral grey: bg (25,25,27), card (32,32,34). Nothing tinted the
grounds.

lookCSS now also sets the theme's grounds from the picked colour.
- Window, light: --bg, --card-2, --pill, --pill-hover, --seg-track, --line,
  --line-2. Cards stay white.
- Window, dark: --bg, --card, --card-2, --pill, --pill-hover, --line,
  --line-2, plus the menus' --pop-bg.
- Tray panel: the body.panel grounds, in light and dark. tintPanel and the
  Windows title bar read --bg, so they follow.
Each ground takes 5% (light) or 8% (dark) of the colour's offset from its
own grey (base + k*(c - mean(c))). Lightness is kept, so a grey pick changes
nothing. With no accent, or under Omarchy, nothing is drawn.
accentOn and --mark are checked against the tinted grounds too.

Tests:
- TestAccentTintsGrounds covers:
  - every block is tinted;
  - lightness is kept (contrast to the base <= 1.1);
  - a grey pick changes nothing;
  - text is >= 7:1 and the accent >= 4.4:1 on the tinted --bg and --card,
    for many picks;
  - no accent gives no CSS.
- TestTintBasesAreAppCSS holds the Go bases to app.css.
- TestLookFixture holds tests/fixtures/look-accents.json to lookCSS
  (UPDATE=1 rewrites it).
- appearance-look.test.cjs now reads the real CSS from the fixture. A new
  case, in each engine and theme, picks a colour on Settings › General with
  and without a wallpaper, and checks:
  - the list, the sidebar and the body are tinted;
  - Default turns them grey again;
  - the panel's --bg is tinted.

Run on mote, at this commit rebased on origin/main 7b002b6be:
- gofmt -l internal/gui: clean.
- go vet -tags nogui ./internal/gui, the same with GOOS=linux, and
  GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui ./internal/gui: ok (126s).
- node --test, in both engines, of: appearance-look, omarchy,
  api-key-theme, checkbox-look, sidebar, settings-sections,
  settings-groups, i18n-keys, panel-options-fold and the seg-/theme files.
  Result: 120 of 138 pass. The 18 reds are api-key-theme (6, #6444),
  omarchy (#6027) and settings-groups' warm-ups case (#6597). On a fresh
  origin/main b005d1a47 the same three files give the same 18 reds.
- Screenshots in both engines: Settings › General, dark, zh, the reporter's
  purple #66258d. With no accent the ground is (26,26,30) and the card
  (35,35,39). Before this change the purple pick gives the same values.
  After it, the ground is (27,21,34) and the card (36,30,43).

Rebased on origin/main dc85a7ca5 (then e36541ddf, site/ only; 4 commits, none in appearance, app.css
or boot.js) and run again on mote at this head:
- go test -tags nogui -run 'TestAccent|TestLook|TestTint|TestWallpaper|Budget'
  ./internal/gui: ok.
- appearance-look and i18n-keys: 44 of 44.

Broken by hand: with both tints at 0.0 and the fixture regenerated,
TestAccentTintsGrounds fails and the four new GUI cases are red. Both pass
again with the change restored.

Not tried:
- the real macOS app, WebView2 and WebKitGTK;
- the full Go and GUI suites.
2026-11-14 12:24:31 +08:00
yetone ed63a5be5e gui: a picked accent colours what is chosen (CHENGJIAHEGOXIS on X)
「选中任意强调色没反应」: picking an accent in Settings › General seemed
to do nothing. The token did apply. With the real server, in Chromium
and WebKit, under light, dark and system, with and without a background
image, --accent was set by lookCSS and kept. Neither the theme nor the
wallpaper overrode it. But nothing on Settings, the sidebar, the header
tabs or the panel's tabs used --accent: every chosen option is graphite,
var(--fg), by design. So the colour only showed in a few buttons
elsewhere.

The fix is a --mark token, the ink of what is chosen.
- It is var(--fg) by default, so magpie's own look is unchanged, like a
  Mac's Graphite.
- accentVars sets it once the user picks an accent. It is moved toward
  black (light) or white (dark) until it reads at 4.5:1 on the surfaces a
  chosen option sits on: --pill-hover #e9e9ee, and the dark switch thumb
  #4c4c52.
- It is used by .seg/.opt/.ptabs/.warm-tabs/.am-seg/.klf-tab/.day-chip/
  .apptab .on, the header nav's chosen tab, the side-nav's open-page icon
  and Settings icon, and Library's switches and radios. Each is the same
  "chosen" role, so all of them follow the accent, not just one.

Tests:
- appearance_test.go's TestAccentReadable checks --mark's contrast on
  each surface, in both themes.
- appearance-look.test.cjs adds 8 tests, in Chromium and WebKit, light
  and dark:
  - Settings' theme and bird options and the side-nav icon at 1200 with a
    wallpaper set: graphite by default, the mark for #0d9488 and #db2777,
    and back to graphite on Default.
  - The header tabs at 900 and the panel's tabs at 380.

Run:
- gofmt clean. go vet ok on darwin, GOOS=linux -tags nogui and
  GOOS=windows (at 75bdc85fe, the same change on an older main).
- At 6f5549b1f (this change on 08f77528f), on Linux (WSL magpie-desktop),
  since mote's suite queue was hours deep:
  - The whole GUI suite, Chromium and WebKit, every language and the
    panel widths: 27231 tests, 1258 red in 183 files. The same 183 files
    at the parent were 1226 red. The 70 tests red only with the change
    were rerun with their 43 files at concurrency 2: 80 red with it, 89
    at the parent 783b69b8c. Every one left has a language or width
    sibling red at the parent too. None is about colour. They are the
    Linux reds #5559 and #4388 track.
  - go test -tags nogui ./... -timeout 45m: every package ok except
    internal/usage's TestRequestStateKeptAcrossACatalogFetchedAgain,
    red the same at the parent (#6572).
- At the pushed head, on mote (macOS):
  - TestAccent*, TestWallpaper*, TestLook* ok.
  - appearance-look 36/36, i18n-keys 4/4, library-all 26/26.
  - segs-press-redraw 16 red and api-key-theme 6/6 red, the same counts
    at the parent 6c88d61f0 (#4566, #3922, #6444).
  - TestCoreScriptBudget is red (1269382 > 1268961), the same at the
    parent. 92e760f3d took it over (#6518, taken). This change adds no
    script.
- Broken by hand:
  - With the old app.css and library.css, the 8 new GUI tests are red,
    8 of 8.
  - accentVars without --mark: TestAccentReadable fails ("…;--sel:#efefef",
    no mark).

Not tried:
- The whole GUI suite and the Go suite on macOS at the pushed head. mote's
  suite.lock queue was hours deep, so they ran on Linux instead.
- The real macOS app.
- Windows WebView2, and Linux WebKitGTK.
- Charts' --c1 series colour still does not follow the accent; that is
  left as it was.
2026-11-14 09:58:38 +08:00
yetone 817d35ffa9 usage: a window's whole follows the tokens pick's With cache (Anotiaww on X)
@Anotiaww asked (X 2121248031983194214) that the account cards' "Whole ≈ N
tokens" on Usage → Overview follow the page's tokens pick. With cache, it
now adds the window's routed cache read and written, scaled by the same
share used as the input and output; the line reads "Whole ≈ N tokens with
cache" and its tooltip says cache is included. Without cache nothing
changes. Changing the pick redraws the cards. The tray panel shows no
holds line, so it has nothing to follow.

holdsLine and holdsUnknownLine move from app.js into the Usage plugin's
page.js, beside usageWithCache, so the core script budget stays as it is
(it had 14 bytes left). quotaWindows still calls them as globals. New
words are said in zh, zh-TW, ja and de.

Run (mica, both engines, every language):
- quota-holds, i18n-keys, i18n-en-no-cjk: 16/16 ok. The new quota-holds
  test (pick With cache at 360 and 1000px, reload keeps it, pick back)
  went red in both engines with the cache left out and the old words, and
  again with no redraw on pick.
- 185 GUI files that reach Usage or quotas, plus mobile-web, idle-ticks,
  old-webkit and every i18n file, concurrency 3. Reds: account-eye,
  account-mask, account-refresh-holds, claude-quota-onboarding,
  codex-auto-reset (de), key-balance-card (de), menu-scroll, mobile-web,
  old-webkit, quota-count-wrap. The same files are red at the base
  ac0b5c287 without this change (quota-count-wrap 1100px cut, alone), and
  each is filed (#5052, #3951, #5814, #6179, #4790, #6414, #6532, #3952,
  #6467, #3404).
Run (mote): go vet, GOOS=linux vet -tags nogui, GOOS=windows vet, builds;
go test -tags nogui ./internal/gui (TestCoreScriptBudget), ./internal/provider,
./internal/usage ok.
Rebased on 077421733, where 5211fd3ba gave holdsLine a provider's
currency (prov); page.js carries it. At this head (mica): quota-holds,
quota-curve, currency-provider, currency, i18n-keys, i18n-en-no-cjk,
quota-count-wrap 80/83; the reds are quota-count-wrap (#3404, red at
077421733 too) and quota-curve chromium en/zh (#4768), which passes 31/31
alone here and at 077421733. go test -tags nogui ./internal/gui (budgets) ok.
Not run: the full go test ./... and the full GUI suite (both machines were
loaded); the only Go change is a comment.
2026-11-13 23:12:48 +08:00
yetone 5211fd3ba2 usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.

Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).

Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.

Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.

A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.

So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.

Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.

Run:
- go test -count=1 at this tree on mote: internal/settings,
  settingsapi, tui, cli, catalog, provider, fx and gui all ok
  (TestCoreScriptBudget included). The full go test ./... and the whole
  GUI suite are queued behind other sessions' suites on suite.lock
  (mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
  i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
  362 pass, 28 red. Every red is red the same at origin/main ac0b5c287
  on mote, and filed: settings-search (#6133, #6353), settings-hints
  (#6107, #6353), settings-lines-wrap de 440px (#6353), old-webkit
  appearance.js (#6467) and :has() (#5919). The one red of this change,
  settings-groups' list of Usage's parts (now with the Advanced fold),
  is fixed here: 14 of 14.
- currency-provider.test.cjs (new): en, zh, zh-TW, ja, de at 900 and
  420px, both engines; By provider, Totals in ¥, then Advanced: $ for
  the menu bar with totals in ¥, totals stay ¥21.60, the fold opens
  itself after a reload. Plus currency.test.cjs (3 choices now),
  i18n-keys, i18n-en-no-cjk, tray-cost: green in both engines.
- TestTrayCostIn (values, refused eur/provider, KeepOwn),
  TestFXByProvider (trayCurrency vs totalsCurrency), TestCoreScriptBudget.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., GOOS=linux go build -tags nogui,
  GOOS=windows go build on mote at this tree: ok.
- Broken by hand, each red: costInYuan ignoring the provider (GUI
  test: deepseek showed $1.00 for ¥7.20), PricesInYuan without the
  preset's site check (a relay made from DeepSeek's preset read as
  yuan), CostIn without its By provider branch (settings test),
  TrayCostIn ignoring TrayCurrency (TestTrayCostIn, TestFXByProvider),
  the fold not opening while set (webkit), the row saving into
  totalCurrency (chromium).
- Real app in a sandbox HOME on mote (dev build, magpie web and magpie
  usage) with DeepSeek, OpenAI and Z.ai presets and one call each: the
  window and the CLI both show deepseek-v4-pro ≈¥15.44, gpt-4.1 ≈$1.00,
  glm-4.6 ≈$0.290 and the total ≈¥24.07 at 6.685; /api/settings' fx
  carries yuan ["deepseek"].
Not tried: Windows and Linux windows and trays, the real menu bar with
Menu bar currency changed (drawn natively; covered through trayCurrency
in Go), a real Kimi CN or Zhipu account.
2026-11-13 22:46:00 +08:00
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
yetone ac1702c330 library: the first part of a skill group opens below its heading, not over it (jinpwng on X)
jinpwng on X (macOS, Chinese UI): in Library > Skills, opening the first
group made the page jump, and what was clicked went off the screen; the
others opened downwards. The group was the first part of a big group (a
repository split by folder, drawn in the group's windowed list). A click
on a part's heading draws it anew, and the first part's only neighbour
above it is the list's zero-height pad, which the click's hold passes
over. So the page held the next part's heading, the rows opened pushed it
down, and the view scrolled by the whole part: the clicked heading went
from 152 to -920. A part's heading is now data-unrolls, so the hold keeps
its list, whose top doesn't move. Top-level groups, projects and the
Instructions agents already held still; the new test guards them too.

library-group-steady.test.cjs opens and folds, at the top and scrolled:
the Skills groups and the big group's parts (first and second, and the
first with the second open), the projects in Skills, MCP and Subagents
(first and third), and two Instructions agents. Each heading must stay
within 1.5px of where it was clicked. Clicks and scrolls go through
page.mouse, since Playwright's own scroll before a click reads as the
reader's.

Run (mica, mica-run), at base 436d507f0 unless said:
- library-group-steady in chromium and webkit, en zh zh-TW ja de, at 980
  and 420: 22 of 22 pass.
- Broken by hand (data-unrolls line removed): 20 of 20 cases red in both
  engines, "the first part opened: the heading moved from 152 to -920"
  (420: 242 to -830).
- With click-scroll, every-skill, found-fold, library-groups,
  library-instr-busy, library-instr-sets, nav-sub-unroll,
  project-skills-groups, project-skills-pick, skill-fold-all,
  skill-group-shared, skill-groups, skill-parts and i18n-keys, in both
  engines: 90 pass, 12 fail. The 12 are i18n-keys' "a plugin's words are
  its own" (#6422/#6423) and skill-fold-all's strict POST list seeing
  /api/update/using (#5982), red the same on origin/main 4545790de.
- Rebased on origin/main 4545790de (no Library or hold change between):
  library-group-steady again in both engines, 5 languages, 980 and 420:
  22 of 22 pass.
- mote: node --check client.js, gofmt -l, go vet ./internal/gui for
  darwin, linux nogui and windows: ok.

Not tried: the real app on macOS (the GUI files only), and a filter
showing a part (it takes the same partHead).
2026-11-13 13:23:41 +08:00
yetone 870a9e0fe1 gui: the Windows tray panel stays where it opened, no jump left (jiangshangmuyun on X)
On Windows the panel opened flush against the right edge and, a moment
later, moved a fair way left. The tray placed it as it opened
(ToggleWindow -> PositionWindow), and every refit after that placed it by
the icon again: fitPanel, each glidePanel step (stepGlide in
glide_other.go) and zoomWindows all called tray.PositionWindow. Wails
centres the panel on the icon only when Shell_NotifyIconGetRect's rect is
inside the taskbar, and flush right otherwise. An icon clicked in
Windows 11's overflow flyout isn't in the taskbar as the panel opens, so
it went flush right; the page's first fit, once the flyout had closed,
read the flyout's arrow and centred the panel over that.

Now every refit of the open panel goes through sizeOpenPanel. On Windows
it keeps the place the tray gave it as it opened: the centre and the
edge by the taskbar held, kept inside the work area (panelRefit, one
SetBounds). The Mac and Linux keep SetSize then PositionWindow, as
before, in the same order.

Run:
- gofmt -l; go vet ./internal/gui ./internal/agent on darwin, linux
  (-tags nogui) and windows, on mote.
- go test -count=1 ./internal/gui ./internal/agent on mote: ok
  (145s, 250s).
- win-run on xiaomi-gpu: TestPanel*, TestOpenPanel*: ok.

Broken by hand (win-run, ../tray-jump-scratch/break.log):
- panelRefit holding the top edge in place of the taskbar's:
  TestPanelRefitKeepsItsPlace red in 4 cases.
- sizeOpenPanel taking the old path on Windows too, and app.go at its
  base (PositionWindow in fitPanel and zoomWindows):
  TestOpenPanelRefitsInPlaceOnWindows red each time.

Not tried: the real tray click on xiaomi-gpu. Nobody is signed in there
(query user: no users, LogonUI up, no explorer), so no tray exists to
click and the panel's moves couldn't be watched; the cause above is read
from Wails beta.24's systemtray_windows.go positionWindow. No GUI
(Playwright) file reaches this: the change is in Go, not the page.
2026-11-13 13:04:03 +08:00
yetone 8097860ab1 gui: put back what 76ceff87c took out of main by mistake
76ceff87c was built on an older base and its tree dropped the Linux
backdrop-blur rule (7c37424fc) and Codex seats change (d6b5f24db) with
their tests, docs and history.go edits. This restores those files from
d6b5f24db; the diff against d6b5f24db is now only the hours feature.
Run: git diff d6b5f24db --stat lists the usage files alone.
2026-11-13 01:01:43 +08:00
yetone 76ceff87c9 usage: a number of hours the reader sets, beside the calendar (eachg0 on X)
The range menu behind Custom has a top row, "[N] hours back". Enter asks
the Usage page for the rolling window last:Nh (1 to 720), which the
backend already answers for every view (totals, chart, models, accounts,
Requests); the chip reads "Last 30 hours". The pick and N are kept on this
device (magpie.usagePeriod, magpie.usageHours). 24 stays the preset's
chip, and an empty page, the credit days and the menu-bar way in know the
new period. zh, zh-TW, ja, de strings added.

Run (mote, at the rebased head): usage-hours, usage-24h, i18n-keys in
chromium and webkit, en and zh. Broken by hand: keptPeriod limited to the
presets turned usage-hours red (expected last:30h, got today).
Not tried: the whole GUI suite (queued on mote's suite.lock behind other
sessions, still running), narrow widths by hand, the tray panel (it has no
24h chip and is unchanged).
2026-11-13 01:00:14 +08:00
yetone 7c37424fcf gui: the Linux app draws without backdrop blur, which WebKitGTK repaints on the CPU each frame (Lsheng2012 on X)
Lsheng2012 (CachyOS, KDE, i7-12700H, RTX 3070 Ti Laptop) found the UI laggy.
webkit_linux.go turns accelerated compositing off under Wayland and without a
GPU, and there every backdrop-filter is software-painted for its whole box
each frame. body.linux now drops it on .modal, .pop, the panel's profile
chips, Settings' sticky head and the confirm ::backdrop. Layout unchanged.

Measured (WebKitGTK 2.52.6, Xvfb on magpie-desktop, 240 rAF scroll frames of
600 rows, 1100x760): no blur 16.2ms, sticky head blur 16.2ms, full-window
modal blur(8px) 25.0ms with compositing off (16.4ms with it on).
Run: linux-no-backdrop-blur.test.cjs in chromium and webkit on mote (green;
red with the rule removed by hand), go test ./internal/gui asset tests.
Not tried: NVIDIA, Wayland/KDE, the omarchy VM, a full suite. The sticky head
cost nothing in the probe, so the modal is the measured gain; if the reporter
is still laggy the cause is elsewhere (CPU painting at HiDPI), and we ask for
their session type, driver and version.
2026-11-13 00:47:41 +08:00
yetone 6edf7a69e5 usage: hide and show single quota rows of an Overview card (wangshaowei39 on X)
Antigravity's card lists Claude & GPT, Gemini and more. A row group can now be
hidden from Usage > Overview the way a card can: right-click or long-press a
row, or use the card's "..." menu, and choose "Hide <group> from Overview". The
"Hidden" line under the cards lists hidden cards and rows with an Unhide button
and Show all. The last group of a card cannot be hidden (use the card's own
hide). Persisted as settings usageWindowsHidden ("<card>|<group>"), changed
through /api/usage/arrange { windowsHidden } and kept by the Settings save.
Table view and tray panel are untouched.

Run (on mote):
- go test: TestUsageArrange*, TestUsageArrangeWindowsHidden (new), TestSettingsSave*,
  settings_keep guard, TestCoreScriptBudget, ./internal/settings, ./internal/settingsapi;
  gofmt clean; go vet darwin, linux nogui, windows.
- GUI, chromium and webkit: usage-rows-hide (new, 5 languages x 1200/560/390;
  32/32), usage-card-more 32/32, usage-arrange, usage-all-accounts 24/24,
  i18n-keys 4/4.
- usage-cards-hide and usage-hidden-way-back: "de 560" red (no sideways scroll
  635 vs 560); the same red on a clean origin/main a5e5f539a, filed as #6294.
Broken by hand: withoutHiddenRows returning its input turns usage-rows-hide
16/16 red in chromium.
Not tried: a real Antigravity account (fixtures only); full suite starts after
the tag.
2026-11-12 23:45:43 +08:00
yetone 36eebea136 update: the header's Update pill waits until it is news (certhon520, jkd6688, Yuyuaneth, milianxinqi on X)
A release comes every few minutes, so a downloaded update was always
waiting and the pill (window and tray panel) never went out. /api/update
now says "quiet" while this version has been behind for less than 3 days
(update.Quiet, the Stable channel's soak; counted from the first newer
version seen, kept in update-behind.json for the version running), and the
pill stays away. An urgent release ("**Urgent release:**" in the latest's
notes or any release between, fetched once per check) lights it at once and
a dismissal does not hide it. The x dismissal now also starts the quiet over,
so the pill is not back with the next release. Settings > Version, the tray's
Restart to update, quit and Restart automatically are unchanged. Plugins'
dot is for plugins that do not update by themselves; left alone.

Run (mote): go test ./internal/update (ok), go test -run Update|Asset|Budget|Script ./internal/gui (ok),
gofmt, go vet darwin / linux nogui / windows clean, update-quiet.test.cjs 21/21 in chromium and
webkit across en, zh, zh-TW, ja, de, panel and window. Broken by hand: dropping
!u.quiet in app.js (11 red), forcing Quiet=false in jsonIn (TestUpdateQuietUntilBehindAWhile red).
Not tried: a real 3-day wait, and the urgent range lookup against the live site.
2026-11-12 18:00:00 +08:00
yetone c14fa0ce93 Bring back 919780414 and 88d2962e0, which 698ed4adb undid
698ed4adb (a busy port names its holder) was committed from a tree made
before 919780414 and 88d2962e0 landed (09:38, eight minutes before it),
and took both out with no word in its body: quotatable.js, the Usage
Cards / Table switch and its test, and sessions' 16-byte head and
prefix hashes (digest.go) were gone from main from v0.1.3823. This puts
both back as they were, on top of 698ed4adb's own change, which is kept.

Run at this tree, on mote (cherry-pick of both onto origin/main
db0c1b039, no conflicts):
- gofmt -l internal/sessions: clean.
- go vet ./internal/sessions ./internal/gui; GOOS=windows and
  GOOS=linux -tags nogui go vet ./internal/sessions: ok.
- go test -count=1 ./internal/sessions: ok 83.6s.
- go test -run 'Budget|Lazy|I18n' ./internal/gui: ok (the core script
  budget holds with both changes).
- GUI, chromium and webkit: usage-quota-table, gateway-port-holder,
  i18n-keys, i18n-en-no-cjk, old-webkit: 44 of 46. The two reds are
  old-webkit's "compat.js is the first" (headerpresets.js, #6030) and
  "the styles hold up in Safari 15.0" (#5919), red the same on an
  origin/main db0c1b039 copy.
Not run: the full Go and GUI suites.
2026-11-12 09:57:52 +08:00
yetone 698ed4adb5 gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number.

proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched.

Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)".
Broken by hand: each fix reverted in turn, its test went red.
gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag.
Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there).
2026-11-12 09:46:34 +08:00
yetone 9197804144 gui: Usage allowances can be shown as a table beside the cards (zysicyj on X)
With a dozen accounts the packed card grid is hard to scan. The Usage
page's Allowances header now has a Cards / Table switch (a segmented
control, remembered per user in localStorage "quotaView"; the default stays
Cards, and nothing is written until the user picks). The table has one row
per account: subscription, account, then the four most common windows
(used % with a bar and the reset time), an Other column for extra windows
and balances, sortable by any column (click again to reverse, a third
time to clear; rows with no value stay last). Balance-only and error rows
span the window columns. Same data and helpers as the cards (quotaFill,
resetClock, quotaWho). At narrow widths the table box scrolls, not the page.

The code is a lazily imported quotatable.js, so app.js stays inside its
code budget. "Cards" and "Table" are translated in zh, zh-TW, ja and de.
quotatable.js is listed in old-webkit's lazy-script exceptions;
docs/subsystems/gui-shell.md has a paragraph on it.

Run (on mica/mote, Playwright): the new usage-quota-table.test.cjs, 22 of 22
in chromium and webkit, in en/zh/zh-TW/ja/de, at 1100px and 420px (14 faked
accounts: default is cards and saves nothing, row count and figures,
persistence across reload, sort cycle and account sort, no page overflow,
back to cards). TestCoreScriptBudget, i18n tests 8/8, gofmt, go vet for
darwin, linux -tags nogui and windows. Whole GUI suite (make test-ui)
at 1ad0f4cc4+this: started before the tag; first 890 results green except account-arrange (#6010, red the same on origin/main).

Broken by hand: with the default flipped to table, 10 of the new tests
failed; restored.

Not tried: the real app, Linux WebKitGTK, a real account's data (the
fixtures are faked, with the shapes the cards read).
2026-11-12 09:38:54 +08:00
yetone 7e3e0fec4f gui: put agents back as they were when magpie quits, connect them again at start (tudjam17795 on X)
New Settings > General switch, "Put agents back when quitting" (zh: 退出时还原 Agent 配置),
default off. With it on, quitting the GUI app runs the same restore Disconnect does
for every agent magpie has connected (*.before-magpie files back byte for byte), and the
next start connects those agents again. Off keeps today's behaviour: a connected agent
keeps magpie as it quits.

- agent.RestoreOnQuit disconnects each wired agent that the user did not disconnect, then
  forgets the <id>.disconnected mark, so the quit leaves no mark; it stashes the list of ids.
  agent.RewireOnStart takes that list once and connects those still unwired and not
  disconnected since. An agent the user disconnected stays disconnected.
- gui: OnShutdown restores only when the setting is on and this process served the
  gateway; start re-wires in the background (not while the gateway is paused). A restore
  on quit also quits at once without the ask.
- settings.RestoreOnQuit, settingsapi key kept unless sent, row in index.html, i18n for
  zh, zh-TW, ja, de, docs in gui-shell.md and agent-wiring.md.
- app.js: the repeated Off/On settings rows go through one helper (segsOO), 422 bytes
  smaller overall, so TestCoreScriptBudget passes without raising the budget.

Run (sandbox HOME, mica because mote was loaded):
- go test internal/agent, internal/gui, internal/settings, internal/settingsapi, internal/cli
  at the rebased head: the new tests and the budget test pass.
- GUI, chromium and webkit, five languages, widths 1100 and 420: restore-on-quit (new),
  quit-ask-setting, quit-ask, settings-general, settings-sections, settings-places,
  i18n-keys, i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw, and for the rows moved to
  segsOO: reduce-motion, skeleton-bird, lightweight, keep-login, checkin-at,
  update-auto, update-hide, update-restart, update-download, tray-bird, tray-logos,
  tray-cost, wsl-agents-setting, login-allow. All 0 fail.
- gofmt -l clean; go vet darwin, windows, linux -tags nogui clean.

Broken by hand: not forgetting the disconnected mark turns
TestRestoreOnQuitAndRewireOnStart and TestRestoreOnQuitLeavesUserDisconnected red;
dropping the Disconnected() checks turns TestRestoreOnQuitLeavesUserDisconnected red;
dropping the setting gate turns TestRestoreAgentsOnQuit red.

Known reds, not from this change (same on the base 60559ee73): 20 GUI failures in
settings-hints, settings-lines-wrap and settings-search (#6133, #6107, #6156, #6073);
internal/gui TestPanelHiddenByWailsMarksPageOutOfSight killed under load (#6063);
internal/agent TestPiGroupEntryKeepsItsMembers on mica.

Not tried: real agent configs (sandbox HOME only), a real Wails quit on a Mac with real
accounts, Windows via win-run, the Linux WebKitGTK app.
2026-11-12 00:19:34 +08:00
yetone 22f2759d71 gui: Settings › General › Sidebar pages leaves pages out of the sidebar for this browser (youimark on X)
Gateway mode hides Agents only for magpie web without agents, and the Library
only goes with its built-in plugin. A docker gateway asked to close both. The
new row is a multi-tick menu of the sidebar's pages (Providers stays), kept in
localStorage magpie.navHidden; navHides and offView read it beside gateway mode
and the built-in plugins, and start.js opens Providers when Agents is out.

Main's TestCoreScriptBudget was already 351 bytes over at origin/main
(1,534,153 > 1,533,802); this commit cuts comments in app.js to land at
1,533,596, under it, with no raise.

Run, on wsl-run (xiaomi-gpu), chromium + webkit: nav-pages-hidden 2 pass;
broken by hand (navHides without the new term) 2 red. settings-general went
red on the first draft (the row was 56 tall, the others 51, the button in a
wrapper) and passes now. i18n-keys, i18n-en-no-cjk, last-page, gateway-mode,
sidebar, phone-tabs 0 fail. go test -tags nogui -run TestCoreScriptBudget ok.
Red the same on an origin/main copy (7 and 14 fails, not from this change):
builtins webkit, side-toggle (both engines) and settings-search ("searching
posts nothing": /api/update/using); filed with this push.
Not tried: a real docker deployment, the full GUI suite, the Mac and Linux
apps, sidebar-glide (3 fails under load, base not compared).
2026-11-11 17:29:38 +08:00
RainierandClaude Opus 5.5 4d9b798d50 web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by
someone signed in to the box already, and asks for a key they never
saw: it is in the container's log. A package can only hand the key to
every browser that reaches the app, or put a proxy in front that adds
the key's cookie to what the box signed in.

The box's ingress, lzc-ingress, sends a browser that isn't signed in to
the box's login page, and puts on every request it passes the app the
box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL)
and what sent it (X-HC-Source, client for a browser), in place of what
the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that
sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by
a browser, each of the three named once, and tells anyone else the box's
reason.

The box's sign-in is a cookie of the box's, and the box's apps are one
site, so a browser sends it with another app's page's requests too: an
earlier build of this change let another app's page on the box include
/boot.js and read window.bootPrefs. So it is taken only for what the
page itself or the user asked for (boxFetched, the Fetch Metadata:
Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a
document from another page), never for another page's script, frame,
fetch or form POST, nor from a browser that sends no Fetch Metadata.

It sets no cookie of the page's own, so signing out of the box signs out
of the page. The key's link and cookie work as before, /api still
answers the page alone (webOwnPage), and the gateway's client routes on
the page's port go to the gateway first (onePort), which asks for a
gateway key. StartWeb refuses another value, and lazycat where
LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't
set: all magpie can check, so the setting is the package's word that the
box's ingress is the only way to the page's port. magpie web prints the
box's address beside the link.

Docs: reference.md's new LazyCat section, with a manifest and what must
never reach the page's port, and gui-shell.md's Browser mode row.

On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request
headers: a signed-in browser's request carries X-HC-User-ID,
X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not
signed in, / goes to the login page and a public path gets none of the
three (forged ones taken off, repeated or in lower case too), while
X-HC-User-Groups passes on as the caller wrote it, so it is never read;
a TCP ingress passes every header as sent. Another app's container
reaches the app through the ingress alone (straight to the app's
container it times out); the box itself, and a container in its network
(network_mode: host, which a manifest may set), reach the port.

A test app made from the docs' manifest, running a build of this change
on 68cb92e8e in the image's place as its user (uid 65532): the box's
administrator opens the console with no key, and no cookie is set;
/v1/models still asks for a gateway key; from another app's page a
navigation opens the console, while a script include of /boot.js and a
frame are turned away; in the container, past the ingress, a request
with no Fetch Metadata, no X-HC-Source, NORMAL or a header twice gets a
401. Bound to /lzcapp/var/config, which the box makes as root's, magpie
couldn't write /config; bound to /lzcapp/var it can, and a gateway key
outlived the container.

Tests, through webServed with the headers the probe saw:
TestLazyCatSignInOpensThePage, TurnsAway, AsksWhereFrom, IsAskedEachTime
and IsNoGatewayKey (the client routes, with each sign-in that opens the
page), and TestWebBoxSignInChecksItsValue.
TestRemoteOpensTheOtherMagpie, new on main, gives webHandler no box
sign-in.

Run, at this tree, on 6c3f113ce: Docker golang:1.26.8 (linux/arm64):
gofmt clean; go vet -tags gtk3 ./... (with the GTK and WebKitGTK
headers, as CI), -tags nogui and GOOS=windows clean; both builds ok.
macOS 27.2 (go1.26.8, not root, a temporary HOME): go vet ./... and the
two cross vets clean, the three builds ok; go test -tags nogui ./...,
TestScriptFindsClaudeMoved skipped (it runs the real
/Applications/Claude.app, #5989): 92 packages ok; red outside
this change, each red the same at 6c3f113ce:
TestBunProxyLoginWithReservedCharacters (#3397),
TestGitUpdateInstallsTheBranchsCommitNow and
TestGitUpdateKeepsACommitPin (#5988), on this Mac's bun 1.3.11,
older than MinBun; TestEveryRouteHasACommandOrIsNamed: POST
/api/settings/join, new with e053c337a, has no command. /join, new
with it too, is a client route, so the docs' manifest lists it.

Broken by hand, each red, all green again put back; a break that lets in
what must be turned away was seen to reach the page: TurnsAway with the
once-each check out, no sender taken, the role in any case, the role or
the sender check out (IsAskedEachTime too), app:… and system alone
turned away, or the key's "open the link" kept in the box's 401;
AsksWhereFrom with boxFetched out, no Fetch Metadata taken, another
page's navigation taken of any method or into a frame, an object or an
embed (or anything but an iframe), its request for a document that isn't
a navigation, or another app's page's script (same-site, no-cors);
OpensThePage with another page's navigation taken by GET alone, or none
taken (IsNoGatewayKey too), a cookie set, or webOwnPage out;
IsAskedEachTime with the first sign-in kept; ChecksItsValue with lazycat
taken outside LazyCat or StartWeb not asking webBoxSignIn's error;
IsNoGatewayKey with the client routes behind the box's sign-in, or one
the box signs in on, or a HEAD to one, given to the page;
TestLazyCatManifestListsTheClientRoutes with /me out of the docs.

Not tried: a NORMAL account in a real browser (the box has one
account); signing out of the box in a browser; the box's own client
apps opening the page; a browser without Fetch Metadata; a header named
twice on a signed-in request through the ingress (a browser can't send
one); a multi-instance app; another lzcos version; a community plugin's
page on the box; a real vendor call through the box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
yetone 47e30d0e97 gui: the Mac's title bar drags while a dialog is open, and the bar's middle does everywhere (ssuuuuooo on X)
v0.1.3624 added the .modal-grip strip but it could not work on the Mac:
there the scrim begins under the bar (body.window.mac .modal top: 50px),
so the strip sat below the bar, while the bar itself (header, sidebar top)
is inert whilst a dialog is open (modalBackground), and an inert element
is not hit, so nothing there carried --wails-draggable. On Windows and
Linux the strip worked only at the sides: the dialog's 16-28px top padding
let a tall dialog (the provider editor) lie over the strip's middle.

Now on the Mac the strip reaches up over the bar (top: -grip height; a
fixed child would not do, the scrim's backdrop-filter is its containing
block), and off the Mac the scrim's top padding is at least the strip's
height so no dialog lies over it. docs/subsystems/gui-shell.md updated.

Run (mote-run, chromium and webkit): modal-title-drag.test.cjs gains
"the middle of the title bar drags with a tall dialog open" (web and mac
classes, 5 x 3 points along the bar, header inert): 0 of 4 on the old css,
4 of 4 now. With modal-*, dialog-*, add-sheet*, signin-closes-sheet,
sidebar*, click-scroll, panel-drag-linux, title-bar-tools, i18n-keys,
popover-mac-chrome, editor-roomy: 351 pass; the 3 reds of that run
(modal-centred-late, sidebar-overlay-scrollbar webkit, title-bar-tools
zh-TW webkit) pass 36 of 36 rerun alone at this tree, and
sidebar-overlay-scrollbar webkit also failed once on the base (load).
Not tried: a real drag in the signed macOS app (the test checks the
--wails-draggable value under the pointer, which Wails reads); the
confirmation (action-confirm, top layer) still has no strip.
2026-11-11 04:09:07 +08:00
yetone c4da9a97dd gui: the window drags from the title bar strip while a dialog is open (ssuuuuooo on X)
On the Mac the main window couldn't be dragged by its title bar while a
dialog was open: #modal's scrim covers the whole window, including the
bar, and had no drag region (--wails-draggable is read from the element
under the pointer). #modal is the one overlay every dialog of the window
uses (provider editor, new provider, what's new, sign-in, ...), so one
strip fixes the class: .modal-grip, last child of #modal (app.js keeps
the dialog the first child), as high as the title bar, drag. The dialog
has z-index 1 over it and so is never a drag region, nor is the scrim
below the strip, which still closes the dialog on a click; the strip
counts as backdrop for modalBackdrop, so a click there closes it too.

Not covered: the confirmation (action-confirm, a top-layer <dialog>);
its ::backdrop hit-tests to the dialog element, which can't carry a
strip. The add sheet is part of the page, not an overlay.

Run (mote-run, chromium and webkit): new modal-title-drag.test.cjs (en,
zh, 1100 and 440px; the provider editor and a new provider's editor):
8 of 8 pass; with the grip's drag style taken out it is 0 of 8. Also
modal-*, dialog-*, add-sheet*, signin-closes-sheet, sidebar, click-scroll,
panel-drag-linux, title-bar-tools, i18n-keys: 162 pass. go test
./internal/gui ok; go vet darwin, gofmt clean.

Not tried: a real drag in the macOS app (the test checks the
--wails-draggable value under the pointer, which is what Wails reads);
windows/linux go vet of internal/gui (no assets-only Go change).
2026-11-11 01:28:27 +08:00
yetone 6bac8f8a59 gui: magpie web on a phone has a tab bar with More (geraldpppppp on X)
On a phone, magpie web's pages sat in a strip under the header that
scrolled sideways, with nothing to show that more pages lay past its
edge. Agents, Library and the rest looked missing. The pages are now a
tab bar at the foot, as an iPhone app's (HIG): each tab its mark over its
word, the page open marked. Five tabs at most: with more pages than
that, the fifth is More, and its menu lists the rest with their marks
and a tick on the open one. More is marked while one of them is open,
and it carries the dot when one of them has one. phonetabs.js does
this. app.js loads it lazily only on a phone, so the core script
doesn't grow. A status line comes up over the bar. The bar is only for
the window, never the tray panel (body.panel).

Agents still isn't shown in gateway mode on a machine with no agents,
as designed (Settings > General > Gateway mode brings it back). Library
has been shown in gateway mode since f285426ac.

Tests: phone-tabs.test.cjs (new) runs at 390x844 in chromium and webkit,
in en, zh, zh-TW, ja and de, with gateway mode on and off. It checks:
- five tabs with More fifth, at the foot, 44px tall;
- nothing scrolls sideways;
- every page is reached from the bar or from More, and More's menu opens
  above the bar;
- the bar covers no page content and no status line;
- a desktop browser has no More.
reader.cjs gets openPage() (the tab, or More's menu). mobile-web,
phone-no-sideways, routing-held-dot and name-suffix-saved open pages
through it. phone-web checks the bar at the foot. old-webkit lists
phonetabs.js as lazy. market-more waits for the view's own foot, not the
window's, which is now above the bar. group-from-model-add wheels Add
wholly into the view before its press, because at 600x420 WebKit took a
press on Add's half-hidden middle as one on the header.

Run on mote:
- The whole GUI suite once (450 files, concurrency 3). 33 red files
  were then run on this change's base and on the branch. The reds only
  on the branch were the four tests that tapped tabs now under More,
  phone-web's old label check, market-more, group-from-model-add (webkit
  600x420), and the panel tests agent-menu-label, zcode-models and
  panel-fit-tabs (webkit). The panel tests are web:true at 360-380px, so
  the bar's padding reached the panel. It is now scoped :not(.panel).
- After the fixes: phone-web, market-more, group-from-model-add,
  agent-menu-label, zcode-models, panel-fit-tabs, phone-tabs,
  mobile-web, phone-no-sideways, routing-held-dot, name-suffix-saved,
  old-webkit and i18n-keys. All are green except reds already filed on
  main: #5919 (old-webkit :has), #5869 (phone-no-sideways de 375) and
  #5215 (tray-cell-click, a web:false panel test). mobile-web's 900/1280
  desktop screenshots need git, so they were run with BASE_REF set to a
  commit of the base's assets: 30/30 pass in both engines, so the
  desktop is unchanged.
- gofmt, go vet for darwin, linux (nogui) and windows, and go test
  ./internal/gui.
- Again at the pushed head, rebased on origin/main ca7a39291: the 13
  GUI files above (239 pass; reds only #5919, #5869 and mobile-web's
  git-less desktop compare), gofmt, vet on all three, and go test
  ./internal/gui ok. TestCoreScriptBudget was over at the old base
  662546e78 and passes here: app.js is ~430 bytes smaller.
- Rebased again on 388ca9ad4 (two agent commits touching app.js and
  i18n.js): the budget tests, i18n-keys, phone-tabs and phone-web
  pass (34 of 34). Then onto 0baa223ec (Kun; a one-line app.js change)
  with no further run before the push.

Broken by hand:
- Without layoutNav's import of phonetabs.js, phone-tabs is 20 of 24 red.
- Without :not(.panel), panel-fit-tabs (webkit, 5 languages) and
  agent-menu-label go red.

Not tried: a real iPhone's Safari, or the LAN share opened on a real
phone.
2026-11-10 22:10:55 +08:00
yetone 10c4dc109a update: a restart by itself waits while magpie's window is in use (BESTLJP0412 on X)
With Restart automatically on, magpie restarted to update as soon as the
gateway was idle, even while the user was adding a provider or changing
settings in its own window, which closed what they were doing.

The page now tells the app it is in use: any pointerdown, keydown, input
or wheel posts /api/update/using (at most every 20s, and at once when a
dialog opens or closes, with whether #modal is open). inUseAt holds a
restart for 2 minutes after the last input (usingFor), or 15 minutes
while a dialog was open at the last input (openFor). waitFor skips the
restart while the window is in use, unless the restart was asked for
(the tray's Restart to update, Settings' Restart now), which still
restarts at once. A `magpie update` from a terminal (restartBeside) waits
the same way. The route writes nothing, so held doesn't drop caches for
it. /api/update says `using`, and Settings' Version row and the Update
pill add "waiting while you use magpie" (en, zh, zh-TW, ja, de).
docs/subsystems/gui-shell.md describes it.

Run (mote, at this head):
- go test -run 'AutoRestart|Wait|Idle|Restart|Using|EveryRoute|CoreScript|Budget'
  ./internal/gui/ ./internal/cli/: ok.
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows for internal/gui
  and internal/cli: ok. gofmt -l: clean.
- GUI, chromium and webkit: update-using (new), every update-*.test.cjs
  and i18n-keys.
- TestCoreScriptBudget: fits with no raise. Main had 40 bytes left, so
  the update code's comments next to this change were cut to one line
  each (no code, every issue and reporter kept): 1,533,641 of 1,533,802.
- One webkit run of update-wait.test.cjs had a red subtest while mote
  needed 10 ssh tries (its output was cut by my grep, so not filed);
  update-wait passed 3 of 3 in webkit at this change and 3 of 3 on
  origin/main 016763f23.

Broken by hand (a separate worktree): waitFor's in-use check made `if
false && …`, restartBeside's !inUseAt dropped, and the page's listeners
given no events: TestAutoRestartWaitsWhileTheWindowIsUsed and
TestTerminalUpdateWaitsWhileTheWindowIsUsed went red, and update-using's
"a restart by itself waits while magpie is used" went red in chromium.

Not tried: the real app on any OS (only Playwright's engines and the Go
tests), WebKitGTK, and a real update downloaded and applied. A dialog
left open with no more input holds the restart for 15 minutes, then it
goes ahead; the wait still gives up after an hour (waitMost) as before.
2026-11-10 21:09:39 +08:00
yetone e8fbee60ea gui: pause the gateway without quitting magpie (me2seeks on X)
Disconnect and quit was the only way to stop the gateway, and it quits
magpie too. Pause does the same without the quit, from the tray's Pause
Gateway (Resume Gateway while paused), Settings › General › Gateway
(On/Paused, the app's only) and the Gateway page's Resume gateway, all
through POST /api/gateway/pause.

- Pause disconnects each connected agent as its row's Disconnect does
  (its own settings put back), keeps their ids in gateway-paused.json in
  the config folder, and stops the listener with requests in flight
  drained. An agent that can't be disconnected keeps the gateway serving,
  those before it connected again, and is named in the status line.
- While paused, serveGatewayLocked serves nothing: not the 15s watch, a
  port change nor a handover; a magpie started again stays paused. A
  pause file that can't be read counts as paused.
- Resume serves again and connects the agents the pause disconnected.
  A port held by something else keeps the pause and says what holds it.
  The Gateway page's Start/Restart, connecting an agent and picking one
  of magpie's models for it resume too.
- quitask's wired list and the pause share wiredOf.
- Strings in en, zh, zh-TW, ja, de. gui-shell.md documents it.

Run (mote was unreachable for the later runs; the Windows box instead):
- mote, before the rebase: go vet ./internal/gui; go test -run
  'TestGatewayPause|TestGatewayResumes|TestTray|TestGatewayFix|TestQuit'
  ./internal/gui: ok.
- at this tree on b46f23ffa: win-run go vet ./internal/gui ok; wsl-run
  go vet -tags nogui ./internal/gui ok; gofmt -l clean.
- win-run go test -count=1 ./internal/gui: the pause and tray tests ok;
  8 reds, each the same on origin/main d4b4a188e run alone on Windows
  and filed (#4115 %AppData% import rows, #5928 ~\ paths, #2107/#3649
  TestGatewayHeldByAContainer).
- wsl-run GUI (chromium + webkit): gateway-pause (5 languages x 1000/420),
  settings-general, gateway-takeover, i18n-keys, i18n-en-no-cjk: 51/52.
  The red is gateway-takeover webkit en's dark-mode case, red 1 of 2 on
  untouched origin/main too: #5942.
- rebased on 401187300: win-run go test -run 'Budget|TestGatewayPause|
  TestGatewayResumes|TestTray|TestQuit' ./internal/gui ok; wsl-run go vet
  -tags nogui ./internal/gui ok; gofmt clean. darwin vet not rerun after
  the rebase (mote refused SSH).

Broken by hand: serveGatewayLocked without its pausedNow check, and the
rollback's reconnect skipped: TestGatewayPauseAndResume ("served while
paused") and TestGatewayPauseRollsBack ("codex not connected again")
went red; green again restored.

Not tried: the real app's tray on a desktop, a real agent's config
round-trip (the Go tests fake the agents; Disconnect/connect are the
rows' own code), an agent wired from the CLI while the app is paused
(it doesn't resume), the whole GUI suite, the full Go suite (started after the tag).
2026-11-10 19:36:24 +08:00
yetone b46f23ffa5 docs: the model list's provider ticks and a provider's billing 2026-11-10 18:58:03 +08:00
yetone b358677305 gui: open a server's magpie in a window of the app (xuanwo on X)
xuanwo runs magpie on a server and wants the desktop app to show that
magpie's routing and usage. Browser access in Settings › Network and
sharing goes the other way: it serves this app's page to a browser.

Settings › Network and sharing has a new section, Another magpie. It takes
an address and a key. You can paste the whole link the server printed
(`magpie daemon install --web`, `magpie web`, or another app's Browser
access), and its k= becomes the key. The app then opens that magpie's own
web page in a window of its own. The window signs in through the server's
own webGuard with ?k=, the same way a browser does, and is traded for its
cookie. Nothing new is served here: the page in the window talks to the
server alone and gets no bound calls from this app.

- remoteAddr:
  - https:// is used when no scheme is typed.
  - Plain http is allowed only to an IP, localhost, a .local name or a
    one-word name, so the key never crosses the internet in the clear.
    This is also the rule a Mac's webview applies.
  - userinfo and other schemes are refused.
- remoteProbe: before the window opens, it asks for the link without
  following redirects. Only a 303 that sets a magpie_web_* cookie counts
  as success. A 401, a 403 (allowed addresses), an untrusted certificate,
  no answer, or any other reply is reported in Settings, translated.
- remote-magpie.json:
  - It sits beside settings.json, mode 0600, and the key is never in
    settings.json.
  - GET /api/remote returns the address and hasKey, never the key.
  - POST with no key reuses the key kept for the same address.
  - POST /api/remote/forget removes the file.
- The routes are on the app's own windows' API only (!isWeb). A host that
  can't open windows refuses.

Run (on mote, at this tree):
- go test -count=1 ./internal/gui/: ok.
- Go tests:
  - TestRemoteAddr
  - TestRemoteOpensTheOtherMagpie: real webHandler; wrong or missing key
    refused, nothing kept; the pasted link opens; 0600; the key is not
    returned; a cookie-jar client following the opened link reaches the
    page behind the key; the kept key is reused; forget.
  - TestRemoteNotMagpie
  - TestRemoteNotOnBrowserPages
- GUI test, new: another-magpie.test.cjs. Covers 5 languages, 360px,
  and a browser page with no section that never asks /api/remote.
- GUI suite: every GUI file that draws Settings › Network (18, the new one included), plus
  i18n-keys, i18n-en-no-cjk and gui-de/ja/zh-tw. Chromium and WebKit:
  307/307 pass. Also remote-magpie.test.cjs (the Remote magpie
  provider's add sheet), run with the new file at the rebased head.
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui, and GOOS=windows on
  internal/gui; ok.

Broken by hand:
- A 303 without the magpie cookie taken as signed in:
  TestRemoteNotMagpie red.
- remoteRoutes outside !isWeb: TestRemoteNotOnBrowserPages red (200).
- renderRemote drawn on a browser's page, and errors not translated:
  another-magpie.test.cjs red in zh/zh-TW/ja/de and the browser case,
  in both engines.

Not tried:
- The real Wails window on macOS, Windows or Linux.
- A real server over https.
- Links on the remote page that open a new window (target=_blank,
  window.open) inside the remote window.
- Settings › Text size does not rezoom a remote window that is already
  open.
2026-11-10 18:39:20 +08:00
yetone d374168d04 gui: Settings stays where it was clicked in the sidebar (jen_celeus on X)
In the sidebar layout Settings sits at the sidebar's foot, and opening it
listed its eight tabs under the button. The foot is anchored at the
window's bottom, so it grew upward and the button rose about 223 points,
out from under the pointer, and dropped back when another page folded the
list.

Settings' tabs now open above its button and grow up from it, so the button
and the gateway's line stay where they were. The foot is laid from its end
(`.side-foot` is `column-reverse`, its rows ordered tabs, Settings, gateway
and kept whole). A window too short for the list scrolls the foot from its
end, so the button stays in sight, and the foot may take 80% of the sidebar
while the list shows instead of 55%. The list's DOM order is the order
shown, so Tab reads tabs, Settings, gateway. The rows rise from the button,
nearest first. The overlay bar's thumb math takes the reversed scroll
origin. Nothing else in the layout changes: pages' own tabs still open
under their rows. The core-script budget is paid by cutting two sidebar
comments, with no raise.

Run (mote, at this head after rebasing on 86825005e unless said):
- sidebar-settings-steady.test.cjs (new), chromium and webkit, wide 1200,
  narrow 760 (sidebar picked), short 460 and tiny 340 high, all five
  languages: 42 of 42 pass. It samples the button every frame while the
  list opens, after a tab is picked and while it folds.
- Broken by hand: the old code is red in all 20 cases per engine ("the
  button moved 223px", 185.8px in the short window). With the foot back to
  `column`, red (223px). With the list put under the button in the DOM,
  red on the reading order. Before the rows were kept whole, the tiny
  window was red at 21.7px.
- sidebar, sidebar-glide, sidebar-tab-top, sidebar-overlay-scrollbar,
  nav-lamp, nav-sub-unroll, side-toggle, side-width, side-gateway-lan,
  settings-tabs-stick, text-size, click-scroll, readable-focus,
  page-width, i18n-keys at 3f27eab03 (this change before the rebase, no
  GUI files changed under it except the one new test): 322 pass, 1 red,
  sidebar-overlay-scrollbar chromium en "dragged to the end: 224 of 253",
  the known #1863. Alone it passed 3 of 3. Commented on #1863.
- go test ./internal/gui/... at 3f27eab03: ok.
- At this head: sidebar-settings-steady, sidebar, side-toggle and
  i18n-keys, chromium and webkit, 90 of 90 pass; TestCoreScriptBudget ok
  (220 bytes under the core budget).

Not run: the whole GUI suite, the full Go suite (started after the tag),
Windows and WebKitGTK by hand. No Go code changed, so no gofmt or vet.
2026-11-10 15:45:35 +08:00
yetone 8287e24c79 usage: a card is as tall as what it holds, none stretched to the tallest (jen_celeus on X)
jen_celeus: the Usage cards didn't size to their content but filled the
whole height, leaving a large empty space. packUsage gave the last card
in each column a min-height down to where the tallest column ended
(ikunbots on X, 3deb85685, so cards in one row lined up). An OpenCode
Zen card, a plan and no windows, beside Claude Code stood as tall as
Claude's, mostly empty. Now every card is as tall as what it holds, the
last in a column too; the packing is unchanged. This reverses ikunbots'
bottom alignment on purpose: the two asks conflict, and empty space
inside a card read as broken. A head with nothing under it keeps no
margin below (.subscription-head:last-child).

usage-pack.test.cjs: each card is as tall as itself (none reaches the
tallest's end); a new case of Claude Code, OpenCode Zen with no windows
and Codex at 1400, 897 and 560 (Zen a head's height, ending at its own
content beside Claude); ikunbots' row has ragged bottoms; an opened
account makes its card taller.

Run (mote): usage-pack.test.cjs, en, zh, ja, de, chromium and webkit,
8 of 8. The 154 GUI files that load the Usage page (grep view=usage,
subscriptionUsage, subscription-card, subscription-head) plus
i18n-keys, both engines, on the previous base 0842bc517: 2692 of 2739.
The reds' 11 files run again at origin/main b596da773 and at this
change: every red at this change is red at origin/main too
(phone-no-sideways de 375, #5869; usage-fold, tray-cell-click and
codex-auto-reset webkit de, #4790); account-eye and quota-curve, red
only in the 154-file run, pass alone on both. At the pushed head (on
origin/main 4bfac1268): usage-pack, usage-card-more, usage-cards-hide,
usage-accounts-fold, usage-keys-fold, usage-shared-balance and
i18n-keys 92 of 92, go test -run Budget ./internal/gui/ ok. gofmt; go vet darwin, linux -tags
nogui, windows; go test ./internal/gui/ ok (on 0842bc517).

Broken by hand: with the last-card min-height put back, usage-pack is
red 8 of 8 (the Zen case first).

Not tried: the real app's WebKitGTK and WebView2 windows.
2026-11-10 11:50:01 +08:00