Commit Graph
249 Commits
Author SHA1 Message Date
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
yetone add47afd82 usage: a card's ⋯ opens its menu, Hide from Overview where it is seen (jen_celeus on X)
jen_celeus asked to hide providers with no usage information, OpenCode
Zen and the like, from Usage. The hide was already there
(UsageCardsHidden, Hide from Overview, the "n hidden" line with Unhide
and Show all), but it sat behind a right-click, a long press or the drag
handle's menu, and nobody found it. Each card's head now has a ⋯ button
(quotaCardMore), the Agents row's pattern: shown on hover and keyboard
focus, always shown where nothing hovers, opening the same menu
(quotaCardMenu, now anchored on the ⋯), a second click closing it. On a
phone it keeps 22px with a 44px-high hit area that stops at the card's
edge (an even -11px inset spilled past it: usage-accounts-fold,
usage-keys-fold and usage-shared-balance said "card spills"). The long
press leaves the ⋯ alone. Its label reuses "Actions for {name}", already
in every language.

Run (mote): usage-card-more.test.cjs (new: Claude beside a Zen card with
a plan and no windows; en, zh, zh-TW, ja, de at 1200, 560 and a 390 web
phone; chromium and webkit): the ⋯ is there with its label, hidden at
rest where hover is, shown on hover, never over the head's text where
nothing hovers, menu = Hide from Overview, toggles, the hide posts
{cardsHidden:["opencode-zen-free|plan"]}, no scroll, the "1 hidden"
line's Unhide brings it back, no page errors. The 154 GUI files that
load the Usage page plus i18n-keys, both engines: see the next commit's
record. gofmt; go vet darwin, linux -tags nogui, windows;
go test ./internal/gui/ (budgets) ok.

Broken by hand: without head.append(quotaCardMore(...)) the new test is
red in every subtest (chromium 0 of 16).

Not tried: the real app's WebKitGTK and Windows WebView2 windows; the
web page on a real phone.
2026-11-10 11:47:06 +08:00
yetone 98c4b2e814 usage: a request opens on a page of its own
geesehowardt7 on X clicked a request on the Usage page to see where it
came from. The click on its time opened Routing, which they hadn't
asked for, and the row's details had no source address.

A row's click, or Enter or Space on it, now pushes that request's own
page (#ledReqPane, ledReqOpen/renderLedReq) over the list. The page
gives the model and status, then ledDetail: time, agent, source IP
(the previous commit's client_ip: loopback reads "This computer ·
127.0.0.1", a gateway row from before the field "Not recorded", rows
read from session files, other computers and magpie's own calls none),
requested, provider, account, sent, served, effort, then status,
error, duration, tokens, cost, credits, speed and the archive. Routing
is the View routing link in it, and the time cell no longer links
there. "Requests ‹" or Escape (not while a menu, dialog or field takes
it) goes back to the list where it was left, with the row focused
(ledReqClose). Leaving the Usage page closes it (ledLeave(true)), and
a refresh keeps it. The in-table expanding row (ledOpen, tr.led-detail)
and its narrow-window lc-opt copies are gone, since the page shows
every field at every width. It slides in 200ms with the ease-out
curve, and only fades with reduced motion. "Source IP" and "Not
recorded" are added in zh, zh-TW, ja and de. The 20 ledger test files
that opened a row's details now open the page. usage-request-page.test.cjs
covers the page, the address, the way back, focus and a 560px window.
docs/subsystems/gui-shell.md describes it.

Run at this commit's tree (rebased on origin/main b4a0a2a1a, with the
two commits beside it):
- mote (macOS 27): gofmt -l clean; go vet ./..., GOOS=linux -tags
  nogui go vet and GOOS=windows go vet ok. go test internal/gui (with
  TestCoreScriptBudget) ok in 164s, internal/usage, internal/usageapi,
  internal/cli and the root package ok, internal/gateway -run
  "Usage|ClientIP" ok, internal/provider -race -count=5 -run Workspace
  ok.
- WSL VM (magpie-desktop), whole suite through the suite lock at
  be9dbce02 plus this change: go test ./... -timeout 45m ok apart from
  the GTK packages, which need a display the VM run lacks (they pass
  on mote), TestGrokInstalled (#3548) and the provider workspace test
  the next commit fixes (#5800). GUI suite: 540 of 23297 red in 114
  files, WebKit timeouts mostly (#4121); those 114 files run again
  give 378 reds here and 365 at be9dbce02, the same files, and
  own-requests was the one this change broke (fixed: a row's click now
  opens the page, and its way back keeps the list's place).
- WSL VM, the 119 Usage and Routing GUI files at the rebased head,
  both engines: 21 red, 20 of them red the same at origin/main
  b4a0a2a1a: click-scroll (#4385), routing-cline-route and
  routing-upstream (#5156), usage-agents-hide (#2276, #3414),
  usage-heatmap (#4718), usage-ledger-ttft (#4489), usage-ledger-chart
  (#4263), usage-focus-steady (#3501), usage-fold (#3415, #2163),
  usage-ledger Requests (#3104, #5048), account-refresh-holds (#5814)
  and usage-speed-all-models (#5834, red since the 24 hours period).
  The 21st, usage-compact-counts chromium "zh 万 at 420px", is the
  flake in #5648 and passes 3 of 3 alone.
Again after rebasing on origin/main b3a57b3d8 (main's WebSocket row in
the ledger, 7c1dc198d): mote go vet, internal/gui, internal/usage,
internal/usageapi, internal/cli, the root package, internal/provider
and gateway -run "Usage|ClientIP|Socket|Memory" ok, apart from
TestCoreScriptBudget, red on main since b3a57b3d8 and fixed there by
4894332d7, which this is now rebased on; the VM's 119 files plus usage-ledger-bytes and
codex-app-back: 1708 of 1782 pass, no red that isn't in the list
above, usage-ledger-bytes passing with the request page.
Not tried: a request from another device over a real LAN share.
2026-11-10 04:44:13 +08:00
yetone fdd38154b8 docs: the Usage, Video generation and sign-in links to their settings
gui-shell.md, gateway-routing.md and providers-accounts.md name the
links 22c665d6f, cedacf1ae and 3b550a99c added: the Usage page's
Allowances head to Settings › Allowances, Video generation's how-to
to the Providers page, and a sign-in kept to its link to Privacy's
Sign-in pages row. Library's limit tag (8607a7a02) has no passage in
library.md to change.

Docs only; nothing run.
2026-11-10 00:02:22 +08:00
yetone be9dbce02c settings search: built-ins are found too, off or on, and Open goes to their row
A built-in's switch and the settings it keeps in Plugins › Built-in or on
its own page (Gateway's Recent calls at a time) were found by nothing in
Settings' search, and one switched off took its Settings tab and rows
with it, so searching "Observability" with it off said no setting
matched (the scattered settings audit after netube99 on X). The search
now lists, after Settings' own rows and under "Plugins › Built-in", each
built-in whose name, line or schema setting has the words, in the
language shown or English, one off saying Off. Open goes to Plugins ›
Built-in and lights that row, again when the list is drawn a second time
as the plugins are read.

The list is drawn by a lazy setfeats.js the first time a search runs,
and only when what it finds changes, as Settings' observer runs the
search again on each change under the view.

Run (mote, at f98e954ce's tree plus this): settings-search,
old-webkit, builtin-places, provider-prefs, i18n-keys: 170 pass, 0 fail,
Chromium and WebKit, every language; TestCoreScriptBudget ok. Broken by
hand: without the row's light, and with the match always false, the new
case went red in Chromium (7 pass, 2 fail each).
2026-11-09 22:11:00 +08:00
yetone 7cabf0da98 sessions: one place says which ids a ZCode request names, and drafts are one group (#5754)
On top of Flandern1211's cherry-picked fix (the commit before this one).
GatewayKeys gave the bare id of a ZCode session (sess_<id> in ZCode's
database, <id> in the gateway's record), but NativeIDs kept its own copy
of the keys: the management page still counted every ZCode session sent
through the gateway as a gateway-only session, its delete listed them,
and its search read them a second time. requestIDs is now the one place
that says which ids a request names a session by; GatewayKeys (Sessions
list, its spend, the stats' native set, viaOf, the manage search) and
NativeIDs (the manage page's count and delete) both read it.

ZCode runs a session started without a project in a folder it makes for
that session alone: <workspaceDirectory>/draft-<id> or <ms>-<uuid>, with
workspaceDirectory = ~/.zcode/workspace (read from ZCode 3.17.2's
out/host/index.js, downloaded from cdn-zcode.z.ai; never the live
~/.zcode). The reporter's group is renamed from "Scratch sessions" to
"Draft sessions" (草稿会话 / 草稿會話 / 下書きセッション /
Entwurfssitzungen), after ZCode's own word for them, with a GUI test of
its own. Comments no longer quote "Seen through the gateway", which
i18n-keys' plugin-words guard read as the core saying the word.

Run (mote, at this tree, rebased on 0eac4e6aa):
- gofmt -l: clean. go vet of sessions/gui/usage for darwin, linux
  (-tags nogui), windows; GOOS=linux -tags nogui and GOOS=windows
  go build: ok.
- go test -run 'ZCode|Gateway|Native|Manage|Merge|External'
  ./internal/sessions ./internal/usage ./internal/gui: ok.
- GUI, Chromium and WebKit: sessions-zcode-drafts (new, 5 languages x 2
  widths), sessions-folder-list, i18n-en-no-cjk: ok. i18n-keys' "a
  plugin's words are its own" is red at origin/main for three words not
  touched here, filed: #5332 (View routing), #5426 (No session ID),
  #5482 (Use the library's). The reporter's comments quoted "Seen
  through the gateway" and made a fourth; reworded.

Broken by hand:
- TestZCodeGatewayRowIsTheSessionItself on origin/main's raft.go,
  manage.go and external.go: red (keys lack zcode|main, fork_of_main,
  abc; NativeIDs lack them; 29 rows for 26 sessions).
- sessions-zcode-drafts on origin/main's Sessions client.js/i18n.js:
  red in every language and width.

Not tried:
- The full Go suite and the whole Sessions GUI set: queued behind other
  sessions on mote's suite lock; run after the push, reds filed.
- A real ZCode database: none on this machine; the reporter's own run
  over 1,105 sessions is in the issue.
- Windows/WSL GUI, and a ZCode data folder the user moved elsewhere
  (only ~/.zcode/workspace is matched).

Reported-by: flandern1211_58540 (Discord)
Refs #5754 (left open for the reporter)
2026-11-09 18:55:01 +08:00
Flandern1211 a39b63e886 sessions: a ZCode session is listed once, and its draft folders are one group
A ZCode request names its session by the id its database gives with a
prefix stripped (sess_…, a subagent's sess_subagent_agent_…: zcodeBareID,
which Titles already used for names), while GatewayKeys kept only the
prefixed id. MergeExternal therefore matched no native session for any
ZCode session sent through magpie's gateway, and each was a row under its
folder and again a row under "Seen through the gateway" with no files
behind it. On this computer's database (1,105 sessions, 3,536 gateway
records) that was 70 of 70 gateway rows: 38 top-level sessions, 9 forks,
23 subagents. A group already holds its forks' and subagents' files
(ocRoots), and assembleListed counts every file's calls in the row, so
each of the 70 counted the same calls a second time.

GatewayKeys now gives the bare id of a ZCode session and of its forks and
subagents; externalAdded reads GatewayKeys instead of keeping its own copy
of the keys in pairs; idInFile names ZCode, so subIDs collects the ids
their own rows give (their files are in the group, no row lists them
apart). The Sessions page draws a ZCode session whose folder ZCode made
for that one session (~/.zcode/workspace/<draft|time>-<uuid>, one for
each session started without a project) in one "Scratch sessions" group
after the projects: 42 of them here were 40 folders of one session under
Other folders, and they are no projects of the reader's. cwd, files and
usage are untouched; a row's tooltip gives the folder it ran in.

The list went from 1,286 rows to 1,216 over the same 1,213 native ones;
the 70 gateway rows had 34.3M input and 2.59M output tokens and $125.66
of the ledger's cost on top of the rows that already counted those calls.
A ZCode row now prices its own calls from the catalog like every other
agent's, and Usage keeps the ledger's figures.

Run:
- go test ./internal/sessions -run 'TestZCode' -count=1: ok.
- go test ./internal/gui -run 'Session|Gateway' -count=1: ok.
- go build ./...; go vet ./internal/sessions: ok.
- gofmt -l; git diff --check; node --check on client.js and i18n.js: clean.
- go test ./internal/sessions -count=1: the same failures as without this
  change (TestAgySessions, TestAgyRowOnly, TestAntigravityAppFolder,
  TestCCListingKeepsItsNames: path separators and allocation counts on
  this Windows box).
- go test ./internal/gui -count=1: the same failures as without this
  change (lody's %AppData%, pageservice's symlink privilege here).

Broken by hand:
- dropping the bare key puts the 70 rows back under Seen through the
  gateway (TestZCodeGatewayRowIsTheSessionItself fails);
- leaving ZCode out of idInFile keeps a fork's and a subagent's own rows
  as gateway rows while the group already counts their calls.

Not changed: the scratch group is worked out on the page (client.js), so
Usage's folder filter still lists the draft folders by their paths; the
group is ZCode's only, and other agents' per-session folders are left as
they were.
2026-11-09 18:49:15 +08:00
yetone f418edffc3 sessions: a session's details show how full its context was, request by request
liang_yongxiang on Discord: Routing tells how full one request's context
window was; does Sessions have the same, each turn's share?

A session's details on the Sessions page (and in Usage's Sessions list,
which draws the same details) get a Context line when the gateway sent
calls of it (s.via): the Context tab's spark of its prompts, request by
request against its window, and the fullest one's share beside it, toned
as the tab tones it. A point's tip says "Request 2: 80K of 200K (40%)" (the
tab's spark says it too now, where the window is known); a point clicked
opens that request in Routing with its card. A session the gateway never
saw asks nothing; one it kept no prompt of shows no line.

The data is the routing history the Context tab already reads. A new
GET /api/context/session?agent=&id=&from=&to= reads only the days from the
session's first to its last (30 at most), through the tab's per-day cache
(daysRecsLocked, split out of contextRecsLocked, so the tab's cached days
are not evicted), and keeps that one session (contextOfRecsFor), with up
to 1000 of its requests. The tab keeps the latest 80 sessions and would
leave an older one out. Subagent and side calls are left out as the tab
leaves them out; the same id under another agent is that agent's.

The line's code is in plugins/usage/page.js (sessCtxLine). context.js only
exports spark and health, and pays for its tip by cutting comments, so
the core's scripts are 10 bytes under main's, no budget raise.

Run at this head (rebased on e215d335a), on WSL (magpie-desktop, Linux;
mote rebooted mid-run):
- gofmt -l clean; go test -tags nogui -run
  'TestContextSessionLine|TestCoreScriptBudget|TestContext' ./internal/gui/: ok
  (also ok on mote at this head).
- node --test sessions-context-line (new: Chromium and WebKit, en zh zh-TW
  ja de, 1100 and 420 wide) and context-window: 44 of 44.
Run on mote before the rebase, at 627fd1a3b:
- the whole internal/gui package: its one red, TestCoreScriptBudget
  (1,536,110 > 1,533,802), is why the line moved into the plugin.
- sessions-context-line: 20 of 20.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- i18n-keys: "a plugin's words are its own" red, the same on origin/main
  e215d335a (#5327, #5332, #5426, #5482); the new strings pass its other
  checks.

Broken by hand:
- the one-session filter dropped: TestContextSessionLine red ("its
  requests' prompts: [21000]", another session's line).
- the tip back to "Request {n}: {tokens} tokens": sessions-context-line red
  in de ("Anfrage 2: 80K Token" for "Anfrage 2: 80K von 200K (40%)").
- the details line turned off: sessions-context-line red in en and zh.

Not tried: the whole GUI suite (it was running under mote's suite lock
when mote rebooted; not run at push); a real magpie with real routing history (the GUI test stubs
/api/context/session; the Go test reads real history files in a sandbox
config); the Linux app's WebKitGTK.

Reported-by: liang_yongxiang (Discord)
2026-11-08 18:13:30 +08:00
yetone 4ab1191bc9 routing: Routing groups opened from Routing lead back to it
Since Routing groups became a page of their own, a group chip on a
request (or Routing's "Routing groups ›") switched to the groups page
with nothing leading back. Without the sidebar the only way out was the
tab bar, and the request you came from was gone from view.

The groups toolbar now starts with "‹ Routing" (gBack). It goes back to
Routing through window.show, so a dirty draft is still asked about, and
focus returns to the chip or button the page was opened from. Esc does
the same, except while an editor, Import, Select or a modal is open, or
focus is in a text field. With the sidebar the back control shows only
when the page was opened from Routing (.rt-gfrom); from the sidebar's own
Groups tab the page is top level and has none. No other drill-in page in
app.js binds Cmd-[, so neither does this. The label follows the language
on every draw. No new layout, no accent stripe.

Run (mote, playwright 1.62.0):
- routing-groups-back.test.cjs (new): 30/30, Chromium and WebKit x
  en/zh/zh-TW/ja/de x 1280 window, 640 window, 420 web. Red on
  origin/main's assets (MAGPIE_ROUTING_ASSETS): no visible .rt-gback.
- Broken by hand: Escape handler off -> red (chromium en 1280); the
  side-nav hide rule off -> red (webkit en 1280, "no back from the
  sidebar's own tab").
- Every routing*, sidebar*, group-*, i18n-keys, i18n-en-no-cjk,
  old-webkit and settings-groups file at 2d66e9f23 (main 0fc3455e2 +
  this): 3548 tests, 3526 pass, 22 red. The same files at origin/main
  cdf734757 alone: the same 18 red, all filed: i18n-keys (#5332, #5426,
  #5482), routing-intent-entry 8/8 (#5392), routing-context-fold webkit
  (#5586), routing-row-swap (#3799), routing-story-shrinks webkit
  (#3954). The other 4 (routing-busy chromium zh, routing-many-keys
  chromium en, routing-pace-expiry chromium de, routing-rule-drag webkit
  ja) passed whole, with routing-groups-back, at this commit on
  cdf734757 (70/70); filed #5665, #5664, seen in #4082, #3789.
- Whole GUI suite and ./...: queued on mote, not run at push; results to
  follow.

Reported-by: unscientific9 (Discord)
2026-11-08 11:04:43 +08:00
yetone b77400826a usage: the Overview read again keeps its cards and its place, and shows it is reading
jiabubu on Discord: a refresh of the Usage page's Overview showed nothing
while it read, flashed the page and dropped cards for a moment, and
pressing Usage again while on the Overview flashed it or moved its scroll.

- Pressing Usage again (show() calls the plugin's open, loadUsage(true))
  put the skeleton up, which hid the sections, collapsed the page and
  clamped its scrollTop. loadUsage now puts the skeleton up only for a
  first read or another period or zone (usageFor/usageKey); a page that
  already shows that read reads again quietly through refreshUsage, so
  nothing is blanked and the scroll stays.
- The refresh beside the period turns while such a read is out
  (#usageReload.reading, after 200ms), and while every card is read
  (loadQuotas) each card's refresh turns (#subscriptionUsage.reading,
  quotaReading in page.js). A card's own busy turn is left to its own
  animation (:not(.busy)). No turning under reduced motion.
- renderQuotas draws the cards again in one go, as their reset
  countdowns need, but now keeps their logo nodes (keepIcons), and the
  Overview's lists do too: a logo made afresh blinked out while its
  picture loaded.
- app.js stays in its budget: a three-line comment in renderQuotas cut
  to one. Core 1,533,507 of 1,533,802 before the rebase on 0b4cda048.

Tests:
- New usage-quiet-refresh.test.cjs: Usage pressed again at the top,
  halfway and at the foot, with the read held: no skeleton, chart not
  hidden, scrollTop the same, the refresh turning, then the same figure,
  row and logo nodes; and Refresh with the allowances held: every card
  stays, each card's refresh is shown and turning, the logos kept.
  Chromium and WebKit, en and zh, 1180 and 560px. Red on the old assets
  (8 of 8 per part: "nothing blanked while it reads ['skeleton','chart
  hidden']", "the cards' logos are the ones drawn before: false,false,
  false"), green on the new.
- usage-quota-head.test.cjs waited for the skeleton on Agents -> Usage;
  it now waits for the quiet read (the page kept, the refresh turning).
- usage-stale-answer.test.cjs lifts loadUsage out of page.js; it now
  lifts usageFor/usageKey with it and stubs the page's loading state.

Run on mote (mote-run), at the rebased head 344cdcde3: go test -run
TestCoreScriptBudget ./internal/gui ok; gofmt -l clean; the nine usage,
quota and panel files above plus panel-fit-tabs, panel-usage and
panel-quota-refresh: 140 of 140. Before the rebase (at d32a7a70c's base,
same change less the stale-answer stub): go test ./internal/gui ok apart
from TestSettingsSaveKeepsWhatItDoesNotSend, fixed on main by c7c05dcf2;
GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... clean;
every GUI file named usage, quota, allowance, click-scroll, sidebar or
last-page (129 files, 1880 tests): red only in files red on main too or
filed: usage-agents-hide (#2276, #3414, red at d32a7a70c alone),
usage-fold (#3415, red at d32a7a70c alone), usage-ledger's Requests
(#5048), and usage-compact-counts' zh-TW 420px tip under load (#5648,
30 of 30 alone); usage-stale-answer's reds there are fixed here (11 of
11).

Not tried: the whole GUI suite (1,274 files; mote at load 60 to 80
from other sessions), the real app and WebKitGTK, languages beyond en
and zh in the new test (no new strings), and the other pages' re-open
by probe (Sessions, Library, Gateway and Masking were read: none puts a
skeleton up over a page already drawn).

Reported-by: jiabubu (Discord)
2026-11-08 03:57:04 +08:00
yetone 0b4cda048c gui: the tray panel shrinks back to a short tab, gliding there
The tray panel was held at its tallest tab's height (#124): fit()
measured every tab and asked for the largest. Once Routing or Usage had
been opened, Agents sat over empty room under its rows until the panel
was let go (refeccd on Discord, macOS). fit() now lays every tab out
the same way and asks for the height of the tab showing (Agents when
none is set), so the panel shrinks as well as grows. #124's complaint
was the panel jumping bigger on a tab switch, so a tab picked glides
the edge there instead (TAB_GLIDE: 240ms on app.css's --ease-out, as
.nav-hl; a jump under reduced motion). Content fits inside a tab
(rows unrolling, Allowances landing) are unchanged.

Siblings: the Go side already shrinks on every OS. FitPanel takes the
height asked, panelFrame clamps it to panelMin/panelMax/the screen, and
glidePanel animates the Mac's frame with its top under the menu bar and
steps Windows/Linux by the tray icon. All three take their height from
this one fit(), so nothing there changed. The web host has no panel.

panel-fit-tabs.test.cjs gets "the tray panel shrinks back to a short
tab": two agents and Routing's eight requests, Agents -> Routing ->
Agents, with reduced motion and without. Agents' height is asked
again, and the tab's fit carries ms=240 and the ease (none under
reduced motion). Its Routing-skeleton check now picks the Routing tab
first, as that is the tab whose height it is about. panel-usage's
assertion is now the showing tab's height, not the tallest.

Run on mote (mote-run). At this commit, rebased on d32a7a70c: gofmt -l
internal/gui nothing; go test -tags nogui ./internal/gui ok (sandbox
HOME); panel-fit-tabs, panel-usage, panel-fit-order, panel-fold 40/40.
Earlier, at the same change on c7c05dcf2:
- new test on origin/main's app.js: 10 of 10 red, Chromium and WebKit
  x en/zh/zh-TW/ja/de: "reduce: Routing asked no taller a panel than
  two agents: 163 629" (the short tab asked the tallest's 629)
- with the change: panel-fit-tabs + panel-usage 24/24 ok (both
  engines, five languages); again at the rebased head with i18n-keys:
  27/28, the one red is i18n-keys' "a plugin's words are its own",
  filed as #5332, #5426, #5482
- the 46 GUI files that read /api/window/fit (at d32a7a70c, before
  the rebase; the change is the same): 1182/1186. Reds, none in the
  panel: images-codex-one (Settings window; red alone on origin/main
  d32a7a70c too, #4618, commented) and view-open-wheel's "wheels
  unheard, usage, en, 1000px" in WebKit (window only, no panel page,
  where fit() returns at once; #4132)
- gofmt -l internal/gui: nothing; go vet, GOOS=linux go vet -tags
  nogui, GOOS=windows go vet ./internal/gui: ok
- go test -tags nogui ./internal/gui (sandbox HOME, pinned caches): ok
  (before trimming, TestCoreScriptBudget was 346 bytes over; the
  comments were cut, the budget not raised)

Not tried: the real app's panel on the Mac, Windows or Linux (no
desktop session driven); the whole GUI suite (mote's suite.lock queue
was full); go test ./... .

Reported-by: refeccd (Discord)
2026-11-08 03:41:23 +08:00
yetone d32a7a70cb remote magpie: once magpie updates, the Remote magpies it uses update too
nnlrl_75403 on Discord: a magpie used as another's Remote magpie stayed on
its old version after the local one updated, and had to be updated by
hand on the other computer. Now nothing needs setting up:

- provider.KeepRemotesUpdated (started by the app's updater and by
  magpie serve) runs UpdateRemotes 30 s after start and hourly. A
  released build with automatic updates on reads each Remote magpie's
  version (GET /v1) and, when it is older, asks it through
  POST /v1/magpie/update?version=<v> with the provider's key, at most
  once in six hours per version. Off here, or a dev build: nothing asked.
- The remote updates as its own automatic update would: the app
  downloads and restarts once idle (updater.updateAsked → download,
  waitIdle); magpie serve puts the latest in where it runs from, one at
  a time, never elevated, and serveFollow restarts into it. Automatic
  updates or downloads off there: it answers "off" and stays.
- A copy that can't replace itself says why: a container (docker pull
  ghcr.io/yetone/magpie:latest), a package manager's (its command), a
  folder it can't write, a build from source. A magpie from before the
  route answers 404 ("too old"), a read-only or held key is "refused".
  The provider's row on the Providers page adds a short status to its
  line ("updating to v…" for 30 min, or "can't update itself" etc.),
  with the reason and the command in its tooltip. en/zh/zh-TW/ja/de.
- The route replaces the program, so it takes the Codex reset's
  admission: another machine only while shared, never a browser page,
  an enabled key with full access from loopback too (401 without one),
  read-only 403 gateway_key_read_only, held 403 gateway_key_held. It is
  in readOnlyRefused and the CORS route list.

App.js stays under TestCoreScriptBudget by cutting two comments; the
budget is not raised.

Run (on mote, at the tree committed here):
- gofmt -l internal/: clean. go vet of gateway, gui, cli, provider for
  darwin, GOOS=linux and GOOS=windows: ok.
- go test -count=1 ./internal/gui ./internal/cli ./internal/provider
  ./internal/gateway: gui and cli ok but for #5644's two settings tests
  (red on main since 6b7ee4a98, owned); provider and gateway were
  still running at the push, and go in the full run after it.
- Rebased on origin/main c7c05dcf2, again: gofmt, vet, the new tests,
  ReadOnlyKeyEveryRoute, CORS, TestCoreScriptBudget (not raised) and
  both GUI files 32 of 32: ok.
- New: TestRemoteUpdateNeedsAFullKey (no key from loopback, Origin null,
  an app scheme, *.localhost, a rebound Host, a foreign page with and
  without the full key, another machine with none or a wrong key,
  read-only and held keys, then not shared; the updater is never
  called until a full key asks, from LAN and loopback),
  TestRemoteMagpieAskedToFollow (UpdateRemotes against a real gateway:
  dev build, same and newer remote, NoAutoUpdate here, asked once per
  version, container answer kept, read-only key refused, a 404 magpie
  "old"), TestUpdateAskedByAnotherMagpie, TestRemoteUpdateNote,
  TestServeUpdateAsked.
- GUI: remote-update.test.cjs (new) and remote-self.test.cjs, Chromium
  and WebKit, 1100 and 420 wide, en/zh/ja/de: 32 of 32 ok, with every
  key checked in zh, zh-TW, ja and de. i18n-en-no-cjk ok. i18n-keys'
  "a plugin's words are its own" is red, the same on origin/main
  f8525323d (#5327/#5332, #5426, #5482); its other cases ok.

Broken by hand, each red, then put back: the handler's key check
(loopback without a key got 200 updating), its held-key check, the
route itself (404 = the old code), asking a remote that is current,
ignoring NoAutoUpdate here, asking again for the same version, the
app ignoring automatic updates off, the app never waiting to restart,
serve's single flight (2 downloads), serve's container answer.
The handler's own Origin and not-shared checks stay green when removed:
corsGuard and lanGuard refuse those first; they are kept as the Codex
reset keeps them.

Not tried: a real update of a real remote (a Docker magpie and an app
on another Mac) end to end; Windows and Linux runs of the new tests
(vet only); the full suite (run after the push).

Reported-by: nnlrl_75403
2026-11-08 03:13:15 +08:00
yetone ea1a8ae809 routing: a folded fold of accounts on one plan says what they have left together
chen2652 (Discord #help): a provider with several accounts on one plan
should show, when its group is folded, one bar and what is left in all;
opened, each account's own quota as now.

A Routing account fold (3+ adjacent accounts of one provider and model),
when folded, now writes its tightest shared window before its status
("5 hours 40% used · …") and a bar under it, from quotaall.js's
mergeQuotas over the accounts' Usage cards. Its tip lists every window,
how they were put together (the mean of n accounts on one plan, added up,
or unlimited on each) and when the first of them starts again. Only when
every account has a card, all on one plan, none free; with different
plans, a card missing, the fold open, or the day view, nothing changes.
An open fold shows only each account's own row, as before. No new words:
every string is already in i18n.js in every language. routing.css is
unchanged (the account rows' bar grid). foldQuota in plugins/routing/
client.js; documented in docs/subsystems/gui-shell.md.

Run:
- routing-fold-accounts-together.test.cjs (new): 5 languages x 1100/420px
  x Chromium/WebKit, 22/22 on mote. Folded: figure, 40% fill, tip in each
  language, no email in the figure; mixed plans: no bar; open: no bar;
  nothing overflows.
- At this tree (rebased on origin/main 999ba6a00), on mote: the new test,
  routing-fold-all, routing-folder and i18n-keys: 66 tests, 65 pass. The
  one red is i18n-keys "a plugin's words are its own" (plugins/library and
  plugins/routing "No session ID"), filed as #5327/#5332/#5426/#5482, not
  a string of this change.
- Earlier, on WSL at d7b298dec vs base 56f095604: every routing GUI file
  plus i18n-keys, provider-at-once and quota-all, 2942 tests; the same
  WebKit/load reds at the base (36 there, 38 here). The one head-only red,
  provider-at-once "webkit en: accounts at once are typed and saved" (a
  Providers editor timeout), passed 60/60 with the new test on a rerun.
- Screenshots of every language at both widths (WebKit) looked at.

Broken by hand, each red in the new test:
- the old client.js;
- combining while the fold is open (no !f.open): "an open fold has no
  bar of its own";
- no one-plan check: the mixed-plan fold drew a bar.

Not tried: the whole GUI suite and the Go suite before the tag (run after
it); the real app with the reporter's real accounts on one plan.

Reported-by: chen2652
2026-11-07 22:03:32 +08:00
yetone 75d0fc3aca gui: on macOS 27 the main window keeps its toolbar, which no longer changes the corners (#3949)
TestMainWindowCorners/macOS_26_SDK was red in every run on mote
(macOS 27.2). The test was right and the code wrong: insetLights took
the main window's toolbar off whenever AppKit gives the program the
design of macOS 26 (designOf26), on the grounds that a toolbar gives a
window Finder's larger corners there. macOS 27 doesn't: a window with a
toolbar and one with a plain title bar both get 16pt corners (AppKit's
_cornerRadius and _cornerMask are the same for both, measured on mote
with a 26.2-SDK probe). So on 27 the toolbar went for nothing, and the
lights, the title bar's height, first presses and sheets were all held
in place by hand where the toolbar would have kept them itself.

insetLights now also asks toolbarRounder: the window's corner radius
held against a window of its style with no toolbar, never shown. The
toolbar is taken off only when it makes the corners larger (or when
AppKit doesn't tell the radius, as before). The test is unchanged
except its comments: it already checks, by measurement and not by OS
version, that the toolbar stays where it doesn't change the corners
and that the main window has a plain title bar's corners,
so on macOS 26 a toolbar kept wrongly is red too.
docs/subsystems/gui-shell.md says so.

Run (mote, macOS 27.2, arm64, at this tree on 05f6fd423):
- go test -count=1 -run 'TestMainWindowCorners$|TestMainWindowRightToLeft'
  -v ./internal/gui: both subtests and right-to-left pass; macOS 26 SDK
  now reads "toolbar kept true", corners 16/16/16, lights, 66pt title
  bar, presses and sheet the same as the toolbar window's.
- go test -count=1 ./internal/gui/...: ok (133s).
- gofmt -l . (empty), go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: ok.

Broken by hand: toolbarRounder made to return YES (the old behaviour):
TestMainWindowCorners/macOS_26_SDK red at "a toolbar doesn't change the corners" on all three stages,
as in #3949. Restored.

Not tried: macOS 26 (no macOS 26 test machine; heavy runs stay off this
Mac), where toolbarRounder must still read 26pt against 16pt and take
the toolbar off; CI's macOS job runs macOS 15, which never reaches it.
No screenshot of the corners on mote (screencapture has no Screen
Recording permission over ssh); the corner mask was compared instead.
The full suite runs after the push.
2026-11-07 15:04:26 +08:00
yetone 80ae904c23 routing: routing groups get a page of their own, beside Routing
The owner asked for the groups to leave the Routing page (11-06): under
the live stage and every request they were a long scroll down, and New
group with them. The design was reviewed before this was built.

- New page, Routing groups (#view-groups), drawn by the routing plugin's
  same script (routingPage), so the editor, its dirty/discard and every
  group action are unchanged. Toolbar: filter, "N groups · M on",
  Templates, Import, Select, and New group as the filled button. The list
  is right under it, and a Settings section under the list holds Found
  groups (with Exclude providers…) and Names in agents' lists.
- No Export button: each group already has its own Copy to share.
- Routing keeps the live stage and the requests. A request's group opens
  the groups page at its row.
- The sidebar has a Routing groups tab right after Routing (from 1024
  points). The header's row has no room for one: at 860px the extra tab
  pushed the logo out (brand.test). There the tab is hidden, Routing's
  tab is lit for both pages (markNav), and Routing's head has a
  "Routing groups ›" button, hidden beside the sidebar.
- Every way in now goes to the groups page: the guide's Open routing
  groups, the panel's and the provider editor's Make a routing group
  (window/main?view=groups&newgroup=…). mainView still takes
  view=routing&newgroup from an older panel.
- Words: "Routing groups", "Open routing groups", "Once saved, make a
  group of them in Routing groups.", and the editor's names note now says
  the setting is under the list, in zh, zh-TW, ja and de. "Open Routing"
  stays for the Agents page's button.
- Docs: providers-accounts, gateway-routing, plugin-runtime, gui-shell
  and reference say "Routing groups page" where they mean the groups.
- Core budget: the core's scripts are 1,533,774 of 1,533,802, paid for
  by three show()/setGatewayMode comments cut in app.js. No raise.

Tests: routing-groups-page.test.cjs (new) covers the page in Chromium and
WebKit, en/zh/zh-TW/ja/de, at 1280, 640 (window) and 420 (web): no
groups on Routing, the tab or the head's button by width, the lit tab,
toolbar order, New group primary and in sight, list then Settings, no
sideways scroll, no native select, no left-border accent; a request's
group to its row; quotas redrawn with an open editor left alone. The
trace tests (routing-compact, -pause-folder, -rule-models, -folder) open
Routing, then show the groups; routing-editor-foot and
name-suffix-where-named scroll by wheel, as the scroll guard lets a
reader; builtins expects the groups tab beside the sidebar only.
Removed: routing-groups-jump (the head's "Routing groups ↓" that scrolled
down to them, gone with them), routing-pointer-pin and routing-steady
(the groups kept in place under requests streaming in above them: no
request is above them now). Their guarantee that what redraws leaves an
open editor and its typing alone is routing-groups-page's quotas case;
Routing's own lists keep their keepInView.

The groups page's jump: a request's group, or a pool's "Several keys"
chip, opened the groups page and scrolled the row to the centre, and the
next frame show()'s backAfterLoad put the page back where the reader
last left it, then brought the focused segment in by "nearest": in
WebKit the pool sat half under the window's foot (routing-mode-goes, 9
of its 10 WebKit cases). goRouting now jumps at once on a page it opens and
marks it arrived(). The wheel in routing-many-keys turns over the keys:
at the page's foot, now shorter, the mouse rested over the requests list
(.rt-reqs, overscroll-behavior: contain), which took every wheel up, and
the test stopped with 2 keys in sight. That is #4082's cause.
routing-days-fit's fixture has 12 requests, a day that fills the window,
since the day bar held needs room under it.

Run on mote (macOS 27, load 25 to 65), Playwright 1.62.0:
- Go: go vet, gofmt -l and go test ./... at the rebased head (650bf8412
  base) ok except TestMainWindowCorners (#3949); internal/gui again
  after the last edits: the same, TestCoreScriptBudget ok (1,533,773 of
  1,533,802, no raise).
- GUI, the 262 files a change here can reach, at the head and at the
  base: the reds at the head are the base's, with their issues:
  menu-input-scroll #3402, provider-mask #5109, context-fold and
  order-unknown (webkit) #3479, header-centre #3479, i18n-keys
  #5332/#5426/#5482, account-eye #5052/#4244, call-headers webkit de
  #5045, codex-predictions #2624, codex-auto-reset webkit de #4790,
  routing-* under load #5088, and zero-priced-free, last-page,
  reasoning-speed, routing-row-swap/-tag-whole/-story-shrinks/-steps-cap
  and routing-intent-entry, red at the base the same way.
- After the last edits: the 11 files with a way to the groups page or
  its scroll (group-*, routing-groups-page, routing-mode-goes,
  routing-groups-off, routing-provider-off, routing-many-keys,
  click-scroll), 175 of 176; the one red is routing-many-keys webkit's
  wire at the foot, red at the base in 8 of 12 (#5543). brand,
  gateway-mode-sessions, header-zoom-fit, header-centre,
  inner-scroll-contain and mobile-web: the same 11 reds at the head and
  the base (mobile-web compares with origin/main through git, which a
  mote-run copy hasn't).
- Rebased on ecc26a339, again: gofmt -l, go vet ./internal/gui and
  TestCoreScriptBudget ok; 10 GUI files (i18n-keys, routing-groups-page,
  routing-mode-goes, sidebar, brand, menu-first-second, library-bar-more,
  click-scroll, name-suffix-saved, unlisted-models) 211 of 212, the one
  red i18n-keys' "a plugin's words are its own", red the same at
  ecc26a339 (#5332/#5426/#5482).
- Broken by hand: without the groups page's CSS rule, brand and
  routing-groups-page go red (32 fails); with the old goRouting,
  routing-mode-goes is red in 9 of its 10 WebKit cases.

Not tried: the whole GUI suite on Linux (WSL magpie-desktop) at this
head; a run at an earlier head is under way and has the Linux reds
#4120/#4121 name. Not tried in the real macOS app, only Playwright's
WebKit.
2026-11-06 23:11:43 +08:00
yetone 361da10ee9 web: the page's API answers its own origin only, not a page on another port or a sibling subdomain
With browser access on (Settings > Browser access, or magpie web), the
sign-in cookie magpie_web_<port> is SameSite=Lax, which a browser sends
with any same-site request: another port of 127.0.0.1 or of the LAN
address, or a sibling name behind the same reverse proxy. apiFramed
refused Origin null, frames and cross-site, but not same-site, and /api
decodes JSON from any Content-Type. So such a page could POST a stdio MCP
server to /api/library/servers/save (text/plain, no-cors) and start it
with /api/library/mcp/check: code run as the user.

webOwnPage (in webHandler, behind webGuard, /api/ only) now judges every
write (all methods but GET/HEAD/OPTIONS) with net/http's
CrossOriginProtection: Sec-Fetch-Site same-origin or none passes, any
other value is refused; from a browser without Sec-Fetch-Site, Origin must
be absent or name the request's Host (or MAGPIE_PUBLIC_URL, for a proxy
that rewrites Host). Any /api request, a GET too, whose Sec-Fetch-Site is
same-site or cross-site is refused, so no GET route with a side effect
(GET /api/import/{id} reads once and deletes) is another page's to call,
without auditing each one. A Sec-Fetch-Site same-origin with an Origin
that doesn't match the Host passes: the browser compared the origins
itself, and nginx's default proxy_set_header Host $proxy_host would
otherwise break every write behind it. The desktop window's /api is served
in-process over no port with no cookie, so it isn't wrapped and its
headers are unchanged. No Content-Type rule: every write the page makes
goes through api() as application/json, but multipart and text/plain are
both CORS-safelisted, so the rule would add nothing the origin check
doesn't already give.

Run on mote at 49c9491b7 + this commit; after the rebase onto e1eeeed73 (38 commits, none in web.go/pluginpage.go/api.go) gofmt, the three vets of internal/gui and -run TestWeb were run again: ok.
- TestWebAPIAnswersItsOwnPageOnly, through webServed (onePort ->
  AllowGuard -> webGuard -> webOwnPage) with the page's cookie and no
  gateway key. Refused: same-site Origin on another port, cross-port
  Origin without Sec-Fetch-Site, localhost on another port, the LAN
  address on another port (both), a sibling subdomain (both), cross-site,
  Origin null (both), no Origin with Sec-Fetch-Site same-site and
  cross-site, GETs from another port, a sibling and a cross-site link, a
  cross-port preflight. Allowed: the page's own origin (with and without
  Sec-Fetch-Site), on the LAN, behind a proxy keeping or rewriting the
  Host, MAGPIE_PUBLIC_URL with an old browser, Sec-Fetch-Site none, a
  non-browser client with the cookie.
- Real browsers: magpie web built from origin/main and from this commit
  (-tags nogui, sandbox HOME, MAGPIE_WEB_KEY), an attacker page on
  127.0.0.1:3497 / localhost:3497 running the no-cors text/plain POST.
  Old: the attacker's server was saved in Chromium and WebKit. New: not
  saved in either, logged "turned away ... Sec-Fetch-Site"; the page's
  own JSON write answered 200 in both.
- go test -tags nogui ./internal/gui -timeout 45m: ok
- gofmt -l: nothing; go vet ./internal/gui/... ./internal/cli/...,
  GOOS=windows go vet ./internal/gui/..., GOOS=linux go vet -tags nogui
  ./internal/gui/...: ok

Broken by hand: webOwnPage taken out of webHandler -> 29 cases red
("reached true, want reached false"). The read rule taken out -> the
three GETs and the preflight red. cop.Check skipped -> the 8 old-browser
cases red.

Not tried: the full ./... suite (the change is one handler in
internal/gui); the GUI Playwright suite (its pages mock /api with
page.route and never reach this server; the real-browser check above
stands in); a real reverse proxy; the Windows and Linux app pages; the
MAGPIE_DEV_UI dev server, which serves /api with no key and isn't
wrapped.
2026-11-06 22:17:04 +08:00
yetone 251cce2059 usage: a click on All N accounts folds that provider's accounts under it (justfreefall on X)
justfreefall on X (CODEX (2), "既然已经有汇总信息了,能不能出个按钮把下面两个折叠?"):
the All N accounts strip already sums the accounts, so its accounts can go.
The strip gets the per-account card's own chevron (quota-acct-fold, aria-expanded,
Fold/Unfold title, no new strings). A click on the strip or the chevron, or
Enter/Space on the chevron, folds that provider's account cards in the Usage
page and in the tray panel's Allowances; again unfolds. Default open. Kept per
provider in localStorage magpie.usageAllFolded beside the other view choices,
and a storage event redraws the other window. The head's "Show ..." button
stays in its room, hidden and inert, so the strip does not move under the
pointer. A menu-bar cell that asks for one folded account unfolds them first
(focusQuotaCard). quotaall.js reads the choice on first use, so loading it
touches no app.js global (usage-merge runs it in a bare vm).

Core script budget: not raised. app.js +35 bytes, met by shortening comments.

Run (mote, macOS 27, unless said):
- go test -tags nogui ./internal/gui/: ok at the rebased head (130s); Budget
  tests again after the last edit: ok. gofmt -l: clean.
- usage-all-fold.test.cjs (new): 10/10, chromium + webkit x en zh zh-TW ja de,
  window 440x520 and panel 360x760. Broken by hand: with main's assets it is
  red (no .quota-all-fold).
- usage-merge, usage-all-fold, tray-cell-click, quota-caption-contrast, old-webkit
  after the last edit: all ok except tray-cell-click 4/4, red the same at
  origin/main fcc0daa23 (#5215).
- Usage/quota files alone, base fcc0daa23 vs this: usage-fold ("several accounts",
  "17 subscriptions"), usage-agents-hide, usage-compact-counts, usage-ledger
  Requests red the same on both (32 each); usage-merge was red only here
  (kept is not defined) and is fixed above.
- i18n-keys "a plugin's words are its own": red the same on base (#5332).
- account-eye webkit "Usage card's eye" on WSL: base 9/10 red, this 5/10 (#5052, #4244).
- click-scroll webkit "a wheel the page hears of after its scroll": red on base too (WSL).
- Whole GUI suite on WSL (concurrency 8) before the usage-merge fix: ~40 reds
  outside usage (Connect, Copilot GHE, gateway keys, groups, skills, routing
  headers, plugins), the class #5475 records on main; each usage/quota/panel
  red was rerun against base above.
Not run: go test ./..., cross-OS vet (assets and one .cjs only); the real app.
2026-11-06 19:27:42 +08:00
yetone 49c9491b73 update: the Windows app asks where to install, the first time
The Windows exe opened from Downloads (or the Desktop, or temp)
installed itself into %LOCALAPPDATA%\Programs\magpie without a word.
Now, the first time, with nothing installed yet, Windows' task dialog
asks "Install magpie in this folder?". It shows the folder and offers
Install, Change… and Cancel, in the tray's language (en, zh, zh-TW,
ja, de).

- Change… opens the system folder picker. A picked folder gets
  "magpie" added unless it is already named that (update.InstallDir).
- A folder other than the default is recorded at HKCU\Software\magpie
  InstallLocation. So the next exe downloaded replaces the copy there
  in place and asks nothing (installed(), forwards()).
- Cancel runs the exe where it is, as a portable copy, and nothing is
  recorded.
- Uninstall forgets the record (update.ForgetInstallDir, a new System
  step).
- The shortcut, App Paths, autostart, magpie://, the PATH entry and
  self-update already take the running exe's folder, so they follow
  the choice.

Program Files and other folders only an administrator can write to
are refused in the dialog (update.Installable test-writes and maps a
permission error to ErrNeedsAdmin). They are not elevated into.
magpie installs per user (HKCU Run, the user's PATH), and its
self-update replaces the exe without elevation (CanElevate is false on
Windows). So an admin folder would make every update fail, or would
need a UAC prompt on each one. A downloads folder is refused too.
Refusing is the simplest correct choice: it costs a user nothing they
had before, and keeps updates silent. Any folders the test-write made
are removed again.

Docs: gui-shell.md, "Where Windows installs magpie".

Run (mote, at this head on origin/main f9e6061b8):
- gofmt -l is clean.
- go build ./... and go vet of update, uninstall and gui.
- GOOS=windows go vet of gui, update and uninstall.
- GOOS=windows GOARCH=arm64 go build ./....
- GOOS=linux go vet -tags nogui of the same packages.
- go test -count=1 ./internal/update ./internal/uninstall, and
  -run TestInstallWords|TestTrayLang ./internal/gui: ok.

Run (win-run, xiaomi-gpu):
- internal/uninstall ok, and gui TestInstallWordsEveryLanguage ok.
- internal/update: one red, TestPackagedByDpkg. It is red on
  origin/main too: an NTFS stream from the fixture name
  magpie:amd64.list (#4603).

Real Windows 11 run (xiaomi-gpu, a sandbox USERPROFILE/LOCALAPPDATA
under C:\Users\yeton\magpie-idir, MAGPIE_ADDR on 3481, exe in its
Downloads, driven over UI Automation and TDM_CLICK_BUTTON):
- The dialog came up in Chinese, with the app icon and the default
  folder.
- Change… → C:\Program Files was refused with the administrator note
  and the warning icon, and no folder was left behind. C:\Windows was
  refused the same way.
- Change… → …\Tools gave …\Tools\magpie. Install put magpie.exe and
  magpie.com there, and the app ran from there.
- Afterwards InstallLocation, the user's PATH, App Paths and
  magpie:// all named …\Tools\magpie. `magpie version` from a fresh
  PATH resolved to …\Tools\magpie\magpie.com. `magpie autostart on`
  wrote Run = "…\Tools\magpie\magpie.exe" tray.
- Upgrade: a 0.1.9001 build downloaded into Downloads asked nothing.
  It replaced …\Tools\magpie\magpie.exe (FileVersion 0.1.9001) and ran
  from there.
- `magpie uninstall --yes` removed autostart, App Paths, the scheme
  and the record, and deleted the sandbox data. The next exe asked
  again.
- Cancel ran the exe from Downloads and recorded nothing.
- The registry and folders were put back as they were before the run,
  checked by a snapshot diff.

Broken by hand:
- recordedDir's lookup turned off: TestSettleInstallsWhereTheUserChose
  and TestSettleOffersTheChosenFolderAgain went red.
- AskFolder skipped: those two and TestSettleDeclinedRunsHere went red.

Not tried:
- The in-app self-update download. There is no newer release to
  download; the in-place replace path was run with a downloaded exe.
- The en, ja, de and zh-TW dialogs on screen. Their words are checked
  by TestInstallWordsEveryLanguage only.
- arm64 Windows.
- A Downloads folder moved by OneDrive.
- The Start-menu shortcut. The box's real App Paths already held
  another session's magpie, so shortcut.ensure took the shortcut as
  removed by the user. This is existing behaviour.

Not changed: uninstall still leaves the PATH entry and the exe, as
before for every install (#5500). Related to #2663, which asks for a
first-run choice of where magpie lives.

Reported-by: feng_21795_78266 (Discord)
2026-11-06 17:34:48 +08:00
yetoneandchiperman ju 0f07fbd0c6 agents: a first Details opening reads its settings before it slides (#5360)
The first time an agent's Details opened, sheet() measured the row before
/api/settings (and, for a full-context row, agentcompact.js) had arrived,
slid to that half height, then jumped to the full one when they landed.
The click now loads what the row needs first (the button shows Loading…),
and only then measures once and slides. A later click supersedes a load
still in flight. agentcompact.js finds #fullContextSegs on the list it is
given, so it fills a row before it is in the page. This is chiperman's
patch (8886a860a) without its core budget raise: Agents-page comments in
app.js were cut instead (app.js 1,311,357 -> 1,311,024; core 1,533,459 of
1,533,802).

agent-expand-steady's slide check looked for the height animation only in
the click's own task. A first opening now waits for the settings read, so
it looks in every frame; it still fails when no frame is animated.

Run (mote, at base 8ee85c59f):
- agent-details-ready.test.cjs (new) + agent-expand-steady: 40/40.
- Every GUI file touching ag-link/ag-exp/agent-compact, click-scroll,
  i18n-keys: all green except i18n-keys "a plugin's words are its own"
  (red on origin/main 8ee85c59f too: #5332, #5426), agent-models-redraw
  chromium 560 "page closed" (4/4 alone), mobile-web "desktop matches
  origin/main" (needs .git, which mote-run's copy has none of), and
  agent-expand-steady's sync check (fixed above).
- TestCoreScriptBudget: ok.
Broken by hand: agent-details-ready on the old app.js fails with
"Details must end without a height jump: 202.984375 -> 729.6875".
Not tried: the real app with the reporter's agents; mobile-web.

Reported-by: chiperman
Co-authored-by: chiperman ju <chipermanju@gmail.com>
2026-11-06 13:43:30 +08:00
yetone f285426ac2 library: the MCP router turns on with no agent, and in gateway mode
treeman_26897 on Discord runs magpie as an MCP entry point for remote
clients on a server with no agents. The router could only be turned on
from the Library, and the Library said "No agents to write to" with no
agent. In gateway mode (magpie web on a headless server, on by itself
with no agents) GATEWAY_HIDES left the Library out altogether. The
router's switch also showed only once a server was in the library. The
gateway and `magpie library mcp router on` had no agent gate: the gate
was the page's alone.

Now, with no agent to write to, or in gateway mode (where no agent is
shown), the Library is its MCP tab alone (`agentless` in client.js):
- servers without agent chips, found servers or projects;
- the router's switch, there before the first server too;
- its lines and status say any app connects at its address, the
  router is on or off;
- the servers it serves are checked once it is on;
- Connect… has Other apps alone, with the gateway key line.
Gateway mode hides only Agents now. The two keys of the empty state
are gone; the gateway-mode subtitle no longer says "no Library".

Remote use goes through the guard /v1 has, unchanged: lanGuard and
serveMCP. TestHubMCPRemoteEntryNeedsKey holds /mcp/magpie/hub to it
from another computer: not shared 403; shared with no key 401 (no
Origin, tools/list, a wrong key); Origin null, chrome-extension://,
file://, moz-extension://, a foreign site and another computer's page
refused from there and from here; a rebound Host with a browser's
marks (Origin = Host, Sec-Fetch only, a Mozilla UA) refused from
here and there; a proxy or tunnel here (X-Forwarded-For,
Cf-Connecting-IP) with no key refused; nothing ran for any of them;
with the key it runs, through the proxy too.

Run on mote at ef20ff690 (on origin/main b4799a6bb); rebased again on
6a78060c6 (gateway.go changed there), the gateway's Hub and LAN tests
and the Budget test ran again ok:
- go test -tags nogui ./internal/gateway -run Hub: ok
- go test ./internal/gui -run Budget: ok (no budget raised; the core
  scripts were 137 bytes over with a longer comment, cut back)
- gofmt -l clean; GOOS=linux and GOOS=windows go vet of gateway, gui: ok
- GUI, both engines, every language: library-mcp-agentless (new, 22
  of 22), gateway-mode, last-page, library-mcp-hub, mcp-hub-direct,
  library-servers-bulk, i18n-keys: 87 of 88; the red is i18n-keys
  "a plugin's words are its own", below.
- Before the rebase, the GUI files a change here can reach (every
  library-*, gateway-mode*, last-page, i18n-*, mcp-hub-direct,
  agent-prefs, bare-ids, images-library-way, search-/vision-mcp-library,
  gateway-conversations; 70 files): 1535 of 1536. The one red is
  i18n-keys "a plugin's words are its own", on main already: #5327,
  #5332, #5426 (files this change doesn't touch).

Broken by hand:
- library-mcp-agentless against origin/main's client.js and app.js:
  22 of 22 red (no router row with no agent; no Library tab in
  gateway mode).
- rebound() returning false and serveMCP's Origin check off:
  TestHubMCPRemoteEntryNeedsKey red on the rebound Host cases and on
  chrome-extension://, file:// and moz-extension:// from here. The
  test passes on the old Go code: the guard was there already.

Not tried: a real remote MCP client against a headless magpie serve
or magpie web on another machine; the TUI (it has no Library page of
its own for the router; the CLI's router on needs no agent).

Reported-by: treeman_26897
2026-11-06 12:12:20 +08:00
yetone 814a625a24 usage: the top refresh reads saved Claude accounts again (#5380)
The tray panel's Allowances refresh said "Allowances refreshed" but a
saved, non-active Claude account kept its old reading: claudeWindows runs
Claude Code's /usage for a saved account only under savedRefresh, which
only that account's own card refresh sets.

Now a refresh of every allowance by hand asks usage/quotas?asked=1&all=1
(AskEveryClaudeUsage). It marks its ask generation in claudeEveryAsked,
and for claudeEveryFor (2 minutes) each saved account not read since is
read as its card's refresh would, under the same due check, the
30-second per-account floor and the same running holds. Opening the
Usage page or the Allowances tab (?asked=1 alone), the timed refresh and
every background read are unchanged, so nothing polls more. Callers:
the panel's top refresh (refreshPage "allowances"), the Usage page's
refresh and sidebar reload (refreshUsage -> loadQuotas("all")),
Routing's Read allowances, and the TUI's r. loadQuotas no longer lets a
lesser load on its way (an opening's asked read) swallow a Refresh.

Siblings: saved Codex accounts are already read anew on every asked
whole read (loginReading over HTTP after AskUsage clears the cache), so
Codex is unaffected. PlanQuotas and KeyBalances keep their 1-minute cache
on an asked read; left as is. The core scripts' budget is not raised:
the ~140 bytes are paid for by two loadQuotas/quotasOpened comments cut.

Run (mote, at 807341cdc on origin/main 5666cb049; rebased onto
505534992 after, which touches only internal/plugin and internal/proc;
the core script budget rechecked at the pushed head, 193 bytes under):
- go test ./internal/provider/ ./internal/gui/ ./internal/tui/ ok
  (TestMainWindowCorners/macOS_26_SDK red on mote's macOS 27, #3949;
  green when run with the -run set at the pushed head)
- go vet the three packages; GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of them ok; go vet provider+tui in WSL ok; gofmt -l
  clean
- GUI, Chromium and WebKit, en+zh: refresh-page, claude-usage-asked,
  usage-refresh, routing-read-allowances, allowance-open-read,
  quota-refresh-order, usage-refresh-flight all pass. A wider set of 119
  files (quota*, panel-quota*, usage-*, allowance*, routing-read/account,
  menu-*, tray-*, i18n-keys) has reds in 6 files, identical at the parent
  commit and filed: i18n-keys #5332, menu-input-scroll #3402,
  tray-cell-click #5215, usage-agents-hide #3414, usage-fold #3415,
  usage-ledger #5048.
- New TestRefreshEveryReadsSavedClaude: an opening's ask runs nothing
  for saved accounts; a top refresh reads each anew; an unasked read and
  a plain asked read after it don't; rapid refreshes keep the floor; the
  every-ask lapses after claudeEveryFor.

Broken by hand: dropping "|| every" from claudeWindows' read turns
TestRefreshEveryReadsSavedClaude red ("top refresh read no allowance of
saved max@x.com"); the panel's refreshPage back on loadQuotas(true)
turns refresh-page's panel subtests red in both engines.

Not tried: a real saved Claude account's /usage run from the real tray
panel (the test fakes Claude Code's /usage per account directory); the
full GUI suite; the de/ja/zh-TW GUI runs (no string changed).
2026-11-06 00:35:39 +08:00
yetone 11d9d0a3a5 routing: each account one calm cell in Accounts and keys (danzi002 on Discord)
danzi002 (v0.1.2945): Accounts and keys "显示的好乱啊,没有之前一目了然".
70a98dd85 (v0.1.2929) made the cards compact for ferock4669 and iyou00,
but left each card 3-5 lines of uneven height (tally, latest answer, a
Try now on its own line) in 168px columns: names cut, the status
wrapped, red twice on every resting account and on healthy ones with
old failures, Try now links scattered. Rendered with 9 Codex, 1
WorkBuddy and 3 WorkBuddy AI accounts, zh at 1100/1440, parent
c4245c4c2 against main.

Kept the compact change (still short, long lists still fold) and made
each account one uniform cell instead of reverting:
- a dot for its state: green in use (the provider's not-resting account
  that answered last), amber resting, grey otherwise, red to act on;
- name, plan and a muted Try now on one line, then one line of what is
  left and when it renews, or when it is back, wrapped in full, never cut;
- how it fared (the tally) and when it was read ("as of") on hover;
- red only where the reader must act: sign in again, a restriction or
  verification, a key failing with nothing else to say. Those rows keep
  their tally in sight;
- columns min(240px, 40vw), the usage bar back in the flow (Chromium
  misplaced the absolute bar inside a multicol .rt-lead).
routing-account-windows and routing-wallet-lapse now find "as of" last
in the tooltip instead of on the line.

Run on mote (Chromium + WebKit, en/zh/zh-TW/ja/de, 1100/420 and the
files' own widths):
- new routing-acts-calm.test.cjs: green both engines, all 5 languages.
- every Routing file that renders .rt-act plus i18n-keys and
  panel-routing*: 679 tests, 610 pass; the reds besides mine were
  rest-try-now WebKit, rules-line, rule-drag/remove, row-swap, steady,
  steps-cap, story-shrinks, order-unknown and many-keys webkit zh, the
  same set as main f44fa2ef6 run alone (41 reds there), filed as #5035,
  #5088, #4585, #3593, #4082, #4628, #3789, #3799, #3412, #4629, #3954.
  After fixing my own reds, acts-calm, account-windows, wallet-lapse,
  many-keys, rules-line and key-windows: 135 pass, 1 red (rules-line
  webkit en 1100, #3593/#5035).
- At the pushed head (rebased on 34116ec01): acts-calm,
  account-windows, wallet-lapse and i18n-keys 70/70 pass, the Go size
  budgets pass.
- go test ./internal/gui/...: TestMainWindowCorners/macOS_26_SDK red
  only (#3949, AppKit on macOS 27); the size budgets pass.

Broken by hand, each red in routing-acts-calm (Chromium):
- the resting line red everywhere (.st.rest red): red outside ivy;
- the tally shown on calm rows: "main: its name and what it says";
- columns back to 168px: a one-line status fails;
- no rest class: expected 'rest'.

Not tried: dark mode by eye, the real app on WebKitGTK (Linux) and on
Windows, real accounts (the fixture is synthetic), and the 8-row fold
with more than 8 Codex accounts by eye.
2026-11-04 22:04:17 +08:00
yetone 532d054bee sessions: every Cursor row has a delete, and the right-hand column lines up
ysm119 (Discord), Sessions page, Cursor tab: some rows had a delete and
some had none, and the time / "N sessions" column stood at a different x
from row to row.

Causes:
- Delete: listAgentWith set Deletable = Deletable(agent) && !ReadOnly, so
  every editor-transcript row (read only) came back deletable:false, and
  client.js drew .sm-del only for deletable rows.
- Alignment: a folder adds its ⋯ only when it has actions, and a session
  row's Resume / terminal / Continue in / delete come and go per row, so
  .sm-when, .cost and .num moved with them. "Copied" is wider than
  "Resume", and at <=600px the cost line wrapped at different places.

Change:
- rowDeletable decides per row. An editor transcript the editor no longer
  keeps (no state.vscdb, or it was read and has no composer for that id)
  is "loose" and deletable: Delete trashes only its <id>/ folder or
  <id>.jsonl/.txt, never state.vscdb. A chat the editor keeps, or a store
  that can't be read, stays undeletable with undeletable:"cursor-editor".
- In an agent magpie deletes from, every row has its delete. One it can't
  delete is aria-disabled, says why in its title, and a click shows the
  reason in the status line and sends nothing (en, zh, zh-TW, ja, de).
- A row without Resume, Continue in or a terminal, and a folder without
  its ⋯, keep that room with an inert, aria-hidden slot. Resume reserves
  the wider of Resume and Copied; at <=600px the cost keeps a min width.
- docs/subsystems/gui-shell.md says so.

Run (on mote via mote-run, base f44fa2ef6; origin/main 93d5c76c0's 3
commits since touch none of these files):
- go test ./internal/sessions: ok. go test ./internal/gui: ok except
  TestMainWindowCorners/macOS_26_SDK, an AppKit titlebar red on macOS 27
  already filed as #3949.
- gofmt -l clean; go vet native, GOOS=linux -tags nogui, GOOS=windows ok.
- New sessions-cursor-align.test.cjs: 10/10 (chromium + webkit x en, zh,
  zh-TW, ja, de; widths 1100/660/420, hover, Copied).
- Sessions GUI set (sessions-*, session-*, gateway-conversations,
  gateway-mode-sessions, account-mask-sessions, header-session-hint,
  routing-session*, routing-ctx-sessions, usage-session*, i18n-keys,
  gui-de, gui-ja, gui-zh-tw): 728/728, and 728/728 again after the
  rebase onto 93d5c76c0 (which changed app.css and i18n.js).

Broken by hand:
- rowDeletable forced to "read only": all 3 new Go tests red.
- sessionPaths' editor-path branch off: TestCursorLooseFlatTranscript red
  (it trashed agent-transcripts/ itself).
- Old client.js/sessions.css/i18n.js: new GUI test 10/10 red. Folder slot
  alone removed: red at 1100 (when 1071 vs 1037). Lanes removed: cost
  edges differ. Before the Copied and de 420 fixes, those cases were red.

Not tried: a real Cursor editor or a real ~/.cursor (every delete ran on
fixture copies in a sandbox HOME); the Windows and Linux apps; deleting a
chat from Cursor's own UI and seeing magpie's list follow.
2026-11-04 21:15:33 +08:00
yetone 70a98dd85c routing: a long Accounts and keys shows its first rows, the rest behind Show N more (ferock4669, iyou00 on Discord)
With many keys the Routing page's Accounts and keys ran on and on: each
card held every window, the models it answered and a meter. Now a card
keeps its name, one line of what is left (or its rest) and how it fares,
with Try now or Sign in again when it needs one. The models it answered
are in its tooltip under its id, and a subscription's other windows are
on hover over its figure.

A list longer than 8 rows shows the first 8 and puts the rest behind
"Show N more" at its foot (kept across a reload in
magpie.routingActsAll). Never behind it: a row to sign in again, a
resting account or model, failures with no answer, a remote whose
allowance can't be read, rows under a fold the reader opened, and the
heading of a provider with a row shown. Two more alone aren't folded.
The button clicked stays where it is on the screen. "View usage" beside
it opens Usage's Overview, where each account's card says it all,
without making that tab the reader's own (window.openUsageOverview).

The foot writes only what changed, so an idle page writes nothing
(routing-live-calm).

Tests: routing-acts-compact.test.cjs (new; chromium and webkit, en zh
zh-TW ja de, 1300px and 420px). routing-account-windows,
routing-read-allowances, routing-wallet-lapse, routing-accounts-narrow
and routing-columns follow the card's new shape and the foot.

Run on mote via mote-run, worktree based on origin/main c7bbd3faf:
- Whole Routing GUI set (routing-*, panel-routing*) + i18n-keys,
  chromium and webkit: 2487 pass, 29 fail, every red one of those
  below (many-keys and routing-levels #3620 too)
- Same reds on clean origin/main c7bbd3faf (11 files run there): the
  routing-rule-remove (#3096), rule-drag (#3789), row-swap (#3799),
  order-unknown (#4627), rules-line (#3593), steady, steps-cap and
  story-shrinks reds of #5088, in different languages run to run.
- routing-folder went red 2 of 3 with this change (30/30 on main):
  its press() clicked Save while the group editor was still growing
  open, and the foot moved .rt-gsec 8px. press() now waits for the
  button to hold still: 3 runs x both engines 20/20, webkit alone
  10/10.
- TestCoreScriptBudget red, 1534154 > 1533802, identical on clean
  c7bbd3faf (#5139): this change adds nothing to the core scripts.
- routing-acts-compact twice, alone and beside 5 files: 22/22, 20/20.
- Rebased onto origin/main 14f6d10de (its routing client.js changes
  merged clean), at this commit, both engines: routing-remote-windows,
  week-low, free-expiring, group-strategy, acts-compact, live-calm,
  folder, account-windows, read-allowances, accounts-narrow,
  wallet-lapse, columns and i18n-keys all green.
  Pushed on c4245c4c2, which changes only internal/gateway's
  object_root and its doc after 14f6d10de; not run again on it.

Broken by hand:
- rows needing the reader no longer kept out of the collapse (m.keep
  ignored): routing-acts-compact red (Show 4 more never shown).
- a row to sign in again under a shut fold not drawn: red (Zed's fold
  row 0 !== 1).
- the foot's hidden/aria-expanded written every draw: routing-live-calm
  red in both engines (attrs: 6 !== 0), as in an earlier run of this.
- the button's hold removed: routing-acts-compact red (chromium en
  1300px, "the click moved the button: 572.9 → 592.1").

Not tried: the real app with a real long key list (fixtures only), the
Linux WebKitGTK app, Windows.
2026-11-04 18:33:07 +08:00