Commit Graph
3263 Commits
Author SHA1 Message Date
yetone d62220d43e gui: a proxy's web page regexps compile when first used (TestNoEagerPackageRegexps)
059d995d5 added webPageStart and webPageTitle as package-level
regexp.MustCompile, which TestNoEagerPackageRegexps refuses: every
package regexp goes through lazyre so start-up doesn't compile them.
CI at 61a04f42a was red on ubuntu and macOS for it.

Run (Windows box, win-run; mote is out of disk and refuses ssh):
- go test -run TestNoEagerPackageRegexps . : ok (red on CI before)
- go test -run 'TestFailSaysAProxyPage|WebPage' -v ./internal/gui:
  TestFailSaysAProxyPageByItsTitle, TestWebPageHandlerEveryWhere pass
- go vet ./internal/gui, gofmt -l: clean
2026-11-11 14:33:37 +08:00
yetone f5e1b10913 settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.

Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
2026-11-11 14:28:17 +08:00
yetone a46c90e7c3 providers: a key's usage cap is set from its row, as an account's is (@wanggenjidev on X)
GUI half of the previous commit; same pill and words as the account cap. key-usage-cap.test.cjs passes in chromium and webkit, en zh zh-TW ja de, 900 and 400px.
2026-11-11 14:18:11 +08:00
yetone 4a7d222dc8 providers: an OpenCode Go key takes the usage cap an account does (@wanggenjidev on X)
Backend only; GUI follows. Tests: provider TestKeyTakesUsageCap, gateway TestKeyUsageCapPassesTheKeyOver (red with the hold removed by hand).
2026-11-11 14:18:10 +08:00
yetone d936be7639 usage: Claude's card shows the extra-usage cap and its spend (Shinji_Zl on X)
Claude Code's `claude -p /usage` text omits extra usage, but with
`--output-format json --verbose` a message carries
usage_report.rate_limits.extra_usage (cap and spend in cents). The gateway
adds it as a line; parseClaudeUsage reads it as an Aside "Usage credits"
window (n / cap USD), so a spent cap never marks the account used up.
magpie asks Anthropic nothing itself, and cannot make a request spend
credits: Anthropic decides. The prepaid balance is a separate endpoint and
is not shown.

Run (wsl-run, linux): TestClaudeUsage*/TestClaudeOverage in provider and
gateway, go vet linux/windows/darwin, i18n-keys, i18n-en-no-cjk and
claude-overages GUI files (chromium + webkit).
Broken by hand: Aside false -> TestClaudeUsageCredits red.
Not tried: a real account with extra usage on (the owner's is off); full
suite after the tag; Windows run.
2026-11-11 14:08:18 +08:00
yetone 465e9f721f gui: library-bili waits for the sidebar's sections before it picks a tab by place
The sidebar list is drawn once in the strip's order and again in sections
once navicons.js is loaded; Pi packages then sits before RTK, so a click by
an index read before the redraw landed on another tab.

Run: library-bili and library-groups on Windows (xiaomi-gpu), Chromium and
WebKit: 100 of 100. Red before this wait in WebKit on mote, 2 of 4 cases.
2026-11-11 13:53:34 +08:00
yetone 29d37b4a6c gui: Library's sidebar list is in sections: every agent, one agent, magpie (@ConatusMoon2222 on X)
The list under Library in the sidebar was one flat column mixing what every
agent shares, what one agent has and magpie's own add-ons. It now has three
quiet section names, as a Mac source list's: "Every agent" (Instructions,
Memory, MCP servers, Skills, Hooks, Subagents), "One agent" (Claude plugins,
Pi packages) and "magpie" (RTK, billion-context). Same pages, same strip,
same routes; the page's own strip is unchanged. A section with no tab showing
has no name, and a list of one section (agentless) has none at all. The names
are said in zh, zh-TW, ja and de ("One agent" is new; "Every agent" was
already there); no colour, no gradient, no border.

The grouping and the sort live in navicons.js (loaded with the first list,
which then draws again), so the core script budget holds; a few navSubs
comments were cut for the bytes.

Run:
- library-groups.test.cjs (new): the three names and the rows' order in en
  zh zh-TW ja de, no names in the strip, a name is no tab, quiet style, a tab
  still opens, hidden-only section loses its name, one section none, 420px and
  dark: Chromium and WebKit, 16 of 16 on mote before the rebase, 100 of 100
  with library-bili on Windows (xiaomi-gpu) after it, and with sidebar.test.cjs
  on WSL.
- Broken by hand: names always shown made the hidden-section case red in both
  engines.
- go test -run Budget ./internal/gui: ok before the rebase.
- Screenshots zh light/dark at 900 and 420, before and after, in
  magpie-wt/library-groups-scratch/shots.
- Wider sidebar and library set on mote: 302 of 304; the 2 reds were
  library-bili in WebKit, a click by an index read before the redraw
  (fixed in the next commit). mote could not launch browsers afterwards.

Not tried: the whole GUI suite (mote refused connections and then browser
launches for hours; run after the tag), the real Linux WebKitGTK app.
2026-11-11 13:53:34 +08:00
yetone 61a04f42a2 library: a project's Skills menu groups the skills by source, a heading ticks the whole group (Elorynth on X)
The project card's Skills menu listed every library skill flat. It now
lists them as the Library does (skillGroups(true): by repository or the
user's own group, this computer's last, whatever sort the list has), with
a heading over each group. Pressing a heading ticks all of the group's
skills, or unticks them when all are in; it is half-ticked while some are.
A typed filter keeps a group's heading over the skills it finds, and
matches a skill by its group's name. One group only stays the flat list.
openProtoMenu takes a `group` option (the values it ticks) for this.
Paid for in app.js by five comments cut, no budget raise.

Run on the Windows box (mote's Chromium launch hung, SSH refused at
times): project-skills-groups.test.cjs, new, in chromium and webkit,
en/zh/zh-TW/ja/de at 400px wide: red on the old code (6 of 6), green
after. With project-*, i18n-*, menu-*, proto-menu-overflow and
skill-group* GUI files in both engines: all green except
menu-input-scroll and menu-scroll (14 chromium, 13 webkit), which are
red the same at origin/main aa2ea5c90 on the Windows box (commented on
#3402). TestCoreScriptBudget ok at the rebased head.
Not tried: the full suite, the real Linux app (WebKitGTK). Part 2 of the
report (instruction presets bundled into a toolkit) is not built: a
project has no instructions of its own yet.
2026-11-11 13:31:23 +08:00
yetone b39a793c98 codex: the Codex app, left showing fewer projects after a switch while it ran, says to quit and reopen it (linsm66 on X)
"为什么codex在触发自动更换账号后侧边栏已有的项目文件夹会消失呢".

v0.1.3600 (10bef5fe0) shares every account's projects while the Codex app
is closed. A switch while the app runs can't be helped by a file: the
app (ChatGPT.app 26.1103, early-bootstrap-133 selectRendererOwner, run on
every principal change) parks the old identity's projects and loads the
new one's from memory, and writes its memory over the file. An app open
since before the sharing, or a project added since it was last closed,
shows the new account's empty list. magpie does not quit the app unasked
(15acba534, 248268ce4); the owner chose a hint instead.

codexProjectsLook, from codexProjectsStep's loop while the app is open,
reads the state file: the owner's local projects' folders against those
parked under the other identities. When the owner changed since the last
look and the owner lacks a folder, /api/providers says codexProjects, and
Codex's accounts show "The Codex app shows fewer projects than you have:
quit and open it again" (Got it hushes it; dismiss-projects). A project
removed on the account the user is on is no switch and says nothing. A
closed app clears it: the share runs and the app loads every list as it
opens. The notice is in codexprojects.js, loaded when the state says so,
so the core's budget is unchanged. i18n in zh, zh-TW, ja, de.

Run (mote refused ssh all session; so wsl-run on the Linux box):
- go test -tags nogui -run 'TestCodexApp|TestCodexProjects' ./internal/provider: ok.
  TestCodexAppProjectsShortAfterALiveSwitch drives the repo's app
  simulator through a live switch to an unshared account and, after
  shareCodexProjects, to a shared one. Broken by hand (every look counts as
  a switch) TestCodexAppProjectsRemovedByHandIsNoHint went red.
- node --test codex-app-projects-short.test.cjs (new), codex-app-stale,
  i18n-keys, i18n-en-no-cjk: all pass, chromium and webkit, 5 languages,
  900 and 480px (70 tests for the first two).
- TestCoreScriptBudget ok; gofmt clean; go vet -tags nogui and GOOS=windows
  of internal/provider and internal/gui ok.
- old-webkit.test.cjs: "compat.js is the first of the page's own scripts"
  and "the styles hold up in Safari 15.0" are red on origin/main
  4ddc150c6 too, same names. GOOS=darwin vet of internal/gui fails at
  traywindows_darwin_test.go:30 (trayImagePNG) on origin/main too, from
  WSL without cgo.

Not tried: the real Codex app switching live (the simulator follows the
bundle's selectRendererOwner, not a launched app); the whole GUI suite
before the push (started after the tag); mote.
2026-11-11 13:26:49 +08:00
yetone 4ddc150c66 gui: a hover hint beside the account switch says how it works and why it is the agent's own use
The owner (11-11): "在这个切换开关旁边有一个 hover 的提示,提示这个原理是啥,
以及它为什么不会让你的账号被封禁". Beside Switch {agent}'s account
automatically, an ⓘ mark; resting on the row (or a key reaching the
switch) shows settingshints.js's card with three lines:

- how: the next account's sign-in is written where the agent keeps its
  own, as /login or codex login does; what is left is read by Claude
  Code's own /usage, or where Codex's /status reads it; sessions already
  open keep their account until restarted;
- why it is the agent's own use: Claude Code still sends every request
  itself, straight to Anthropic, unchanged, and magpie sends none (an
  account's own proxy kept); for Codex, only which of your own accounts
  it is signed in to changes;
- the limit: the same as switching by hand; use only your own accounts,
  sharing one is against the vendor's terms. It promises nothing about
  bans: that is the vendor's call.

Only where the switch moves the sign-in. Under the gateway it moves
Claude Code's requests instead, and the "straight to Anthropic" line
would be false, so SignInMovesOf now says `routed` on a kept Claude
whose requests go through the gateway, and the hint shows for `moves`
and for `kept` without it.

The lines and mark are in autoswitchtip.js, imported when the switch is
drawn; app.js gets the one import line, paid for by cutting this branch's
own two comments: the core is 1,533,771, under 1,533,802, no raise.
Strings in zh, zh-TW, ja and de.

Run (xiaomi-gpu, Windows 11, win-run; mote refuses ssh):
- node --test sign-in-moves, keep-login, pool-ends, old-webkit, i18n-keys,
  i18n-en-no-cjk, settings-hints, editor-hints: 148/152. The 4 reds are
  the same at the base 156861b3a: old-webkit's headerpresets.js (#6030)
  and Safari 15.0 :has() (#5919), and settings-hints webkit de at 420px,
  filed as #6073.
- the new test (Chromium and WebKit, en and zh): the mark sits beside
  the switch on its line, the lines rest out of sight, hovering shows the
  card with the three lines beside the row, a press on the mark posts
  nothing; no mark for kept+routed or gateway.
- Broken by hand, each red: the mark's preventDefault removed (a press
  turned the switch off); the routed check dropped (kept+routed showed
  it); Routed not set in SignInMovesOf (TestSignInMovesSaysWhatSwitchDoes).
- go test -run "SignInMoves|ClaudeRoutedSignIn|KeepLogin|SwitchOnly"
  ./internal/provider ok; go vet ./internal/provider ok;
  TestCoreScriptBudget ok; gofmt -l clean.
- A Chromium screenshot of the card in zh looked at.

Not tried: the Codex variant's card in a browser (its strings pass
i18n-keys); the real app; macOS and Linux.
2026-11-11 13:05:16 +08:00
yetone e31625f641 gui: one helper builds a lib-switch button, one a button that opens a menu
origin/main's core scripts were 1,533,806 bytes, 4 over their budget
(TestCoreScriptBudget red), and the accounts list's automatic-switching
switch (the previous two commits) added 2,248 more. Ten places built the
same lib-switch button by hand (type, role, aria-checked, aria-label,
the knob); libSwitch(cls, on, label) builds it. Five set aria-haspopup
and aria-expanded=false in a row; menuOf(b) does. The switch's own
comments are cut to a line each, and the routing note's gateway sentence
comes from signInMovesLine instead of a second copy. The core is
1,533,756 after, under its budget with no raise; the budget's history
says so.

What each switch does is unchanged: same classes, role, aria-checked and
label. Two differences: providerSwitch's button now has type="button"
like the rest, and Only models I pick's aria-checked is "false" rather
than "undefined" when the setting is unset.

Run (Windows box, win-run): node --check app.js; TestCoreScriptBudget
ok. The whole GUI suite: see the push record.
2026-11-11 13:05:16 +08:00
yetone fc24a89183 gui: switching the agent's account is a switch of its own
The owner (11-11): "这个轮换做成一个开关". The used-up switch was off
behind a "Keep Claude Code signed in to" tick box, and the tick box read
as something else. Under the accounts of a Claude Code or Codex with
more than one account there is now a "Switch Claude Code's account
automatically" switch:

- on: the line from the previous commit sits under it, saying when the
  sign-in moves and whether it comes back;
- off: "Keep Claude Code signed in to [account]", the picker that was
  the tick box's (first account, or the one picked);
- switch-only: held on and disabled, with a title saying why, since
  switch-only always moves the sign-in.

The switch posts provider/keeplogin as the tick box did (keepLogin is
the switch off), so nothing on the server changes and a user's saved
keepLogin reads as the switch off. The name is a label for the switch:
clicking it flips it too. `.editor label`'s text-align: right is undone
for it, so its words start at the left. The two "Automatic switching is
off" strings give way to the switch's name and title in zh, zh-TW, ja
and de. docs/subsystems/providers-accounts.md says it under "Used-up
switch".

Run (Windows box, win-run; mote refused ssh and WSL's GUI runs failed
with E_UNEXPECTED):
- sign-in-moves, keep-login, pool-ends, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit, en and zh:
  100 pass
- after the alignment fix: sign-in-moves, keep-login, pool-ends: 72 pass
- TestCoreScriptBudget (wsl-run): PASS
- screenshots, chromium en and zh, on and off: name at the left, switch
  at the right, line or picker under it
- after rebasing on origin/main: see the push

Broken by hand:
- posting !on from the switch: sign-in-moves red 4 of 16;
- dropping the text-align fix: the "words start at the left" check red
  (160 to 224px in), where the old box check had passed.

Not run: the whole GUI suite with the switch (mote and WSL down). At the
previous commit it was cut short on mote with load timeouts; the account
reds there (account-arrange, agent-switch-accounts, claude-switch-only's
"page doesn't move") also fail on origin/main d1b4eff5a and are #6010,
#5925 and #4344. Not tried in the real app with the owner's accounts;
their keepLogin (the switch off) is left as it is.
2026-11-11 13:05:16 +08:00
yetone 8a3dbf0232 gui: the accounts list says what magpie does with the agent's sign-in
A user with two Claude accounts read the used-up switch as gone. Their
"Keep Claude Code signed in to" box was ticked, which turns the switch
off, and nothing on the page said so. Under the accounts of a Claude Code
or Codex with more than one account, a line now says what the switch
does, as NextLogin decides it:

- kept: switching is off, the agent stays on the first account (or the
  one picked) even once it runs out;
- gateway: Claude Code's requests go through magpie, which picks an
  account per request; its own sign-in stays put;
- moves: the share it moves at (98%, or used up for In order / Until
  used up), and whether it comes back to the first (returnsToFirst).

provider.SignInMovesOf gives the mode from the same checks NextLogin
makes (leftAlone, keep, ClaudeThroughMagpie && !SwitchOnly, SpentShareOf,
returnsToFirst). /api/providers carries it as signInMoves on the agent's
own provider row. The Routing tab's sign-in note says the gateway case
too. Strings in zh, zh-TW, ja and de.

Run (mote, through mote-run):
- go test -run 'TestSignInMoves|TestClaudeRouted|TestKeepLogin|
  TestClaudeSwitched|TestNextLogin|TestCodexLogin' ./internal/provider: ok
- go test -timeout 45m ./internal/gui ./internal/provider: ok (script
  size budgets included)
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  provider and gui: ok
- GUI: sign-in-moves, keep-login, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit: 60 pass
- whole GUI suite (make test-ui): see below
- screenshots in WebKit, en and zh: the line sits inside the list at the
  rows' inset; zh sentences join with no space

Broken by hand: dropping NextLogin's keep case from SignInMovesOf turns
TestSignInMovesSaysWhatSwitchDoes red; not appending the line turns
sign-in-moves.test.cjs red 4 of 4.

Not tried: the real app with the owner's accounts; the user's own
keepLogin is left as it is.
2026-11-11 13:05:16 +08:00
yetone 1315ac7d99 update: the first update finds a magpie without gateway.json, and a restart waits a bounded time (ljlwlcz on X)
Two edges of v0.1.3687's gateway.json:

1. The first update from a magpie older than the record found no gateway.json,
   asked 3425, said "isn't running" and left a service on MAGPIE_ADDR=0.0.0.0:10100
   on the old version. With no record, no MAGPIE_ADDR and no answer at the usual
   address, `magpie update` now tries the installed service's MAGPIE_ADDR (read
   from its unit or launch agent, daemon.Addr), the port in Settings and 3425,
   and takes the first that answers as magpie. --addr and MAGPIE_ADDR stay the
   user's word.
2. A restart asked by `magpie update` waited on "N requests" with no end (Windows
   hands nothing over, long streams never finish). The app and magpie serve now
   wait at most 10 minutes for that ask, then restart; the output says so
   ("or in 10 min at the latest, which cuts what is still running"). `magpie
   update --force` restarts at once (gateway.SetForceRestarter), and says if the
   running magpie is too old to know --force. The app's own look at the disk
   (followReplaced) and autonomous serve follow still never cut a request.

Run (mote refused SSH; win-run on xiaomi-gpu): go vet cli/gui/gateway/daemon
(windows), linux nogui vet; go test -run TestUpdate|TestServeFollow|
TestTerminalUpdate|TestRestart over cli, gui, gateway, daemon: ok except
TestUpdateThatWontStart, red on origin/main on the same box too (#6059).
Broken by hand: drain bound off, record fallback off, serve bound off: the new
tests TestTerminalUpdateWaitIsBoundedAndCanBeForced, TestUpdateFindsAMagpieThatWroteNoRecord,
TestServeFollowDrainIsBounded go red.
Not tried: a real systemd service upgrade; darwin cross vet (cgo) and the full
suite (started after the tag if mote is back).
2026-11-11 13:01:11 +08:00
yetone 059d995d56 gateway keys: the list reads the ledger once for all keys, and a proxy's web page is said by its title (aiandcloud on X)
aiandcloud (2.98B tokens, 12,654 requests a day, server mode behind a
proxy) saw Gateway keys draw a Cloudflare 524 page as raw HTML.

Slow list: every poll of /api/caller-keys read up to a month of ledger
rows once per window per key. budget.AllOf now reads each distinct window
once for all keys, and keeps the settled blocks' sums with a cursor
(usage.VisitFrom), so a poll only reads what was appended since; the
unfinished tail block is always read again. A rewritten or shorter log
resets the cursor. All(k) is AllOf of one key.
Numbers (BenchmarkAll vs BenchmarkReadEach, 8 keys x day/week/month,
31 days x 12000 rows/day = 372k rows, warm): 211-228 ms before, 23.5 ms
after.

Raw HTML: fail() now turns an error string holding a web page (a remote
magpie's or a vendor's 524/502 page inside the JSON error) into a short
said/what pair, "A proxy in front of magpie answered, not magpie ({what})"
with the page's title, translated in all 5 languages (key already in
i18n.js). The browser already handled non-JSON bodies (notJSON, #2032).

Run (Windows box, mote ssh was down earlier): go test budget, usage, gui
(AllOf, Budget, FailSays, I18n, Keys); gateway-keys-proxy-page and
gateway-key-limit GUI files in chromium and webkit, 5 languages: 24/24;
gofmt; vet windows, linux nogui, darwin (mote, only a clang deprecation
warning). Broken by hand: with the old fail() TestFailSaysAProxyPageByItsTitle
is red; with VisitFrom's reset() removed TestAllOfIsWhatEachWindowRead is red.
Not tried: a user-scale cold ledger, a server behind a real Cloudflare,
the full suite before the tag (started after).
2026-11-11 13:00:54 +08:00
yetone 1ae2241538 gateway keys: the model picker offers image and video models (aipha2025 on X)
/api/caller-keys/models listed provider.Catalog() only, which leaves out
image and video models (Codex's gpt-image, a catalog's drawers, ...). The
gateway already holds a key to them on /v1/images and /v1/videos
(keyHolds + modelAllowed in draw.go, video.go), so a key held to some models
could not be let draw. Each provider's Drawers and Videomakers now follow its
chat models in the picker.

Run: TestCallerKeyModelsOfferImageAndVideoModels red on old code (pix/gpt-image-2
offered 0 times), green now; gofmt; vet darwin/windows/linux-nogui on mote.
Not tried: GUI suites (no JS change); full ./internal/gui run timed out at
600s on loaded mote.
2026-11-11 12:58:36 +08:00
yetone dd3c9042c5 tests: the saved proxies' routes and settings are named in the guards
58fb07095 (named proxies) added POST /api/proxies/save, /delete and /test
and settings.Proxies and ProxyNames with no line in either guard, so
TestEveryRouteHasACommandOrIsNamed and
TestSettingsSaveKeepsWhatItDoesNotSend went red again a minute after
c1a072636 mended them for context-cap.

The three routes are a setting saved by its own route (stage 2), beside
POST /api/proxy/check. The settings-keep test sets a saved proxy and its
name, and a Settings save keeps both (KeepOwn already carries them; no
code change).

Run on mote at origin/main 61a93b531 plus this: both guards red at
61a93b531, naming these five; ok with this, with TestCoreScriptBudget and
the gui, cli and settings packages' Proxy tests.
2026-11-11 12:28:15 +08:00
yetone 61a93b531f gui: the core's scripts back under their budget, by a comment cut
Main at 245f07b19 had the core's scripts at 1,533,806 bytes, 4 over
TestCoreScriptBudget's 1,533,802. Each of eb56de0b5, 914fcf59b and
4df5256db fit at its own base; together they don't. The comment eb56de0b5
put over its modelSamePick call, which names the file the line imports, is
cut. No raise.

Run on mote: go test -run TestCoreScriptBudget ./internal/gui red at
245f07b19 (1,533,806 > 1,533,802), ok with this.
2026-11-11 12:26:53 +08:00
yetone c1a0726369 tests: context-cap and the catalog's model list are named in the route and settings guards
747632890 added POST /api/settings/context-cap and settings.ContextCap,
and eb56de0b5 added GET /api/catalog/models, with no line in either guard,
so TestEveryRouteHasACommandOrIsNamed and
TestSettingsSaveKeepsWhatItDoesNotSend were red on CI from 8aae124b0 on
(run 42954436265, ubuntu and macOS).

context-cap has its command, magpie model context-cap; the catalog list
is the model editor's Same as picker, with no command yet (stage 2). The
settings-keep test now sets ContextCap, which has its own route, and checks
a Settings save keeps it (it does: the test passes with no code change).

Run on mote at origin/main 245f07b19 plus this: go test -count=1
./internal/cli ok (42s). ./internal/gui: both guards ok; the package's red
tests there were TestCoreScriptBudget (next commit) and eight AppKit window
tests that wait 30s for a window over ssh (TestPanelCloseHidesIt,
TestMainWindowCorners and the like), which this change doesn't reach.
Red before: both guards on CI at 8aae124b0, naming these three.
2026-11-11 12:26:53 +08:00
yetone 58fb070953 settings: named proxies, chosen as inherit, direct or a saved one anywhere a proxy is (@tsingchao on X)
Settings > Network keeps named proxies (name, address, optional login)
with a Test that says reachable and the latency. Everywhere a proxy can be
chosen (global, plugin downloads, a provider, a key, a Claude account) now
has a Saved mode beside the others; the value is "@<id>". Addresses typed
before are read exactly as before, nothing is migrated or overridden.
netproxy.Parse/Resolve/Redact/EnvWith/Dispatch resolve a reference at the
lowest layer, so a proxy edited once reaches the gateway, usage reads,
sign-ins and the plugin host at the next request; Claude Code's
settings.json env (a snapshot) is rewritten by provider.ProxyEdited.
A reference this computer lacks fails closed (DeadProxy), says the proxy's
name in the request error and as "Proxy missing: {name}" on the provider
row, and never goes direct. The password lives in settings.json (0600), is
never read back by the page, logged, or put in Settings sync. The list
rides with the providers part of a sync (Bundle.Proxies, MergeProxies by
id, passwords only with keys). A proxy in use can't be deleted (409).
The saved list's page code is in proxies.js, loaded when Settings draws it;
app.js grew by Saved-mode helpers only, paid for by 16 long comments cut
(core budget unchanged, no raise).

Run (mote refused ssh all session, so Go and GUI went through win-run on
xiaomi-gpu, Windows 11; gofmt and darwin/linux-nogui/windows go vet were
clean on mote before it went down, at the pre-sync tree):
- go test settings, netproxy, backup, settingsapi, davsync: ok on Windows
  (earlier on mote: also gui, provider, plugin with real Bun, gateway).
- saved-proxies.test.cjs 20 of 20 (chromium+webkit, en zh zh-TW ja de,
  420px) twice more on Windows; provider-proxy-missing.test.cjs 20 of 20.
  One webkit de 420px run of saved-proxies failed once under 4-way
  concurrency and passed 3 of 3 alone; not reproduced.
- TestCoreScriptBudget ok after the move (it was 3.4KB over before).
Red on this tree and on origin/main alike (Windows run, not mine):
settings TestSharedCheckedReadsOnceAndKnowsUnknown; provider
Codex keychain/Git tests; plugin TestHostRunsAsMagpieBun, TestPiPackage;
gui TestGatewayHeldByAContainer and others; old-webkit "compat.js is the
first" (headerpresets.js) and ":has() (Safari 15.4)" on origin/main 245f07b19.
Broken by hand: restore skipping Proxies (TestSavedProxiesTravelWithProviders
red), Parse returning nil for a dangling ref (netproxy tests red), the
Proxy-missing badge disabled (provider-proxy-missing 0 of 20), and the Claude
env snapshot failing open (found by reading, test added).
Not tried: real vendors, the real Claude Code, a real two-computer sync, the
macOS suite and the whole GUI suite on this final tree (mote down; the whole
suite ran to test ~3700 on the earlier tree with reds owned by others).
A proxy missing whose sender never had it is named by its id.
2026-11-11 12:26:43 +08:00
yetone 245f07b19e agent: the pages that poll name rows from a list built once a while
The Sessions page polls its list and its stats every 15s, the Usage
page its clients, and each asked agent.Clients() only for each agent's
id, name and icon. Clients() builds every agent (30+ constructors):
2.5 ms, 378 KB and 3411 allocations a call on the Windows box with
discovery's real 2s look window, mostly os.Stat, filepath.Join and
Getenv. On the real-account run (t69, 4 min) agent.All under the
sessions handler was 22 MB of 210 MB allocated.

agent.Looks keeps that id/name/shared-name/icon list for 30s, built
again at once when the plugins' agents change (agentplug's set) or the
Agents page's refresh (Rescan). A new omp or QwenPaw profile shows by
its id for up to 30s. Nothing is kept in a test binary unless a test
says, so tests that add an agent read it at once. The GUI's sessions
list, stats, one session, markdown export, trash, manage and reads
views, and usageapi.Clients, read Looks.

Tests: TestLooksBuiltOnceAWhile — six asks build once, the list equals
Clients(), a plugin agent switched on and off shows at once, Rescan
builds again. Broken by hand (memo check made false): "six asks built
the agents 6 times; want once".

Run on the Windows box: go test ./internal/agent ./internal/gui
./internal/usageapi at the pre-rebase base 0cc91af3d: usageapi ok, agent
and gui with 38 reds. Those tests, run at 8aae124b0 with and without this
change: the same 37 fail on both (#6068). TestLooks/TestPlugged/TestRescan
ok and go vet ok at 8aae124b0. mote (macOS) refused ssh all session, so no
macOS run and no real-account measurement yet.

Rebased on 156861b3a after the runs; its new commits touch library,
plugin and site only.
2026-11-11 12:02:52 +08:00
yetone 4df5256db8 plugins: a plugin's page shows its README in the UI's language (ahwulv on X)
A plugin that ships README.zh-CN.md still showed README.md on its details
page with magpie in Chinese. GET /api/plugins/page now takes ?lang= (the
page's document language) and plugin.ReadmeIn picks the README named for it:
README.zh-CN.md, README_zh.md, README-zh.md, README.zh-Hans.md, README.CN.md
and the like, any case (readmeTag/pickReadme). Order: the language's own tag,
then its base (zh-TW takes a simplified README over English), then the plain
README.md as before.

Where it reads from: an installed plugin's folder; an npm package not
installed from its files through jsDelivr's file list (the registry entry
holds README.md only), public registry only, never a user's private one;
a GitHub repository not installed from its contents list. Any failure keeps
the old README.md path. The page cache in plugins.js is keyed by package and
language. A package only on the community dist branch still shows the
README its index carries (English).

Before/after: zh UI + a package with README.zh-CN.md showed README.md; now
shows the Chinese one. en UI, no such file, or jsDelivr down: unchanged.

Run: TestPickReadmeByLanguage, TestReadmeInUILanguage (fake npm, jsDelivr,
GitHub, installed folder) on mote at the commit before the final rebase and
on a WSL box; broken by hand (lang forced to "" in ReadmeIn) the test goes
red. GUI plugin-readme-lang (new, chromium + webkit, en and zh) green, red
when &lang= is dropped from the request; plugin-detail-escape green. go vet
darwin green. Not tried: a real npm package with a localized README against
the live jsDelivr; the other plugin GUI files and linux/windows vet were
still queued on mote when this was pushed.
2026-11-11 11:50:13 +08:00
yetone 914fcf59b0 gui: Sessions' Settings › no longer scrolls the whole window (kalicyh on X)
Settings' explanation lines are held out of sight with position:absolute
(hover mice), but their row had no positioned ancestor, so each sat at the
window's top-left corner, below the fold for the rows far down a page. The
document (body is overflow:hidden, still scrollable by script) then had
~870px of scroll, and Sessions' Settings › (openSettingsAt ->
scrollIntoView on the Privacy session-history rows) scrolled the window as
well as the page: Settings' top, the header, was pushed off the screen.

The row's .who is now the line's box (position:relative), in Settings and
in the provider editor's prefs (same rule, same hole). Every other
openSettingsAt link (Privacy rows, General's name row) shared it.

Run (win-run xiaomi-gpu; mote refused SSH all session, WSL tar errors):
- sessions-to-settings, all 5 languages x 1100/420 x chromium+webkit:
  20 of 20 ok. The new check (window scrollTop 0, Settings top >= 0,
  document no taller than the window) is red on the old CSS, 4 of 4 in zh
  (both engines, both widths).
- settings-hints/-lines-wrap/-places/-back/-search/-tabs-stick,
  editor-hints/-roomy, provider-prefs: 15 failures on this change against
  18 on the old CSS, the same names minus three the fix cleared (webkit de
  440 line-wrap, webkit hover hints); the remaining 15 (chromium de 440
  line-wrap, Settings' search, both engines) fail the same on the old CSS
  on the Windows box.
Not run: the full GUI suite, go test, macOS/Linux WebKitGTK.
2026-11-11 11:40:24 +08:00
yetone 7476328901 settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model
context-cap [<size>|off], POST /api/settings/context-cap). It lowers every
model's window to it, so a user need not set each model. A window the user
set on a model, or on its provider with "*", wins and is not capped; a model
whose window is unknown stays unknown.

It is applied where the window is derived, provider.windowIn, so /v1/models,
every agent's catalog, group windows and the compaction thresholds that
follow the window all agree. Codex's own models take it through
CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway
serves; the list's ETag carries the cap so Codex asks again. The provider
editor's Listed value stays the vendor's.

Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests;
GUI context-cap, model-load, settings-places, i18n-keys, settings-general in
chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin,
linux nogui and windows. Broken by hand: windowIn without the cap turns
TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap
red.
Not tried: the whole GUI suite (one row added to an existing list, no new API
read on page load), a real Codex reading the capped list, Windows run.
Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's
fallback when a ref has no window.
2026-11-11 11:07:57 +08:00
yetone eb56de0b59 gui: a model's Same as can be picked from models.dev's list, filtered (timfang4162 on X)
In Model settings the Same as box, which binds a provider's model to
another model's metadata (window, reply limit, levels, images, list
price), was a bare text field. A button beside it now opens the app's own
menu (not a <select>) with the models of the models.dev catalog magpie has
already synced: id, name, window and price on each line, a Filter… box over
id, name and maker, the current one ticked. A pick fills the box, so it is
staged and saved with the editor's Save like a typed id, and a value typed
afterwards still wins; nothing about how Same as is read changed.

GET /api/catalog/models lists the cache with one entry per model
(catalog.SameModel), taken from the provider that lists its window and
price. It fetches nothing. The picker lives in modellimits.js, loaded with
the model rows, so the core script budget is not raised (five comments in
renderModels cut to pay for the strings, 613 bytes of room before).

Run on mote at this tree:
- TestCatalogModelsListsTheSyncedCatalogOnce; broken by hand (last
  provider wins instead of the one with window and price) it fails with
  "kimi-k3 = {ID: ... }; want the provider that lists its window and
  price".
- model-same-pick.test.cjs, 22 cases (chromium and webkit, en zh zh-TW ja
  de, 400 and 900px): filter by maker, name and id, Enter picks, the
  current one ticked, one catalog read, no scroll, no <select>, saved as
  modelPrefs same; a failed read says so. With the filter argument taken
  out of openProtoMenu it fails. provider-same-as.test.cjs still passes.
- gofmt, go vet (darwin, linux nogui, windows) on internal/gui,
  TestCoreScriptBudget.
Full GUI suite at this tree (rebased on 5c05ac41b): the only reds are not this change's, each also red or flaky at origin/main 1f99f6f0b run alone, and filed: account-arrange #6010, account-eye #5052, account-refresh-holds #5814, accounts-own-signin's Antigravity test #6038 (a webkit access-control flake that moves between languages).
Not tried: the real app's WebKitGTK; the full suite is started after the
push.
2026-11-11 10:56:41 +08:00
yetone 0cc91af3db agy: magpie's models go in a settings file of its own, so agy's remote control works (baysonfox on X)
magpie wrote modelProvider gemini, the model and its custom models into
agy's settings.json. That made every agy an API-key session: no Google
account, so no remote control (needs the sign-in plus Google's server-side
flag), and a plain agy asked for GEMINI_API_KEY too.

Now they go in ~/.gemini/antigravity-cli/magpie-settings.json, handed to agy
as --settings for the one session (the launch command, magpie agy run, and
the function in a shell or a WSL distro). settings.json stays the user's.
An older wiring is given back (stashed model and provider) at the next Sync
or pick. agy remote-control and --remote-control run plain, on the sign-in.

Run (mote): go vet, GOOS=windows and linux nogui vet, agent/cli/sessions/update
packages (see push note). Real agy 1.5.3 in a sandbox HOME: plain agy with
the user's untouched settings.json now asks for sign-in (no GEMINI_API_KEY
error); the new launch reached a stub gateway at /v1beta/models/<m>:streamGenerateContent.
Broken by hand: remote-control bypass removed, TestAgyRun red; TestAgy red
on the old code (settings.json written).
Not tried: real remote control (needs a Google sign-in, none in the sandbox);
signed-in BYOM custom models; Windows PowerShell function run.
2026-11-11 10:31:52 +08:00
yetone 89f66966d9 release builds: the UI's files are packed into one zip, ~5.7 MB off each binary (@ZhangXiaof48473 on X)
The Windows and Linux downloads (and the CLI builds) are the raw binary, so
what is embedded counts in full. 8.2 MB of the 12 MB under internal/gui/assets
is scripts, styles and svgs. `make assets-pack` (build/assetpack) writes them
to internal/gui/assets.zip (deflate; png/jpg/webm stored), and the release
targets and `make app` build with -tags packedassets, which embeds that zip
instead of the tree (assets_packed.go: a file is unpacked once, on first use,
and served seekable with no modification time, as an embedded one is). Plain
`go build`, `make build`, `make cli` and every test still embed the tree.
The zip is git-ignored and made before every release build.

Sizes (go build -trimpath -ldflags="-s -w", on mote, at e430e2750):
  linux/amd64 nogui   73,203,874 -> 67,502,242  (-5,701,632)
  windows/amd64 app   88,401,408 -> 82,755,584  (-5,645,824)
The macOS zip/dmg compress the binary already, so they gain nothing.

Run: assetpack, then `go test -tags packedassets -run TestPacked ./internal/gui`
(passes: every file byte for byte and no other; / and a range of the webm served;
no Last-Modified). The first try failed it with "packed has 0 files, the tree
301" (zip entries lacked the assets/ prefix), so it does go red on a bad pack.
go vet ./internal/gui on darwin, linux nogui, windows and -tags packedassets:
clean. gofmt clean.

Not run: the full suite and the GUI suite (default builds embed the tree as
before; api.go only lost the embed line), a real release through
magpie-releases (its release.yml calls these make targets), the Linux GTK
build (cgo).
2026-11-11 10:28:05 +08:00
yetoneandRainier 5c05ac41b9 web: a LazyCat sign-in takes no peer on a public address; the manifest lists /magpie-ca.crt (forgetable024 on X, #5987)
Follows Rainier's two commits (cherry-picked with authorship, #5987).

What LazyCat's own docs say (developer.lazycat.cloud/en/http-request-headers.html,
read today): lzc-ingress authenticates a request, and after a success sets
X-HC-User-ID, -User-Role (NORMAL or ADMIN), -Device-*, -Login-Time; "if
authentication fails, it will clear the above X-HC-XX headers", and "lzcapp
developers ... can directly trust X-HC-User-ID". X-HC-User-Groups is said to
have the caller's own removed. X-HC-Source is in no page of the docs; the
sign-in's use of it only narrows who gets in. The docs name no address for
the ingress, so the peer can't be named; a TCP ingress or port forward passes
headers as sent (the docs for it say no authentication), which the manifest
section already says to keep off the page's port.

This commit: lazyCatSignIn turns away a peer that isn't on a private,
loopback or link-local address (or isn't an address), whatever headers it
sends. The client-routes list gains /magpie-ca.crt, which main added after
the branch's base (TestLazyCatManifestListsTheClientRoutes was red on it).
TestTranslatedRoutesDropProxyIdentity adds the chat and messages routes to
the vendor-leak tests (native, Codex relay and MCP were covered).

Run (mote, go1.26.8): gofmt clean; go vet on gui, gateway and cli for darwin,
linux nogui and windows; LazyCat, ProxyIdentity, OnePort and Web tests in
internal/gui and internal/gateway ok.
Broken by hand: with the peer check off, TestLazyCatSignInIgnoresAPublicPeer
is red; with X-Hc- out of proxyIdentity, TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity are red.
Not tried: a real LazyCat box (none here); the plugin fetch route builds its
headers from the request magpie made, read, not run. Full suite and GUI
tests follow the tag.

Co-Authored-By: Rainier <74943233+Rmosser@users.noreply.github.com>
2026-11-11 10:15:40 +08:00
RainierandClaude Opus 5.5 4d9b798d50 web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by
someone signed in to the box already, and asks for a key they never
saw: it is in the container's log. A package can only hand the key to
every browser that reaches the app, or put a proxy in front that adds
the key's cookie to what the box signed in.

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
yetone 88c417392e usage: a sortable model speed ranking on the Requests tab (@flying_crp on X)
Usage's Requests tab gets a "Model speed" card: per model, the median output tokens/s, the median wait for the first token and the request count, over the selected range, sortable by every column (aria-sort header buttons, quiet table, no gradients). A request counts when it was answered (not rejected, handed on, failed or canceled), its first token was timed and it wrote 100 tokens or more (usage.MinRankTokens; the tooltip says so). Computed locally: each chunk keeps a 2% log-bin histogram per model beside its cells (speed_rank.go, chunkPart.speeds), a page merges the chunks' histograms, so there is no per-request sort and medians are within ~1%. The settled chunks' histograms are in the page file; its key salt is now page-v2, so the first load after upgrade recounts settled history once. /api/ledger sends speeds and speed_min.

Run (mote): gofmt clean; go vet darwin, linux nogui, windows for the touched packages and ./... earlier; go test internal/usage, internal/usageapi, internal/gui ok at this head; usage-model-speed.test.cjs 12 of 12 (chromium and webkit, en/zh/zh-TW/ja/de, 400px: order, sort by every column, aria-sort, focus kept, no horizontal overflow, ellipsis, hidden when empty); with i18n-keys and i18n-en-no-cjk 20 of 20; the whole GUI suite once on the branch before the rebase: every red is in a file unrelated to this change (account-arrange #6010, account-refresh-holds #5814, account-eye #5052, agent-switch-accounts #5925, bulk visibility and disconnect previews #5982 fixed in e430e2750, accounts-own-signin #6038), each red alone on origin/main 71a68639b or load-only.
Timing: 1M requests added to a chunk in ~185ms (TestModelSpeedRankAtTheLargestLedger).
Broken by hand: dropping the Failed/Canceled exclusion (gpt: 5 requests, 59.7 tok/s) and dropping the page's merge of chunk speeds (ranking empty) each turned the new tests red; restored.
Not tried: the real Linux app (WebKitGTK), a real ledger of hundreds of thousands of rows through the page-v2 file, a Windows run (win-run).
2026-11-11 10:12:23 +08:00
yetone e430e27500 gui tests: agent-bulk-visibility and agent-disconnect-preview leave the window's in-use signal out of the writes they count (#5982)
10c4dc109 posts /api/update/using on the window's first pointer or key event. Both files record every POST and count or compare them, so bulk visibility (10 cases: 4 posts, not 2) and disconnect previews (4 cases: the two /api/update/using posts) were red on origin/main 71a68639b, run alone on mote. The recorders now leave that path out, as provider-find's did in b96847c3d.

Run: both files on mote, chromium and webkit, 5 and 2 languages: 14 of 14 ok (before, at 71a68639b: all 14 red). Not tried: the rest of the ~250 files with a strict POST recorder (#5982's open part).
2026-11-11 10:07:19 +08:00
yetoneandskygunner 28a79bc33a gui: the gateway-mode stats test holds its clock at a local 00:30 (#5690)
TestGatewayModeStatsNameTheGatewaySessions wrote its record at
time.Now()-1h, which in the first hour of a local day is yesterday, so
days=1 left it out: red on macOS and ubuntu CI at 4167419ab (00:31 UTC)
and on mote at 00:40 PST (#5690). The test now runs in a testing/synctest
bubble whose clock is moved to the next local 00:30, writes the record at
that moment, and checks the clock didn't move during the queries. A usage
test pins GatewaySessionWindow's edge: a local midnight is left out, one
nanosecond after it is in, on two consecutive days.

skygunner's patch (1554065a on their fork, posted on #5690 on 11-08),
applied as written on origin/main e12244aca; it waited three days unported.

Run on mote at this tree:
- The old fixture (-1h) inside the bubble: red at days=1 (TZ=UTC).
- -race -count=3 of both tests in UTC, America/Los_Angeles,
  Asia/Shanghai and Australia/Sydney: ok.
- go test -tags nogui ./internal/gui ./internal/usage: ok; go vet ok;
  gofmt -l clean.
Not run: the full suite (test-only change).

Co-authored-by: skygunner <skygunner@users.noreply.github.com>
2026-11-11 08:51:15 +08:00
yetone 68d1fda92b providers: GPUStack, a self-hosted model server, in the Add sheet (tayedexuanfeng on X)
tayedexuanfeng asked for GPUStack so locally deployed models import quickly.
GPUStack (github.com/gpustack/gpustack, read at 26b4af6) serves its
OpenAI-compatible API at <server>/v1 (/v1-openai is the legacy path), takes
the key as a Bearer (docs/user-guide/api-key-management.md), and lists the
ready models at GET /v1/models as {"object":"list","data":[{"id",
"object":"model","created","owned_by":"gpustack"}]} (routes/openai.py).

A KindLocal preset, so the Add sheet's Server address field, the CLI's
address=, the TUI's ask and AtAddress all apply as for Ollama; unlike
Ollama it is not NoKey, so its key is asked for. Default http://localhost/v1
(port 80). Logo: the project's own docs/assets/logo.png (Apache-2.0), 96px,
in pngIcons as mlx-serve's is (lobehub has none). Note translated in zh,
zh-TW, ja, de.

Run on mote: go test -count=1 of internal/provider, gui, cli, tui (ok);
go vet on darwin, windows and linux nogui for provider and gui (ok);
GUI i18n-keys, i18n-en-no-cjk, models-add-and-icons, local-address and the
new gpustack-add (56 of 56 in chromium and webkit; gpustack-add also in en,
zh, zh-TW, ja, de at 900 and 440px). The new Go tests use a fake server in
GPUStack's documented shape and never reach the network.
Broken by hand: NoKey true on the preset turns TestGPUStackPreset red;
dropping gpustack from pngIcons turns gpustack-add red (11 failed).
Not tried: a real GPUStack server (none on the LAN), the Linux WebKitGTK
app, the Windows box. Not built: GPUStack's /v1/responses and /v1/messages
(chat only).
2026-11-11 08:31:55 +08:00
yetone ae449f8e4f gui: the sidebar's tab lists give each tab a mark of its own
Library's, Usage's, Plugins' and Settings' tabs, listed under their page
in the sidebar (navSubs), were names alone while every page above them
has an icon (the owner, with a screenshot of Library's list). Each tab
now has a 14px line mark before its name, from NAV_SUB_IC by page and
tab id: segs gives its buttons data-seg (Usage's own strip too), and
Settings' tabs have data-set. A tab with no mark (none today) keeps an
empty slot, so the names stay in one column. The mark is muted, and
takes the row's ink when the row is hovered or picked.

The marks are in navicons.js, imported with the first list drawn, which
then draws again with them. Its one line in app.js is paid for by two
navSubs comments cut, so the core's script budget is not raised
(1,533,751 of 1,533,802).

German's longest Settings names ("Synchronisierung und Backup") were
cut with an ellipsis at 1100 before this; "Netzwerk und Freigabe" now
is too (7px). Left as is: shortening the word would change it in five
other German sentences that name the tab.

Run:
- nav-sub-icons.test.cjs (new): every row of the four lists has its
  mark, 14px, before its name and level with it, one column per list,
  names whole (not German); en zh zh-TW ja de, Chromium and WebKit, on
  WSL (magpie-desktop): 12 of 12. Red with Library's memory mark taken
  out by hand ("library: Memory has a mark").
- go test ./internal/gui on Windows: 8 reds, the same 8 alone on
  origin/main b46f23ffa (#4115, #5928, #5324; TestCherryStudioImportRow
  added to #4115).
- At this head, on origin/main b50910fee, on mote: 27 GUI files a
  sidebar list, a tab strip or a core script reaches (nav-sub-icons,
  nav-sub-unroll, nav-lamp, sidebar*, side-width, side-toggle,
  settings-sections, settings-tabs-stick, settings-back, segs-glide,
  segs-press-redraw, plugin-pick-sub, plugins-more-discover,
  plugin-updates, usage-refresh, library-items, library-bili, i18n-keys,
  i18n-en-no-cjk, click-scroll, readable-focus, icon-one-tone,
  old-webkit), both engines: 588 of 590. The 2 reds are old-webkit's,
  red the same alone on b50910fee: headerpresets.js unlisted (#6030,
  filed now) and .side-foot:has() (#5919). go test ./internal/gui
  -run 'Budget|Core': ok.
- settings-search is red on b50910fee alone too (the window's
  /api/update/using in its strict list, commented on #5982), so it was
  left out of the run above.
- Not run: the whole GUI suite (mote's suite.lock queue is ~30 deep)
  and the whole Go suite at this head.
2026-11-11 08:31:16 +08:00
yetone 9212185a73 gateway keys: Model names is a row of name and a picked model, not a textarea (tsingchao on X)
The key's Model names editor was one textarea of "name = provider/model"
lines. It is now a row a name: the name typed, the model picked in the app's
menu (search by name or id), x to remove, Add a name for another, the
Headers editor's row. A row with a name and no model, or the reverse, holds
Save off; a row with neither is left out. aliases-key's body and the saved
data are as before; the line-format message is gone, so is its key.

Run (mote): gateway-key-search-names (rewritten for the rows) + i18n-keys,
24 ok, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 440. Broken by
hand: half-row check off, the test goes red in all 10 chromium cases.
Screenshots before and after in chromium, dark and light, 900 and 420.
Not tried: Windows/Linux GUI run; the whole GUI suite runs after the tag.
2026-11-11 07:52:22 +08:00
yetone 0d0462d4a2 gui: a Presets menu in a provider's Headers fills in what a common client sends (l3123109756 on X)
The Headers editor gets a small Presets button beside + Add header. It
opens the app menu (openProtoMenu) with Codex CLI, Gemini CLI, OpenCode,
Kilo Code, Cline, Roo Code and Cherry Studio. A pick adds that client's
headers: a header the draft already has with a value keeps the user's own,
one with no value is filled, the rest become rows. The list lives in
headerpresets.js, imported when Presets is pressed, so the core's script
budget is not touched. No Claude Code preset and nothing that imitates it.

Where each value comes from (another app's values come from that app):
- Codex CLI: originator codex_cli_rs and the User-Agent shape from
  codex-rs login/src/auth/default_client.rs (as internal/provider
  codex_request.go sends them), version 0.167.0 = @openai/codex on npm.
- Gemini CLI: GeminiCLI/<ver>/<model> (<platform>; <arch>; terminal) as
  internal/provider/google.go userAgent has it, 0.67.0 = @google/gemini-cli
  on npm.
- OpenCode: opencode/latest/<ver>/cli (packages/core/src/app.ts,
  internal/provider/opencode_client.go), 2.2.7 = @opencode/cli on npm.
- Kilo Code: HTTP-Referer, X-Title, User-Agent, X-KILOCODE-EDITORNAME from
  Kilo-Org/kilocode request.ts and headers.ts (internal/provider/kilo.go),
  7.8.27 = @kilocode/cli on npm.
- Cline: cline/cline sdk/packages/llms/src/providers/cline-client-headers.ts
  (internal/provider/cline.go), desktop client, 3.5.54 as cline.go has it.
- Roo Code: DEFAULT_HEADERS in RooCodeInc/Roo-Code
  src/api/providers/constants.ts, RooCode/3.53.0 = src/package.json on main.
- Cherry Studio: defaultAppHeaders in CherryHQ/cherry-studio
  src/main/utils/http.ts, read from main on 2026-11-11.

Run (mote, at the pushed head, rebased on origin/main):
- new header-presets.test.cjs: 20 of 20 in chromium and webkit, en, zh,
  zh-TW, ja, de, 900px and 420px. With the user-value rule broken by hand
  (a preset overwrote a set value) it was 0 of 20.
- header-session-hint, model-headers, i18n-keys, i18n-en-no-cjk: green.
- TestCoreScriptBudget: ok. app.js is smaller than before.
- editor-hints.test.cjs webkit: 10 red here and on a clean origin/main
  copy alike ("Tab didn't come back to Certificate's box"), filed in
  #5872.
- The whole GUI suite is running on mote after the tag; reds will be
  filed.
Not tried: a real request through a preset's headers against a vendor
that checks them. Codex's and Gemini's User-Agents carry macOS and arm64
as magpie's own Go code does.
2026-11-11 06:38:15 +08:00
yetone ce5e5964db gateway keys: model search box, re: patterns and Model names in the key editor (tsingchao on X)
The model picker of a gateway key gets a search box (name or id) and takes
"re:<regexp>" typed then Enter; the row menu gets Model names (aliases-key).
Docs: gateway-routing.md "A key's model patterns and names".

Run (mote): go vet darwin, windows, linux nogui on access/gateway/cli/gui;
go test internal/access, gateway (937s), cli, gui all ok at the pre-rebase
base; after rebasing on origin/main: go build ./..., the new Go tests,
TestCoreScriptBudget, and GUI gateway-key-search-names + gateway-key-models
+ i18n-keys (28 ok, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 440).
Broken by hand: pattern match off (gateway + access tests red), aliasRequest
off (alias test red), search argument removed (all 20 chromium GUI red).
Not tried: Windows/Linux GUI run, a real client against a real key; the
full suite runs after the tag.
2026-11-11 06:26:47 +08:00
yetone 13a9f1263a plugins: Discover counts who uses and likes each plugin
Discover showed npm's weekly downloads, which CI, mirrors and magpie's
own keepMovedCurrent updates inflate. Now each card and the hero say
how many people use a plugin, counted by magpie itself, and a plugin's
page has a like.

- The daily stats send (stats.Send) also POSTs usemagpie.ai
  /api/plugins/report with the install id and the installed, switched-on
  plugins Discover lists, by their Discover key: the npm name, or
  github:owner/repo for a repository tagged magpie-plugin
  (plugin.Public). A folder, a private repository or an unlisted
  package is never named. It goes only while "Share the agents,
  providers, models and plugins I use" is on (noUsageStats), and only
  where the day's event goes at all (Count me as a user, DO_NOT_TRACK,
  MAGPIE_NO_STATS, release builds).
- site/pluginstats.js on D1 magpie-plugins: users are the ids that
  reported a plugin in the last 7 days, reports drop after 30 days, a
  caller's address is kept only as a hash for an hour (60 asks an
  hour). /api/plugins/stats carries no id and is cached for an hour.
- A like (POST /api/plugins/like through the GUI's /api/plugins/like)
  is taken only for a plugin installed and on here, can be taken back,
  and is kept in plugin-likes.json.
- "Most liked" sorts by likes once a plugin has 20, below that by
  GitHub's stars.
- plugincounts.js is loaded with the Plugins page, not the core, and
  redraws the cards only when the counts changed.
- The privacy text follows: README.md, README.zh-CN.md, docs/reference.md,
  the site's privacy and start pages in en, zh and ja, llms-full.txt,
  and the Privacy switch's label and description in every language.

Run at this tree (on origin/main 51da6f1f5):
- Windows box (win-run): gofmt -l clean; go vet of internal/stats,
  internal/plugin, internal/gui ok for windows and linux (-tags nogui);
  node --test site/pluginstats.test.mjs site/worker.test.mjs 44 of 44;
  TestCoreScriptBudget, TestPluginCountsAndLikes ok; GUI old-webkit,
  i18n-keys, privacy-usage-stats, plugin-git, plugin-local,
  plugin-github in both engines: 45 of 46, the one red is #5919
  (.side-foot:has, d374168d0).
- mote, one commit before the rebase onto 51da6f1f5 (Go unchanged
  since): go vet darwin ok; TestSendPlugins, TestPublicPlugins,
  TestPluginCountsAndLikes, TestCoreScriptBudget ok.
- Windows, at 7bc7af1d0 (one rebase earlier): go test internal/stats
  ok; internal/plugin and internal/gui red only in TestPiPackage and
  eight gui tests that fail the same at origin/main 72f2deebe on that
  box (#4115, #5928; TestCherryStudioImportRow added to #4115 with its
  cause). Every plugin*, market*, privacy*, i18n*, old-webkit* and
  discover* GUI file (83 files, both engines, concurrency 4): the reds
  left after the fix below match origin/main 6d7862769 on the same box,
  or are flakes red there too under concurrency: plugin-update-button
  (#4500), plugin-proxy-page (#6017, new), privacy-agent-telemetry
  (#6018, new).
- Broken by hand, caught: the first run had `const like = !local && …`,
  so a local plugin's page called false?.sync() every 600ms; 136
  "like?.sync is not a function" errors across plugin-git, plugin-local,
  plugin-github and the sign-in files. Fixed before this commit.
- Live: D1 magpie-plugins created and the worker deployed;
  /api/plugins/stats answers {"plugins":{}}, a bad report or like 400,
  /api/latest and / 200. No test data was written to production.

Not tried: the full Go suite and the full GUI suite. mote had 28 suites
waiting for its lock, and WSL on the Windows box failed with
E_UNEXPECTED while another session uninstalled a distro. Not tried
either: a real like or report from a release build (source builds
never send), so the first real counts come with this release.
2026-11-11 04:28:18 +08:00
yetone 51da6f1f5c gui tests: the settings-keep test sets Bark's server, key and daily time, which have their own route
71c4ef2d0 added BarkServer, BarkKey and BarkDaily, which the Settings
page doesn't send (POST /api/settings/bark sets them), and left them
unset in TestSettingsSaveKeepsWhatItDoesNotSend, so it was red on main
at 47e30d0e9 ("BarkServer: not sent by the Settings page; set it in
this test").

Run on mote: go test -run TestSettingsSave ./internal/gui ok; without
the change, red on origin/main 47e30d0e9 with the three Bark lines.
2026-11-11 04:14:58 +08:00
yetone 796f759e20 gui tests: library-bar-more leaves the window's in-use signal out of what the page posted (#5982)
10c4dc109 posts /api/update/using on the window's first pointer or key
event. library-bar-more recorded every POST and compared the list to
["/api/library/skills/check"], so it went red in every subtest.

Run on mote, at 90f4a377b: library-bar-more.test.cjs, BROWSER=chromium 11/11 and
BROWSER=webkit 11/11. Before the change: 22 failures, the same at
origin/main 459405960.
2026-11-11 04:14:58 +08:00
yetone d77eb6d236 memory: search by meaning, on a small model on this computer
A memory search now finds what means the same in other words or another
language ("什么时候上线" finds "Releases go out on Tuesdays"), for the
MCP server's memory_search and the Library's Memory tab alike. It is off
until switched on under Memory → Search by meaning, since it downloads
paraphrase-multilingual-MiniLM-L12-v2 (Xenova's int8 ONNX, ~135 MB,
pinned revision, size and sha256 checked); switched off, the model is
deleted.

- internal/pii/guard: the BERT code runs the embedder too (LoadEmbedder,
  mean pooling; the tokenizer reads 250,002 pieces and WhitespaceSplit).
  Its vectors match ONNX Runtime's int8 to cosine >= 0.995 and are no
  further from fp32 than ORT's own; testdata carries both.
- internal/memembed: the switch, the download, vectors.bin keyed by each
  memory's sha256 (read once, again when the text changes, a cut-short
  file read as none), Keep reading in the backend, the model let go after
  10 minutes unused.
- internal/memory: memory.Semantic fuses the meaning ranking with the word
  ranking by reciprocal rank; a tie goes to the nearer in meaning, since
  a first word hit may hold one common word ("when do we release" had
  "Never delete images when..." first). Near 0.30 / Within 0.15 come from
  97 real memories and 16 queries, half Chinese for English memories:
  12 of 16 sought found with ~4 others each. Rank searches without noting
  memories used.
- GUI: the Search by meaning row (download %, memories read, failures),
  and the tab's search lists what the backend ranked first
  (POST /api/memory/rank), then word matches. zh, zh-TW, ja, de.
- docs/subsystems/memory.md: the section, out of "Not built yet".

Why not multilingual-e5-small, which this was built on first: run for
real, its cosines sat at 0.78-0.89 for everything, and a Chinese search
ranked Chinese memories over the English one it meant. e5-small, e5-base
and MiniLM were compared in ONNX Runtime on the same 97 memories; MiniLM
put the sought one first 9 of 16 and in the top 3 12 of 16, with the
rest at a median cosine of 0.16.

Run before the rebases (mote, on origin/main as of the work):
- gofmt -l internal/ clean; go vet of memembed, memory, pii/..., gui,
  library; GOOS=linux and GOOS=windows vet of memembed and pii/guard.
- MAGPIE_EMBED_DIR=~/models/pml go test -run Embedder ./internal/pii/guard:
  7 texts (CJK, full width, emoji, digits before runs of spaces) at
  0.9962-1.0000 with ORT int8.
- go test memembed, memory, memdistill, pii/..., library, browsermcp.
- Linux (magpie-desktop, -tags nogui, mote's disk was full): go test
  memembed, memory, pii/guard, gui (461s), cli (1228s, past the default
  10m timeout, so -timeout 30m); gateway -run 'MemoryMCP|OwnMCP'.
- Rebased on origin/main 3ebb1ba2c, on mote at this tree: gofmt -l
  internal/ clean; go vet of memembed, memory, pii/..., library, gui,
  gateway, and GOOS=linux and GOOS=windows vet of the first four; go
  test memembed, memory, pii/..., library, browsermcp (Embedder test on
  ~/models/pml); gateway -run 'MemoryMCP|OwnMCP'; cli -run
  'Settings|Parity|Budget'.
- Rebased again on origin/main 5d6935b11 (title bar, cli parity,
  account export, provider catalog): go vet of gui and cli; go test -run
  'Settings|Parity|Budget' of cli and gui, ok with the Bark test fix two
  commits up (TestSettingsSaveKeepsWhatItDoesNotSend, red on main).
- GUI on mote, this commit plus the next (90f4a377b, which fixes
  library-bar-more for #5982): every library-*.test.cjs, i18n-keys and
  i18n-en-no-cjk, BROWSER=chromium and webkit, 701/702 each. The red is
  library-loading's tab list, which has no "Claude plugins" (6af54dc9a)
  and is red alone at origin/main faffb1e95 (#5997). library-bili's
  webkit saved count times out about 1 run in 3, on main too (#6015).
- A real switch-on: the pinned files downloaded from Hugging Face and
  checked in 11s, 5 memories read; 什么时候上线, 端口被占用怎么办, 清理磁盘,
  回复用什么语言 and "when do we release" each find their memory first.
  缩进用什么 finds nothing (0.23 to the tabs memory, under Near).
- Broken by hand: without the tie rule, TestSearchFindsByMeaning's new
  case is red (images first).

Not run: the whole Go suite and the whole GUI suite; go test of
internal/gui and the whole of internal/cli after the rebases (WSL kept
restarting, and they passed on Linux before).
2026-11-11 04:14:58 +08:00
yetone 47e30d0e97 gui: the Mac's title bar drags while a dialog is open, and the bar's middle does everywhere (ssuuuuooo on X)
v0.1.3624 added the .modal-grip strip but it could not work on the Mac:
there the scrim begins under the bar (body.window.mac .modal top: 50px),
so the strip sat below the bar, while the bar itself (header, sidebar top)
is inert whilst a dialog is open (modalBackground), and an inert element
is not hit, so nothing there carried --wails-draggable. On Windows and
Linux the strip worked only at the sides: the dialog's 16-28px top padding
let a tall dialog (the provider editor) lie over the strip's middle.

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

Run (mote-run, chromium and webkit): modal-title-drag.test.cjs gains
"the middle of the title bar drags with a tall dialog open" (web and mac
classes, 5 x 3 points along the bar, header inert): 0 of 4 on the old css,
4 of 4 now. With modal-*, dialog-*, add-sheet*, signin-closes-sheet,
sidebar*, click-scroll, panel-drag-linux, title-bar-tools, i18n-keys,
popover-mac-chrome, editor-roomy: 351 pass; the 3 reds of that run
(modal-centred-late, sidebar-overlay-scrollbar webkit, title-bar-tools
zh-TW webkit) pass 36 of 36 rerun alone at this tree, and
sidebar-overlay-scrollbar webkit also failed once on the base (load).
Not tried: a real drag in the signed macOS app (the test checks the
--wails-draggable value under the pointer, which Wails reads); the
confirmation (action-confirm, top layer) still has no strip.
2026-11-11 04:09:07 +08:00
yetone b9f8548d22 accounts: export ChatGPT and Claude accounts as Sub2API or CLIProxyAPI files (heyiwei5 and Rk1ngggg on X)
WIP commit before the full checks; body rewritten at ship.
2026-11-11 04:07:09 +08:00
yetone 696556e26c provider: Google Vertex AI takes an API key (express mode) and a base URL (Langanpaibian on X)
Vertex AI could only be signed with gcloud credentials and a project id.
A provider now takes one API key instead: a Key with no project is Vertex
express mode, asked at https://aiplatform.googleapis.com/v1/publishers/
google/models/<model>:streamGenerateContent with the key in x-goog-api-key
(Google's docs), no project, no token minted. Express serves Gemini
models only, so Base(Chat)/Base(Anthropic) are empty and the models list
drops partner and Claude models. A key with a project is asked at the
project's address, signed by the key. Vertex.BaseURL (optional, /v1
stripped) replaces Google's host for a keyed provider, such as a proxy.

Security: a Google token or gcloud credentials go only to Google's own
address. A BaseURL is honoured only with a key, and the key is the only
credential sent there; without a key Save refuses it and a providers.json
holding one has it dropped on load.

Wired through: provider.Save/normalize/Sign/Base/planModels, `magpie
provider add google-vertex <key>`, `provider key`, `provider set ... url=`,
`provider <id>` and the list, the editor's API key and Base URL fields
(app.js, 4 translations each), the Providers row pill, and the
providers-accounts subsystem page.

Run (mote-run): gofmt -l clean; go vet for darwin, linux -tags nogui and
windows over ./...; go test -run Vertex for provider, cli, gui, gateway
and tui, all green, with new tests TestVertexExpressKey,
TestVertexExpressBaseURL, TestVertexExpressEditor (fake server) and the
gateway's TestVertexExpressStreams (chat, streamed and whole, asks
/v1/publishers/google/models/... with the key header, no token minted);
vertex-editor, i18n-keys and ledger-protocol GUI files in chromium and
webkit (en and zh editor flows; the i18n check covers zh, zh-TW, ja, de).
Broken by hand: Sign without x-goog-api-key turns the provider, gui and
gateway express tests red. The existing tests that pinned "a key is
refused" now pin the new rules.

Not tried: a real Vertex AI key (no account on hand; the endpoint and
header are from Google's express-mode docs, the tests use fakes), the
full GUI suite in webkit, Windows and Linux runs of the tests.
2026-11-11 03:54:21 +08:00
yetone 71c4ef2d07 gui: Bark push target for every alert, and a daily spend summary (EV_John_Liu on X)
Settings > Usage has a Bark row: a server (default https://api.day.app, or
a self-hosted one) and the device key, then Test and Remove. Every alert
that goes through notifier.sendAs (allowance, balance, reset reminder, task
done, masking, sign-in) is also pushed to Bark when a key is set, whether or
not the system lets this computer notify. A second row, once a key is set,
turns on a daily summary at a time of day: today's cost and request count,
and each window or balance near its cap (the Allowance alert's share, else
80%), capped at 8 lines. It is pushed once a day (a restart does not resend;
a failed push is retried every 15 minutes; one more than 6 hours late is
left), in the page's language (en, zh, zh-TW, ja, de).

The device key is a key: the page only gets barkKeySet, never the key; it has
its own route (POST /api/settings/bark, key omitted keeps it, "" removes it),
a Settings save carries it (settingsapi.Merge), and a backup or sync without
keys leaves it out and keeps this machine's. No log line or error names it
(the Bark client replaces it with "..." in what the server or client says).
bark.js is a lazy module so app.js (budget) gains one line.

Run (mote, at the pushed tree before the rebase onto 6d7862769):
- go test ./internal/bark ./internal/settings ./internal/settingsapi
  ./internal/backup ./internal/davsync ./internal/provider: ok.
- go test -run 'Bark|AlertsGoTo|GitHubToken' ./internal/gui: ok. go vet
  darwin, GOOS=linux -tags nogui and GOOS=windows over gui, bark, settings:
  clean. gofmt -l: clean.
- GUI: bark.test.cjs (5 languages x 900/380px x chromium/webkit), i18n-keys,
  i18n-en-no-cjk, usage-alert: pass. Whole GUI suite started; reds so far are
  in account/agent/checkin tests that do not touch Settings or Bark, filed
  separately after this tag; old-webkit's Safari 15.0 :has() is #5919.
- All against fake servers; nothing reaches the network.
Broken by hand, each went red: no barkPush in sendAs
(TestAlertsGoToBark), BarkKeySet forced true / key shown (TestBarkSettingAndTest),
no same-day check in the daily step (TestBarkDailyStep).
Not tried: a real Bark device or the real api.day.app; win-run and wsl-run
(vet only for those OSes); a self-hosted Bark server.
2026-11-11 03:41:37 +08:00
yetone 6af54dc9a9 library: Claude Code plugins kept as one item, with a Claude plugins tab (FakeshadowzZ on X)
A Claude Code plugin (.claude-plugin/plugin.json, skills/, agents/,
hooks/hooks.json, .mcp.json) can be installed into the Library from a
folder, a git address or a marketplace.json, and is one row: turned on, off
or removed as a whole, and given to the agents picked with the chips every
tab has. Its skills, MCP servers, hooks and subagents are ordinary library
items tagged Bundle: <plugin>, so each agent gets them through the code of
its kind and the Skills, MCP servers, Hooks and Subagents tabs go on
working. Off clears every part's agents and keeps them for on; Remove
removes the parts. A part whose name the library has gets the plugin's name
as a prefix, never over the user's own. Claude hook events and matchers map
to the portable ones; others become claude:<Event>, for Claude Code only.
Slash commands, LSP servers and non-command hooks are listed as not
carried, not dropped. internal/library/plugin.go, POST /api/library/plugins/*,
the Claude plugins tab in plugins/library/client.js (en, zh, zh-TW, ja, de),
docs/subsystems/library.md.

Run (mote): go test -tags nogui ./internal/library ./internal/gui
./internal/backup ./internal/davsync ok; gofmt clean; go vet darwin, linux
(-tags nogui) and windows clean. GUI, chromium and webkit, en zh zh-TW ja de
at 420 and 1100: library-plugins (new), library-hooks, library-subagents,
i18n-keys, i18n-en-no-cjk, click-scroll all pass. Whole GUI suite started
and cut short at ~460 of its tests: failing only account-dragging and
accounts-sheet (routing, untouched by this), not compared on origin/main.
Broken by hand: dropping the Off handling in givePlugin and the hookTakes
filter each turned the new Go tests red.

Not tried: a real Claude Code plugin from a marketplace, a git source
(tests use folders), WSL, Windows. Not carried yet: commands/*.md, LSP
servers, a plugin's folder across computers (a backup carries the parts, not
the plugin record).
2026-11-11 02:55:15 +08:00
yetone 5df062f0f2 provider, gui: a Claude account with its provider switched off shows its last reading, or says it is switched off, not "No allowance reported" (Kunlin03 on X)
Kunlin03 (Pro subscription, "Claude Code" switch off): the account's card
said "暂无额度数据". LoginUsage returns nothing for a provider magpie leaves
alone (switched off or removed, leftAlone), so /api/login/usage answered {}
and the card had neither a reading nor an error, although left_alone.go says
what was last known is still shown. Pro versus Max is not the cause: the
read itself (Claude Code's /usage) is the same for both.

LoginUsageShown, used by /api/login/usage and `magpie accounts`, answers such
an account from keepLast (its last reading, readDeferred, "not refreshed this
time") and, with none kept, errLeftAlone, which the card words as "Switched
off, so no allowance is read — switch it on and refresh" (4 languages).
LoginUsage itself is unchanged: warm-ups and switching act on it and must
not take a kept reading for a fresh one. Nothing is requested for a provider
left alone.

Not changed: the Usage page and a card refresh for an off provider (they
read through loginReading as before). Not tried with a real Claude Pro
account; the sandbox has none.

Run (mote): TestLoginUsageShownOfSwitchedOffClaude (red without errLeftAlone
in readDeferred), claude-off-usage-card.test.cjs in chromium and webkit, 5
languages, 2 widths (red with the quotaError branch removed), gofmt, vet
darwin/linux nogui/windows, the provider, cli and gui packages, i18n and
account/usage GUI files.
2026-11-11 02:40:18 +08:00
yetone 1d41799f2a agent: turn off every agent's telemetry from Settings › Privacy (OipsAnthony on X)
OipsAnthony on X: "magpie 设置 - 隐私,支持统一关闭所有 Agent 的遥测功能,
这个统一管理的地方优先级最高". v0.1.3562 gave Codex, Claude Code, Gemini
CLI and Qwen Code a Telemetry row each; there was no one switch for all.

Settings › Privacy now has "Turn off telemetry for all agents"
(settings.AgentTelemetryOff, POST /api/settings/agent-telemetry,
agent.SetTelemetryAll in internal/agent/telemetry_all.go):

- On: every agent found here with a telemetry switch is turned off through
  its own switch and that switch's rules (only keys the file lacks are
  written; a value of the user's own that keeps telemetry on is never
  written over: the agent stays on and the reply's "refused" names it
  and why). Each agent the switch turned off gets a stash marker,
  <id>.telemetry.all. An agent found later is turned off on the next
  state the window reads and by a one-minute gateway loop
  (KeepTelemetryAllOff, in WhileServing).
- While on, each agent's own Telemetry row shows off, says "Off for all
  agents in Settings › Privacy" and its buttons are disabled; the API
  refuses it too (ErrTelemetryAllOff).
- Off: only the marked agents are turned back on, which takes out only
  magpie's keys. An agent off by its own row or the user's own config
  before stays off.
- An unreadable settings.json is unknown: nothing is written.
- The setting is per computer (KeepOwn) and the generic settings POST
  can't change it (settingsapi.Merge carries it).

app.js pays for its ~650 bytes with ten Privacy-section comments cut
(core 1,533,550, under its 1,533,802 budget, no raise).

Run (mote, first on 10bef5fe0):
- go test -count=1 ./internal/agent ./internal/gui ./internal/cli
  ./internal/settings ./internal/settingsapi: ok, except gui's
  TestSettingsSaveKeepsWhatItDoesNotSend, red as it should be for a new
  field; with AgentTelemetryOff in its fixture it and the budget and
  parity tests pass (-run).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: clean.
- GUI, chromium and webkit: privacy-*.test.cjs (new
  privacy-agent-telemetry: 5 languages x 1100/640px plus a refused case
  in each engine, no scroll on click, no native select), i18n-*,
  agent-telemetry, settings-search, click-scroll: 218 of 218 pass.
- The whole GUI suite (1,367 files) was started under ~/suite.lock and
  never got it: lockf gave up after 4h with the lock held by other runs.

- Rebased on 6a81a3c62 (this commit's parent), again: go vet
  ./internal/... (darwin) and GOOS=windows vet of agent, gui, cli; the
  Telemetry, budget, settings-keep, CLI parity and route tests; GUI
  privacy-agent-telemetry, agent-telemetry, i18n-keys and
  privacy-usage-stats in both engines: 64 of 64.

Broken by hand:
- no stash marker in keepTelemetryOff: TestTelemetryAllOff red, "Gemini
  CLI not back on".
- SetTelemetry without the ErrTelemetryAllOff check: TestTelemetryAllOff
  red, "Gemini CLI's row turned on under the switch".

Not tried: a real agent's config on this computer (sandbox HOME only);
Windows runs of the new Go tests (they skip there, a #! stand-in isn't a
command on Windows; the switch's code has no OS-specific path).
2026-11-11 02:38:58 +08:00
yetone 6a81a3c62a masking: its head's Settings link is a link, and the head wraps before it squeezes the title
v0.1.3386 (ff7d84b9b) put "Settings › Privacy" in Insights › Masking's
head as a second button.text beside Turn off masking. The whole GUI
suite, run on mote after the tag, went red on it:
- mask-alert and masking-records "masking on, the page turns it off and
  on again" found two button.text where Turn off is the only one
  (all languages, both engines);
- masking-records "the card says what was kept" at de 640px: the two
  buttons and the 7/30 days switch left the title a column ~60px wide,
  the head 276px tall, and the first request at 907px, past 760.

Now the link is a .link (as on Plugins › Built-in), and .msk-head wraps
whenever its title would be narrower than 16em, in place of the
600px media query. de 640px: head 107px, first request 738px.

Run on mote: node --test masking-records, mask-alert, builtin-places
(Chromium and WebKit, every language): 218 pass, 0 fail. Red before
this on the same files (gui-full.log of the post-tag run).
The rest of that post-tag GUI run is triaged separately; mote rebooted
mid-run twice, and its other reds are in files this change doesn't
reach.
2026-11-11 02:14:20 +08:00
yetone 5048a48d5c gui: a plugin's README renderer moves out of the core, to pluginmd.js
Discover and the new Install button took TestCoreScriptBudget 2,766
bytes over. The README's Markdown renderer moves to pluginmd.js,
imported once plugins.js has run; the core is 1,531,323 of 1,533,802,
no raise. markdown and mdLoad stay function declarations: as consts,
window.mdRender = markdown at the top of plugins.js threw "Cannot
access 'markdown' before initialization" and every page failed (the
first WSL run). The Library's skill files read through window.mdRender
too, so the import isn't left for the Plugins page to open.
old-webkit lists pluginmd.js with the other lazily loaded files.

Run record: the Discover commit's (same push).
2026-11-11 01:51:15 +08:00