Commit Graph
399 Commits
Author SHA1 Message Date
yetone 00b2c11a6b agent: Open Code Review (ocr) is an agent magpie sets up (@AlanWang1027713 on X)
Open Code Review (github.com/alibaba/open-code-review, npm
@alibaba-group/open-code-review) is a Go CLI, `ocr`, that reviews a diff
with a model. Its Claude Code, Codex, Cursor, Kimi Code and OpenCode
plugins and its skills all run that command, which reads
~/.opencodereview/config.json on every run.

Picking one of magpie's models on its row writes a custom provider
"magpie" there (protocol openai, the gateway's /v1, a key naming Open
Code Review, the model) and points provider at it. The user's own
provider and model are stashed and come back on Disconnect, which also
drops a custom_providers left empty. A model of the user's own can be
picked too (written the way `ocr config model` writes it). Check reports
a hand-edited url or key, or a removed entry. The `ocr` command counts
only under a folder named for Open Code Review, since other programs
share the name. WSL distros get the row too (cold distros not opened).
Its User-Agent, open-code-review/<version>, already counts as this agent.
CLI update via npm. Docs, READMEs, site and icon (OCR's own logo,
Apache-2.0).

Run (mica, at 593517bf0; origin/main has one unrelated usage commit since):
- go test ./internal/agent -run 'TestOCR|WSL|Wsl|TestOwnProviderNamedAsMagpies|TestHandWiredMagpieProviderSiblings|TestAgentOf|TestEveryAgentNamedByItsKey|TestMarkedLinesEveryAgent': ok
- gofmt -l: clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok
- Broken by hand: url dropped from Check -> TestOCRWiring red; stash
  turned off -> red at the Disconnect restore. TestWSLColdPlaceOpensNothing
  went red before the row's options were given an asleep path.
- Real e2e in a sandbox HOME: npm-installed ocr v1.13.10 (7e5ce06c)
  darwin/arm64, magpie built from this tree, a fake OpenAI upstream that
  calls tools. `magpie agents` lists the row with the user's
  deepseek/deepseek-chat; `magpie open-code-review magpie/fake/m1` wrote
  the entry and kept the user's keys and settings; `ocr llm test`:
  connection ok, tool-call round trip verified; `ocr review` on a repo
  with a nil dereference: 2 findings "[bug · high]" through magpie
  (8 /v1/chat/completions calls, UA open-code-review/v1.13.10, model m1,
  its six review tools); `magpie usage` counts them under Open Code
  Review; `magpie open-code-review default` put deepseek/deepseek-chat
  back and removed custom_providers.
- Full suite: not run before this push (ship at once; mote was running
  another session's suite). It runs on mica right after, at this head.

Not tried: a real vendor model behind magpie; WSL and Windows/Linux
machines for real; the Claude Code / OpenCode plugin path itself (it runs
the same `ocr`); an ocr installed by the curl script outside a folder
named for it is found by ~/.opencodereview only.
2026-11-17 11:10:43 +08:00
yetone ead91a9a50 gui: a browser tab's title names this magpie: MAGPIE_NAME or Settings › Network and sharing › Advanced › Name (starballl on X)
starballl on X (tweet 2122376116220633444) runs several magpie web pages
and every tab is titled "magpie", so they can't be told apart. A magpie
now has a name, and a browser tab's title is "<name> · magpie" (plain
"magpie" with none).

- settings.Name, set in Settings › Network and sharing › Advanced › Name
  (instancename.js, imported when Settings is drawn, so nothing is added
  to app.js's core). Advanced is closed until a name is set.
- MAGPIE_NAME (Docker, magpie web) names it while the field is empty and
  is the field's placeholder. It is read, never written, so a name typed
  in Settings always wins and clearing the field goes back to it.
- One line, at most 60 characters (settings.CleanName).
- This computer's own (KeepOwn): sync and a restored backup never bring
  another magpie's name. A Settings save that leaves `name` out keeps it
  (settingsapi.Merge).
- boot.js titles a browser tab itself for the first paint, so app.js's
  core gains only the line in applyPrefs, which sets the title again from
  every settings read (TestCoreScriptBudget was 74 bytes over with a
  title function in app.js). Only a browser page (web) is retitled: the
  app's windows and tray keep "magpie".
- Docker docs (en, zh, ja) list MAGPIE_NAME; docs/reference.md and
  docs/subsystems/gui-shell.md say how it works.

Tests:
- TestInstanceName (internal/gui): the variable alone names it at boot;
  a saved name wins over it, trimmed; a save without `name` keeps it;
  KeepOwn keeps it; cleared goes back to the variable; no name, none at
  boot. Broken by hand, each red: KeepOwn without Name ("KeepOwn took
  \"other\""), Merge without the keep ("a save without the name changed
  it to \"\""), boot.js with s.Name in place of InstanceName ("named by
  the variable alone: boot <nil>"), boot.js not setting the title ("a
  browser tab's boot.js sets no title"). The app window's boot.js sets
  none.
- TestSettingsSaveKeepsWhatItDoesNotSend now sets Name: the page's other
  saves leave it out, and it is kept.
- instance-name.test.cjs: title from the first paint, the field under a
  closed Advanced, save and clear retitle the tab, Advanced open after a
  reload, 360px, the app's window keeps "magpie"; en, zh, zh-TW, ja, de,
  Chromium and WebKit, 16/16. 14 of 16 red with applyPrefs not setting
  the title.

Run, at this commit on dbbb2f26b plus 9d5d8baf2 (the site index):
- go test ./... -count=1 -timeout 45m on Linux (WSL magpie-desktop, Go
  1.26.8), at the tree before the boot.js move: 99 packages ok,
  internal/gateway included (959s); ., internal/cli and internal/gui
  don't build there without GTK headers. On mica (macOS): . and
  internal/cli ok; internal/gui/... ok at this commit, after the two
  reds that run found (the core budget, the keep test) were fixed.
- go vet and GOOS=linux -tags nogui / GOOS=windows go vet of
  internal/gui and internal/settings, earlier the whole tree on all
  three: ok. gofmt -l clean.
- site: node --test *.test.mjs, 132/132.
- GUI: the 135 files the change reaches (settings, network, LAN, i18n,
  old-webkit, core budget) on mica: 16 files had reds. Run again on this
  tree and on its base, the same tests are red on both (allow-ips
  #4357, settings-hints #6107/#6353, lan-join #6353, i18n-keys #6877,
  old-webkit #6030/#5919 and the rest of the 16) but two:
  search-mcp-library (WebKit, #4756) and gateway-pause (WebKit de 420px,
  #6684), red only beside other files: alone, 0 of 10 and 0 of 3 red on
  both trees.
2026-11-17 03:11:31 +08:00
yetone e0f9218f91 update: Restart to update goes into the newest version out, not an older download (char1es_lu on X)
char1es_lu on X: Restart to update put in a version downloaded a while
ago, and right after the restart magpie offered an update again. Since
b05a525a3 (0.1.4051) a restart never asked the feed while a copy was
downloaded and waiting (keepsStaged). The clock's check runs every half
hour or more and magpie releases many times a day, so that copy was
often a release or more behind.

Every restart now asks the feed first (recheck, a check marked
restarting). This covers the page's Restart to update, the tray's, and
the restart AutoRestart or a click waits for. If a newer version is out
it is downloaded in place of the waiting copy, and the restart goes
into it once it is in. A restart waiting for an idle gateway takes it
too: run's waiting rule doesn't apply to the restart's own check. The
clock's check during that wait still keeps the waiting copy.

The feed is still not asked in two cases:
- The copy was downloaded by a restart's own check, or that check found
  it to be the newest (restartGot). The header's Update restarts once a
  click's download is in, and asking again there was elis_pina's loop of
  downloads that never restarted. This also stops a feed slower than
  recheck's wait from asking on every poll.
- Downloads wait for a click (NoAutoDownload). The copy clicked for is
  what goes in (sakamotokurome, iiiiiimone on X).

The update dialog's freshen still names the waiting copy (keep).

Trade-off: a click may now wait for a download (canlee886's earlier
complaint). The header's Update and the tray restart by themselves once
it is in. Settings' Version card shows the download and needs a second
click, which restarts without asking again. Making the card follow by
itself needs app.js bytes, and its budget has no room (tried: 337 over).

Tests:
- TestRestartTakesTheNewestOut replaces TestRestartTakesTheDownloadWaiting.
  With a fake feed it steps 0.1.11 waiting, 0.1.12 out, through the
  page's click, the restart once it is in (0.1.13 out, feed not asked),
  the tray (0.1.14), AutoRestart's wait (0.1.16) and the dialog.
- TestUpdateStagedGivesWayToNewer now checks that a restart's recheck
  takes 0.1.13 with downloads automatic, and keeps 0.1.11 on a click.
- The recheck lines in TestUpdateClockFetchesNewerThanWaiting asserted
  the old rule and are gone.

Run (mote-run, at 9c4e87736 + this change):
- go test ./internal/gui ./internal/update -count=1 -timeout 45m: ok, ok
- gofmt -l internal/: clean
- On the old update.go, TestRestartTakesTheNewestOut and
  TestUpdateStagedGivesWayToNewer fail: "the page's click ... Latest:0.1.11,
  1 downloads, want 0.1.12 after 2".
- Broken by hand:
  - Without restartGot set: "the restart once it is in: Latest:0.1.13,
    the feed asked 1 times".
  - With run's old waiting rule: "AutoRestart restarted into 0.1.15,
    want 0.1.16".

Docs: gui-shell.md "When an update downloads" and reference.md.
Not tried: a real release feed and real app restart; the fake feed
covers the updater only.
2026-11-16 16:37:40 +08:00
yetone 56c988cb5e gateway: /v1/realtime passes a Realtime API session on to its provider (Qwen Token Plan's realtime voice)
gaubeebangeel (X) set up Qwen's Token Plan in magpie and couldn't use its
realtime voice: magpie had no /v1/realtime, so the WebSocket upgrade got a
404. Token Plan does cover realtime: qwen-audio-3.0-realtime-plus at
wss://<plan host>/api-ws/v1/realtime?model=… with the plan's sk-sp- key,
OpenAI Realtime events
(platform.qianwenai.com/docs/token-plan/best-practices/realtime-voice).

GET /v1/realtime and /realtime upgrade to a WebSocket after the same Front
guards as every route (lanGuard, corsGuard, keys, the rebinding check),
plus a same-origin check on the socket's Origin. The model resolves as on
the other routes (a bare id unlisted anywhere goes to the one DashScope
provider that is on), with key, model and account holds, and each try is
dialled in turn with the account's key. A DashScope base ending
/compatible-mode/v1 dials /api-ws/v1/realtime; any other base dials
base+/realtime (OpenAI). Frames go both ways as they are; a close goes on
with its code and reason. Text frames are masked going up and restored
coming down (audio appends and deltas are not), failing closed. Each
response.done's usage is recorded as a "realtime" call (cached input as
cache read). openai-insecure-api-key / organization / project
subprotocols never go upstream. Shutdown ends open sessions with 1001.
/realtime is a client route on magpie web's port (and in the LazyCat
manifest), and a read-only key is refused it.

Run (mote, at this tree):
- TestRealtime* (fake upstream WebSocket, no network): Token Plan path,
  echo, binary, close both ways, usage 60 in / 40 cache read / 20 out,
  OpenAI-style path, subprotocol filter, masking; guards: 426, 400, 404,
  Origin evil/null/localhost subdomain 403, rebound host, remote without
  key 401, key held to another provider 403, vendor 401 passed on.
- Broken by hand, each went red: subprotocol filter removed, masking off,
  cached tokens not subtracted.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: clean.
- go test -count=1 -timeout 45m ./internal/gateway ./internal/masking
  ./internal/gui: the first run found TestClientPathCoversHandler,
  TestReadOnlyKeyEveryRoute and then TestLazyCatManifestListsTheClientRoutes
  red, all fixed here and rerun green. Otherwise ok. The log has one
  recovered "close of closed channel" in continuation_test.go:781's
  doneHold fake upstream (a test fake this change doesn't touch; in both
  runs), already filed as #6505 (and its duplicate #6690).
- Rebased on origin/main 6dbd6e5b1 and rerun at the rebased head: the
  TestRealtime* tests, the three route-list guard tests, gofmt -l, and
  GOOS=linux / GOOS=windows go vet ./internal/gateway.

Not run: the full ./... suite at any head (mote at load ~22-33 of 18, mica ~66 of
12). Not tried with a real Token Plan account or a real Realtime client.
2026-11-16 15:31:53 +08:00
yetone 50f7a8e01f routing: a Smart row behind one renewing sooner says so; Smart says new conversations go there too
YsiCing on X: in Smart, every conversation went to one Codex account (pro,
74% of its week) while Business and team, both at 0%, said "已用 0% · 会话留在另一个账号" ("0% used · the conversation stays on another account").
That is what Smart is meant to do. It sends every request, new
conversations included, to the one account whose quota renews soonest, and
only Stays: Session or Strict spreads new conversations. But the row blamed
a kept conversation, and the Smart description said "one account at a time"
without saying that covers new conversations, plus "at 90%", which is wrong
for a week since d5d48f4f9.

- routing plugin client.js behindWhy: when the account in use also renews
  sooner, a row says "{n} used · one renewing sooner goes first" (and
  "renews in"/expires as before), not "kept"; "kept" is left for a row that
  would have gone first without the kept conversation. Four languages.
- The Smart description (app.js, i18n.js) now says every request, new
  conversations too, goes to the one account renewing soonest until it
  runs low. app.js is 4 bytes shorter; the budget is not raised.
- docs/reference.md: Smart is not load balancing; to spread conversations,
  set Stays to Session or pick Least used first.

Run:
- routing-behind-why.test.cjs on mote with the old client.js: 62 fail,
  40 pass (the "kept on the one renewing sooner" and "fresh" cases, both
  engines, all 5 languages). Green on the new code.
- mica-run go test -tags nogui ./internal/gui -run
  'TestCoreScriptBudget|I18n|Lang': ok. gofmt -l internal/: clean.
- GUI subset on mica at base c867a12c5: routing-*, i18n-*, account-arrange,
  account-weight, builtins, gateway-model-info, key-weight, rotate-figure
  and update-blocked (203 files). 3482 passed, 20 failed. I reran the 7
  red files at base c867a12c5 and with this change, one after the other:
  the same 17 are red at base (#6520 routing-signin, #6010 account-arrange,
  #6512 pin-away, #3799 row-swap, #3954 story-shrinks, #5647 pulse under
  load). routing-stage-routes 420px is red once in en and once in zh, on
  rows with no Smart account, a single read of the on class: #6830.

Not tried: real Codex accounts (fixtures only), and the Linux app's
WebKitGTK.
2026-11-16 14:40:53 +08:00
yetone 2649d5d727 agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).

Run:
- mica, at this tree (rebased on 574b7b96f): gofmt -l clean; go vet (darwin), GOOS=linux
  -tags nogui and GOOS=windows go vet of internal/agent, cli, agentenv;
  go test -tags nogui -count=1 -timeout 45m ./... -> ok, 101 packages. An earlier run on mote
  was red in internal/library's TestEveryAgentInLibrary (dim had no
  Library place); dim is now in noLibrary as "not looked at (#5897)".
- Broken by hand: DIM_API_FORMAT=openai-chat turns TestDim and
  TestDimRun red; dropping shell(false) turns TestDim red (function
  kept in .zshrc).
- Real dima 0.1.0-alpha.24 on mote, sandbox HOME, sandbox magpie serve
  on 127.0.0.1:38600 with a fake OpenAI upstream: `magpie dim
  magpie/fakeup/echo-1` wrote dim.json and the .zshrc function; `zsh -ic
  'dima exec -p "reply with one word"'` answered through the gateway
  (upstream got POST /v1/chat/completions, model echo-1); usage.jsonl
  recorded agent "dim"; `magpie dim default` removed the file and the
  function, and dima ran as npm installed it. Dim's home was never
  written by magpie.

Not tried: a real model provider (only the fake upstream); Windows and
WSL runs (the shell function is this machine's home only, no WSL
distro support); a Library target (skills, MCP, instructions; #5897); Dim's interactive TUI beyond
exec -p and --version.
2026-11-15 17:16:57 +08:00
yetone bbe5c952f1 settings: Update source moves from Network to About, under Download source (WeltAn_X on X)
WeltAn_X on X: the source updates come from sits in Settings › Network and
sharing, though it is an update setting. Update source (Automatic,
usemagpie.ai only, GitHub only) is now the row right under Download source
in Settings › About, with Automatic updates, Update channel and the other
update rows. Same menu, same updateSource value, same save; the Network page
loses the row. App updates' proxy stays on Network, beside the other
proxies. No new tab, label or line.

It goes under Download source rather than above it: placed above, the
About page scrolled at update-mirror's 420px window, and Use a mirror…
then slid Download source 2-10px. That slide is on main too in a shorter
window (#6739), not fixed here.

Docs: the Mirrors page (en, zh, ja) and reference.md say About › Update
source; llms-full.txt and the search indexes are regenerated.

Run at 60ebaea03 + this change, on mica; rebased since onto 02f1cee79,
which touches only internal/plugin, internal/provider, internal/cli and a
subsystem page:
- gofmt -l internal: clean. go test -tags nogui ./internal/gui/...: ok
  (TestCoreScriptBudget included). node --test site/*.test.mjs: 132/132.
- GUI, chromium and webkit: settings-update-source (en, zh, zh-TW, ja, de at
  1100 and 420px; now opens About, the row is under Download source, none
  on Network), update-mirror, update-channel, update-auto, update-restart,
  settings-search, settings-sections, settings-places, settings-general,
  settings-update-proxy, settings-plugin-proxy, about-log, about-notices,
  about-report, about-website, cli-path, uninstall-settings, click-scroll,
  i18n-keys, i18n-en-no-cjk: all ok.
- Reds that fail the same on origin/main 2e1c0a377, run there on mote:
  old-webkit's two (#6030, #5919), settings-hints ja/de 420px (#6107),
  settings-lines-wrap chromium de 440px (#6353).
- The new settings-update-source is red 20/20 on origin/main 2e1c0a377.

Not tried: the real app; the GUI tests stand in for it.
2026-11-15 14:55:33 +08:00
yetone b466aa2803 update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.

What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
  cron) the newest tag whose commit has a successful Test run and whose
  release has all 17 assets is picked and kept in LEDGER "daily". A day
  with none keeps the day before's; a failed GitHub read writes nothing.
  /api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
  and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
  ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
  kept); the feed is asked channel=daily, never falls back to GitHub's
  latest, What's new lists every change since yours. Settings > About >
  Update channel has Every version / Daily / Stable; the version row says
  "Up to date on Daily (· {v} is out on Every version)". CLI: magpie
  update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
  for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
  420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
  Daily words, packed to one t() per choice; Settings and renderUpdate
  draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
  llms-full.txt, search indexes.

Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.

Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
  ./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
  included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
  i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
  GOOS=linux -tags nogui.

Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after 9cd5f3652, so the two site freshness tests were red.

Filed: #6730, engines.magpie is never read, so a plugin needing a newer
magpie installs on Stable (0.1.3078) and fails without saying why
(page-amp-usage >=0.1.3681, middleware-company-guard >=0.1.3841,
page-day-card >=0.1.3427).

Not tried: a real self-update on Daily, a real docker-daily workflow run,
the whole GUI suite, the worker's unauthenticated GitHub reads under a
rate limit.
2026-11-15 13:10:18 +08:00
yetone 6256d9956a gateway keys: a limit can follow a subscription account's own window (ljayic on X)
A key's limit gains the period "account": it names one subscription
account ("<provider>/<user>") and one of its windows (5h, Weekly, Monthly,
...), and starts and resets when that account's window does, at the reset
time in the account's last good reading (quotas.json), never asked of the
vendor on the request's path (provider.AccountWindow).

When the window can't be read (no reading yet, no such window, or its reset
has passed with no reading since), the limit is "reset unknown": it is
neither reset nor lifted. It counts from the latest time the window can't
have begun before (the reset that passed, else when the limit was set), so
it counts at least the window's calls; a refused call gets Retry-After 300
and a 429 saying the window can't be read now, and the accounts are read
again in the background at most once a minute.

GUI: Gateway keys -> a key's limit -> Window -> "An account's window", then
an app-menu picker of the accounts' windows as read (GET
/api/caller-keys/account-windows); the row reads "$x / $y · 5h of
codex/...", and an unknown reset reads "resets with the account's window".
CLI: magpie gateway-key limit <id> account --account codex/me@example.com
--window 5h --tokens 2m. i18n zh, zh-TW, ja, de. reference.md and
gateway-routing.md say it, with the fallback.

Run (at this tree, base ec8125e68, rebased onto 1ac137e10 which touches
none of these files):
- gofmt -l clean; go vet darwin, linux (-tags nogui), windows clean (mica).
- go test -count=1: internal/access, internal/budget, internal/provider,
  internal/cli, internal/gui ok (mica). TestEveryRouteHasACommandOrIsNamed
  was red until the new route was named (magpie quota).
- New: TestAccountWindowLimit (budget), TestAccountWindowFromLastReading and
  TestReadAccountWindowsOnceAMinute (provider), TestParseAccountWindowLimit
  (cli), TestCallerKeyAccountWindowsRoute (gui). Broken by hand: the unknown
  branch made to guess a 5h window from now -> TestAccountWindowLimit red
  ("let through on a window not read").
- GUI: gateway-key-account-window.test.cjs, chromium + webkit, en zh zh-TW
  ja de, 500px, no native select: 10 of 10 (red without the keys.js and
  i18n change). Every GUI file that loads the caller-keys fixture or the
  Gateway keys page, plus i18n*: 1064 tests, 1046 pass, 18 red, the same
  18 red on origin/main ec8125e68 alone: api-key-theme (6, #6444),
  gateway-key-arrange 420px (10, #6268), text-size webkit (a subtest and its test, #6561).
Not tried: a real Codex/Claude account's window through a live gateway;
the full GUI suite (mote and mica each had a full suite running).
2026-11-15 03:50:46 +08:00
yetone cd030691a3 gateway: the chat page's turn is held to its key's MaxConcurrency (#6688)
6bdeedc6f added the /deepseek-chat routes without judging them for a
gateway key's MaxConcurrency or the LazyCat manifest, so
TestKeySlotEveryRoute and TestLazyCatManifestListsTheClientRoutes were red
on main. The first was a real gap. The page's turn asks a model through
the Messages route's handler, called in process (chatInner), past
keySlots. A key capped at one slot could therefore run a chat page turn
beside an agent's request, with nothing waiting.

- keySlotRoutes: the page's messages route is lazy, so its rounds' tries
  take the key's slot (chatInner's clone keeps the hold in its context),
  and asr and tts are eager. The file upload and delete routes are free
  (keySlotFree): they are kept in magpie and never sent to a model.
- docs/reference.md's LazyCat manifest makes /deepseek-chat public, as it
  does the key page (/me), for a key's holder who isn't signed in to the
  box. The page's static files are keyless already; every call it makes
  still needs a gateway key.

gofmt realigned keySlotRoutes for the longer key.

Run: go test -tags nogui -count=1 -timeout 45m ./internal/gateway on
mica: ok (1005s). The new TestKeyConcurrencyChatPage is red with the
messages entry taken out of keySlotRoutes ("timed out waiting for the
chat page's turn waits for the key's slot"), broken by hand on mica.
2026-11-15 00:38:06 +08:00
yetone 3ffac60480 docs: the management API's routing groups and the app's switch for it (#6307)
docs/reference.md's Management API lists the routing-groups routes
(list, get, create, update and the Routing page's actions), says they are
checked as the app checks them and that found/skip are not served, names
the key menu's Advanced switch beside `magpie gateway-key admin`, and
drops "this first part leaves out Routing Groups": what is left out on
purpose is the export of sign-ins, which would hand out every account's
secrets. docs/subsystems/gateway-routing.md says how the routes reach
/api/groups (adminGroupActions, adminGroupWrite over provider.SaveGroup)
and names the tests. The site's remote page says the same in en, zh and
ja, and public/llms-full.txt is built again from it (node llms-full.mjs,
on mica).

Run: site's worker.test.mjs (llms-full current) in the full run before
the push; no code changes here.

Run for the three #6307 commits (mica, at 4eafd9963 on 90efddaba's
successor, then the touched tests again after rebasing onto 221c91fae):
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. Builds (darwin, linux nogui, windows): ok.
- site worker.test.mjs: 41/41 (llms-full.txt current).
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  two, both red on origin/main and filed: internal/cli
  TestEveryRouteHasACommandOrIsNamed (POST /api/providers/delete, #6677)
  and internal/tui TestEveryWordHasZh ("permission mode", #6686).
- At 221c91fae + these: go test -run 'Admin|Group' ./internal/gui ok;
  gateway-card, gateway-key-admin, gateway-chat-page in both engines
  62/62; i18n-keys, i18n-en-no-cjk 8/8.
2026-11-15 00:16:11 +08:00
yetone ed82d8fab1 agent: a plugin's connect is given magpie's decision models as decisionModels
An agent plugin's connect() got only chat models in `models`, and
/v1/models leaves decision models out too, so a plugin had no way to
learn magpie's Jev, Clef or plugin `decides` models, though
/v1/systemone and /v1/decisions answer them (baranwang on X,
tweet 2121551068022915149).

connect's input now has `decisionModels`, apart from `models`:
provider.OfferedDeciders (what /v1/models lists under
X-Magpie-Deciders), then the decision routing groups, each
{ id, name, provider | group: true,
  endpoints: ["/v1/systemone", "/v1/decisions"] }, [] for none.
`models` and /v1/models are unchanged. Docs: reference.md,
agent-wiring.md, site plugins page (en, zh, ja) and llms-full.txt.

Run at 87f358b70's tree rebased on 659ca3f02 (a gateway-only parent; the
plugged tests re-run there: ok), on wsl-run, magpie-desktop; mote was at load 75-150, mica's disk full):
- go test -tags nogui -count=1 ./internal/agent ./internal/agentplug: ok
  (agent 191s)
- go vet (linux), GOOS=windows and GOOS=darwin go vet of both: ok
- site: node --test worker.test.mjs -n llms-full: ok
- gofmt -l: clean
Broken by hand: connect given decisionModels [] makes
TestPluggedConnectSeesDecisionModels red (jev and the group missing).
Not run: the full go test ./... before the tag (another session's full
suite held the WSL box, mote over its load); run after, recorded on
the issue/next commit. No real third-party agent plugin tried with it.
2026-11-14 18:55:12 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

Cause: Sync's `failover` in codex.go wrote
`openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash
codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the
gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with
another of its accounts on (#1385), on every start and Sync, unless the
user had disconnected Codex or turned on "Only switch Codex's sign-in".
The row said not connected while every request went through magpie.

Fix: failover writes nothing any more. A Codex that isn't wired or
using magpie as its provider gets what failover wrote before taken out
by Sync: the marked base URL, or the mirror's base_url. A base URL the
user wrote by hand has no mark and stays (#856). Failover between Codex
accounts comes with connecting Codex. modelOptions no longer counts
failover as through magpie, so a pick of Codex's own model on the
Agents page doesn't go via magpie. codexProxyOK (the proxy probe only
failover waited for) is gone. The CLI's and GUI's switch-only lines,
reference.md and the subsystem pages say failover is for a connected
Codex.

Users already affected: the first Sync after updating (magpie's start)
removes the marked openai_base_url or mirror base_url, and the route
change restarts Codex's app-server; Codex then goes straight to OpenAI
on its own sign-in. A thread opened while it was on magpie keeps its
provider until reopened, as after Disconnect.

Tests:
- TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex
  not connected; SyncCatalog, Sync twice and a model pick leave no
  base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly.
- TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked
  mirror base_url from before are taken out, bytes restored exactly.
- TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror,
  disconnect-stays and proxy/EndFailover tests reworked to seed the
  old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn
  deleted with codexProxyOK.

Red on the old code (old codex.go + codex_proxy.go, new tests, mote):
TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut
and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's
line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`;
TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at
magpie.

Run (mote; mica's disk is full, 100% with other sessions' runs, and
mote's load was ~17-25 of 18):
- At base b592c1fde: go vet ./... (darwin, GOOS=linux, GOOS=windows)
  ok; go test -timeout 45m ./... 98 ok, two reds:
  TestEveryRouteHasACommandOrIsNamed (fixed on main by 69946f43c) and
  TestCoreScriptBudget, mine (+24 bytes) - the GUI string was shortened
  to fit, no raise.
- Rebased on a63923e3d (what main changed since the base: agent, cli,
  gateway, gui, provider, sessions): gofmt -l clean; go test
  ./internal/agent ./internal/cli ./internal/gui ./internal/provider
  ./internal/sessions all ok. Then rebased on 943404477 (GUI tests
  only below run there).
- GUI (chromium + webkit, every language, both widths): switch-only,
  agent-failover, i18n-keys, i18n-en-no-cjk, claude-switch-only,
  panel-switch-accounts: 115 of 116; the red is claude-switch-only
  chromium 1100 en "the page doesn't move" (scrollTop 3), 4 of 12
  alone here, 0 of 9 on origin/main 943404477, on a path this change
  doesn't touch; filed as #6645 with its output. agent-switch-accounts is 20 of 24
  red the same on a fresh origin/main 69946f43c (#5925, Claude Code
  path, untouched here).

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone 7ea1e6a4b3 usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.

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

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

Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
  pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
  webkit, every language, on mote: 17 files red, rerun alone at
  concurrency 1 here 123/449 red and at origin/main 015860f2d 122/449,
  the same tests but tray-cell-click's chromium en, which is red alone on
  main too (#5215); the rest noted on #5475. tray-cell-click + panel-arrange +
  panel-page-hidden together before the last rebase (no GUI file changed
  in it): 21 of 22, the one red tray-cell-click's (#5215). At this head
  (after the move into page.js): panel-page-hidden, panel-arrange,
  panel-balance-order and i18n-keys green; the reds in key-balance-card
  (de), panel-fold, tray-cell-click (zh) and usage-cards-hide are each
  in the origin/main 015860f2d record above.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) on mica
  under suite.lock at 734f06b64 (this change before the move into
  page.js): 97 packages ok; internal/gui red only on TestCoreScriptBudget
  (fixed by the move), internal/gateway red from "too many open files in
  system" at mica's load ~65. At this head on mote: internal/gateway,
  internal/gui, internal/tui, internal/settings and internal/redact (the
  one commit rebased over) ok; gofmt -l clean; go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet ./... clean; go build ok.
- Rebased onto origin/main 667ac8bd6 (5faed634d): internal/gui (budget
  included), internal/tui and internal/settings ok on mote;
  panel-page-hidden + panel-arrange 18 of 18.
Not tried: the real tray panel by hand on a live install.
2026-11-14 14:10:24 +08:00
yetone b005d1a473 update: a fresh install of Stable's version stays on Stable (fishmagic80 on X)
The site now offers Stable's downloads, but the app's Update channel is
Every version until changed, so a Stable install was offered the newest
at its first check. Before that check, a fresh install (no version run
before and magpie's folder new, from whatsNew.start) asks the feed for
Stable's version and the newest; when it is Stable's and a newer one is
out, settings take "updateChannel": "stable" (settings.TakeStable, under
the file lock, keeping a channel already set). A feed that can't be read
is unknown and asked again at the next check. A version that is both
Stable's and the newest stays on Every version: its download can't be
told apart. update.LatestStable never falls back to GitHub.

docs/reference.md and the privacy pages (en, zh, ja, llms-full.txt) say
a fresh install asks ?channel=stable once.

Old installs: nothing changes for them. Until a release with this
becomes Stable, a Stable download (0.1.3078 today) is still offered the
newest unless Settings → Update channel is set to Stable.

Run at 936c70756, on mote: gofmt -l internal/ clean; go vet (darwin),
GOOS=linux and GOOS=windows go vet of internal/gui, update, settings ok;
go test -count=1 ./internal/update ./internal/settings ./internal/gui ok
(gui 99.9s). TestFreshStableInstallStaysOnStable goes red (2 subtests)
with the takeStable call removed (broken by hand, on mica). llms-full.txt
regenerated and current.
Not run: the full go test ./... (mote and mica each had several suites
queued on the lock); not tried with a real Stable install.
2026-11-14 12:17:40 +08:00
yetone b325718f0a antigravity: turned-away lines go reworded, not broken up; Antigravity min 0.1.12 (#1118)
Since 11-14 Google's check reads past invisible characters. A system
prompt with Claude Code's billing line and Agent SDK line, broken up
with two U+200B in every word as the cloak sent them, was turned away
5 of 5 with the bare 429 "Resource has been exhausted". Claude Desktop's
Code tab through magpie to Antigravity failed every turn (hc295971796
on X, tweet 2121429628019781849), and on v0.1.4110 with the Antigravity
Cloak plugin Antigravity hit 429 very often (daoche_wuzui, tweet
2121432333769433178).

The built-in cloak (codeassist.go) now rewords each line Google turns
away, in plain words:
- the x-anthropic-billing-header line is left out to its line's end; a
  system part or message holding only it is dropped;
- "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent
  SDK by Anthropic";
- Codex's "based on GPT-5" -> "built on GPT-5";
- Hermes' "created by Nous Research" -> "built by Nous Research";
- omp's RFC "keywords" -> "key words".
A copy an older magpie or middleware broke up (U+200B, U+2060, soft
hyphen, inside or between words) is matched and reworded as the line.
The Code tab's main line passes as written and is kept.

The plugins repo's packages carry the same rewording (plugins 5bb41941:
opencode-antigravity-auth 0.1.12, opencode-agy-cli-auth 0.1.41,
middleware-antigravity-cloak 0.1.7 on the dist branch). The Antigravity
mover's min goes to 0.1.12, the version dist has (these packages are
not on npm); the cloak middleware is Official and updates itself.

Run:
- real Antigravity account, sandbox HOME, gemini-3.8-flash, 10
  sequential requests each through the new plugin: Code tab main prompt
  as Claude Desktop sends it 10/10 200, Agent SDK subagent line 10/10,
  an old two-U+200B copy 10/10, Codex GPT-5 10/10, Hermes' earlier
  persona 10/10, omp's RFC line 10/10. The zero-width break went 0/5.
- mote-run: gofmt -l; go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/gateway, provider, cli;
  go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
  ./internal/cli/ ./internal/middleware/: all ok (gateway 926s);
  vet clean, gofmt clean.
Broken by hand: codeassist.go from origin/main with these tests: 6 fail
(TestAntigravityCloakClaudeCode2316, ...RewordsEveryLineItTurnsAway,
...AnswersHermesAndCodexByDefault, TestOnlyAntigravityIsSentThePrompt
Reworded, ...LineWrappedOrWidened, ...TurnsCodexsGPT5ThreadAwayOnce).
Not tried: models other than gemini-3.8-flash; the whole go test ./...
(only the four packages this touches); Claude Desktop itself (its Code
tab's system prompt was captured and replayed instead).
2026-11-14 11:42:32 +08:00
yetone 0fda3a1c12 cli: provider set resolve.<host>=…, the editor's Connect to from the CLI (quantum_lsfc on X)
v0.1.4012 added Advanced › Connect to (Provider.Resolve) in the GUI
only; the reporter asked for it from the CLI. `magpie provider set <id>
resolve.<host>=<IP or dns:name>[,…]` sets a host's connect addresses,
an empty value takes the host out, and `resolve=` clears them all (any
other resolve= value is refused, never saved). provider.Save checks
them as the GUI's do (netproxy.CheckResolve, TakesResolve), so a bad
place or a vendor's own host is refused with nothing written. `magpie
provider <id>` lists them as "connect". Usage and docs/reference.md say
how.

Run on mote: go test -count=1 ./internal/cli ok (166s);
TestProviderSetResolve ok; go vet ./internal/cli for darwin, linux
(-tags nogui) and windows ok; gofmt -l clean. A nogui build in a
sandbox HOME on mote: provider add + set resolve.api.corp.example=
10.0.0.5,dns:gw.corp.example saved and shown as connect; resolve=oops
and a bad place refused; resolve= cleared it; provider set --help
printed usage.
Broken by hand: not deleting the host on an empty value, and taking a
non-empty resolve=, each turn TestProviderSetResolve red.
Rebased on origin/main 9572a2b4c and run again on mote: the resolve,
Pair and Help tests of internal/cli ok.
Not tried: a request actually dialled through the rule from the CLI
(the dial is the GUI's, covered by netproxy's and provider's tests),
nor the reporter's managed network; Windows and Linux beyond go vet.
2026-11-13 16:39:09 +08:00
yetone 51c3ecc573 vertex: Gemini 4 Carbon and Hydrogen in the preset, and Gemini 4 at us and eu (#6452)
Google Vertex AI's model list lacked gemini-4-carbon (released 2026-11-10)
and gemini-4-hydrogen (2026-11-12); SunsetBirdW and T_t__biu on X, #6452.
Google's model-versions page lists both ids, and each model's page lists
PayGo at global, us and eu, as Argon's now does too, so the us/eu list
gains all three Gemini 4 models.

Their window, output, prices and thinking levels come from models.dev's
google-vertex entry as for every Vertex model, which matches Google's own
pages today: Hydrogen 1,048,576 in / 65,536 out, $1.50 / $0.075 cached /
$7.50 at global, levels low to xhigh; Carbon 1M / 65,536, $2 / $0.10 / $10,
levels low to high. The provider test asks both at thinkingLevel low.

Run (mote): go test -tags nogui ./internal/provider ./internal/gateway
./internal/catalog -run 'Vertex|GeminiEffort|Preset|Effort'; go vet ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; gofmt -l.
Broken by hand: presets.go reverted, TestVertexProviderListed red (no
gemini-4-carbon/hydrogen at global); vertex.go's us/eu list reverted, red
at us and eu.
Not tried: a real Vertex project (no Google credentials here). Carbon and
Argon go to $4 / $0.20 / $20 on 2026-12-01 (Google's pricing page); the
price comes from models.dev and follows it when it changes. The bundled
offline catalog (2026-11-10) has neither model until it is refreshed.

Rerun after rebasing onto origin/main 96558cfde: go test of provider,
gateway and catalog -run Vertex|GeminiEffort|Preset|Effort, ok on mote.
2026-11-13 15:06:26 +08:00
yetone 04776ec6cb providers: a plugin subscription imports accounts from a file through its own auth.import, WorkBuddy's from 0.2.32 (marchen_cc on X)
marchen_cc on X: 「从文件导入账号」 took no WorkBuddy sign-in file. The cause
was not WorkBuddy's: magpie's import reached only built-ins (Codex,
Claude, Antigravity, Factory), and a plugin had no way to say it could
read a file. This adds that for every plugin subscription:

- A plugin's auth may have import(texts, {signal}), returning sign-in
  results, with importFrom (and importFroms by language) saying which
  file to choose. The host's importFiles op keeps each one as a sign-in
  is kept (keptAs, saved under signInKey, settled), so an account
  already there comes back "updated"; it is cancellable (signInSteps)
  and takes at most 100.
- /api/signin/import and `magpie accounts import <plugin> <files>` go
  to provider.ImportPluginFiles when PluginImportable(id); the editor's
  「从文件导入账号…」 row and the import sheet show for such a plugin, in
  its own words (importSay), moved subscriptions included (subOf).
- docs/subsystems/provider-plugins.md: "Accounts from a file".
- WorkBuddy's mover min goes to 0.2.32, which reads the desktop app's
  .info sign-in or a JSON credential, and sends a cloud-hosted
  enterprise account (*.sso.copilot.tencent.com, *.copilot.qq.com,
  *.sso.codebuddy.cn, iOA apart) to its enterprise's address (emilochen
  on X), published and checked with npm view --prefer-online.
- TestCoreScriptBudget +468 for the import branch, packed to one
  statement. importSay is read as the Providers rows draw, so it has
  no lazy page; nothing else was moved out (#2710). The budget's
  arithmetic was checked over this tree: 1,267,762, at the new cap.

Run on mote (mica's disk is full; mote over its cores) at this change
on 3f6b1b0c9; ac1702c33 (the library plugin and its GUI test, no core
script) landed after, and the core budget's arithmetic was redone at
this head:
gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/{gui,plugin,provider,cli}; go test -count=1 of those four:
all ok. GUI (chromium + webkit, en and zh): plugin-import,
login-import, factory-key, plugin-moved-signin, i18n-keys: 23 pass, 1 fail: i18n-keys "a plugin's words are its own",
memory_mcp.go's "No folder", red on main since 72facf72e (#6422).
Plugins repo: workbuddy import.test.mjs 6 of 6, bun scripts/check.mjs
ok, root bun test 8534 pass / 1 fail (agy-cli smoke under load, green on a rerun: 8535 pass, 0 fail;
unrelated, plugins #1070).

Broken by hand: without the host's importFiles handler,
TestPluginImportFiles goes red; without importable in pluginSubs,
plugin-import.test.cjs goes red ("WorkBuddy lists no import").

Not tried: a real WorkBuddy desktop .info file or a real enterprise
account on a cloud-hosted domain; the fixtures follow WorkBuddy's own
client source. Not tried on Windows or Linux beyond vet.
2026-11-13 13:32:32 +08:00
yetone d6a6865b1f update: a file from usemagpie.ai has its attestation from usemagpie.ai, GitHub's API after (ArcticLampyrid on X)
The site's cron keeps each release's SLSA bundles on R2 as
/files/<tag>/attestations.jsonl (728f3de40, 5e51e241c), but the updater
still asked api.github.com for every file, 60 an hour unsigned, and with
Update source set to the site alone it never checked an attestation at all.

attestation() now takes the asset. A file the feed names on the site
(Site/files/<tag>/<file>) has its release's bundles read from the same
site first; GitHub's API is asked as before when the site misses: a pruned
tag's 302 to GitHub's release (not followed; that asset doesn't exist),
any other status, a body with no bundle, or the site unreachable.

The trust model is unchanged. The site is only transport: its bundles go
through the same verifyBundle (embedded Sigstore root, release.yml of
yetone/magpie-releases, the digest from the ed25519-signed SHA256SUMS).
A site bundle that fails sends the updater to GitHub's API, where a valid
bundle holds; if that API can't be read it is a refusal, not unknown, so a
tampered mirror plus a blocked GitHub can't go through as "unattested".
Update source "site alone": the site's bundles are checked, GitHub never
asked; a miss is unknown as before. Update source "GitHub": the API alone.
docs/reference.md and the start page (en, zh, ja) say so; no
docs/subsystems page covers updates. llms-full.txt regenerated.

Run (mote):
- go test -count=1 ./internal/update/ ok; go vet darwin, GOOS=linux
  -tags nogui, GOOS=windows ok; gofmt -l clean.
- node --test site/*.test.mjs 120/120.
- New tests (attest_site_test.go, fixture = the site's real
  v0.1.3986/attestations.jsonl): the site serves it and GitHub isn't asked;
  site-alone source attested; another digest refused; misses (302, 404,
  502, html, empty, cut mid-line, site down) go to GitHub; site-alone miss
  stays unknown; a tampered site bundle refused with GitHub 403/503/404 and
  with site-alone, and passes on GitHub's valid bundle; wrong identity
  refused; GitHub source and github.com files never ask the site. No test
  reaches the network (TestMain points the site at 127.0.0.1:1).
- Broken by hand, each red: never asking the site (4 tests), taking a site
  bundle unchecked (3), following the redirect (1), a failing site bundle
  plus unreadable GitHub kept unknown (2).
- Live once (a throwaway test, not committed): usemagpie.ai's real
  v0.1.3986 bundles attested magpie-cli-android-arm64 with the API pointed
  at a dead address; pruned v0.1.3985 (302) fell back to api.github.com
  and attested.

Not tried: a full app update from the site end to end; Windows and Linux
runs of the package (the change is OS-independent).
2026-11-13 12:49:24 +08:00
yetone 52830b077b site: the build attestations are kept on R2 beside the release files (ArcticLampyrid on X)
The SLSA attestations live behind GitHub's API only, so with GitHub down
they could not be fetched while the mirrored files could. The five-minute
cron now also asks api.github.com/.../attestations/sha256:<digest> for every
file of a release from v0.1.3891 on and, once every file has one, writes
<tag>/attestations.jsonl to R2 (a Sigstore bundle per line, deduped), served
at usemagpie.ai/files/<tag>/attestations.jsonl. It is written only whole, so
a file with no attestation yet is asked again next run, and it is pruned
with its tag. `gh attestation verify <file> -R yetone/magpie-releases
--bundle attestations.jsonl` checks a download with it. It is not a release
asset: the GitHub release keeps its 17 assets and release CI is unchanged.
start (en, zh, ja), llms-full.txt and reference.md say where it is and how to
verify. The updater does not read it yet.

Run (mote): node --test site/*.test.mjs 118/118; gofmt n/a.
New tests: bundles land once and only whole; pre-0.1.3891 release not asked.
Broken by hand: ATTESTED set to 9.9.9 turns the bundles test red.
Not tried yet: the real cron run and the file on R2 (after deploy), the
updater reading it from R2, gh --bundle on a real downloaded file.
2026-11-13 11:23:30 +08:00
yetone bbce1fc1ab update: the updater checks a download's GitHub build attestation too (ArcticLampyrid on X)
Release CI attests every file (SLSA provenance through Sigstore, v0.1.3891
on). The updater now fetches the bundle for a file's signed SHA-256 from
api.github.com/repos/yetone/magpie-releases/attestations/sha256:<digest>
before it downloads the file, and verifies it with sigstore-go against the
Sigstore trusted root embedded in the binary (attest_root.json, public
good instance): certificate chain, certificate timestamp, Rekor entry,
issuer token.actions.githubusercontent.com, subject release.yml of
yetone/magpie-releases on main or a v* tag, source repository
yetone/magpie-releases, and the digest among the statement's subjects. It is
in addition to the ed25519 check over SHA256SUMS, which still runs first
and still works offline and from the R2 mirror; the attestation is asked
about the digest that signed list gives, so both speak of the same bytes.

When the attestation can't be had (a failed read means "unknown", but an
outage of GitHub must not take updates away):
- a bundle that is there and fails (signature, identity, digest, a chain
  outside the trusted root), GitHub answering 404, or an empty list: the
  file is refused. GitHub was asked and says these bytes weren't built by
  that workflow.
- GitHub unreachable, rate limited (60/hour anonymously), 5xx, a body that
  isn't JSON, or Settings' update source set to the site alone (which never
  goes to GitHub): the update goes on, since the ed25519 check has held, and
  the log says the file went unattested and why. Someone who can only drop
  the API call downgrades an update to the ed25519 check, never below it.
- releases before 0.1.3891 and a MAGPIE_UPDATE_FEED of your own are not
  asked.
The bundle checks itself, so the API call goes through source.Do and may use
a mirror.

Cost: go.mod gains sigstore-go v1.1.4 and its tree (go.sum +350 lines).
The embedded root has to be renewed (gh attestation trusted-root, first
line) when Sigstore rotates its keys; docs/reference.md says so. Until then
a chain under a new key fails as "not attested" and is refused: a known
cost, in the doc.

Run (mote, sandbox HOME via testenv): go test ./internal/update (ok),
site node tests (112 of 114; docker-tags and the sponsors README test fail
because mote-run -C site cannot see ../README.md, unrelated), gofmt -l
empty, go vet darwin, GOOS=linux -tags nogui and GOOS=windows on
internal/update, go build ./... on all three. Fixture: the real answer
api.github.com gave for v0.1.3925's SHA256SUMS (testdata/attest), verified
offline; the whole run reaches no network.
New tests: TestAttestationOfARealBundleHolds, ...OfAnotherDigestRefused,
...TamperedRefused, ...EditedPayloadRefused, ...WrongIdentityRefused (repo,
workflow, ref, source repo, issuer each), ...NoneListedRefused,
...UnknownGoesOnAndSaysSo (403, 429, 502, HTML, nothing listening),
...OnlyWhereItIsOwed, TestVerifyMarksAttestedReleases,
TestDownloadRefusedWithoutAttestation.
Broken by hand: identity check swapped for WithoutIdentitiesUnsafe turns
WrongIdentityRefused red on all five cases; the attestedFile call removed
from download turns DownloadRefusedWithoutAttestation red (the file was
fetched). The first full run of the package, before TestMain pointed the
attestation API at a closed port, had TestSourceSiteAndAutomaticUseTheSite
reach the real GitHub with a made-up digest and be refused: now closed.
Not tried: a real update end to end (needs a release newer than the
running binary; the unit path covers download), Windows box, the
GUI, full suite (starts after the tag).
Docs: docs/reference.md, start.html (en, zh, ja) and llms-full.txt say what
the app checks now.
2026-11-13 00:01:01 +08:00
yetone 477bbb7a15 usage: GET /v1/magpie/usage/requests?cursor= reads requests as changes, with stable ids (rdsaltbo on X, #6060)
A program keeping a ledger of its own (a WakaToken plugin) can now read the
requests incrementally: cursor=start or cursor=now, then each next_cursor.
Rows carry a stable content-derived id (same after a restart), origin, and
original_ids (request_id, response_id, client_response_id, message_id,
session_id, native_session_id), each only when the source gave it. A call
read late, a corrected row (same id, higher seq) and a native row replaced by
the gateway's (deleted, with seq) all come through a persisted journal
(usage-feed.jsonl, appended and synced before answering). Cursors magpie
cannot resume from are refused: 400 cursor_invalid / cursor_filter_changed,
410 cursor_expired / cursor_reset. A held key sees only its own rows and
tombstones. Without cursor, offset/limit mode is unchanged.

Also: Record.MessageID (not persisted) from the agent file's message id, and
usageapi's row decoration moved into a namer shared by both modes.
Docs: reference.md, integrating.md, gateway-routing.md, gateway-sessions.md,
site remote.html (en/zh/ja), llms-full.txt.

Run (mote, this tree): go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
usage, usageapi, gateway (gui on darwin); go test -count=1 for
internal/usage, usageapi, gui, gateway: all ok. New tests: resume gets exactly
the new rows, ids and cursors survive a restart, correction keeps the id,
gateway takeover retires the native row, refused cursors, expiry, now cursor,
identical records, and the feed over the gateway (held key, 401 without key,
offset mode). Broken by hand: an unconditional memo made the new-rows test
red (fixed to memo only the next page).
Not tried: real Claude Code/Codex session files, a huge (700k+) history,
Windows run of the tests, GUI browser suites (no GUI file touched).
2026-11-12 22:40:15 +08:00
yetone a2feeb11a0 update: pick the update source by hand, Automatic, usemagpie.ai only or GitHub only (RootSir, Sakugar_ on X)
usemagpie.ai's download is slow for some users (Cloudflare R2) and GitHub
is the one that works for others. Settings > Network has an "Update source"
menu button under App updates' proxy (the app's menu, no native select):
Automatic (default, as before: the site, then GitHub when the feed can't be
reached), usemagpie.ai only, GitHub only. Settings.UpdateSource ""/site/
github, this computer's own (KeepOwn), in settingsapi.Keys and Choices so
`magpie settings set updateSource github` works; any other value is refused
on save. The menu loads from assets/updatesource.js, so app.js (at its
budget) grows by one line.

GitHub only: latestAt reads yetone/magpie-releases without asking the feed,
and download starts at the file's github.com address (mirror and GitHub's
API route as before), never the site. usemagpie.ai only: no fallback to
GitHub for the release (fallsBack) nor for a file (toGitHub, toAPI off).
Stable and a MAGPIE_UPDATE_FEED of your own keep reading the site's feed
whatever the source says (Stable's release list is only the site's; its
files still come from GitHub on GitHub only). Every source goes through
Release.verify: ed25519 signature against the embedded key, the version in
the signed text, each hash from the signed list; a release read from GitHub
must be signed whatever its version. The update private key is untouched.

Run (mote, tree before the commit): gofmt clean; go vet update/settings/gui,
GOOS=windows and linux vet of update; go test internal/update, settings,
settingsapi, backup, cli ok; internal/gui TestCoreScriptBudget, assets and
i18n tests ok. GUI: settings-update-source (chromium and webkit x en, zh,
zh-TW, ja, de x 1100 and 420px: three menu items, each pick saves updateSource
alone, tick, no overflow), settings-update-proxy, i18n-keys, i18n-en-no-cjk,
settings-*, gui-* ok except the 22 subtests (gui-de/ja "has every zh string",
settings-hints, settings-lines-wrap de 440, settings-search) that fail the
same on origin/main 5a3d73039 (#6234, #6073, #6156, #6133 are open for them).
New Go tests use a fake GitHub and a live fake site feed that count their
hits: GitHub only never asks the feed and downloads from GitHub, the site and
Automatic never ask GitHub, the site only never falls back (release or file),
GitHub only refuses wrong key, swapped sums, no/junk signature and an
unsigned old version, a custom feed is never overridden. Broken by hand:
without the githubOnly branch and the two download switches, 3 of them go red.
Not tried: the real github.com or R2, a Windows run, Stable with GitHub only.
2026-11-12 19:35:57 +08:00
yetone 5241308212 settings: a day can start at 0 to 6 o'clock (ssharpcc on X)
Settings > Usage > "Day starts at" (dayStart, 0 to 6, default 0; also
magpie settings set dayStart 4). With 4, a call at 01:30 counts toward the
day before: the Usage page (summary, charts, heatmap, ledger day filter,
hour labels of Today) and the daily and monthly key caps (access.Window,
provider.SpendCap.Window).

internal/dayzone makes a time.Location whose midnight is the real day's
hour:00 (TZif built from the zone's own offsets, same DST instants), so
every place that cuts days by a Zone's midnight follows without edits;
usage.Zone returns it and the "now" reads use it too.

Run (mote): go test usage, settings, settingsapi, access, provider, gui,
dayzone, also with TZ=UTC and TZ=Pacific/Kiritimati; gofmt; go vet darwin,
linux nogui and windows; day-start, currency, number-units and i18n-keys
GUI files in chromium and webkit, en zh zh-TW ja de; TestCoreScriptBudget.
Broken by hand: TestDayStartsAfterMidnight red with 9 failures when the
hour is ignored. New tests: dayzone over 5 zones x hours 1/4/6 x two years
of days, usage, limit window, spend-cap window, day-start GUI.
Not tried: a real log history in a real window.
Not shifted, filed as #6314: the Sessions page, TUI sessions filter,
davsync shared per-day files, gateway_sessions day keys, credits_daily.
Rows are never stored in the shifted zone.
2026-11-12 18:31:50 +08:00
yetone 727e236378 gateway: a management API for providers, accounts and gateway keys, for a key set to manage (ljayic on X)
ljayic asked for a complete, stable management API so nothing needs a
hand-edited file. /v1/magpie/admin/ now serves the app's own /api handlers
(providers and their keys and accounts, OAuth sign-in start/poll/cancel,
gateway keys, account groups) to a gateway key set with
`magpie gateway-key admin <id> local|any`. Routes and actions not in
gui/admin.go's adminRoutes are 404, so a provider's saved key, a gateway
key's secret, sign-in export and actions on this computer's apps are not
served; "admin-key" is not served either, so the API can't raise its own
caller. Sign-in returns the vendor's page and code, opens nothing, takes no
password.

Guard (gateway/admin.go), in order: any Origin or Sec-Fetch-Site/-Mode is
403 with or without a key (Origin null, foreign, listed, *.localhost, an
app scheme); no key 401; a key without Key.Admin 403; from loopback the Host
must be ownHost (a rebound page's GET has no Origin); from the network the
key must be "any"; a proxied request counts as remote. Key.Admin is dropped
(adminOf) for a read-only, Browser, issued, expiring or default key, and
setting read-only clears it. The route is in readOnlyRefused and keySlotFree.

Docs: docs/reference.md "Management API", gateway-routing.md, and the
remote page in en, zh and ja. Routing Groups, sign-in export and a GUI
switch for the level are left to #6307.

Run (mica, the worktree before the rebase onto 9 newer commits): go vet of
access, cli, gateway, gui (darwin), GOOS=windows vet of the same four,
GOOS=linux -tags nogui vet of access, cli, gateway; gofmt -l empty;
go test -count=1 -timeout 45m ./internal/access ./internal/cli
./internal/gateway ./internal/gui: all ok but TestKeySlotEveryRoute, which
named the new route and is fixed here, then it and the read-only, admin and
guard tests pass again. After the rebase the same tests ran again.
Broken by hand, each red in TestAdminAPIGuards: browser check off (a
browser case served), Admin check off (a key without it served), Host check
off (a rebound name served), the "any" requirement off (a local-only key
from the network served, and a proxied request).
Tests: TestAdminAPIGuards (no key, unknown key, non-admin, read-only,
local/any, x-api-key, 8 browser headers x 3 callers, rebound Host, proxy,
no handler), TestAdminKey (access: levels, read-only, Browser, issued),
TestGatewayKeyCLIAdmin, TestAdminAPIGatewayKeys / Providers (a canary key
is never told) / SignIn, TestAdminRoutesEveryAPIRoute.
Not tried: a real sign-in against a vendor through the API, a request from
a second computer on the LAN, the GUI suite (no page or app.js changed), a
Linux/Windows run of the new tests.
2026-11-12 17:47:11 +08:00
yetone cfd3367df8 usage: a request's details show its service tier (JackyFill on X)
The ledger has kept each call's service tier since #1784 (tier_asked,
tier_sent, tier_served in the log, the CSV and the JSON), but the
Requests page never showed it. A request's details now have a Service
tier line: "asked X", then "sent Y" only when it differs, then
"answered Z" only when the reply named a tier. A call with none shows
no line. Row flag bits are untouched: the tiers are string slots, so no
bit is taken.

Run, on mica: new ledger-service-tier.test.cjs (3 rows: all three tiers,
asked+sent without an answer, none) in chromium and webkit, en zh
zh-TW ja de, 12 of 12 green; with the add("Service tier") line removed
by hand it is 0 of 12; i18n-keys caught a duplicate "Service tier" key
(the core table already has all four languages), which is removed;
ledger-*, i18n-keys, i18n-en-no-cjk and gui-* files rerun green after
(ledger-cache-hit chromium was red once in the first batch, green on
rerun in the same batch's second run).

Not tried: a real Codex priority call end to end (the gateway side is
#1784's); the full suite runs after the tag.
2026-11-12 17:22:03 +08:00
yetone 65e1422c4a update: fall back to the GitHub release when usemagpie.ai can't be reached (ssharpcc on X)
A company network that allows github.com and no other domain could not
update magpie at all: the feed (usemagpie.ai/api/latest) failed and that
was the end. When the default feed fails (20s limit, so dropped packets
don't hold the check for 10 minutes), the newest release is now read from
yetone/magpie-releases: the API, or the release page's redirect when the
API is rate-limited, plus SHA256SUMS and SHA256SUMS.sig from github.com
(or the API route when github.com's address is busy). The result goes
through Release.verify like the feed's: ed25519 signature against the
embedded key, the version inside the signed message, every hash from the
signed list. Unlike the feed, a release read this way must be signed
whatever its version. Files download from github.com (Asset.GitHub),
checked by hash as before; feed files named on the site now also get a
github.com address, so a download falls back too. Covers the app,
`magpie update` and the Windows and Linux builds (all go through
latestAt). Not on Stable (the site's choice) nor on MAGPIE_UPDATE_FEED.

Run (mica, tree at this head): gofmt clean; go vet update/cli/gui, GOOS=windows
and linux vet of update; go test internal/update, internal/cli, internal/gui all ok.
New tests use a feed port nobody listens on and a fake GitHub (API and
rate-limited redirect paths): update succeeds and stages the file by hash;
wrong key, swapped sums, missing and junk signature, signature for another
version, unsigned old version are refused with no download. Broken by hand:
with verify() removed from the fallback, 4 of those tests go red.
Not tried: the real github.com, a real allow-listed network, Windows run.

Other usemagpie.ai-only on such a network: install.sh, plugin catalog
(falls to raw.githubusercontent.com, ok), npm registry for plugin
installs, models.dev catalog, partners/icons, telemetry.
2026-11-12 17:19:40 +08:00
yetone c1a91b5a52 agents: Mistral Vibe is an agent, and a Library target (alterxyz4 on X)
Vibe (mistralai/mistral-vibe, the `vibe` CLI) keeps its settings in
config.toml in $VIBE_HOME, else ~/.vibe. magpie now connects it: a
[[providers]] entry named magpie (the gateway's /v1, api_style openai,
backend generic), one [[models]] entry per catalog model aliased
magpie/<provider>/<model>, and active_model set to the alias, with the
previous value stashed and put back on Disconnect. Vibe reads keys only from
the environment, the keyring or ~/.vibe/.env, so the key naming Vibe goes in
the provider's extra_headers as an Authorization header; nothing is put in
the user's environment. Avibe's `vibe` command is turned away by binNot.

Library (#5595): instructions are $VIBE_HOME/AGENTS.md and skills
$VIBE_HOME/skills (vibe/core/system_prompt.py,
vibe/core/config/harness_files/_paths.py, read at 3.1.2). VIBE_HOME is in
appdir's usable list and agentenv. README (en, zh), docs/reference.md and
docs/subsystems/agent-wiring.md list it; the restart notice is in zh, zh-TW,
ja, de.

Run (mica, sandbox HOME):
- go test -count=1 ./internal/agent ./internal/library ./internal/appdir
  ./internal/agentenv ./internal/gateway ./internal/gui: ok.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on the touched
  packages: clean.
- Real vibe 3.1.2 (uv tool install mistral-vibe) with the file shape magpie
  writes, against a fake OpenAI upstream: the alias with slashes resolves as
  active_model, the request goes to /v1/chat/completions with model kimi/k2,
  Authorization: Bearer <key> from extra_headers and user-agent
  Mistral-Vibe/3.1.2.
- GUI: agent-notice-lang, i18n-keys, i18n-en-no-cjk, gui-zh-tw pass.
- Broken by hand: vibeMine returning false fails TestVibe,
  TestVibeOwnModelTakesMagpieOut and TestVibeSyncKeepsTheirs.

Not tried: the file written by the built magpie binary itself (the unit tests
write it through the same code), Windows runs of the new tests, a Vibe
signed in to Mistral with its own models alongside. gui-de and gui-ja
"every zh string" were red on the base for the "{agent} isn't installed
here" string, not for this change.
2026-11-12 17:07:23 +08:00
yetone c4f7ba9d3a update: only a release whose SHA256SUMS carries the release key's signature is installed (danny0dong on X)
The updater took a file and its SHA-256 from the same feed answer, so
whoever could change /api/latest could swap both; only the Mac app also
checked its signing team. Now release CI (yetone/magpie-releases) signs
"magpie release <version>\n" + SHA256SUMS with an ed25519 key held as that
repo's UPDATE_SIGNING_KEY secret and publishes SHA256SUMS.sig (release
assets: 16 -> 17). The site worker carries the list and signature in the
feed; internal/update/signed.go checks them against the public key built
into the binary, takes each file's hash from the signed list and refuses a
missing or bad signature or a feed hash that differs. Versions from
0.1.3862 require it; older ones and binaries older than the key update as
before. MAGPIE_UPDATE_FEED lifts the requirement for local test servers.
mirror-release waits for 17 assets; docs/reference.md and code-standards
say 17 and describe the transition.

Run: go test internal/update, internal/cli, internal/gui -run Update|WhatsNew
(ok); node --test site/*.test.mjs (116 ok); gofmt; go vet darwin, linux
nogui, windows on internal/update. Broken by hand: signature check skipped
(tamper and other-key tests red), feed-hash comparison skipped (swapped
hash and feed tests red), worker not attaching signed (worker test red).
The embedded key is checked against a sample signed by the real key with
openssl, as CI does. Signing script run against a throwaway key.
Not tried: a real signed release before this tag; install.sh does not
verify the signature.
2026-11-12 16:43:23 +08:00
yetone a5e805f574 Codex: Ultrafast beside Fast in a group member, and a Fast/Ultrafast setting per model (kdajenks on X)
kdajenks (magpie 0.1.3739, Codex on ChatGPT Pro) could set Fast only from a
routing group's member row and had no Ultrafast there, and no way to set the
speed in the model's own settings. Ultrafast exists: Codex's catalog lists
the `ultrafast` service tier, the code already sent it for agent picks and
Codex's service-tier row, and the live account's service_tiers hold it.

- Group member: the button steps Standard speed, Fast, Ultrafast (where an
  account offers it, `ultraOK`), back to Standard. `Group.Ultra` is a subset of
  `Fast`, kept through rename, fold, share, gone-filter and the CLI
  (`magpie group ... ultra=`). The gateway marks the candidate `ultra`.
- Per model: `settings.ModelTiers` ("<provider>/<model>" to priority or
  ultrafast), `provider.SetModelTier` (refused where CanFast/CanUltra say no),
  `ModelPref.Tier` in Model settings (Standard speed / Fast / Ultrafast, in
  modellimits.js), and `magpie model tier <provider/model> [fast|ultrafast|usual]`.
  The gateway sends it on a direct pick for an agent with no fast pick of its
  own, through fastPick, so an account without Ultrafast gets priority. A group
  member goes as the group says.
- Docs: gateway-routing, providers-accounts, reference.

Run (mica, at the rebased head over a6d84e13a):
- gofmt -l clean; go vet darwin, linux nogui, windows clean.
- go test internal/provider, internal/settings ok; internal/gui and
  internal/cli ran: the one red of mine (TestSettingsSaveKeepsWhatItDoesNotSend
  wanting ModelTiers) is fixed in this commit; the others are not mine and
  red on a clean origin/main: TestEveryRouteHasACommandOrIsNamed (#6202),
  TestPanelHiddenByWailsMarksPageOutOfSight (#6203, not checked on main).
- internal/gateway ok (984s).
- GUI, chromium and webkit: new model-speed.test.cjs (30, five languages, 1200
  and 420px), plus model-*, group-*, fast-*, i18n-*, text-size,
  codex-service-tier, panel-*, routing-group*, routing-save* files. Red and not
  mine, same on a clean origin/main worktree: fast-pick and fast-ultra (#6201),
  group-editor-selected (#5049).
- New tests TestModelTierSentToEveryAgent, TestGroupMemberUltrafast,
  TestCleanModelTier, TestSaveGroupUltra.

Broken by hand: removing the gateway's model-tier branch and the candidate
`ultra` copies turned both gateway tests red; turning off the Ultrafast choice
in Model settings turned 20 of 30 GUI tests red; reverting the member button to
two states turned 10 of 30 red.

Not tried: a real ChatGPT account sending Ultrafast through the new setting;
the agent picker's bolt does not show a model-level default; Windows and Linux
GUI runs.
2026-11-12 01:56:26 +08:00
yetone fc615339f0 provider: Alibaba Cloud Token Plan quota read with the account's AccessKey; intl Token Plan preset (pppMathew on X, #2940)
Cause: a Token Plan sk-sp- key only authorizes inference. The plan's
usage sits on the Bailian console gateway, which wants a console token
(the key gets BailianGateway.Login.NotLogined) that Alibaba's own `bl` CLI
makes from the account's AccessKey through GenerateCLIAccessToken (ACS3
signed). magpie had no such path, so the usage card showed no quota.

Change:
- alibaba_usage.go: ACS3-HMAC-SHA256 signing, the console token (kept 20
  minutes per AccessKey and region, made again once on NotLogined), the
  personal plan's usage API, and per<N><Unit>Percentage/ResetTime read as
  5 hours / Weekly / Month windows. Hooked in as AccessKeyVendor "alibaba"
  (editor asks AccessKey ID and Secret, a keyless card says so),
  accountPlanOf (routing), PlanQuotas and the key card tag.
- Hosts: token-plan.cn-beijing.maas.aliyuncs.com (bailian-token-plan) and
  the new token-plan.ap-southeast-1.maas.aliyuncs.com preset
  alibaba-token-plan (Alibaba Cloud international Token Plan, #2940), also
  an OpenCode import target.
- Editor hint in zh, zh-TW, ja, de; docs (providers-accounts, reference).

Not covered: qwen-token-plan (Qwen AI platform) and qwencloud-token-plan
have no AccessKey route (browser-session console, #5829); team plans.

Run on mica at this tree: go test ./internal/gui ./internal/provider ok;
go vet darwin, linux nogui, windows on provider/gui clean; GUI files
i18n-keys, i18n-en-no-cjk, tencent-access-key, volc-access-key,
usage-access-key-card, tencent-cloud in chromium and webkit: 60 of 64 pass,
the 4 reds are tencent-cloud's "region clicked right after the strip
scrolled", red the same at origin/main 319753d89 (filed: #4321, #4399,
#4625). Broke it by hand: dropping the *100 on the percentage turns
TestAliReadWindows and TestAliPlanQuotas red.
Tests never reach the network (httptest behind a rewriting transport).

Not tried: no real Alibaba Cloud account, so neither the mint nor the
usage reply was seen live; the field names and the envelope come from the
official client's source. The international gateway host
(bailian-singapore-cs.alibabacloud.com) and the RAM-user case are the least
certain. The full suite was not run before the tag.
2026-11-12 01:20:52 +08:00
yetone 8016205e3f provider: trust a self-signed server's certificate by fingerprint, for Remote magpie and any https address of your own (Zhangzhangi on X)
Zhangzhangi on X couldn't add a Remote magpie at a domain with a
self-signed certificate ("x509: "api.magpie.local" certificate is not
standards compliant") and asked for a skip-verification option. A
follow-up asked for the same on other self-signed hosts.

This adds a pin (trust on first use), not a blind skip. It is off by
default and kept per provider:
- Advanced → Server certificate → "Trust its certificate…" fetches the
  certificate the server shows (provider/peekcert) and lists its SHA-256,
  subject, issuer and expiry. "Trust this certificate" keeps the
  fingerprint as the provider's serverPin.
- From then on only that certificate is accepted (netproxy pinTLS:
  InsecureSkipVerify plus VerifyConnection comparing the leaf's DER
  SHA-256). Another one fails with PinMismatchError, saying the server
  showed a certificate other than the one trusted.
- The editor shows a red "Certificate not verified: only this one is
  accepted" with the fingerprint, and "Verify it again" drops the pin.
- The pin is set only on the provider's own hosts (provider.PinHosts):
  - every address of Remote magpie and of a provider added by URL;
  - for a preset (Ollama, LM Studio, OpenAI at your own box), only https
    addresses whose host is not one of the preset's or its regions' own
    hosts. A vendor's host never takes a pin.
  - Never for an account, Vertex or a subscription. Save refuses one
    elsewhere.
- The client certificate and Server CA still go only to the providers
  that took them before (TakesClientCert). A preset gets the pin alone.
- The editor's certificate rows (Client certificate and the new Server
  certificate) are drawn by a lazily imported tlscerts.js. The Client
  certificate row moved out of app.js with it, so the core scripts stay
  under TestCoreScriptBudget without a raise.

Run (Go 1.26.8):
- WSL magpie-desktop, before the rebase:
  - go test -tags nogui -count=1 ./internal/netproxy ./internal/provider
    ./internal/gui all ok;
  - GOOS=darwin -tags nogui vet of gui fails on traywindows_darwin_test.go's
    undefined trayImagePNG, the same at the base (a cgo-only helper).
- mote and mica, after the rebase on ab5824aee:
  - gofmt -l clean; node --check app.js;
  - go vet darwin (cgo), GOOS=linux -tags nogui, GOOS=windows: ok;
  - go test ./internal/netproxy ./internal/provider: ok.
- mote, at the final tree: node --check app.js and tlscerts.js; go test
  ./internal/gui -run 'Budget|ServerPin|InsecureTLS|ClientCert|OnDemand|Lazy'
  ok (TestCoreScriptBudget under 1,533,802) at the base ab5824aee.
  Rebased on fe5a0cf6d, TestCoreScriptBudget is red, as it is on that
  main alone: main's core is 1,534,708 (16ed1a952 took it to 1,535,318);
  this change takes it to 1,534,484, 224 bytes less (#5918, commented).
  The rest of the run above passes at the pushed head.
- mica, GUI files at the final tree, both engines inside each file:
  - green: provider-server-pin (54), mtls-settings (16),
    provider-insecure-tls (60), provider-socket (60), provider-http1 (60),
    i18n-keys, i18n-en-no-cjk, editor-advanced-align, provider-advanced-fold
    (50);
  - old-webkit: headerpresets.js not loaded (#6030) and Safari 15's :has()
    (#5919), both on main too;
  - menu-scroll: 24 of 24 red on /api/update/using, the same alone at
    origin/main fe5a0cf6d (#5982, commented).
  - Earlier flakes of provider-http1 beside another session's suite:
    #6159.
- Broken by hand, each red:
  - presets never take a pin: TestServerPinSaveChecks,
    TestServerPinPresetAtOwnServer, TestServerPinNoVendorHost;
  - vendor hosts pinned (the own-host check dropped):
    TestServerPinNoVendorHost;
  - client cert and CA sent to presets: TestServerPinPresetAtOwnServer;
  - the pin never compared: TestPinOnlyThatCertificate,
    TestServerPinRemoteMagpie.
  Restored: both packages ok.

Not tried:
- a real self-signed domain from the macOS app (httptest servers with
  their own certificates only);
- the Responses WebSocket dial (read only: it takes the same netproxy
  transport);
- go test ./internal/cli and the whole GUI suite before the tag (the
  full Go suite runs after it, under suite.lock).
2026-11-11 21:13:43 +08:00
yetone ab5824aeea gateway keys: a limit in total never resets by the period, only by Reset usage (Cyrus_4433 on X)
The Limit window menu gains "in total" (period "total", CLI: gateway-key limit <id> total). It counts from when it is set or last reset and ends a century off (access.Limit.Window), so only Reset usage starts it again; its 429 says it stays refused until reset or raised, the row reads "$0.00 / $300 · 总额" with no reset time, and a remote key's window is "Tokens/Spend in total" with no reset. Old settings files read the same (new period only). i18n in zh, zh-TW, ja, de; reference.md and gateway-routing.md say it.

Run: TestLimitTotal and TestTotalLimitNeverResetsByThePeriod, red on the old code (Valid refuses "total"); gateway-key-total.test.cjs red without the keys.js change (5 of 5). Not tried: a real key through a live gateway; full suite follows after the tag.

Run (before this push):
- gofmt -l clean; go vet darwin, linux (nogui), windows clean.
- go test: internal/access, internal/budget, internal/cli, internal/provider ok.
- Go tests for the total period are red on the old code (Valid refuses "total"); the GUI test is 0 of 5 languages passing without the keys.js change.
- gateway-key-total.test.cjs and i18n-keys: 9 pass in chromium and in webkit (zh, zh-TW, ja, de, en; 500px width; no native select).
- Full GUI suite on mica, chromium: 46 reds in files this change does not touch (accounts, Pi/OpenCode Go, panel sheet, check-in, Aside provider, API key theme, allowed addresses); none is a key-limit test. Webkit pass still running; reds are to be compared with origin/main and filed after.
- TestCoreScriptBudget is red on origin/main 2d12e8274 by 7 bytes (1,533,809 > 1,533,802); this change touches no counted core script (#5918).
Not tried: a real key through a live gateway; the full Go suite (started after the tag).
2026-11-11 20:35:13 +08:00
yetone 5c02be05b8 agent: agy moves onto the community agent-agy plugin
The built-in agy agent (Antigravity CLI) is the first built-in agent a
community agent plugin serves, as the retired subscriptions moved onto
provider plugins. While @magpie-community/agent-agy is installed and on,
magpie's agy is the plugin's: the built-in leaves the list (here and in
WSL), its id and aliases are the plugin's, and what the built-in wired
is handed over. Turned off or removed, the built-in is back. Nothing is
forced yet; the forced install and the built-in's retirement come once
the plugin is on npm and a real run with it is on record.

The plugin (plugins ebcff866, 0.2.0) follows the built-in since
0cc91af3d: its config is magpie's own magpie-settings.json, handed to
agy with --settings, agy's settings.json is only read, and
remote-control runs as agy is.

What an agent plugin can say now (agentplug; docs/reference.md and the
site's plugins pages, en/zh/ja, and llms-full.txt):
- base: the agent's own settings file, read for the user's own model
  and passed to connect and own; needs launch.args with {config}, and
  stepping out removes magpie's config file whole;
- launch {env, model, args, plain}: `magpie start <id>` and the shell
  functions (posix, fish, PowerShell, a WSL distro's) put args before
  the model flag, and run a plain word or flag as the agent is;
- own({config, base, model}), effort, wsl, aliases.

Moving over (plugged_moved.go): agentMovers names agy's package;
agyHandover gives back a settings.json an older built-in wired (Sync),
then makes magpie-settings.json the plugin's stash, so the plugin's
agent reads as connected and stepping out removes the file.

Run (mote, macOS 27, Go 1.26.8) at fe8c05e0c, the base before the last
rebase:
- go test internal/agent (507s), agentplug, sessions, edit, update,
  plugin: ok.
- internal/cli and internal/gui: red only on main's own reds, the same
  at origin/main 8fe720453: TestModelUsageAlignsEveryDescription and
  TestModelUsageLinesUpItsDescriptions (#6104),
  TestSettingsSaveKeepsWhatItDoesNotSend (#6103), TestCoreScriptBudget
  (#6116, filed now).
- GUI, both engines, and site node --test: agy-effort, agy-launch,
  library-rtk-agy, gui-de, gui-zh-tw, i18n-en-no-cjk, i18n-keys,
  plugin-page-foreign-error, site/*.test.mjs: 114 pass.
- vet: macOS, GOOS=windows, Linux in WSL (-tags gtk3); gofmt clean.
- The shell functions with a config path holding a space: bash and zsh
  on mote, PowerShell on Windows (win-run), bash in WSL.
- Broken by hand: TestAgyPlugin red with Args, Plain or the file's
  removal taken out.
At 20d807d92 (rebased on 8fe720453): vet (macOS, windows) ok, agentplug
and internal/agent -run 'Agy|Plugged' ok, agy-launch and i18n-keys
pass; plugin-page-foreign-error is red there and at plain origin/main
8fe720453, from that commit (#6117), not this change.
Plugins repo: bun test packages/agent-agy 4 pass.

Not tried: fish (on none of the machines); a real agy run with the
plugin at 0.2.0 (the 0.1.0 design ran for real in a sandbox HOME, the
settings.json one this replaces); Windows and WSL agy with the plugin;
an install from npm: @magpie-community/agent-agy isn't on npm yet, so
until its first publish no user is moved.
2026-11-11 16:13:19 +08:00
yetone 5399c33728 healthcheck, update and status find the running gateway by its own record (ljlwlcz on X)
The gateway now writes gateway.json (addr, pid, role, version) in magpie's
config folder while it serves; healthcheck, update, status and the other
CLI clients read it when MAGPIE_ADDR is unset, trusting it only if the pid
on GET / matches. --addr overrides. New: magpie status [--json] for
watchdogs (role, pid, listen address).

Run: new gateway and cli tests on Windows via win-run (pass); broken by
hand (record disabled): they go red; gofmt; vet windows and linux nogui.
Not run: mote/Linux (SSH down, WSL broken), darwin vet, a real systemd
service. TestEveryRouteHasACommandOrIsNamed is red on the base for two
GUI routes, unrelated to this change.
2026-11-11 12:00:19 +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
yetone 90a028d2c1 air: JetBrains IDEs get a Magpie agent for each running WSL distro (yanghonghang on X)
IDEA 2026.3 starts a WSL project's ACP agent inside the distro through EEL.
An absolute Windows command whose environment differs from the project's is
refused ("ACP executable belongs to a different environment"), which the AI
Assistant shows as "Magpie does not run". The host entry in ~/.jetbrains/acp.json
therefore never worked for a WSL project.

Now each running distro that has opencode gets its own "Magpie (WSL <distro>)"
entry: command is the distro's opencode as a \\wsl.localhost UNC path (the
WSL descriptor, accepted), env OPENCODE_CONFIG points at a magpie-opencode.json
written in the distro's ~/.jetbrains. Set, Sync, Check and the uninstall path
all reach the entries; a stopped distro is never started. The probe now
records the binary paths (distro.Paths).

Ran: mote-run go test -run 'TestAir|TestWSLProbeKeepsPaths' ./internal/agent
(ok), the same on win-run and wsl-run (ok), gofmt, GOOS darwin/linux/windows
go vet ./internal/agent. Broke by hand: turning the WSL branch off in airAt
turns TestAirIDEAddsMagpieAgentForWSLProjects red.
Not tried: a real JetBrains IDE (none on the Windows box); the EEL rule was
read from the IDE's bytecode.
2026-11-11 10:27:44 +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 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 4623f54190 gateway: HTTPS for other computers, from magpie's CA or an imported certificate (zhangly1 on X)
zhangly1 on X: Claude on another computer on the LAN needed magpie at
https://. Settings → Network and sharing → HTTPS (magpie https on)
serves other computers TLS on the gateway's own port, with a
certificate magpie's CA (the mTLS one, in ~/.config/magpie/mtls) signs
for this computer's names and addresses; this computer keeps plain
http://. The switch is read per connection, so no restart.

- Certificate row: Import… takes the user's own PEM certificate (with
  chain) and unencrypted key, in any files and order; a pair that can't
  be served (no key, no cert, a stranger key, a passphrase, run out,
  nothing PEM) is refused with the reason in the page's language and
  leaves nothing behind. Remove goes back to magpie's CA. --tls-cert
  still comes first.
- magpie's CA row: SHA-256 shown, Save puts magpie-ca.crt in Downloads;
  the gateway serves it without a key at /magpie-ca.crt to any address
  the share lets in. Rows under it give curl -kO, macOS, Windows, Linux
  and NODE_EXTRA_CA_CERTS steps with Copy.
- A page open from another computer can't turn HTTPS on or off under
  itself (it would lose its own address).
- magpie https status|on|off|import|remove|ca --out; the serve banner
  names magpie's CA or the imported file instead of "(mTLS)".
- docs/reference.md and gateway-routing.md say all of it, and that
  Windows' curl.exe needs --ssl-no-revoke for any private CA.

Run:
- gofmt -l clean; go vet linux -tags nogui ./internal/..., GOOS=windows
  and GOOS=darwin -tags nogui vet of the touched packages (WSL, mote
  refused ssh all evening).
- WSL: go test -tags nogui gateway -run HTTPS|MTLS|ClientCert|CAFile|TLS|LAN
  ok; gui -run HTTPS|MTLS|Keep ok; settings, settingsapi, mtls ok;
  cli -run Help|HTTPS|TLS|Serve|Banner|Flag|Unknown ok. The whole cli
  package hit its 40m timeout in TestEveryAgentFieldNameWritesNothing
  (#5234, #4247, not this change).
- GUI (WSL Playwright, chromium + webkit): https-settings (en, zh, 390px,
  strings in all four languages) ok, plus mtls-settings, allow-ips,
  browser-access, cors-origins, gui-de/ja/zh-tw, i18n-keys,
  i18n-en-no-cjk, lan-*, public-url*, api-key-theme,
  connect-address-kept, gateway-connect-keys, gateway-caller-keys,
  side-gateway-lan, menu-scroll. Reds at load ~130: api-key-theme
  (#5044), connect-address-kept (#5972), gateway-caller-keys (#2572),
  gui-ja (#5943), lan-docker (#4692), all red the same at base
  10bef5fe0 run beside it; allow-ips and gateway-connect-keys went red
  once under that load and pass 18/18 at concurrency 1, base and this
  change side by side.
- Real: a sandbox HOME gateway built from this tree on WSL
  (MAGPIE_ADDR=0.0.0.0:3593, a gateway key, magpie https on, magpie
  serve). From the Windows host: curl -k /magpie-ca.crt 200 without a
  key; Node fetch with NODE_EXTRA_CA_CERTS=magpie-ca.crt 200 on
  /v1/models, 401 without the key, SELF_SIGNED_CERT_IN_CHAIN without
  the CA; plain http:// 400; curl.exe --cacert needs --ssl-no-revoke
  (schannel), then 200. Cert SANs: localhost, the hostname, .local,
  127.0.0.1, ::1 and every address. magpie https import of an openssl
  CA's leaf on the running gateway: Node trusting that CA 200, magpie's
  CA alone refused. remove + off on the running gateway: plain http://
  from Windows 200. This computer's plain http:// 200 throughout.
- At the pushed tree (on origin/main ee818e8bc), WSL:
  gofmt -l clean; go vet -tags nogui linux, GOOS=windows, GOOS=darwin
  nogui of gateway, gui, cli ok; go test -run 'HTTPS|CAFile|MTLS|LAN'
  gateway, gui ok. GUI https-settings, mtls-settings, i18n-keys,
  gui-de/ja/zh-tw, allow-ips, lan-* (both engines): 147/155; reds are
  gui-ja (#5943), lan-docker (#4692), allow-ips webkit under load, and
  gui-zh-tw chromium under load (2 of 3 green alone, filed #5983).

Broken by hand:
- TLSOn without HTTPSOn: TestHTTPSOtherComputer red.
- lanGuard without the caFileOpen exemption: TestHTTPSCAFile red.
- mtls config without GetCertificate = settingsCert: all three
  serving tests red.
- app.js without renderHTTPS(s): https-settings red in both engines.

Not tried: the macOS, Windows and Linux system trust commands on a real
store (they change the box's trust); Claude Desktop itself; a darwin
GUI run (mote unreachable); the full suite before the tag (started
after it).
2026-11-10 23:05:47 +08:00
yetone 065ca02c28 provider: Fireworks Nexus preset, Nexus Auto on all three APIs (CNSA0422 on X)
Fireworks Nexus is an account and plan of its own (nexus.fireworks.ai,
Pro $8, Team, Enterprise) on the platform's /inference endpoints, which
speak chat completions, Responses and Anthropic messages
(docs.fireworks.ai/nexus/apis-and-sdks). Its keys are made at
nexus.fireworks.ai/settings/api-keys; a platform key carries no Nexus
plan.

The new preset fireworks-nexus (Add sheet tile "Nexus", the Fireworks
logo) sets all three endpoints and lists only `auto`: Pro and Team
refuse an open model named directly with a 403 (nexus/open-models), so
the platform's /models would offer models the plan refuses, and no list
is asked for. Enterprise users type their open models in, or set a
models URL. The editor offers x-anthropic-api-key and x-openai-api-key,
the headers Nexus Auto takes the user's own Claude and OpenAI keys in.
No usage API is documented (only the nexus.fireworks.ai/usage
dashboard), so there is no usage card. READMEs (en, zh) and
docs/reference.md list it.

Run (mote): go test -run 'TestFireworksNexus|Preset' ./internal/provider
ok at the pushed head; go test -count=1 -timeout 45m ./internal/provider
./internal/gui ./internal/catalog at the pre-rebase base: provider and
catalog ok, gui red only in the real-window AppKit tests killed at their
deadline under mote's load (TestCoveredWindowStaysUp,
TestClosingWindowMarksPageOutOfSight,
TestPanelHiddenByWailsMarksPageOutOfSight; #2645, #4924, #4125).
gofmt clean; go vet darwin, linux (nogui) and windows of internal/provider.
Broken by hand: without NoList TestFireworksNexusPreset goes red, the
fake platform list's accounts/fireworks/models/glm-5p3 listed and its
/models asked.
Not tried: a real Nexus key (none here), so neither `auto` on each API,
the header passthrough, nor what /models answers for a Nexus key; the
`auto` context window is left to the catalog (Nexus CLI writes 1M/131K).
GUI suite not run: presets reach the Add sheet as data and no GUI file
names a preset list.
2026-11-10 22:26:38 +08:00
yetone 0baa223ec9 agent: Kun, magpie as a provider connection through its runtime API (zhongxingyuyes on X)
Kun (KunAgent 0.4.5, Electron, com.xingyuzhong.deepseekgui) keeps its
model providers in ~/.kun/data/model-connections.v2.json (or
$KUN_DATA_DIR) and changes them only through its runtime's admin API,
whose address and token are in runtime.json. magpie wires Kun by
calling that API while Kun runs:

  POST   /v1/model-connections/connect    the magpie connection
  PATCH  /v1/model-connections/:id        models, gateway address
  POST   /v1/model-connections/select     the default model
  DELETE /v1/model-connections/:id        off
  POST   /v1/provider-config/transactions/preview, then commit
         off when magpie's connection is the default: Kun refuses a
         plain DELETE of the connection its default names, so the
         transaction clears the default and removes it in one step,
         and the default the user had before is put back.

When Kun isn't running, wiring says "open Kun, then try again"; the
file is never written behind Kun's back. Kun joins the agent list,
desktop-app detection, the env guard, the icon set (kun.png), the
READMEs and docs/reference.md and docs/subsystems/agent-wiring.md.

Run:
- WSL (Ubuntu 24.04), at the rebased head: go test -tags nogui
  -run 'Kun|ListsModels|Picker|Spelled|HandWired|Sync|Drift|ListOnly|
  Moved|LAN|Proxy' ./internal/agent ./internal/agentenv ok;
  ./internal/library ok; ./internal/gui -run 'Icon|Budget|CSS|I18n|
  Picker' ok (agentenv: no tests match the filter).
- Windows (win-run): go test -run 'Kun|ListsModels|Picker|Spelled|
  HandWired|Drift|ListOnly' ./internal/agent ok. CGO_ENABLED=0 go vet
  for windows (agent, gui, agentenv), darwin nogui (agent, agentenv)
  and linux nogui (agent, agentenv, gui): clean. gofmt -l clean.
- GUI (WSL, chromium + webkit): i18n-keys, i18n-en-no-cjk,
  icon-one-tone, routing-client-icons, icon-tile together 63/63 at
  this head. An earlier run at the pre-rebase head was 60/63, the 3
  reds icon-one-tone's "Open Design one-tone ... Plugins page"
  (chromium), which passed 48/48 alone there and at origin/main: a
  load red (#5425).
- Real Kun 0.4.5 (Linux build, sandbox HOME, `kun serve`): connect,
  a second model, Sync, restart, off. `kun run`
  finished a turn through the gateway (POST /v1/chat/completions,
  Bearer magpie-kun, reply "hello from magpie"). Off restored the
  previous default, and with no previous default Kun was left with
  none and no magpie connection.

Broken by hand: off through the plain DELETE again. The fake Kun now
refuses it as the real one does, and TestKunFromNothing and
TestKunFollowsTheGateway went red with "Deleted connection still has
references: default.providerId"; green with the transaction.

Not tried: Kun's desktop window itself (the runtime was driven
headless); macOS (mote refused SSH all session); `kun run --model`
(run uses its own default model, not the registry's default, so a
CLI run picks magpie's model only with --model).
2026-11-10 22:07:34 +08:00
yetone 6a450c4982 agent: Shelley, magpie's models as its custom models (on X, tweet 2120109384315658393)
"Can support Shelley?" Shelley is boldsoftware/shelley (Apache-2.0, Go,
`shelley serve`). It keeps models and profiles in its SQLite database,
not in a config file, so magpie talks to a running Shelley through the
same API its own Models and Profiles pages use, on the Unix socket it
opens for its CLI ($SHELLEY_SOCKET, else shelley.sock / shelley-N.sock in
$XDG_CONFIG_HOME/shelley or ~/.config/shelley; read from its source).

- Connect: each magpie model is a custom model (POST /api/custom-models,
  provider_type openai, endpoint = the gateway's /v1, Shelley's own
  gateway key, model_name = the catalog id, reasoning/images/max_tokens
  from the catalog). Picking one makes it the default profile's model
  (PUT /api/profiles/{name} with the whole profile, as the API requires)
  and clears a thinking level the model can't take.
- The user's own values: the profile's model and thinking level are
  stashed once and put back on Disconnect (to the server's default if
  that model is gone); only the custom models magpie made (ids stashed)
  are deleted, so a model the user pointed at the gateway by hand stays.
- Sync re-points magpie's models when the gateway port moves; Check names
  a model left on an old address. Shelley not running is an error on a
  pick and nothing on Sync/Check; turned off while Shelley is uninstalled,
  the takeout is stashed and done when Shelley answers again (Alma's way).
- A notice: new conversations start on the pick, an open one keeps its
  model. i18n for zh, zh-TW, ja, de.
- Icon: Shelley's own S mark from its assets, one tone. README (en, zh),
  site index, docs/reference.md, docs/integrating.md, site integrate
  pages (en, zh), docs/subsystems/agent-wiring.md.
- Library: listed as "not looked at (#5897)" like the other new agents.
- Shelley has no Windows build, so there is no Windows or WSL wiring.

Run (mote refused SSH for the whole session, kex reset, so runs went to
the Linux VM and the Windows box):
- Real binary: shelley v0.1718.926152762 linux_amd64 (sha256 66cb5acb…
  checked) in a sandbox HOME/XDG_CONFIG_HOME/-db on the Linux VM, with a
  throwaway test driving it against a fake OpenAI upstream at
  MAGPIE_ADDR: connect made custom model glm-4-6-… and the default
  profile's model; POST /api/conversations/new sent two
  /v1/chat/completions with model=relay/glm-4.6, auth magpie-shelley,
  UA Shelley/58d5f200; disconnect left the profile as before and no
  custom models. Check "" and Drift nil while connected.
- Linux (wsl-run, nogui): go vet ./internal/agent ./internal/agentenv
  ./internal/library; go test ./internal/agent ./internal/agentenv
  ./internal/library ./internal/profile ./internal/sessions: ok except
  TestGrokInstalled (#3548, red on base too) and, before its fix here,
  TestEveryAgentInLibrary. internal/cli times out there in
  TestEveryAgentFieldNameWritesNothing (43m, the #5234 class).
- Windows (win-run): go vet ./internal/agent ./internal/agentenv;
  GOOS=darwin and GOOS=linux -tags nogui vet; the Shelley, applied,
  rewire, disconnect, mark and kept tests: red only in
  TestAppliedOfParsesAnUnchangedFileOnce (#5950),
  TestAsideOfflineDisconnectRestoresWithoutDaemon (#5951) and the #4786
  allocation tests, all red on base d4b4a188e too. internal/cli
  TestHelpOnEveryCommandDoesNothing, TestEveryAgentFieldNameWritesNothing
  and internal/library TestEvery*: ok.
- GUI (node --test, chromium + webkit) i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  routing-client-icons, usage-agent-filter-icons, agent-connect,
  agent-models, agent-layout, on the Windows box at the rebased head:
  110 tests, 107 pass. Red: gui-ja "ja has every zh string" ({model}
  twice, #5943) and icon-one-tone webkit voyage-color (#5962), both red
  at origin/main a1ba92ad8 too.
- At the rebased head 2a9c7b715 (on origin/main a1ba92ad8), Linux:
  vet of agent, agentenv, library ok; go test agent, agentenv, library,
  profile ok except TestGrokInstalled (#3548). Pushed on ca7a39291,
  which changes only internal/gateway (MiniMax drawing); not rerun.
- gofmt -l clean.

Broken by hand: not restoring the profile's model on Disconnect turns
TestShelley and TestShelleyThinkingLevel red; not deleting magpie's
custom models turns TestShelley and TestShelleyKeepsHandWired red.

Not tried: a real model upstream (the upstream was a fake), macOS (mote
unreachable; the darwin build was vetted only), the GUI against a real
Shelley, Shelley's web UI after the switch.
2026-11-10 21:52:19 +08:00
yetone c2c2c82ca8 agent: Tuanjie Cowork, a magpie provider and model in its Custom Models (Charles24209792 on X)
Tuanjie Cowork (Unity China's coworker app, dev.codelycowork.desktop,
2.1.6-stable) keeps the user's own models in ~/.codely/settings.json:
customModelProviders {id, name, baseUrl, apiKey, authType} and
customModels {id, model, providerId, displayName, roles, wireApi,
supportsMultimodal}, read afresh on every lookup. Read from the app's own
core (tZ/oE for the file, Mwi for a session's OPENAI_BASE_URL/KEY, BOe
for the model list, rha/sha for its startup migrations).

magpie adds a provider and a model of its own, both id "magpie": the
gateway's /v1 with Cowork's own magpie key, the model picked, wireApi
chat. The user's providers and models and every other key stay as
written; a name or roles given magpie's entries in Cowork are kept when
the model changes. Off takes both out, and the file too when magpie made
it and nothing else is in it. A provider or model with id magpie that is
the user's own is left alone, with an error. Which model a chat is on is
Cowork's own per-workspace pick, which magpie doesn't write; a notice
says to pick "<model> (magpie)" in its model menu while it runs. Skills
go to the shared ~/.agents/skills, which its core scans. Icon from the
app's icon.icns. Lists, READMEs, reference, agent-wiring doc, i18n.

Run:
- go test ./internal/agent ./internal/library ./internal/gui on mote;
  TestTuanjieCowork* and TestHandWiredMagpieProviderSiblings on Windows
  (win-run).
- gofmt; go vet darwin, linux -tags nogui, windows.
- GUI, chromium and webkit: i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone,
  icon-tile, routing-client-icons, usage-agent-filter-icons,
  agent-connect, agent-models, agent-layout.
- Cowork's own code on magpie's output: its tZ, oE, rha, sha, cE, KGa,
  Mwi, kOe and BOe, extracted from the 2.1.6 core, run in node on the
  settings.json magpie wrote (with the user's own provider, and fresh).
  Its migrations leave magpie's entries; cE("magpie") finds the model,
  the picker label is "deepseek/pro (magpie)", a session gets
  OPENAI_BASE_URL http://127.0.0.1:3425/v1 and magpie's key, the list
  URL is /v1/models, and the user's glm-4.5 is still there.

Where: the packages, vets and GUI files above ran on mote at b834dc2a7
(this change on 4a9142ccd); at the pushed head (on 016763f23) internal/agent's
Cowork, HandWired, EveryAgent, Aliases and Icon tests, internal/library, and
the de, zh-TW and en-no-cjk i18n files ran on Windows. Reds not from this
change, both red on main already: gui-ja's {model} twice (#5943), and
TestEveryAgentInLibrary for obsidian and avibe (#5945).

Broken by hand, each red:
- rest() keeping magpie's entries: TestTuanjieCowork (two models) and
  TestTuanjieCoworkMadeFile (file left behind).
- no check for a provider id magpie of the user's own:
  TestTuanjieCoworkLeavesTheUsersMagpie/provider.
- unwire never removing a file magpie made: TestTuanjieCoworkMadeFile.

Not tried: the real app's GUI (picking magpie's model in its menu and a
chat through it), Windows detection (its NSIS per-user path isn't
known, so on Windows it shows once ~/.codely exists), Linux.
2026-11-10 20:50:10 +08:00
yetone 4a9142ccd4 agent: Obsidian, magpie's models in Copilot for Obsidian (shirotokiren on X)
shirotokiren asked for magpie to set up Obsidian's AI plugins, naming
Copilot and Smart Connections.

The new agent "obsidian" finds the vaults in Obsidian's obsidian.json:
~/Library/Application Support/obsidian on a Mac, %APPDATA%\obsidian on
Windows, and on Linux $XDG_CONFIG_HOME/obsidian or the Flatpak or Snap
folder. In each vault that has Copilot for Obsidian 4+
(.obsidian/plugins/copilot), magpie edits data.json in the shape
Copilot 4.0.19 reads:
- it adds providers.magpie, openai-compatible at /agent/obsidian/v1,
  with requiresApiKey false and no keychain id;
- it adds one configuredModels entry per magpie model, with a
  deterministic uuid v5 id, plus limits, image input and reasoning
  efforts;
- new models go into backends.chat.enabledModels;
- on the first wire it sets defaultModelKey, and stashes the old value.

A sync keeps the models the user turned off, their default, and the
name they gave the provider. It writes only the keys that change
(edit.PatchJSON, then temp and rename), and nothing when nothing
changed. A provider named magpie counts as magpie's only when its
baseUrl is magpie's Obsidian route. One the user added by hand under
that name is theirs: it doesn't read as connected, Disconnect leaves
it, and Connect says so and writes nothing. Disconnect takes magpie's entries out and puts the old default
back. Copilot 3, a data.json it can't parse, and no vault with Copilot
are each an error, and nothing is written. A notice asks the user to
reload Copilot, since Obsidian holds the settings in memory.

The gateway now answers CORS for app://obsidian.md keylessly
(appOrigin). Copilot streams through the window's fetch, and without
CORS headers it can read no reply. Only Obsidian's own window sends
that origin, so it gets no more than its calls without an Origin get.
From the network it still needs a key.

Smart Connections is not wired. Its free plugin embeds with a local
model only, and its API providers are in the closed Pro plugin, with
keys in the keychain.

Run (mote, at 401187300 + this commit, then again after rebasing on
9c39edb92):
- gofmt
- go vet for darwin, linux nogui and windows
- go test -run 'Obsidian|Notice|CORS|Craft' ./internal/agent ./internal/gateway
- GUI, chromium and webkit: i18n-keys, i18n-en-no-cjk, icon-one-tone
  (56 of 56)
At 9c39edb92 + this commit: the whole internal/agent package ok
(211s), vet for darwin, linux nogui and windows, CORS tests ok.
At 4d95d81ea + this commit: Obsidian, HandWired and Spelled tests,
vet for darwin and windows, and the three GUI files again (56 of 56).
win-run: TestObsidian* ok on Windows 11.

Broken by hand (each went red, then was restored):
- corsGuard without the appOrigin branch: TestCORSObsidian, preflight
  404.
- re-enabling every magpie model on sync: TestObsidianCopilot, "a
  model the user turned off came back on".
- dropping the user's configuredModels: TestObsidianCopilot.
- counting any provider named magpie as magpie's:
  TestObsidianCopilotHandWiredMagpieIsTheirs.

Not tried: a real Obsidian with Copilot loading the written data.json.
The fixtures follow Copilot 4.0.19's types and migrations. Not tried
over LAN either. The full suite runs after the tag.
2026-11-10 20:06:21 +08:00
yetone 5e3f14f21f agent: Paimon, magpie's models through its litellm provider (ditangongyuan on X)
Paimon (aisk/paimon, `uv tool install paimon`) is a terminal coding agent
on pydantic-ai. Read at 7f7fa51 (config.py, llm.py): its settings are one
JSON file, $PAIMON_CONFIG_HOME/config.json, else ~/.config/paimon/config.json
on every OS. "model" is provider:name, and "providers" keeps each
provider's api_base and api_key.

magpie connects it through pydantic-ai's litellm provider, an
OpenAI-compatible proxy that profiles a vendor/model name by its vendor,
as magpie's ids are spelled, and which Paimon's login never offers:
model = litellm:<catalog id>, providers.litellm = the gateway's /v1 and
magpie's key for Paimon (0600, as Paimon writes it), and
compaction.context_window = the model's window. Paimon compacts against
that only for names genai-prices doesn't know, which magpie's ids aren't;
for a model whose window magpie doesn't know it gets the user's own back,
never the last model's. What the user had in the three keys is stashed and
put back on Disconnect (or `magpie paimon default`); the rest of the file
is untouched, and a file magpie made goes again. A model picked in Paimon
itself while magpie's provider stays is the user's from then on. Requests
are told apart by Paimon's paimon/<version> User-Agent. WSL distros, the
PAIMON_CONFIG_HOME isolation, notices in every language, icon, READMEs,
docs/reference.md, agent-wiring.md and the site's list come with it.

Run:
mote refused SSH all session (kex reset), so the Linux runs went
through wsl-run (magpie-desktop) and Windows through win-run:
- go vet: linux -tags nogui, GOOS=windows, GOOS=darwin -tags nogui on
  internal/agent, agentenv, library: ok. gofmt -l: clean.
- go test -tags nogui ./internal/agent/... agentenv library gui cli (WSL,
  base f03ec97b8): all ok except TestGrokInstalled, the known WSL binfmt
  red #3548.
- Windows: TestPaimon, TestHandWired*, TestEveryNoticeIsTranslated,
  TestPortMovesEveryAgent ok (file-mode checks skipped there).
- GUI, chromium + webkit (WSL): i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  mono-icon-redraw, routing-client-icons, usage-agent-filter-icons,
  agent-connect(-no-models), agent-models(-own, -picker), agent-layout:
  150/151; the red is gui-ja's usage price string, untouched here, filed
  as #5943.
- Real Paimon 0.2.8 (uv pip install paimon) in a sandbox HOME on WSL,
  against a sandbox magpie gateway over a fake OpenAI upstream:
  `magpie paimon magpie/fakeup/m1` wrote litellm:fakeup/m1 and
  providers.litellm at 0600; `paimon -p ping` answered "pong from fake
  upstream", the upstream saw POST /v1/chat/completions with
  "paimon/0.2.8 (Python 3.10.19; Linux x86_64)", and magpie usage counted
  the call under Paimon; `magpie paimon default` put the file back equal
  to the user's.
- After the rebase on origin/main 9c39edb92: the three vets, the targeted
  agent tests and internal/gui ok; internal/library's
  TestEveryAgentInLibrary red for avibe from 9c39edb92 (#5945, not this
  change); i18n-keys, i18n-en-no-cjk, agent-notice-lang, gui-de, gui-zh-tw
  ok; icon-one-tone's every-logo case ok in both engines, its webkit
  Plugins-page case timed out on page.goto's 5s at WSL load 92 (#5425).

Broken by hand, each red in TestPaimon:
- the user's window not put back for a model magpie doesn't know (switch
  window: <nil>);
- stashing again while providers.litellm is magpie's (switch window: 200000);
- a file magpie made not removed (made file left: {});
- a model picked in Paimon not kept as the user's (restore after a pick).

Not tried: macOS (mote unreachable) and the GUI's own Connect click with
the real binary; Paimon's auto-compaction at a window magpie wrote (the
fake model had none, so Paimon said compaction was off, as it does for any
name it doesn't know); a model picked in Paimon's own /model while
connected beyond the unit test.
2026-11-10 19:54:37 +08:00
yetone 9c39edb92c agent: Avibe, magpie as a model source through its Model Hub (alex_metacraft on X)
Avibe (avibe-bot/avibe, avibe-os on PyPI, the `vibe` CLI) runs its own
agent, Vibey, and Claude Code, Codex and OpenCode, all on models from its
Model Hub. Its sources live in model_hub.sources of config/config.json in
$AVIBE_HOME (else ~/.avibe, else a legacy ~/.vibe_remote), but a source
can't be written there by hand: its key is sealed in the hub's credential
store and Avibe puts it into its agents' route chains as it is made.

So the Avibe row adds "magpie" the way Avibe's Models page does, through
its internal API (POST /internal/model-hub on state/dispatch.sock, or on
Windows the loopback port + bearer of runtime/control-ipc/endpoint.json):
create_source with kind api_key, vendor custom, base_url the gateway's
/v1, key agentKey("avibe"), protocol openai_chat and save_unverified.
Avibe then lists the models from /v1/models and adds the source to
Vibey's, Claude's, Codex's and OpenCode's chains itself.

- openai_chat, not openai_responses: for a Responses source Avibe's
  CLIProxyAPI runs Codex's executor, which sends codex-tui headers the
  gateway would take for Codex.
- Off is delete_source with force, sent again with the would_remove_hops
  and would_interrupt Avibe answers, as its page confirms them. Sync is
  refresh_source the same way; on a moved gateway the source is made
  again (the key goes with the address; patch_source can't change it).
- The source id is stashed; a custom source at the gateway's /v1 counts
  as magpie's too and is stashed once seen.
- Every change needs Avibe running; otherwise the switch says to run
  `vibe start` (errAvibeDown). Nothing is written to config.json.
- A sync moves the source only from the gateway's own address on an
  older port (avibeMoved). One the user pointed at a NAS's or the LAN's
  magpie, a local proxy's route, or a WSL distro's way to Windows stays,
  as kept.away keeps every file-written agent's; a Rewire after a port
  move sets it again through the field's Set.
- Every test of the package but Avibe's own finds an Avibe running for
  each home (runningAvibe, served in-process), so the tests that connect
  every agent (gateway moved, LAN and proxy addresses kept, drift,
  ListOnly) take Avibe in too.
- The logo is a tile solid to its edges, so it joins app.css's tile rule
  (icon-tile.test.cjs went red without it).
- AVIBE_HOME joins agentenv and the ~-expanding path vars (Avibe expands
  it). Icon from Avibe's assets/logo.png (MIT), 64px.

Run:
- Real Avibe 3.2.5 (uv tool install avibe-os) in a sandbox HOME in WSL
  magpie-desktop, with a fake OpenAI server as the gateway: magpie's own
  code (a throwaway test, AVIBE_HOME + MAGPIE_ADDR) connected it, Avibe
  discovered both fake models with "Authorization: Bearer magpie-avibe"
  and put the source in vibey/claude/codex/opencode chains; Sync
  refreshed; a gateway move to :3592 made the source again there and
  stashed the new id; a second run found the source by address alone
  and still followed the move; off removed it (list_sources []).
  Earlier, by hand: Anthropic /v1/messages and /v1/responses through the
  hub reached the fake as chat completions.
- wsl-run, at this head rebased on origin/main 021a6e1fd (then 401187300, where the Avibe and all-agents tests, i18n-keys, icon-tile and the gui -run set were run again: ok on Linux and Windows): go test
  -tags nogui ./internal/agent ./internal/appdir ./internal/agentenv:
  appdir, agentenv ok; agent ok but TestGrokInstalled, red on WSL2 at
  main (#3548).
- win-run: the Avibe tests and the all-agents tests (drift, port move,
  LAN, proxy, ListOnly, pickers): ok. The whole internal/agent package
  on Windows (one commit earlier) has main's known Windows reds (#4115,
  #5068, #4846, #5130, #5344, ...); its two Avibe reds (drift, ListOnly)
  are what runningAvibe fixed.
- vet (on the Windows box): windows, GOOS=darwin, GOOS=linux nogui on
  agent/appdir/agentenv: ok.
  gofmt clean.
- GUI (chromium + webkit, win-run): i18n-keys, i18n-en-no-cjk,
  icon-one-tone, routing-client-icons, icon-tile: 63 of 63 ok; go test
  ./internal/gui -run 'Icon|Budget|CSS|I18n|Picker': ok.
- mote refused SSH all session, so everything ran on wsl-run/win-run.

Broken by hand:
- a sync moving any address that isn't the gateway's: the LAN- and
  proxy-kept tests red on Avibe's config.json.
- app.css without avibe in the tile rule: icon-tile.test.cjs red.
- protocol openai_responses: TestAvibeAddsMagpieAsAModelSource red.
- confirmed() not resending the echoed hops: the add, knows-its-source
  and follows-the-gateway tests red (source_in_route_chain).

Not tried: magpie on Windows wiring an Avibe that runs inside WSL; a
real Vibey turn against the real gateway (the fake stood in for it);
macOS with a real Avibe.
2026-11-10 19:36:59 +08:00
yetone 4011873001 catalog: models.dev unreachable falls back to the last copy or a shipped one, retried in minutes (creeksuen on X)
Where models.dev can't be reached (a network in China), the catalog that
gives prices, context windows, reasoning levels and names degraded:

- first run: no catalog file, so every model unpriced, no windows, and a
  plugin's provider listed no models, until a fetch got through;
- a failed fetch: KeepFresh tried again only after an hour, and the app's
  backend waited up to 30s on models.dev before it asked the vendors for
  their lists;
- Sync wrote models.json in place (os.WriteFile), so a reader could catch
  it half written, and a parse failure left no catalog at all.

Now:

- Sync writes the catalog through a temp file renamed over it
  (writeWhole, shared with labs.json). A refused, hanging or wrong answer
  (HTML, cut-off JSON) keeps the last good copy byte for byte.
- The binary ships models.dev's api.json of 2026-11-10
  (internal/catalog/bundled/api.json.gz, 608KB; go:generate refreshes it).
  loadGen reads magpie's copy, then OpenCode's, then the shipped one,
  passing over one it can't parse. Seed (app backend, magpie serve, the
  plugin host) writes the shipped copy into the cache when there is none
  or it is older, dated bundledAt, so the plugin host reads it and Stale
  still has the real one fetched. A test binary has it off (bundledOn).
- The app's backend no longer waits on models.dev before the vendors'
  lists when a catalog is there; KeepFresh fetches beside them, and a
  failed fetch is tried again after 2 minutes, doubling up to the hour.
- The fetch already goes through http.DefaultClient, which
  netproxy.Install routes through the proxy in Settings, *_PROXY or the
  system proxy; there is no models.dev mirror setting to honour.

Run (mote, at the rebased head unless said):
- gofmt -l: clean. go vet darwin (catalog, plugin, cli, gui), linux -tags
  nogui and windows: ok.
- go test ./internal/catalog: ok at the rebased head; ./internal/plugin,
  ./internal/gui, ./internal/cli: ok at the pre-rebase head but for
  TestEveryRouteHasACommandOrIsNamed, red at that older base (a GUI route
  this change doesn't touch) and ok at the rebased head.
- New tests, each fake models.dev on 127.0.0.1 (cut connection, hang,
  captive-portal HTML, cut-off JSON): TestFailedSyncKeepsLastGood,
  TestFirstRunOfflineAnswersFromShippedCopy,
  TestUnreadableCacheFallsBackToShippedCopy, TestSeed,
  TestSyncWritesThroughRename, TestFailedFetchRetriedSoon.
- Windows (win-run): the catalog tests ok, 15 of 15 with -count=15;
  TestSyncWritesThroughRename skips there (it holds the file open).

Broken by hand, each red: Sync back to os.WriteFile
(TestSyncWritesThroughRename); load without the shipped copy
(TestFirstRunOffline…, TestUnreadableCache…); Seed over a newer catalog
and Seed dated now (TestSeed); first retry after the hour
(TestFailedFetchRetriedSoon).

Not tried: the real app started with models.dev blocked; the full suite
(started after the tag).
2026-11-10 19:26:13 +08:00