Commit Graph
3077 Commits
Author SHA1 Message Date
yetone 3b550a99c7 providers: a sign-in kept to its link leads to the setting that kept it
With Settings › Privacy › Sign-in pages' "Open sign-in pages in the
browser" off, adding an account says "magpie didn't open the sign-in
page, as set in Settings" and gave no way to that setting (the
scattered settings audit after netube99 on X). That line now ends in a
Settings › link that opens Privacy and lights the row. The row stays
in Privacy: it is there for max2020's reason, a vendor seeing which
browser a user signs in from.

app.js's core budget is met by one comment cut beside it, no raise
(38 bytes over before the cut).

Run (mote, through mote-run, Chromium and WebKit): signin-link-only
(every language, both a link-only and an opened sign-in, which has no
link), video-gen-pick and i18n-keys, 78 of 78; TestCoreScriptBudget ok
after the cut.
Broken by hand: no link, signin-link-only red in Chromium.
Not tried: a real sign-in in the app; the whole GUI suite runs after
the last of these changes.
2026-11-10 00:01:15 +08:00
yetone cedacf1aea settings: Video generation's how-to leads to the Providers page
With no model that makes videos, Settings › Models › Images' Video
generation says to right-click a model in its provider's Model settings
and mark it a video model, on another page, with no way there (the
scattered settings audit after netube99 on X). The line now ends in a
Providers › link that opens that page. It is drawn in videogen.js, so
the core script doesn't grow.

Run (mote, through mote-run, Chromium and WebKit): video-gen-pick
(every language it covers, 1100 and 400), signin-link-only and
i18n-keys, 78 of 78; TestCoreScriptBudget and the I18n Go tests.
Broken by hand: no onclick, video-gen-pick red in Chromium.
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-10 00:01:15 +08:00
yetone 8607a7a029 library: a skill GitHub's limit left unchecked leads to the token's row
A skill check that ran into GitHub's 60-an-hour limit says "Add a
GitHub token in Settings → Network and sharing", in a status line that
fades and a tag's tooltip, and nothing there went to Settings (the
scattered settings audit after netube99 on X). The Not checked tag is
now a link when the limit was the one without a token: it opens
Settings › Network and sharing and lights the GitHub token's row. A
token's own limit has nothing to add there, so its tag stays plain.

github-token.test.cjs swaps its route between rounds with
unrouteAll({ behavior: "ignoreErrors" }): the click leaves Settings'
lazy files being served, and the old unroute made the next round's
handler fulfil a route already handled.

Run (mote, through mote-run): github-token.test.cjs, Chromium and
WebKit, en and zh, 8 of 8; github-token plus every
library-*.test.cjs before the route fix: 1211 pass, the one red that
route race.
Broken by hand: the tag never a link, 4 of 8 red (each limited case).
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-10 00:01:15 +08:00
yetone 92be1d779b usage: the allowances' head opens Settings › Allowances
The Usage page draws the allowances, but how they are shown (used or
left, the menu bar's figures) and their alerts are set in Settings ›
Allowances, and nothing on the page said so (the scattered settings
audit after netube99 on X). The allowances' head now has a Settings ›
link, as the Routing page has, that opens that tab and lights the
Allowance display row (now #quotaLeftRow). Wired in the usage plugin,
so the core script doesn't grow.

Run (mote, through mote-run, Chromium and WebKit, every language, 1100
and 420): settings-places, mobile-web (with an origin/main baseline;
the button is taken out until the baseline has it, as rtToSet is),
account-mask, quota-curve, i18n-keys: 89 of 89, twice. A first run had
one red whose name a tail cut off; the next two runs of the same files
were 89 of 89, so it is unnamed and not seen again.
Broken by hand: no onclick, settings-places 2 of 2 red (no row lit);
no #quotaLeftRow, 1 of 1 red.
At the pushed head (rebased on f37de8cc4, which changed plugin pages and
the core budget): Budget and I18n Go tests ok; settings-places,
i18n-keys, plugin-page 30 of 30.
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-09 23:44:16 +08:00
yetone 623e797fde plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.

- A page that asks for the "usage:day" read gets that day as
  magpie.read("usage:day", {date, tz}): totals, each agent and its
  models, the streak and the average active day (usageapi/day.go,
  gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
  of at most 16 MB. In the window they go through
  POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
  the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
  PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
  it to Downloads under a name made safe. In magpie web, the browser
  saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
  shares a picture. The core grows by its one call only, paid for by
  comments cut, so the budget is not raised.

Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
  TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
  covers the bridge, both engines and a refused SVG.

What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
  - TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
    this change's own reds. The new route now has a parity entry, and
    the share code moved into lazy pageshare.js with no raise.
  - TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
    first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
  passed. Every red is filed and none touches this change:
  - i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
  - page-width-steady: #5013.
  - plugin-card-update in WebKit: #3079.
  - plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on bc8b01d60:
  - gofmt clean; go vet ./internal/... on darwin, linux (nogui) and
    windows ok.
  - internal/usageapi, internal/plugin and internal/cli ok.
  - internal/gui: TestCoreScriptBudget, the TestPluginPage* tests and
    the TestPageImage/TestClipImage tests pass.
  - plugin-page and old-webkit (both engines): 12 of 12.

Real use:
- A sandbox HOME with a copy of real usage, through the real GUI
  server, in Chromium and WebKit, light and dark, en/zh/zh-TW/ja/de, at
  420 and 1100 px. The card showed 87.9M tokens, $9.85 and 4076 calls
  with a 22-day streak.
- Picking an earlier day and WebKit's Copy ("Copied") worked, with no
  page errors.
- Not tried at push: Chromium's Copy (its headless clipboard was
  denied) and magpie web's Save as a captured download. A second real
  run that grants both was still queued on mote's suite lock.
- Clipboard: checked live on macOS (osascript) and Windows
  (PowerShell). Not tried live on Linux: WSLg had no display.
2026-11-09 23:19:14 +08:00
yetone bc8b01d603 claude: the short system prompt is set in the Claude Code editor, not Settings › Replies
The scattered settings audit after netube99 on X. Short Claude system
prompt and Claude Code's interactive mode changed only Claude
subscription runs, yet sat in Settings › Models › Replies, while the
Claude Code editor already had its own "Claude Code runs as" switch for
the second, whose card said "Switched here or in Settings › Models ›
Replies".

Both rows now go in a claudeRunList in the Claude editor (PROV_PREFS), so
Settings' search still finds them and Open goes to the editor. In the app
the editor's own "runs as" switch is the one shown, and the duplicate
interactive mode row is hidden by CSS; in magpie web as a gateway, where
that switch is disabled, the row shows (the list gets a gw class from
renderReplies: body.gateway-mode is set only on a change, not at boot).
provPrefsField lets Claude's run list through in gateway mode, without
the warm-ups, which are this computer's. The card and the "off" reason
no longer name Settings (zh, zh-TW, ja, de written with them), and the
bridge's subsystem page names the editor.

Run (mote, mote-run, origin/main ddd6c649b as BASE_REF):
- claude-lean-prompt-setting, claude-tui-setting, claude-mode,
  provider-prefs, settings-places, i18n-keys, bare-ids and mobile-web,
  both engines: 170 of 170.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok.

Broken by hand (chromium):
- both rows back in Replies: claude-lean-prompt-setting and
  provider-prefs 18 of 18 red;
- the editor's duplicate row not hidden: claude-tui-setting 8 of 8 red;
- no gw class in gateway mode: claude-tui-setting 8 of 8 red.

Not tried: the real app with a real Claude subscription.
2026-11-09 23:14:57 +08:00
yetone a6e4cf7635 settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.

Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
  classify-timeout-setting, model-load, i18n-keys and bare-ids, both
  engines: all pass.
- mobile-web against origin/main fdabddeb4 (a git repo made in the copy
  from git archive, since mote-run carries no .git): 30 of 30. It now
  takes the new Settings › button out of the Routing page until main has
  it, as it does for other new rows.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok. gofmt clean.

Broken by hand:
- the three rows back in Replies and busyLoadRow left where it was:
  settings-places and retry-after-cap-setting 20 of 20 red (chromium);
- the Settings › button's click handler off: settings-places 10 of 10 red.

Not tried: the real app; the GUI suite beyond these files runs with the
rest of this audit's changes.
2026-11-09 22:42:58 +08:00
yetone 7d177985f6 settings › allowances: the alerts under an Alerts heading, and no empty Menu bar cost row in magpie web
The scattered settings audit after netube99 on X found Task done alert
filed among the allowances' display rows, with nothing saying why, and
magpie web drawing Menu bar cost as a row with no control (it has no
menu bar, and renderTrayUsage returns before filling it there).

- Allowance alert, Low balance alert, Reset reminder and Task done alert
  are now a list of their own under an "Alerts" heading (#alertHead,
  #alertList), after the display rows. Gateway mode hides the heading
  and the list, as it hid the four rows.
- #trayCostRow is app-only, as #trayUsageRow is.
- "Alerts" in zh, zh-TW, ja, de.

Run (mote, at this tree):
- settings-places (new), bare-ids, turn-done, usage-alert,
  reset-reminder, mask-alert, settings-search, i18n-keys:
  122 pass, 0 fail, both engines.
- go test -run "Budget|I18n" ./internal/gui: ok.
Broken by hand: without app-only, settings-places is red 10 of 10 on
"no Menu bar cost row in magpie web"; with the heading renamed, red 10
of 10.
Not tried: the real app; the row moves are markup only.
2026-11-09 22:42:58 +08:00
yetone 92e8edd7fc windows: magpie is listed in Installed apps, and its Uninstall puts every agent back
Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml
still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex";
Rk1ngggg asked whether an update cleans it. magpie's own uninstall
(Settings › About › Uninstall magpie, `magpie uninstall`) already
disconnects every agent and takes Codex's leftovers (#3866), but on
Windows magpie wasn't in Settings › Apps › Installed apps, so it was
removed the way Windows offers for a program it doesn't list: by
deleting the exe and folders, which runs no code.

shortcut.Ensure now writes
HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie
(DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString,
URLInfoAbout, NoModify, NoRepair) at every installed start, beside App
Paths, and Remove (uninstall's System step) takes it out the same way:
only while it names this exe, or an exe that is gone. Its Uninstall
runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe
has no console, where the terminal's `magpie uninstall` would refuse
for want of one to ask on, so those exact args open the app's window
(or forward to the running app, OnSecondInstanceLaunch) on Settings ›
About with Uninstall magpie's question asked (uninstallView,
?uninstall=1). It asks once: a redraw of Settings doesn't ask again,
and Cancel removes nothing. magpie web opened at that link asks
nothing. Deleting the app by hand still runs no code (macOS
drag-to-Trash included); agent-wiring.md says so.

Run on mote at the pushed head (rebased onto be9dbce02):
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. go build, GOOS=linux go build -tags
  nogui, GOOS=windows go build: ok.
- go test -tags nogui ./internal/gui ./internal/cli ./internal/shortcut
  ./internal/uninstall: ok (TestCoreScriptBudget included).
- uninstall-settings.test.cjs and i18n-keys.test.cjs: 40 of 40
  (chromium and webkit; the new Installed-apps cases in en and zh at
  1100 and 420).
At d3f40bedd, the same change on c7ebb6f8d, under suite.lock:
- go test -tags nogui -timeout 45m ./...: ok, every package.
- The whole GUI suite (--test-concurrency=4): 22518 of 22800; the 282
  reds are in 53 files the change doesn't reach (model-chip-steady 40,
  usage-agents-hide 22, zero-priced-free 20, provider-fetch-again 14,
  ...), the full-suite reds of #5475; the numbers are on that issue.
  Their run at c7ebb6f8d alone is queued behind other sessions' suites.
- The first full run found the core scripts 147 bytes over
  TestCoreScriptBudget; the page's part was cut to one line (the
  budget is not raised).
On xiaomi-gpu (win-run): go test ./internal/shortcut, incl.
TestInstalledAppsEntry on the real HKCU registry under a test key: ok.

Broken by hand, each red:
- registerAppPath not calling registerUninstall: TestInstalledAppsEntry
  (UninstallString = "") on Windows.
- main.go not taking UninstallArgs to the window:
  TestInstalledAppsUninstallOpensTheWindow (unknown "--window").
- app.js not asking on ?uninstall=1: 4 of 4 Installed-apps GUI cases.
- app.js asking without its once guard (params.delete): the same 4
  ("asked again").

Not tried: a real Settings › Apps › Uninstall click on Windows with an
installed magpie (the test box's install belongs to other sessions); the
second-instance forward (OnSecondInstanceLaunch) has no test of its own.
2026-11-09 22:33:31 +08:00
yetone 39569d5604 claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in
while using magpie. Turning on "Separate app" in Claude Desktop's row on
the Agents page (or `magpie claude-desktop launcher add`) moves magpie's
3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds
~/Applications/Claude Magpie.app. That launcher opens Claude.app with
--user-data-dir on that folder, so it runs side by side with the user's
own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the
default, and turning it off (`launcher remove`) moves the wiring back
and removes the app. It is macOS only: Desktop's packaged app strips
CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p.
The folder ends in -3p because Desktop adds -3p to any other name.
Restarting the isolated app ends only its own process (pkill on its
--user-data-dir) and opens the launcher again.

Run at 1b25cda26 (this change on origin/main be9dbce02); rebased onto
fdabddeb4 (catalog only), then go build ./..., vet and the budget and
launcher tests again: ok. All
on mote:
- gofmt -l clean; go vet ./internal/...; GOOS=linux go vet -tags nogui
  and GOOS=windows go vet on agent, cli, desktopiso, desktopdir, gui.
- go test (whole packages) desktopiso, desktopdir, settings, settingsapi,
  proc: ok. -run Isolated|TestDesktopInstance|TestAddStartsDesktopOnTheFolder|
  TestScript|TestAddLeavesTheirs|ClaudeDesktop|Restart in agent;
  TestClaudeDesktopLauncher|TestEveryRouteHasACommandOrIsNamed|Help in cli;
  TestCoreScriptBudget|TestSettingsSaveKeepsWhatItDoesNotSend|Budget|Desktop
  in gui and gateway: ok.
- An earlier full `go test ./...` at fef23255f had four reds, all from
  this change and fixed here: the route without a command (now in
  notYet), settings_keep's DesktopIsolated, os/exec instead of proc, and
  the core script budget (paid by sharing the switch helper with the
  largest-window line and cutting comments; no raise). A second full run
  of the touched packages queued ~7h on mote's suite lock behind other
  sessions and was stopped; the targeted runs above replace it.
- GUI on mote, both engines: desktop-isolated (new; en, zh, zh-TW, ja,
  de; 1100 and 640; aria-checked, posts, status text, no scroll, no
  select, absent without `isolated`), desktop-longest, click-scroll,
  plain-names, i18n-keys: ok. page-width-steady, panel-fold and
  zero-priced-free are red, the same 33 tests at origin/main be9dbce02
  (diffed): #4541/#5013, #5796, #5262. i18n-keys' "a plugin's words are
  its own" is red on main too (#5332).
- Whole GUI suite on WSL at an older head: 400 of 22778 red across
  ~100 files of other pages, in line with #5559 (478 of 21666 on main
  there). Not rerun on mote.

Real use, on mote in a sandbox HOME with Claude.app 4.23118 linked in:
`claude-desktop magpie`, then `launcher add`, moved the wiring to
Claude-Magpie-3p (deploymentMode 3p, mcpServers and locale carried).
Opening Claude Magpie.app started Claude with
--user-data-dir=.../Claude-Magpie-3p; it wrote configLibrary and
model-catalog there (3P mode) and no -3p-3p folder. A second, 1P Claude
ran beside it on its own sandbox folder. Opening the launcher again
kept one instance; the pkill pattern matched only the isolated pid; both
quit on SIGTERM. `launcher remove` put the wiring back and removed the
app.

Broken by hand: a folder without -3p (Desktop made -3p-3p), the
CLAUDE_USER_DATA_DIR env route (ignored by the packaged app), os/exec in
the quit (TestNoCommandBypassesProc red).

Not tried: a screenshot of the running app (screencapture fails over
ssh); a model request through a gateway from the isolated app; Windows
and Linux (not offered there). Known: the Dock shows Claude's own icon
for the running isolated app, and Chrome pairing is off in a moved
userData folder.
2026-11-09 22:31:16 +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 07a06617e1 quota: an early reset starts the Cycle chart though the card's reset has milliseconds
steven_4422 (Discord #feedback, 11-09): a weekly window refilled early at
Nov 9 02:00 kept its deadline, yet the Cycle trend began at Nov 4 10:40, the
vendor's own start. quotaCycle took the recorded early reset only when the
card's resetsAt equalled the last reading's exactly. History keeps whole
seconds and a vendor's deadline can drift a little between reads, so the
two rarely matched. Now a reset minutes apart counts as the same one.

Run (mote): new quotaCycle test red on the old code (actual
2026-11-04T10:40:00.437Z, the reporter's start), green after;
quota-curve.test.cjs 31/31; go test -run Budget ./internal/gui ok.
Not tried: the reporter's own account; the full GUI suite (mote's suite
lock queue is hours long).

Reported-by: steven_4422 (Discord #feedback)
2026-11-09 22:06:55 +08:00
yetone 89d8b4d5f9 settings search: a provider's settings are found only while that provider is added
Settings' search lists each provider's own settings (warm-ups, check-ins
and the like) as rows that open the provider's editor. It listed them
for every provider magpie knows, so a search for "warm up on reset"
offered ChatGPT and Claude to a user with neither, and Open did nothing
(the scattered settings audit after netube99 on X). A row now remembers
its providers and is left out while none is added, and a row whose
built-in plugin is off is left out as the others are.

Those rows are drawn by a lazy provlinks.js the first time a search
wants them, not on each Settings draw: app.js was 399 bytes over
TestCoreScriptBudget with the change, and is now 956 under its size at
the base, with the budget unchanged.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): settings-search, provider-prefs, old-webkit,
i18n-keys, builtin-places: 168 pass, 0 fail, Chromium and WebKit;
TestCoreScriptBudget ok. Broken by hand: without the set-miss line the
new case was red with ['ChatGPT','Claude'].
2026-11-09 21:51:54 +08:00
yetone 4064c10362 routing groups: on while Routing is off, their Built-in row says their page went with it
Routing groups have no page of their own: theirs is on Routing. With
Routing off and Routing groups on, Plugins › Built-in showed the groups
switch on and nothing anywhere to set them, and the quick start's
routing step still counted groups alone (netube99 on X, and the
scattered settings audit after it). The groups row now says "Their page
is on Routing, which is off" with Turn on Routing, which flips Routing's
own switch on the same list, and the quick start's step leaves with
either one off.

The hook lives in a new plugins/routing/settings.js, loaded after app.js,
whose featWho it extends (plugin client files load before app.js; the
first try in client.js threw "featWho is not defined" in every test).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): builtin-places, mask-alert, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. Broken by hand: the hook returning at once,
builtin-places' groups case went red in all 20 runs.
2026-11-09 21:51:53 +08:00
yetone 7cb437ee16 masking: its alert sits with its other settings, and its Built-in row says when nothing is masked
The Masking alert was the one masking setting on the Masking page, under
the request list, away from every other one in Settings › Privacy (and
in Settings › Usage before that, where nb5p looked for it). It is now
the first row of Privacy's "when a value is found" list, out in gateway
mode as before. The Masking page is the list of masked requests alone.

Masking turned on with no kind, no personal data and no word of the
user's masks nothing, and its Plugins › Built-in row said only where
its settings are. It now says "Nothing is masked yet" before the link
(the scattered settings audit after netube99 on X).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): mask-alert, builtin-places, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. The builtin-places file committed here is the
one run minus the routing-groups case, which comes with its change.
2026-11-09 21:51:53 +08:00
yetone 17a94a1b00 gateway: its keys show for a web page listed in Settings, and Settings links to them
A web page listed under Settings › Network and sharing › Web pages that
may call magpie is refused without a gateway key, shared or not, and the
row says to use "a gateway key from Gateway". But the Gateway page drew
its keys only while Share on local network was on, so that user found a
line saying keys come with sharing and no way to make one (the scattered
settings audit after netube99 on X). The keys now show while sharing is
on or a web page is listed, the off line names web pages too, and the
Web pages row links to Gateway's keys once it has a page.

The guard in renderGatewayOwn's settings callback also redraws the whole
view only while its box is still in the page, as 5efe0e195 does for the
first draw.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): gateway-keys-off, cors-origins,
gateway-own-settings, old-webkit, i18n-keys: pass in Chromium and
WebKit, every language, 1100 and 420 wide (72 of 72 for the first four).
Broken by hand: gwKeysShown limited to sharing alone, gateway-keys-off
went 20 pass / 20 fail.
2026-11-09 21:51:53 +08:00
yetone 88b541a25c images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
  ./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
  ./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
  ./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
  library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
2026-11-09 21:51:53 +08:00
yetone 4ddd01fe5b gateway page: its own settings draw nothing while the page isn't drawn
c9a1c557d's renderGatewayOwn, run again once settings are read, met a
window where the view was "gateway" but the page's template wasn't on
it, and threw on a null #gwOwn. old-webkit's "with Safari 15.0's
built-ins, the panel and the window draw every page" was red on main
from then on ("null is not an object (evaluating 'box.replaceChildren')").

Run on mote:
- old-webkit + gateway-own-settings on origin/main 8d80f6bc0 with only
  this line added: 26 pass, 0 fail. Without it (8d80f6bc0 as is):
  old-webkit 5 pass, 1 fail, the error above.
Not tried: the real app (the window has to switch views before the
settings read returns).
2026-11-09 21:51:53 +08:00
yetone dae104bfac capre: a length check, not an unrolled repeat, holds nine patterns
Go's regexp unrolls a bounded repeat into that many copies of its
class: [A-Za-z0-9.-]{0,254} (the session terminal's bundle id) was
89kB of program, kept from start to exit, and Codex's item-id refusal
`.{0,1000}?` 88kB. Measured one by one over magpie's 540 package-level
patterns (1.5MB in all), the nine largest bounded ones were ~440kB.

capre.MustCompile(expr, max) is the pattern with * or +, matching only
a string of max characters at most (rune count, so the (?i) Kelvin
sign and invalid bytes count as the regexp counted them). The nine:
settings' bundle id, library's name and agent id (now name@wsl:distro
cut in two), Anthropic tool names, the trace page's name and find,
access's MCP server, OpenClaw's profile and Codex's provider id. The
item-id refusal is a function: the tail within 1000 characters of a
head.

Run on mote (go1.26.8):
- go test ./internal/capre ./internal/access ./internal/settings
  ./internal/library ./internal/sessions ./internal/agent ./internal/gui
  . : ok; ./internal/gateway -run 'ItemID|Undeclared|ToolName|Refus': ok
- TestCappedMatchesBounded holds each old pattern against its new one
  over 14 units x 19 lengths (0..300, at each bound +-1); with the
  length check taken out it is red (1586 mismatches).
  TestItemIDRefusalAsTheRegexp holds the function against the old
  regexp at 998..1002 characters of x, é, 日, \xff, \n; with 1001 it is
  red. TestCappedIsSmall: 1304 bytes held, 49680 bounded.
- go vet native, GOOS=linux and GOOS=windows over the touched packages
  (gui natively: its Linux build needs cgo); gofmt -l clean.
- Real build, GODEBUG=inittrace=1: magpie's own inits allocate
  11.93MB -> 10.61MB.
- Idle on the real-account copy, 180s heap: regexp programs (sampled)
  4.54MB -> 3.01MB.

Not tried: the full ./... suite; the gateway package beyond the run
above.
2026-11-09 21:47:24 +08:00
yetone ffbc45eac5 usage: a breakdown row's second line wraps at every width, not cut at 180px
In a wide window a Usage breakdown row's name column is a fixed 180px
and the line under the name (the sign-in, calls, credits, failures,
TTFT, speed) was one line cut with an ellipsis there, so everything after
the provider was hidden. Only the narrow web layout let it wrap. It now
wraps at every width; the narrow rule that did the same is gone.

Reported-by: shusoyo (Discord #general, 11-09)

Run (mote): usage-stat-sub-wrap.test.cjs 8/8 (chromium, webkit; en, zh;
1440 and 1000px). Broken by hand: with the old app.css it is 0/8 ("the
line wraps, not cut").
2026-11-09 21:40:13 +08:00
yetone 331f4a1393 gui tests: a comment line doesn't say a plugin's words (#5332, #5327, #5426, #5482)
i18n-keys' "a plugin's words are its own" has been red on main since
73c98ebc2 and was filed four times with no owner. Each red was a Go
comment citing a word from the window: search_row_archive_test.go's
"(View routing, the …", trace.go's '"No session ID")' and
skills_shared_copy_test.go's "Use the library's sets …". A comment says
nothing to the window, so whole-line // comments in .go and .js are left
out of the scan. Words in code are still found.

Run on mote at this tree (on origin/main c9a1c557d):
- node --test i18n-keys.test.cjs: 4 pass, 0 fail (was 1 fail on
  e3f1efdaa, the same three words).
Broken by hand: a code line t("View routing") in app.js turns it red
("plugins/usage/i18n.js "View routing": internal/gui/assets/app.js says
it too").
2026-11-09 20:14:03 +08:00
yetone c9a1c557d0 plugins: every built-in's row leads to where it is used, and the Gateway page holds its own setting
netube99 on X: one feature's settings are spread over pages that don't
say where the rest are. Plugins › Built-in had six rows (Key limits,
Groups, Rotation, Warm-ups, Middleware, Tools) with no page and no link,
so a user who turned one on was left to find where it shows. And the
Gateway page's one setting, Recent calls at a time, was a form under its
row in Plugins › Built-in, two pages from the calls it is about.

- pluginrt.Manifest gets Opens: the window page a built-in without a page
  of its own is used on. budget → gateway (keys' limits), groups →
  groups, rotation and warmups → providers (a provider's editor),
  middleware and tools → plugins. builtinJSON sends it; featGo links to
  that page by its sidebar name, as for a page plugin.
- A plugin with a page draws its settings there, not under its row
  (renderBuiltins). The Gateway page draws its schema under Recent calls
  (renderGatewayOwn), saves through /api/plugins/builtin as before, and
  ends with a row "Port, allowed addresses and model ids" that opens
  Settings › Network and sharing at the gateway's rows (4 languages).

Tests:
- TestBuiltinSaysWhereItsSettingsAre holds SetAt, Page and Opens per
  built-in.
- builtins.test.cjs: no form in Built-in, and each Opens row's link says
  its page's sidebar name. Its row reached by the wheel now counts the
  window's bottom too, and frees a switch under the view's floating To
  the bottom button by wheeling toward the window's middle: the rows grew
  with their links, and WebKit de 420 left Usage's switch under it.
- gateway-own-settings.test.cjs (new): the setting under the calls,
  translated, 20, picking 50 posts {id: gateway, config: {callsPage: 50}},
  the row opens Settings › Network at #portList flashed; every language,
  Chromium and WebKit, 1100 and 420, nothing past the window.
- builtin-places.test.cjs: Library's row now leads to Library.

Run at this tree (on origin/main e3f1efdaa), on mote:
- gofmt -l: nothing. go vet ./internal/gui ./internal/pluginrt
  ./plugins/..., GOOS=linux go vet -tags nogui, GOOS=windows go vet: ok.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translat' ./internal/gui
  ./internal/pluginrt ./plugins/...: ok.
- node --test builtins builtin-places websearch-places gateway-own-settings
  gateway-keys-off i18n-en-no-cjk: 272 pass, 0 fail (both engines).
- i18n-keys: "a plugin's words are its own" red, the same on a clean
  origin/main e3f1efdaa (#5332, #5327, #5482, #5426); fixed next.
Broken by hand: without budget's Opens, TestBuiltinSaysWhereItsSettingsAre
fails (want "gateway"); without the renderGatewayOwn call,
gateway-own-settings is 0 of 10 in Chromium.
Not tried: the real app; the whole GUI suite (next, behind suite.lock).
2026-11-09 20:12:30 +08:00
yetone cf24e59065 gui: the stats answer test builds Active's hours through JSON (#5806)
36ddd5761 made sessions.Active.Hours the unexported hours type, and
internal/gui's TestStatsAnswerWritesWhatEncodeDid still built it as
[]int64, so the package's tests didn't compile on main. The test now
reads its Active from JSON, as the cache gives it, so the hours still
go through MarshalJSON in both answers.

Run on mote at this head: go vet ./internal/gui/ ok;
go test -count=1 -run 'TestStatsAnswer|TestSameAnswer' ./internal/gui/ ok.
Not run: the full suite (follows after the push).

Fixes #5806
2026-11-09 19:57:10 +08:00
yetone 7000b23b88 gui: a reset's time is said by a formatter kept per language, not made each call (#5310)
resetClock and resetText called toLocaleTimeString/toLocaleDateString/
toLocaleString, which build a new Intl formatter on every call. The Usage
page says every account window's reset on each render, so 600 accounts
made thousands of formatters per render.

dateFmt(opts) in i18n.js keeps one Intl.DateTimeFormat per intlLang() and
options. resetText's past time gives toLocaleString's default
fields (year/month/day/hour/minute/second numeric) by name, which is
what toLocaleString uses when given no options.

Probe (mote, 600 accounts open, W=520, names wrapping, 8 renders,
median sync ms, before → after):
  WebKit   ~431 → ~377
  Chromium ~327 → ~279

Test: reset-clock-formats.test.cjs compares resetClock and resetText
with what the old toLocale*String code said word for word. It covers a
time every 5h from a week back to eight days ahead, in en, zh, zh-TW,
ja, de and then system (a language switch after the cache is warm),
Chromium and WebKit, in a Tokyo time zone with an en-GB system. 2/2
green.

Broken by hand: a cache key without the language is red in Chromium
(zh said "02/11/2026, 20:29:01" for "2026/11/2 20:29:01").

Run at this change on 74017e0b8 (mote): TestCoreScriptBudget ok. The
40 GUI files that say a reset time ("Resets", "Reset time",
"tomorrow", 重置) plus i18n-keys: 770 tests, 3 red. The reds are
codex-auto-reset webkit de 1100/420 (red the same at its base 40cfae5d3,
#4790) and i18n-keys 'a plugin's words are its own' (#5327 #5332 #5426
#5482).

Not tried: the other ~37 toLocale*String calls in app.js. They run once
per page or row, not once per account window.
2026-11-09 19:21:46 +08:00
yetone 7a2a05c7a3 routing: Accounts and keys keeps each provider's heading while it says the same
freefcw on X (11-09, v0.1.3373 and v0.1.3375): magpie at 32% CPU with
2,250 idle wakeups and its webviews at 80 to 223MB; lemonkillergame and
laincatx say the same of CPU and memory.

The Routing page draws Accounts and keys again each second while it is in
sight (countdown: its rests and resets count down). Each drawing made
every provider's heading anew, icon <img> included, and patch then kept
the old heading in the page. But an <img> asks for its picture as soon as
its src is set, in the page or not, and the app's icons go out no-cache
(revalidated), so every provider's icon was asked for again each second:
through the Wails asset server in the app (a read and a sha256 of the
file each time), and each a new SVG document in the webview (~0.6MB, #909).
Over `magpie web` on mote, a seeded HOME with five providers on Routing:
322 requests a minute, 155 of them icons every 30s; every other page asks
for 4 to 13 in 45s.

A heading is now kept per provider while its icon, name and routing mode
are the same, and a heading with its first row are a list of nodes, no
longer a box they were moved into: the move took a kept heading or keys
row out of the page each second, so patch never found it in place.

Measured on mote (M5 Pro, load 50 to 90 from other sessions), the
0.1.3377 build vs this one, `magpie web` in Playwright WebKit on
?view=routing, 60s, twice each:
- requests: 322 and 325 a minute -> 7 and 7 (icons: 31 each per 30s -> 0)
- magpie's CPU: 0.78% and 0.73% -> 0.32% and 0.32%
- magpie's RSS: 225-227MB both

Test: routing-acts-idle.test.cjs, in Chromium and WebKit, en, zh, zh-TW,
ja, de at 1100px and en at 420px: a resting key's countdown redraws the
list, and over 3.5s no icon is asked for again and each heading is the
node drawn before. 14/14 pass; with client.js before this change 0/14
(each heading is a new node). Its icon count alone passes on the old code
there, since page.route's replies are kept in the browser's memory cache;
the real server's requests are the numbers above.

Run on mote:
- every GUI file that opens Routing (181 files, both engines, at
  origin/main 9a00bfed1 + this): 3337 pass, 16 fail in 8 files. Run again
  alone, at this change and at origin/main ff7d84b9b: the same 11 fail in
  both (ctx-session-line, filed #5801; routing-context-fold #5586,
  routing-row-swap #3799, routing-story-shrinks #3954); provider-mask,
  routing-model-rest and usage-compact-counts pass alone in both.
- at the pushed head (on 74017e0b8): routing-acts-idle and routing-acts-calm
  36/36; at 193d171b6: routing-acts-idle, routing-acts-calm,
  routing-acts-compact pass; i18n-keys' "a plugin's words are its own" is
  red, the same at origin/main 0eac4e6aa (#5332, #5426, #5482).
- go test -tags nogui -run 'Budget|Size|Routing|Asset' ./internal/gui: ok.

Not run: the whole GUI suite (only the 181 Routing files) and the full Go
suite (no Go file changes). Not reproduced: freefcw's 32%; the heaviest
seeded HOME here idled at 0.3 to 1.7% and the live heavy-user instance on
the owner's Mac at 0.9%. In the real app on mote the Routing window idled
at 0.3% with no ticking (its window not in sight on a headless session),
so the app's own numbers before and after are not measured, only
`magpie web`'s.
2026-11-09 19:12:45 +08:00
yetone 74017e0b87 gui: a card of many accounts is laid out once a render, not once an account (#5310)
fitQuota stacks each window's counts and gives side-by-side names one
height. It ran group by group: clear the names' min-height, then read
their offsetTop. Every read after a write lays the card out again, so
one Usage render with N accounts in full laid the card out N times,
O(N²). With 600 accounts at 520px wide and the names wrapping (a long
window name), one render held WebKit's WebContent at 100% CPU: 1.7-2.3s
of script and 10-13s to the second frame after it. Chromium took
1.2-1.4s.

fitQuota now takes every group. It reads all the sizes first, then
writes the classes and clears the heights. It reads each name's row and
height in one pass, then sets the heights. packUsage's heights() passes
the card's groups in one call; the ResizeObserver path already passed a
set.

Probe (600 accounts, all open, W=520, wrapped names), on mote:
  WebKit:   0.5s sync, 0.7s to two frames (was 1.7-2.3s, 10-13s)
  Chromium: 0.45s (was 1.2-1.4s)
  Wide layout, both engines: 0.3-0.4s before and after.
Scrolling 600 accounts was smooth before and after (2 frames ~30ms).

Test: quota-fit-batched.test.cjs counts the layouts forced in one
render: a read of a layout getter while MutationObserver records are
pending. The count must be the same at 160 accounts as at 40 (+4 room
for a frame's observer). It also checks that every group was drawn, the
names' heights were written, and each group was evened. Chromium and
WebKit, en/zh/zh-TW/ja/de, 10/10 green.

Broken by hand: the test pointed at HEAD's app.js (MAGPIE_FIT_ASSETS)
is red 10/10: 243 forced layouts at 40 accounts, 963 at 160, both
engines.

Run (mote, load ~30; first at base 40cfae5d3 + this change):
- 161 GUI files that touch quota/usage/panel, both engines, every
  language they cover: 2832 tests, 34 red in 9 files.
- Those 9 files again, on this change and on base 40cfae5d3 alone: 25
  red with the change, 30 on base. Every red on the change is also red
  on base except provider-mask, which times out in a different language
  each run on both trees (#5109).
- The reds on base are filed: codex-auto-reset webkit de (#4790),
  mobile-web (#3952, #5013), tray-cell-click (#5215), usage-fold
  'most on one screen' (#4790, #3415), and panel-fold (#5796, filed now).
- i18n-keys 'a plugin's words are its own' is red (#5327, #5332,
  #5426, #5482).
- At the pushed head (this change on origin/main c056b7c8c):
  TestCoreScriptBudget ok. quota-fit-batched 10/10, and usage-agents-hide,
  usage-compact-counts, usage-fold, usage-ledger and usage-ledger-search
  run beside it: 32 red, the same 32 as at c056b7c8c alone
  (usage-agents-hide #2276 #3414, usage-ledger Requests #5048, usage-fold
  #4790 #3415).

Not tried: the real app with 600 real accounts. The fixture's accounts
are Claude windows with one long name. Another layer is not changed:
the first layout after the rebuild, resetClock's Intl formatters, and
building the DOM, ~45ms each at 600 accounts.
2026-11-09 19:08:52 +08:00
yetone c056b7c8c3 provider: a Responses provider's turns may go over the Responses WebSocket (#5781)
A provider the user added with an http(s) Responses address can now send
its Responses turns over the Responses WebSocket that magpie already
speaks to chatgpt.com (codexSocket), with `socket=auto|on|off`:

- off, or absent: today's behaviour exactly. Provider.Via hides any
  socket value an outer context carried, so such a provider never dials.
- auto: tries the socket, falls back to HTTP when the handshake is
  refused or the socket ends before the reply, and speaks HTTP to a host
  for 10 minutes once it refused the handshake (codexShun).
- on: the same fallback, but never shuns; the socket is tried each turn.

Provider.Via puts the provider's Responses host and path in the request's
context (withSocket); codexSocket's gate is provider.SocketTurn, which
takes a ChatGPT turn as before, or a POST to that host at
<Responses>/responses. The rest is the ChatGPT leg's: the kept socket and
its delta (codexKeepKey now also hashes the scheme, X-Api-Key and
Api-Key), the error frames, 1009 handling. A provider's reply with no
Content-Type is marked text/event-stream, since it is read as one.
Routing, keys, limits, usage and masking are unchanged: only the
transport under the request differs.

Set with `magpie provider set <id> socket=auto|on|off` (refused on a
provider with an account, no http(s) Responses address, or Vertex,
TakesSocket), saved in providers.json as "socket", shown by `provider
show`, and in the editor's Advanced as a WebSocket tick beside HTTP
version (ticked saves auto, keeps a CLI's on, unticked saves off; shown
only while the Responses address is http(s) and there is no account).
docs/subsystems/providers-accounts.md describes it.

app.js pays for its rows by three long comments cut to one line
(renderMove, the vendors' status pages, header rows): the core's scripts
are 478 bytes smaller than on 0eac4e6aa (1,533,069 of 1,533,802); no
budget raised.

Run on mote at this change on origin/main 0eac4e6aa (since then main
added a39b63e88 and 7cabf0da9, internal/sessions only):
- gofmt -l clean; go vet (darwin) of provider, gateway, cli, gui, clean.
- go test -tags nogui ./internal/gui ./internal/cli: ok;
  ./internal/provider -run TestSocket: ok.
- go test ./internal/gateway -run 'TestResponsesProvider|TestCodexSocket|
  TestCodexKept|TestCodexTurn|TestHTTP1|TestInsecureTLS': ok. The new
  tests use an httptest WebSocket upstream: a turn over the socket, a
  provider without the field never dialling (and one on the same host
  with it), a refused handshake shunned on auto and tried again on on, a
  socket closed before the first event going over HTTP, the kept
  socket's delta on the next turn, and the reply being a stream.
- node --test provider-socket (new; chromium and webkit, en zh zh-TW ja
  de, 1100 and 420 wide), provider-http1, provider-insecure-tls,
  i18n-en-no-cjk: pass. i18n-keys' "a plugin's words are its own" is
  red for three words in files this doesn't touch, filed as #5327/#5332,
  #5426 and #5482.
- One rebase earlier (on 2a48974e8, the same change): GOOS=linux (nogui)
  and GOOS=windows go vet of the four packages clean, and the whole of
  ./internal/provider ok.
- Broken by hand, each red then green: SocketTurn codex-only (all six
  gateway tests red); a path-suffix gate in place of the context
  (WithoutSocketNeverDials, TestSocketTurn red); the never-shun case
  removed (RefusedOnTriesAgain red); the Content-Type line removed
  (ReplyIsAStream red).

Not tried: a real Responses upstream speaking the WebSocket (no network
in tests); the keep key's X-Api-Key/Api-Key separation has no test of
its own; the editor in the Linux app's WebKitGTK; the full suite (run
after the push).

Reported-by: matrix0487 (Discord)
Reported-by: faithleysath (#5781)
2026-11-09 18:57:29 +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 0eac4e6aa8 gui: the core is back in its script budget, the account-cap comments cut (#5795)
40cbdaa7e (a window's cap at an amount of its unit) added ~1.1KB to
app.js and, with what landed beside it, took the core's scripts to
1,535,556 bytes, over coreScriptBudget's 1,533,802, so
TestCoreScriptBudget was red on main.

No raise. The comments of the account rows, names and caps in app.js
(renameIn, accountNameButton, windowCapOf, capHeldOf, directNote,
windowCapMeter, the lanes pill, refreshLanes and a few beside them) are
cut down or out, 2,009 bytes: the core is 1,533,547 now. Only comment
lines change. The budget's comment records it.

Run at this head (origin/main 4da0aa027 plus this commit), on mote:
- go test ./internal/gui -run TestCoreScriptBudget -count=1: ok
- node --check app.js: ok; gofmt -l internal/gui: clean
- grep of the Go and GUI tests for the cut comments' text: no test
  reads them
Broken by hand: none needed; the sum of the core's scripts at
4da0aa027, worked out the way the test does, is 1,535,556, over.
Not tried: the GUI suite, since no code line changes.
2026-11-09 18:40:30 +08:00
yetone 2b8ad61468 routing: a group's header counts its members on, not who one request was held to
adorable_piglet on Discord: the group magpie found for GPT-6 Astra, In
order, three of its five members on (two on providers switched off),
read "GPT-6 Astra · routing group · 1 on" over a Codex request answered
by one member. The header counted the request's order, who that one
request was weighed among. A conversation held to one member (native
compaction, Strict, a sealed task, a key's models) has an order of one,
so the group read as having one on. It now counts the route's
group.members (GroupRef: the group's ready members as the request
came); why the request went to one alone stays the first line's to say.
Routing itself was not at fault: a gateway repro with five members, two
providers off, routed In order over all three on.

Run on origin/main 40cfae5d3 with this change (rebased onto 4da0aa027,
client.js untouched between):
- routing-group-on-count.test.cjs (new; chromium and webkit; en zh
  zh-TW ja de) on mote: 10/10. With the client.js change taken out by
  hand: 10/10 red, " · 路由组 · 启用 1 个", the reporter's text.
- No Go change: gofmt and go vet have nothing new.
Not run before this push: the 182 routing-*, panel-routing* and
i18n-keys GUI files (running on mote now, reds to be filed).

Reported-by: adorable_piglet (Discord)
2026-11-09 18:40:10 +08:00
yetone b62117287b gui: a moved plugin's first question offers its other ways, the API key among them
mahiro233 on Discord (v0.1.3372, Kiro plugin 0.1.34): Kiro's account
sheet asked "Choose a sign-in method" with three choices and Cancel, and
offered no API key. The plugin has one (its third way, "Kiro API key
(ksk_…)"), but a moved subscription opens its plugin's first way at once
(#777), and when that way asks a question first, as Kiro's does since
plugin 0.1.21, the question had no way to the others: "Other ways to sign
in…" and "Use an API key instead" are on the waiting box only, which the
question comes before. Kiro CLI's or IDE's sign-in was out of reach too.

The first question of a moved subscription's way, when the plugin has
other ways, now has "Other ways to sign in…" (already in every language),
which shows the way picker, as the waiting box's does. A later question
(Kiro's Start URL) doesn't: the user chose that way already.

Test: plugin-ask-ways.test.cjs, en and zh, Chromium and WebKit: the
question's choices and hint, the link, the picker with the key way, the
key field titled by its label, nothing signed in before a key, no link on
the Start URL question, and the plugin's words in Chinese where it gives
them.

Run on mote at the pushed head, Chromium and WebKit: plugin-ask-ways,
plugin-other-ways, -moved-signin, -key-hint, -password-prompt, -signin,
-keyless-signin, signin-paste-plugin, deprecated-subscriptions,
i18n-keys and i18n-en-no-cjk, 49 of 50 each; the one red is i18n-keys'
"a plugin's words are its own", the same 3 words on origin/main
2a48974e8 (#5327, #5426, #5482). TestCoreScriptBudget is red at both, as
below. Broken by hand: with origin/main's app.js,
plugin-ask-ways is red (en waits for the link, zh for the Chinese
question). Not tried: a real Kiro key (none entered anywhere).

Core script budget: the two commits add 1,284 bytes to app.js, paid for
by cutting the Add sheet's comments on retired built-ins (Cursor, Grok,
WorkBuddy, Command Code, Qoder, Devin, Zed, Factory, MiMo, Kiro) and
inLang's to one line: the core is 1,535,556, 260 under origin/main's
1,535,816, no raise. Main stays over 1,533,802 from 40cbdaa7e (#5795).
2026-11-09 18:36:07 +08:00
yetone 5611e7274e plugin: a plugin's sign-in words show in the window's language when it gives them
mahiro233 on Discord (v0.1.3372, Kiro plugin 0.1.34): in a Chinese
window, the Kiro sheet's "Choose a sign-in method" and its choices read in
English, while the rest of the sheet is Chinese. magpie showed a plugin's
method labels, questions and choices only as the plugin wrote them, and no
plugin had a way to give them in another language.

A plugin may now give them by language, magpie's own fields beside
OpenCode's English, as a page gives its titles: a method's labels, a
question's messages, a select option's labels and hints, each
{"zh": "…", "zh-TW": "…", "ja": "…", "de": "…"}. host.js passes them on
(byLang: string values, codes of 1-16 characters, at most 16, empty ones
left out); plugin.Method and plugin.Prompt carry them; the app shows the
window's language, then its first part, else the English (inLang), on the
way picker, a question, its choices and their hints, a key's field and
the site step's other ways. `magpie plugin login` stays English. Kiro
0.1.35 gives its words in all four (plugins 588b3611).

Tests: TestPluginSignInWordsByLanguage (a plugin's words reach magpie as
given, bad ones left out, none for a plugin that gives none);
TestPluginOwnIconAndKeyHint compares a Method with reflect.DeepEqual now
that it holds a map. The GUI side is checked by plugin-ask-ways.test.cjs
in the next commit.

Run on mote at this tree: gofmt -l empty; go vet ./internal/plugin
./internal/provider ./internal/gui (darwin), linux -tags nogui, windows:
ok; go test -count=1 ./internal/plugin ./internal/provider ./internal/cli:
ok. Broken by hand: with origin/main's host.js the new test fails (no
labels, messages or hints reach magpie). Not tried: a real Kiro sign-in
(no keys or passwords entered anywhere); the full suite is queued on mote
under suite.lock after the push.
2026-11-09 18:29:55 +08:00
yetone 2a48974e82 gui: a redraw with no copy of the pressed element marks the focus it gives, as before 9dd7aabca
9dd7aabca stopped openModal's focus from marking the dialog's hold on every
redraw, so a refresh pressed among alike rows stays held. In WebKit, which
doesn't focus a button on click, that left the hold on a button the redraw
took away (Codex's Sign out, then the ask's Cancel). holdModal then fell
back to the focused element with the old element's depth (modalHold.y),
moved the dialog by the difference, and its ResizeObserver reported a loop:
codex-signout "webkit en: Codex's only account signs out, asked first" red
3 of 3, green 3 of 3 at its parent a6a99717e.

Now the focus given back skips the mark only when there is a copy of the
pressed element to hold (the element kept through the redraw, or the
focused one of several alike); otherwise it marks it as before.
Found by serving app.js with each part of 9dd7aabca turned off in turn:
only the refocus guard took the red away.

Core: 1,533,732 (budget 1,533,802), no raise.

Run at this head, rebased on b8270850d (wsl-run, Linux, Playwright 1.62.0):
- codex-signout, account-refresh-holds and builtin-places (main's new
  GUI file): 110 of 110 ok.
- go test -tags nogui ./internal/gui -run 'Budget|I18n|Dates': ok. The
  whole package hit go test's 10m default on WSL; a 30m run is going.
Before the rebase, on a6a99717e:
- codex-signout.test.cjs, 3 times: 24 of 24 ok each time
- account-refresh-holds.test.cjs and click-scroll.test.cjs: account-refresh-holds 4 of 4 ok;
  click-scroll ok but for its WebKit late-heard wheel (#4385)
- go test -tags nogui ./internal/gui -run 'Budget|I18n|Dates': ok
After 9dd7aabca, the rest of the 203 GUI files that reach #modal ran to a
3600s cap; every other red there is red the same at a6a99717e and filed:
model-chip-steady #4388, i18n-keys #5332, icon-url #4688,
inner-scroll-contain #4689, menu-input-scroll #3402, mcp-hub-direct
#4701, ledger-hscroll (red 2 of 3 at a6a99717e too) #4400, click-scroll's
late-heard wheel #4385.
Not tried: the real Wails app.
2026-11-09 18:26:15 +08:00
yetone 40cbdaa7e8 provider: an account's window can be capped at a fixed amount of its unit
A window magpie reads with a total and a unit (a day's 1000 credits, a
plan's requests) can now be capped at an amount of that unit, not only
a share: 9won_25273 asked to stop an account at 300 of its day's credits.

- AccountWindowAmounts keeps it per account and window (capId). An
  amount and a window's own share replace each other.
- WindowCaps.limitShare turns it into a share of the total for the mark
  and NearCap. CapHeld and capReached hold the account once the window's
  count reaches the amount (past), and rest it as the percentage cap
  does: the next account takes the request. cappedError and the trace
  say "has used 300 credits ... past its cap of 300".
- A reading with no total ignores the amount; the account's share
  applies.
- GUI: the window meter's menu has one more item, Amount..., typed in
  place (provider/windowcap with amount). It shows only on a window
  with a unit and total. Strings in zh, zh-TW, ja, de.
- CLI: magpie provider account-cap <id> <account> --window <name>
  --amount <n|off>.

Usage outside magpie counts: every cap reads the vendor's own count, so
what the account spent in the vendor's app or on another machine counts
from the next reading on. magpie can only hold back its own requests.

Run, at this head on Linux (wsl-run, magpie-desktop):
- gofmt -l: clean; go vet ./... for linux (-tags nogui) and windows: ok (darwin
  vet needs cgo, so it runs with the full suite on mote afterwards)
- go test -run 'Lang|ToolLoop|LoopGuard|Cap|Amount' ./internal/gateway
  ./internal/provider ./internal/cli: ok (TestWindowAmountCapHeld,
  TestSetWindowAmount, TestWindowAmountHoldsTheAccount, the CLI cases)
- GUI window-cap, window-cap-pool, account-cap in chromium and webkit,
  420 and 1100 wide, en zh zh-TW ja de: 78 of 78 in each engine. An
  earlier webkit run lost the amount test's page once ("Target page,
  context or browser has been closed"); it passed in 2 more full-file
  runs and 60 of 60 alone
- i18n-keys: only "a plugin's words are its own" red, words that aren't
  this change's (#5332, #5426, #5482)
Broken by hand: limitShare ignoring amounts (of < 0): TestWindowAmountCapHeld
and TestWindowAmountHoldsTheAccount go red.
Not tried: the full go test ./... at this head (queued on mote, runs
after); a real account at an amount cap.
iFlytek: 9won's 讯飞 overshoot isn't covered. Loomy's daily window sends
used as a count and amount as what is left (plugins#889); AStudio's
wallets tell a balance only, which no cap can hold (#5770).

Reported-by: 9won_25273 (Discord)
2026-11-09 18:19:02 +08:00
yetone f5f68b4335 routing: with routing groups switched off, their sidebar tab goes
yyddbds (Discord) turned Routing groups off in Plugins > Built-in and
the sidebar still showed its tab. The tab was tagged with the routing
plugin only (data-feature="routing"), so only switching Routing off hid
it. It is now tagged "routing groups", like Routing's own "Routing
groups >" button and the two "Make a routing group" buttons.

The page also holds each provider's accounts and keys (pools), which
stay editable with groups off. So with groups off:
- ?view=groups, or a page open when groups are switched off, opens
  Routing (offView in app.js), not Agents;
- the groups' section moves under Routing's requests, with the "turn on
  routing groups" note and the pools; turning them on opens the groups
  page again and moves the section back.
Every other sidebar tab (sessions, library, routing, gateway, usage,
masking) was already tagged with its own plugin; only groups was wrong.

Run, on mote (macOS 27):
- routing-groups-off.test.cjs (rewritten: 1200, 900 and 420px, both
  engines, every language): 12 of 18 red on the old code, 18 of 18
  green on this one.
- routing-groups-off, builtins, sidebar at the rebased head 3930a3917:
  green in Chromium and WebKit.
- Whole GUI suite at the old base c9d253e4a: 22,447 of 22,724 pass, 277
  red in 46 files. Those 46 files rerun at the rebased head (on
  bceeabd93): 258 red, every one in an open issue filed before this
  change (#5475 umbrella; #5392 routing-intent-entry, #5332 i18n-keys,
  #5232 provider-fetch-again, #3952 mobile-web, #4541 page-width-steady,
  #4720/#4721 vertex-editor, #5262 zero-priced-free, #4388
  model-chip-steady, #4644 account-weight, #3799 routing-row-swap,
  #3954 routing-story-shrinks, #5586 routing-context-fold, #3479
  header-centre, #4787/#5425 nav-timeout, #5215 tray-cell-click, #3415
  usage-fold, #2448 s3-sync, #4624 omarchy, #5048 usage-ledger, #4320
  recovered-file). None is in a test of the nav or the groups page.
- go vet ./..., GOOS=linux/windows go vet ./internal/gui and gofmt -l
  at the old base: clean (no Go file changes).
- TestCoreScriptBudget, worked out by hand at the pushed head (on
  b8270850d): the core's scripts are 1,533,791 of 1,533,802. The 526
  bytes this adds to app.js would be 351 over, so the comments it adds
  are cut to one line. No raise. node --check app.js passes.

Not tried: the real app; the GUI files rerun after the last rebase
(b8270850d; the only change since is comments in app.js); the panel's new-group path with groups off;
the same 46 files on a clean bceeabd93 (queued behind the suite lock
for over an hour; the reds above all predate this change).

Reported-by: yyddbds (Discord)
2026-11-09 18:11:53 +08:00
yetone ff7d84b9b2 gui: a built-in's switch, settings and page lead to each other (netube99 on X)
netube99 (X, 2119721422918742222): masking is switched on in Plugins ›
Built-in, set in Settings › Privacy and seen in Insights › Masking, and
none of the three leads to the others. Web search had the same split.
One pattern for every built-in whose switch, settings and page are apart:

- pluginrt.Manifest.SetAt ("privacy #redactList") says where Settings has
  its settings: redact, search, gateway and otel set one. builtins.go
  sends setAt and page (its nav.page Part).
- Its Built-in row (featGo): "Settings › <tab>" and, while on, its page
  ("Masking"). No settings link while off when those settings hide with
  the plugin (Observability).
- Its settings, while off (featOff): a first row "Off in Plugins ›
  Built-in", what being off means, and Turn on. Privacy and Web search
  use it; search's own off row went.
- Insights › Masking's head: "Settings › Privacy", unless Turn off
  already goes there. At 600px and under its buttons wrap below the title.
- docs/subsystems/plugin-runtime.md documents SetAt.

Proposal for the owner, not built: give each feature one home with its
switch, settings and page together. This commit only links the three.

Core budget: no raise. +~1.9KB of code is paid for by shortening six
app.js comments (logo mask shelf, copy, sidebar, account models,
fitSend, the hold room).

Run on mote at fe672ce69's tree (origin/main 2b22425b4 + these two):
- go vet ./internal/gui ./internal/pluginrt ./plugins/...;
  GOOS=linux -tags nogui and GOOS=windows vet of gui and plugins: clean.
  gofmt -l: clean.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translated'
  ./internal/gui ./internal/pluginrt: ok (budget passes after the cuts).
- node --test builtin-places, websearch-places, builtins, i18n-keys,
  i18n-en-no-cjk: 235 pass, 1 fail. The fail is i18n-keys "a plugin's
  words are its own" on plugins/usage "View routing", red on origin/main
  too (#5332, #5426, #5482).
  builtin-places and websearch-places cover en, zh, zh-TW, ja and de in
  Chromium and WebKit, at 1100 and 420 wide, nothing past the edge.
Broken by hand: featGo and featOff made to return at once, and 40
builtin-places subtests went red (42 fails with their parents). Round 1's
files reverted made websearch-places 102 of 142 red.

Queued, not waited for (owner: push each verified fix at once): the full
`go test -timeout 45m ./...` then `make test-ui` on mote behind
~/suite.lock; log at
~/workspace/projects/magpie-wt/websearch-surfaces-scratch/full.log. Any
red gets an issue.
Not tried: the real app on Linux/Windows; warm-ups have no SetAt (their
settings moved into the provider editor).
2026-11-09 17:58:11 +08:00
yetone f2ac9ae357 gui: web search's three places say what each does and point to the others (netube99 on X)
netube99 (X, 2119707804370084128) couldn't tell how web search is set up:
Plugins › Built-in has a Web search switch, the Library offers search
MCPs, and Settings › Models has Web search, and none of them names the
others.

- Plugins › Built-in, Web search: while on, the row says what it
  searches with ("Searches with Tavily → Brave"), or "Nothing to search
  with yet" in the warning colour (builtins.go searchesNow, featWho.search).
- Settings › Models › Web search: off, its first row says so and turns
  it on.
- Library, a search MCP's card: says agents call it with its own key,
  and links to Settings for magpie's own search.

Tests for this commit (TestBuiltinSearchSaysWhatSearches,
websearch-places.test.cjs) come in the next commit, which generalises
the off row and the links. The record for both is there.
2026-11-09 17:58:11 +08:00
yetone 9dd7aabca8 gui: an account's refresh stays where it was pressed, and a sheet held low rises as it scrolls
墨雨藏锋 on Discord (#feedback, 11-09): pressing an account's quota refresh
in a plugin provider's sheet (MonkeyCode) moved the view down, and the
accounts showed only a few rows while the window had room.

The jump: every account's refresh shares the aria-label "Refresh this
card". openModal gave a redraw's focus back to the first element with that
label, which is the first account's, and the focusin listener then marked
the hold on that button. WebKit's fallback focus did the same. So the row
pressed was let go, and it moved with the rows above it as they grew
(186px in the test). And since quotaRefresh keeps the same button across
redraws, holdModal never took it as a copy, and cap() never scrolled the
list back to it.
Now openModal finds the focused element by its place among elements
with that label. A redraw giving focus back does not mark a new hold
(modalRefocus). The held element (or its redrawn copy) is handed to
holdModal (modalHold.copy), so it stands in and the list is scrolled to
hold it.

The short list: there is no fixed cap. A sheet pressed while short and
centred keeps its top (calc(100% - off)) when its content then grows to
the window's foot, so its one scroll box shows a few rows. Now scrolling
that box first lifts the sheet into the room above, its foot staying,
until it has what it needs (modalClimb); then the box scrolls. Nothing
moves on a click, and no CSS or layout changed.

Core budget: app.js 1,310,953, core 1,533,711 (budget 1,533,802), paid
for by comments cut in startImport, openProtoMenu, hold(), the click
handler and navMorph; no raise.

Run on 4314f4b77 plus this change, through wsl-run (Linux, Playwright
1.62.0); it is pushed on a6a99717e, whose two commits since touch no GUI
file:
- account-refresh-holds.test.cjs (new): Chromium and WebKit, 1000/560/390
  wide, en zh zh-TW ja de: 4 of 4 ok.
- click-scroll.test.cjs: ok in Chromium, and one WebKit subtest red, the same
  on origin/main a6a99717e run alone: "a wheel the page hears of after
  its scroll", #4385
- go test -tags nogui ./internal/gui -run 'Budget|I18n|Dates': ok
Red on the old code: the new test against app.js at c7ebb6f8d fails 4 of
4: "the pressed refresh moved 186.875px" and "the sheet rose as its
accounts scrolled (96 → 96)", in both engines.
A run of the 203 GUI files that reach #modal or hold/scroll/focus/refresh
is still going and is pushed without, per the owner's ship-at-once rule;
its reds get issues.
Not tried: the real Wails app on macOS, and mote (its suite queue was
long). The whole GUI suite (1298 files) was not run.

Reported-by: 墨雨藏锋 (Discord)
2026-11-09 17:35:44 +08:00
yetoneandsevtdy 136178803b gui: Escape closes a plugin's details dialog on Discover (#3779)
On Plugins › Discover, Escape left a plugin's details dialog open and
only showed Install's focus ring. detail() opened #modal without
setting confirmAsk, unlike every other dialog that borrows #modal
outside Providers, so Escape reached only the Providers page's
handler, which closes nothing there.

detail() now sets confirmAsk and its Close goes through
closeConfirmAsk. show() clears confirmAsk when leaving a page closes
the modal: the dialog's Sign in goes to Providers through show(), and
a leftover confirmAsk would take the next Escape there. This is
sevtdy's patch from the issue.

Side effect: cfgblocked.js steps back to the dialog under a Repair
only when confirmAsk is unset, so a Repair opened over the plugin
details no longer goes back to them, the same as over the other
confirmAsk dialogs.

New test: plugin-detail-escape.test.cjs (en, zh): Escape closes the
details twice, Close still closes them, and after Install, then Sign
in, then Providers, Escape closes the add sheet.

Run (mote, via suite.lock):
- plugin-detail-escape.test.cjs: chromium 3/3, webkit 3/3
Broken by hand:
- plugins.js and app.js at the base: red in both engines (the first
  Escape leaves the dialog open)
- only show()'s clear taken out: red in both engines (after Sign in,
  Escape on Providers leaves the add sheet open)
Wider GUI run (every plugin*, modal-*, i18n-keys, update-wait and the
files testing Escape on #modal: 114 files, both engines): running at
push time; any red gets its own issue.
Not tried: the real app (Wails webview) by hand.

Reported-by: sevtdy <16433683+sevtdy@users.noreply.github.com>
Co-authored-by: sevtdy <16433683+sevtdy@users.noreply.github.com>
2026-11-09 17:21:30 +08:00
yetone b475004d52 library: Pi's extensions and packages, switched and copied between Pis
leokon3 runs Pi on Windows and in WSL and asked for magpie's Library to
manage Pi's extensions and packages. A new "Pi packages" tab in the
Library lists each Pi here (this computer's and each WSL distro's), with
the extensions and packages it loads, read by Pi's own rules
(@earendil-works/pi-coding-agent 1.4.0). Each has a switch, written as
`pi config` writes it, and a "Copy to…" menu for the other running Pis.

- A package is copied as its settings.json entry; Pi installs it itself
  when it next starts. node_modules is never copied. A local package, and
  one the other Pi already has by Pi's identity (npm name, git host/path),
  is refused.
- An extension file or folder is copied as files, without node_modules,
  .git or symlinks, never over one of the same name. The page says to run
  npm install there when it has dependencies.
- A package that already picks some parts (filtered in `pi config`) shows
  its switch disabled. A settings.json that can't be parsed lists nothing
  and is never written; a stopped distro is never started; every write is
  backed up first.
- GET/POST /api/library/pi, POST /api/library/pi/copy (notYet in the CLI
  parity list, stage 3: the library).

Run at 29d63e2dd (this tree on origin/main c7ebb6f8d; rebased after onto
608c1543e, which changes only internal/gateway), on mote:
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
  internal/library and internal/gui: ok.
- go test -tags nogui ./internal/library ./internal/gui ./internal/cli:
  ok, ok, ok.
- A real pi 1.4.0 (npm) in a sandbox HOME and PI_CODING_AGENT_DIR, through
  an uncommitted pireal test: pi -p loads hello.ts (a marker file), the
  switch turns it off (no marker) and on again; a todo folder copied from
  a second Pi's dir is loaded by the real pi; npm:pi-web-access@0.47.0
  copied as a settings entry was installed by pi itself into
  <agentDir>/npm/node_modules and read back as installed v0.47.0; switched
  off, `pi list` still lists it and magpie reads it off.
- GUI, 70 files (library-*, i18n-*, gui-* and the Library's neighbours),
  both engines: 1503 of 1515 pass. The 12 reds are the same on origin/main
  c7ebb6f8d: page-width-steady's 11 (run there alone, 11 of 20 red; #5013)
  and i18n-keys "a plugin's words are its own" for "Use the library's",
  "No session ID" and "View routing" (#5482, #5426, #5332).
  library-pi-extensions runs en, zh, zh-TW, ja and de at 980 and 380px.
On Windows (win-run): go vet with and without the pireal tag ok; go test
-run TestPi ./internal/library ok.

Broken by hand: the first run named the tab "Pi extensions", which a
comment in internal/provider/discovery.go says too, and i18n-keys went
red for it; library-loading went red for the new tab next to RTK while a
Pi is here; and TestEveryRouteHasACommandOrIsNamed went red for the three
routes. All three were fixed and pass in the run above.

Not tried: a real copy between a WSL Pi and the Windows Pi (the WSL side
is covered by the unit tests' fake distro only), the full go test ./...,
and the whole GUI suite.

Reported-by: leokon3 (Discord)
2026-11-09 16:33:28 +08:00
yetone c7ebb6f8d9 settings: Video generation picks the model Magpie Image makes videos with
The same Discord (#feedback) user: a custom provider's video model still
couldn't be chosen. A custom provider's video model was already found
(seedance, kling, veo, wan, hailuo ids by name, or marked by hand with
right-click › Makes › Video model, #1399), but generate_video always used
AutoVideomaker's pick, the first video model of the first provider, with
nowhere to choose another, as Settings › Images does for images.

settings.VideoGen (provider/model or a routing group) is now the model a
request that names none makes its video with, while it resolves; else
AutoVideomaker's, as before. Image generation turned off turns video off
with it, as before. Settings › Models › Images gets a Video generation
row under Image generation: Automatic (naming the automatic pick) and
every model Magpie Image can make videos with. A pick that no longer
makes videos (provider gone or off, model unmarked) says so and the
automatic one is used in its place; the settings API refuses a model
that makes none, and keeps the pick when a save doesn't send it.

The row is drawn by videogen.js, imported when Settings draws Image
generation, with one call in app.js: drawn in app.js it put the core
scripts 616 bytes over TestCoreScriptBudget (1,534,418 > 1,533,802, found
by the first full run), and the budget is not raised.

Run on mote:
- At this change on bceeabd93 (rebased onto c630d9a29, which changes
  only the gateway key page): gofmt -l clean; GOOS=windows go vet and
  GOOS=linux go vet -tags nogui of the changed packages: ok. go test -run
  'Budget|VideoGen|Videomaker|TestSettingsSave|TestKeysAreWhatTheSaveWrites'
  in settings, settingsapi, gateway, gui: ok. GUI: video-gen-pick
  (32 subtests: chromium and webkit; en, zh, zh-TW, ja, de at 1100px, en
  and zh at 400px), old-webkit, i18n-en-no-cjk and the six image/Settings
  files (image-timeout-setting, images-codex-one, images-library-way,
  images-missing, image-models-hide, image-mcp): 220 of 220 ok.
- At 95a3fa3e0 (the change before the videogen.js move and the rebase):
  go test -timeout 45m ./internal/settings ./internal/settingsapi
  ./internal/gateway ./internal/gui: ok except TestCoreScriptBudget
  (fixed above). i18n-keys at 4394ea1b9: only the known plugin-words red
  (#5332).
- Not run at this head: the whole of those four packages and the 183 GUI
  files a Settings change reaches; the suite lock on mote was an hour
  deep in other sessions' suites.

Broken by hand, each red:
- videomaker ignoring VideoGen: TestVideoGenPicksAMarkedModel.
- settingsapi not keeping a pick a save doesn't send:
  TestVideoGenCheckedAndKept.
- No Video generation row: video-gen-pick.test.cjs, 30 of 32.
- videoGen left out of the Settings page's prefsKeep:
  TestSettingsSaveKeepsWhatItDoesNotSend ("VideoGen: not sent by the
  Settings page"), found before it was added.

Not tried: a real video generation with a custom provider's model (the
gateway tests hold the vendor's replies).
2026-11-09 14:25:55 +08:00
yetone c630d9a29c gateway: the key page's Claude Code setup keeps each tier on its own family
The /me page's Claude Code tab wrote the picked model into
ANTHROPIC_MODEL and into ANTHROPIC_DEFAULT_OPUS_MODEL, _SONNET_ and
_HAIKU_ alike, so picking Opus sent every Haiku background call to Opus
too (and picking a GPT model made "haiku" a GPT model).

The pick now sets only ANTHROPIC_MODEL. /v1/magpie/me returns `tiers`,
built by keyPageTiers from the models this key may use: for opus,
sonnet and haiku, the newest model of that family (claudeTier and
claudeVersionOf; routing groups and fable are skipped). A tier the key
has no model for is left out of the snippet, so Claude Code keeps its
own default for it.

Siblings: the agent writer (internal/agent/claude.go) has its own tier
design (tiers follow the main model, haiku to the provider's Haiku, the
user's own tiers kept) and writes the user's real config; it is a
different situation and is left as is. OpenMausBot's snippet writes
only ANTHROPIC_MODEL.

Run (mote, via suite.lock):
- go test -count=1 -run KeyPage ./internal/gateway/: ok
- GUI key-page.test.cjs: chromium 13/13, webkit 13/13
- gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., and go build for darwin, linux (nogui) and
  windows: ok
Broken by hand:
- old keypage.html: the new GUI test is red in both engines
  (ANTHROPIC_DEFAULT_HAIKU_MODEL 'claude/claude-opus-5', want
  'claude/claude-haiku-4-5')
- keyInfo without keyPageTiers: TestKeyPageTiersAreTheirFamilys red
  ("tiers map[]")
Full suite (go test -tags nogui -timeout 45m ./...): queued behind
other sessions on suite.lock at push time; its result goes on the
follow-up, with an issue for any red.
Not tried: a real Claude Code against the page's snippet, and the
gateway binary in a sandbox HOME.

Reported-by: strinah (Discord)
2026-11-09 14:22:05 +08:00
yetone bceeabd93a gui: a subscription's warm-up, check-in and resets are in its provider's editor
The owner, 11-07: "这些配置难道不是应该在对应的Provider那个弹窗里面吗?为什么会散落在Settings里?"

Settings › Allowances no longer holds Codex's auto-use resets and how
early before one expires, Codex's and Claude's warm-ups, or the daily
check-in of WorkBuddy, Trae CN, MiniMax, Qoder and the plugins that check
in themselves. Each is in its own provider's editor (PROV_PREFS: the lists
move from a hidden holder into the editor's .prov-prefs box and back).
Settings' search still finds them, each a row whose Open goes to the
editor. Task-done alerts stay in Settings. "Codex: auto-use resets" and
"Codex: how early before one expires" lose their "Codex:" in the editor.

In the editor a press inside a part that redraws moved the page: the
modal hold moved the dialog, which can't move once it meets the window's
edge, and lost a pressed element a redraw replaced. The hold now scrolls
the editor's body by what is left, and finds the replacement by its path
or by tag, class and text under its id'd ancestor. In a browser the
editor's body keeps its bar's room, as the app's already did: WebKit kept
the grid's columns from before a bar that came with a grown field, and
the editor scrolled 10px sideways.

Budget: app.js grew with the editor's parts; paid for by comments cut
(curlOf, scrollCloses, unrollSheet, quotaRange, ledGroupSpeed, the
Settings tabs, the warm-up and fold notes), no raise.

Run at this head (704fd85f3 before this message, on origin/main):
- mote: go test -count=1 ./internal/gui/ ok (TestCoreScriptBudget
  included); go vet ./..., GOOS=windows go vet ./... and GOOS=linux go vet
  -tags nogui ./... clean.
- mote: settings-groups and i18n-keys GUI files. i18n-keys' "a plugin's
  words are its own" fails the same on origin/main (#5332, #5327, #5482).
- WSL, both engines, the files this can reach, mine vs origin/main
  8544d5fdb: before the rebase, settings-groups was the one red only here
  (fixed: it now asserts the pressed field stays under the pointer). The
  nine files of account, Codex and editor tests rerun at load ~60 fail on
  both sides with WebKit "access control checks" page errors and measured
  sizes; the sets differ by which language/width hit the load, none by a
  cause in this change. editor-advanced-align is red on main too.
- Broken by hand: the hold following the pressed element itself
  (models-fold and names-fold moved +402px), and updating modalHold.y before
  the cap (provider-remove kept the dialog at 5.89px); both reverted.
Not run: the whole GUI suite to the end (stopped after ~4500 tests at
load 61 on WSL; mote dropped ssh mid-run).
2026-11-09 13:20:30 +08:00
yetone c81065ca72 providers: System One for a custom provider and Ark's pay as you go
A user on Discord (#feedback) found no System One endpoint under a custom
provider's More endpoints (OpenAI Responses), no System One choice in its
Model settings, and on the Volcengine Ark page neither an endpoint nor any
model a routing group could ask as its classifier.

System One is asked at POST …/systemone under a provider's Decide base;
a model is offered as a group's classifier only when its provider has
one. Two causes:

- A custom provider kept a Decide URL only when its API was "System One
  base URL". With a Responses or chat URL there was no field for it, and
  Save sent "" for one the provider didn't have yet. More endpoints now
  has "System One URL" for any API, saved as typed.
- Ark's pay as you go answers System One on the same key at
  ark.<region>.volces.com/api/v1, but a provider asked at …/api/v3 (the
  preset's or a custom one, chat completions or Responses) had no Decide
  unless the user knew to type it. normalize now sets it (arkSystemOne);
  a URL the user gave is kept. The Coding and Agent Plans answer System
  One 404, so they get none, and decideKeys leaves out a key whose plan
  has none (a Coding Plan key beside a pay-as-you-go one). Ark's one
  decision model is offered whatever chat models are picked, as
  Bailian's is (OfferedDeciders).

Run on mote at this head's tree (65aacb8f8, on e0f6eda64):
- gofmt -l clean; GOOS=windows go vet and GOOS=linux go vet -tags nogui
  of internal/provider, internal/gateway, internal/gui: ok.
- go test -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui: ok (provider 136s, gateway 849s, gui 131s).
- GUI: custom-systemone-url.test.cjs (chromium and webkit; en, zh,
  zh-TW, ja, de; 1200px and 420px), i18n-en-no-cjk, i18n-keys,
  editor-advanced-align: ok but i18n-keys' "a plugin's words are its
  own", red on main for three plugin words Go files also say (#5332,
  #5426, #5482). Earlier, at c9d253e4a, 30 GUI files a provider editor
  change reaches: the same red, and editor-advanced-align's two whole-run
  reds under load 670 (#4615), green alone and in the run above.

- Rebased onto 77076eef4 (four commits: a group editor's Advanced,
  Remote magpie cards, npm updates on Windows; none in these files' code
  paths): gofmt, both vets, go test -run 'Ark|Decide|Decider|Classif|
  SystemOne' of the three packages, custom-systemone-url and
  i18n-en-no-cjk: ok.

Broken by hand, each red:
- arkSystemOne returning "": TestArkPayAsYouGoDecides and
  TestArkDecisionSkipsPlanKeys.
- OfferedDeciders without the bailianApart exemption:
  TestArkPayAsYouGoDecides (the providers with chat models picked lose
  their classifier).
- decideKeys without the Decides filter: TestArkDecisionSkipsPlanKeys,
  "doubao-seed-2.1-lite asked with: [k-api … k-coding]".
- No System One URL under More endpoints: custom-systemone-url, every
  subtest.

Not tried: a real Ark account (the decision call is held to the
recorded reply); a provider whose main key is on the Coding Plan with a
pay-as-you-go key beside it gets no Decide, since normalize reads the
provider's own URLs.
2026-11-09 13:05:00 +08:00
yetone 9edc6506e0 routing: a group's editor folds what few change under Advanced
The owner found the Add group form too long. Name, In agents' lists,
Models, Accounts, Rules and the classifier stay in the form; Patterns,
Model lists, Routing, Rate limited, Slow to start, Every member busy,
Context, Stays, Effort and Levels move into an Advanced fold
(details.more, as the provider editor's). It opens by itself when the
group sets any of them, remembers being opened or closed while the
editor is up, and Save opens it when a typed pattern is invalid so the
focus lands on it.

The fold's inner grid takes the editor's label column (--ed-lab), so
its labels line up with the ones above; without it English sat 30px
off (group-editor-fits caught it), and at 520px and in the web layout
it stacks like the rows above. edAlign now sets --ed-lab/--ed-at only
when they change, and in an open fold a later change waits a frame
(a closed fold only moves its chevron and follows at once): opening the fold
re-measured inside the ResizeObserver callback and routing-rows-fit
failed on "ResizeObserver loop completed with undelivered
notifications".

The GUI tests that edit those rows open Advanced first (openAdvanced
in group-context, -unlists, -first-token, -patience, -defaults,
-editor-align, -from-model-add); group-editor-align measures the
fold's labels too.

Run (Linux, WSL magpie-desktop, Chromium + WebKit, 5 languages):
- the 34 GUI files red in a first run plus group-editor-fits and
  group-editor-selected, at this head rebased on 8935abcf5: 528
  tests, 499 pass, 29 fail. The reds are i18n-keys (1, #5332 #5426
  #5482), routing-intent-entry (8, #5392) and zero-priced-free (20,
  #5262); the same files fail the same way at base 4f3ec591a without
  this change.
- the 112 GUI files that reach an editor's fold, the view's room or
  the group editor (details.advanced/.more, rt-gedit, --ed-lab,
  setRoom, click-scroll, i18n-keys), at this head and at base
  8935abcf5: 2246 tests, 44 fail on each, the same tests but two
  that flipped once (provider-url-each-api 440px red here, 3 of 3
  green alone; a long-text-box menu red at base only). Among them
  editor-advanced-align's chromium case (#4615) is red at base too.
- the whole GUI suite was started and stopped part way (it would take
  hours on WSL); its reds so far are in #5559's list.
- rebased on b68218f43 (a912cdc36 touched the groups page): every
  group-* file, routing-rows-fit, routing-save-blank and click-scroll
  again: 616 tests, 2 fail, both click-scroll's late wheel in WebKit
  (#4385, red at base too).
- go test -run Budget ./internal/gui on mote at the pushed head: ok.

Broken by hand: without the inner grid rule, group-editor-fits is red
(373 vs 343 in English); without the edAlign change, routing-rows-fit
is red on the ResizeObserver page error; without the previous commit,
routing-save-blank is red.

Not tried: the real app window, macOS (mote was overloaded with
launch timeouts) and Windows.
2026-11-09 12:53:37 +08:00
yetone 041afc6b01 gui: a Save that leaves only a sliver of the page above the room keeps no room
A click's hold kept a blank room at the foot of a view while any content
stayed in sight above it. A group editor saved from far down the page
left the last settings card, 88px of a 594px window, above a 506px room,
and no group row was in sight. The room is now kept only while a third
of the window is still content. Otherwise the browser's own clamp after
the shrink stands.

The group editor's rows folded under Advanced (next commit) make the
editor short enough to reach this. routing-save-blank goes red there
without this change: chromium en and zh, "not one group row in sight"
(seen {"inSight":0,"room":506,"window":594}). It passes with it.

Run: on the Linux box (WSL magpie-desktop), routing-save-blank and the
whole GUI suite at the pushed head, recorded in the next commit.
2026-11-09 12:53:37 +08:00
yetone dc098c1e82 library: a skill from a folder follows GitHub once installed from there (biubiu8802 on X)
biubiu8802 (X, 2119602075864903924) downloaded a skill from GitHub and
put it in the Library from its folder, so it had nothing to update from
and no way to link it to GitHub. Installing it from its GitHub link now
links the two, the way an update of a CC Switch skill already does: the
library's skill by that name takes GitHub's files and GitHub as its
source. A check and an update cover it from then on, and the agents'
links keep pointing at it. When its own files aren't GitHub's, they go to
the backups like UpdateSkill's replace does, and the result says so. A
folder of the user's it was linked to stays as it is.

followsHere (skill_link.go) decides it. It links only a skill with no
remote source that wasn't renamed and is that skill: it traces to this
repository (CC Switch, the skills CLI's lock, a git checkout, From), or
it traces nowhere and its SKILL.md has the same description as GitHub's,
as an older download of it does. One traced to another repository, or
an untraced one that describes something else (mora1n's case,
TestInstallSetPutsAnotherByTheSameNameBeside), still goes in beside it
(skill_beside.go). A had skill with
the same files and no source is bound to the GitHub source it was found
in, so a later install of another repository's skill by that name goes
beside it, not over it (TestSameFilesByNameAreHad).

The probe marks such a candidate links:true. The GUI's Add list tags it
"links to GitHub" with a tooltip, and the report names "updates from
GitHub now" and "files of their own kept with the backups". The TUI's
probe list and result line say the same. The new strings are in zh,
zh-TW, ja and de.

Run on mote (macOS), on 64ecd0f69, then rebased on 8a58c0e30, whose
new commits touch none of internal/library, the TUI's library or the
library page:
- gofmt -l clean; go vet ./..., GOOS=windows go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=linux go build -tags nogui
  ./..., GOOS=windows go build ./... all ok
- go test ./internal/library/... ok at this tree; ./internal/tui/...,
  ./internal/cli/... and ./internal/gui/ ok at the tree before the
  description check (that change touches internal/library only)
- GUI (chromium + webkit, 5 languages, wide and narrow):
  skill-install-link (new), skill-install-beside, skill-install-skip,
  skill-install-agents-all, skill-git-source, skill-too-big,
  provider-discovery, i18n-en-no-cjk pass. i18n-keys' "a plugin's words
  are its own" is red on main for three strings this change doesn't
  touch, already filed: #5332/#5327 ("View routing"), #5482 ("Use the
  library's"), #5426 ("No session ID").

Broken by hand: without the description check (the first version),
TestInstallSetPutsAnotherByTheSameNameBeside is red (caveman taken over).
followsHere returning false always turns
TestFolderSkillFollowsGitHub red (probed As:pdf-pro-biubiu) and
TestOwnSkillFollowsGitHubKeepsItsFiles red (linked [] kept []).

Not run: the full go test ./... suite. mote's suite lock had a queue
waiting up to 16h, so this change ran the packages it touches.
No real GitHub install either: the tests use a fake tarball server. Not
tried on Windows or Linux. The market's had-check (haveSkill) is
unchanged: a market skill with a folder copy by that name still counts
as had.
2026-11-09 11:29:51 +08:00
yetone 8544d5fdb5 settings: Download source says usemagpie.ai first, GitHub when it fails
Since v0.1.3345 an update's files come from usemagpie.ai (R2) and go to
github.com only when that fails; a mirror stands in for github.com only.
Settings › About › Download source still showed "GitHub", said updates
come from GitHub, and its button "Use GitHub" (zh 恢复官方) read as
switching back to GitHub. Now it shows usemagpie.ai, says GitHub (or the
mirror) is the fallback, and the button is Remove mirror (不用镜像), in
en, zh, zh-TW, ja and de. `magpie update mirror` says the same.

Run on mote (update-mirror, i18n-en-no-cjk, i18n-keys and cli vet again at the rebased head: ok but #5332):
- update-mirror, i18n-keys, i18n-en-no-cjk and every GUI file that opens
  About (19 files), chromium + webkit: update-mirror and i18n-en-no-cjk ok.
  The reds, rerun one file at a time:
  - i18n-keys "a plugin's words are its own" and segs-press-redraw
    "clicks its new self once": red the same at origin/main 26e9c9566,
    filed as #5332/#5426/#5482 and #4566/#3922.
  - lan-docker, public-url-default: red at load ~400, 62/62 ok at load 36.
  - about-*, cli-path, settings-sections, statusline-remote,
    uninstall-settings: ok alone (red only at load 278 to 400).
- go test ./internal/cli ok, go vet ./internal/cli ok, gofmt clean.
Broken by hand: the new update-mirror test run against origin/main's
app.js and i18n.js: 0 of 10 pass.
Not tried: the real app's About page; the whole GUI suite.
2026-11-09 09:36:33 +08:00
yetone a912cdc369 routing: the groups page's Select and New group no longer touch
The groups page's toolbar row has gap 0, so Import, Select and the
filled New group sat edge to edge: Select's hover met New group's fill
(the owner's screenshot, 11-08). The buttons right of the spacer now
stand 4px apart, New group 8px.

Run at this head (rebased on 4fac4c863): group-new-head.test.cjs,
Chromium and WebKit, en and zh, 4/4 on mote. Its fixture has two groups
now, so Select shows as in the screenshot, and it checks each button
pair's distance. Broken by hand: with the CSS taken out, 4/4 red
("rt-gimportbtn | rt-gselect touch: 0px").

The 78 GUI files that reach the groups page, at the pre-rebase head on
mote at load 60-200: 938 pass, 134 red, 124 of them TimeoutErrors. Of
the 10 assertion failures, run alone one file at a time at this change and at
origin/main 8935abcf5: group-disabled-contrast passes, and
menu-input-scroll (#3402) and routing-intent-entry (#5392) are red the
same 12 on both. group-accounts, group-arrange and filter-ime, which
timed out in the full run, pass alone.
Not tried: the real app; the whole GUI suite.
2026-11-09 09:27:37 +08:00