Commit Graph
240 Commits
Author SHA1 Message Date
yetone e65bc84731 plugins: a git plugin updated past the commit the look found waits no more (#4802)
matrix0487 (Discord, #4802): github:faithleysath/magpie-oh-my-aihub, unpinned.
The look at 14:38:55 wrote {version: fdaa691, latest: 3b411a5}; the repository
moved on to ba898e7 twenty seconds later, and Update installed ba898e7. The
dot, "Update all (1)" and the row's New commits stayed until the next hourly
look, and every Update after said only "is up to date".

Cause (checked against the source, as the reporter traced it):
- PendingUpdates kept a git entry until the commit installed was the
  recorded latest (GitBehind is installed != head, not "behind"), so a commit
  newer than latest kept it forever. The npm branch compares versions in
  order and was right.
- Upgrade, Update and add never touched plugin-updates.json; only the next
  CheckUpdates/CheckNow rewrote it.
- The page kept /api/plugins/git's old head (3b411a5) in its heads map, and
  merge() put it over the plugins' own fresher head after the update, so the
  row's New commits and Update all stayed even with the file right.

Changes:
- waitsNoMore (shared by PendingUpdates and the new settleWaiting): a git
  entry also waits no more once the commit installed is not the one the look
  saw installed (Version).
- settleWaiting rewrites plugin-updates.json without what waits no more,
  after add (every install, npm Upgrade, Update's pinned path), a git
  Upgrade, Update (Update all) and InstallMissing. Checked time is kept.
- reinstall's #2954 "left it at X" error now needs the commit to have stayed:
  a moved install that can't ask the repository again (rate limit, offline)
  isn't reported as stuck on the look's older head.
- plugins.js: an action on a plugin (Update all: on every one) drops the
  page's cached head for it, so the plugins' own head is drawn; a git Update whose
  commit moved says "{name} updated to {commit}" (zh, zh-TW, ja, de), and
  the Up to date chip's tooltip prefers the row's head over the check's.

Siblings: npm (version order already right; now also rewritten on file),
a commit pin (dropped once at the pin: test case), Update all (same flow as
Upgrade: test case), the toast (above). CheckNow/CheckUpdates rewrite the
file as before.

Tests (reporter's literal fdaa691 / 3b411a5 / ba898e7):
- TestGitWaitingGoneOnceUpdatedPastTheLook: installed ba898e7, 3b411a5, another
  commit, still fdaa691 (waits), and a pinned spec.
- TestSettleWaitingRewritesTheRecord: git + npm entries gone from the file.
- TestGitUpdatePastTheLookWaitsNoMore: fake bun + fake GitHub; look, push,
  then Upgrade / Update / Upgrade with GitHub down after; nothing waits on
  file or in PendingUpdates, and the update isn't an error.
- plugin-git.test.cjs: the repository moves on after Check for updates;
  Update installs ba898e7, no New commits, no Update all, toast names it.

Run at the pushed head (rebased on 99d9016fd), on mote:
- After the last rebase onto 16ce5ed23 (quotaall.js, i18n.js): internal/gui
  TestCoreScriptBudget ok, i18n-keys and plugin-git in both engines 10 of 10.
- gofmt -l internal/plugin internal/gui: empty. go vet darwin, linux
  (nogui) and windows on internal/plugin, gui, provider: ok (at d2a83de61;
  only plugins.js changed after).
- go test internal/plugin, internal/provider: ok. internal/gui
  TestCoreScriptBudget: ok, 1,533,780 of 1,533,802 with no room added (the
  JS's comments cut to one).
- go test internal/gui and internal/cli at d2a83de61: ok except
  TestMainWindowCorners (#3949), TestSettingsCLISetsWhatTheWindowSaves
  (#4793) and TestEveryRouteHasACommandOrIsNamed (#4794), main's own.
- node --test plugin-git, plugin-update-button, plugin-updates,
  plugin-check-updates, plugin-card-update, i18n-keys (chromium + webkit,
  every language they cover): 54 of 56; the 2 are plugin-card-update webkit
  waiting 5s for the card's Update button before any click, red 2 of 3
  alone at this head and 2 of 3 alone at origin/main 99d9016fd (#3079).
- Before the rebase, every plugin-*.test.cjs + i18n-keys +
  account-plugin-user: 956 of 960, the 4 being plugin-move-unserved's "Try
  again takes the models unticked", equally red at de7953e3b (#4410).

Broken by hand (on mote, then restored):
- all three Go parts removed: all three new Go tests red (the reporter's
  ba898e7 case keeps Waiting; the file keeps both entries; Upgrade/Update
  keep it waiting, and the GitHub-down Upgrade errors "left it at ...").
- plugins.js without the heads line: plugin-git red in both engines (New
  commits still shown, 6 of 6 red).
- only settleWaiting a no-op: TestSettleWaitingRewritesTheRecord and the
  on-file check of all three TestGitUpdatePastTheLookWaitsNoMore cases red.

Not tried: the reporter's real repository or a real bun against GitHub (the
fake bun and fake GitHub API stand in); the Windows and Linux apps.
2026-11-02 03:54:00 +08:00
yetone 276c806db2 plugins: a plugin's own requests are counted; a provider plugin's options get the editor (plugins#592)
zelong77 asked for two things once Devin 0.1.30's cache keep-alive
worked: its pings were invisible in magpie, and the interval and ping
count could only be edited in plugins.json. The owner decided pings are
shown as counted usage and the two numbers are edited in the GUI.

- host.js gives plugins input.magpie.usage(provider, call) and
  input.magpie.account(provider). usage validates the call (kind
  [a-z0-9_-]{1,40}, a model id, whole-number tokens from 0, status at
  most 999, error clipped to 500) and sends an unasked "usage" event;
  host.go hands it to plugin.OnUsage in the background.
- internal/usage/plugin_calls.go writes each one as a row of agent
  magpie on the plugin's provider (provider.PluginID) and account
  (provider.PluginAccountUser), with its kind. It is counted, priced
  and in every total, not a probe. Kind cache_keepalive is in the
  purpose catalog as "Cache keep-alive" (five languages), so the
  request log names and filters it. The ping itself still goes straight
  to Devin, never through the gateway, which would break the cache.
- /api/plugins reads every plugin's package options example, not only a
  middleware's or request hook's, and the Installed row offers the same
  Options JSON editor for a provider or agent plugin that suggests or
  has options (not while it is off). Clear's confirm no longer calls
  them a middleware's options.
- The Devin mover's min is 0.1.31, which reports each ping and gives
  its two settings' defaults (285 s, 6) to the editor. npm has 0.1.31
  (published 10:03Z); the plugins publish run is red only for
  think-tags' known E404 (plugins#180).
- docs: provider-plugins.md (the API, the options editor),
  gateway-sessions.md (the counted row beside probes).

Run at this tree (rebased on origin/main 85e37162e):
- mote (mote-run): go test -count=1 -timeout 45m ./internal/plugin
  ./internal/usage ./internal/gui ./internal/provider: plugin, usage,
  provider ok; gui red only in TestMainWindowCorners/macOS_26_SDK, the
  macOS 27 red already filed as #3949 (not this change's code).
- mote: GOOS=linux and GOOS=windows go vet of plugin, usage, provider ok;
  gofmt -l clean.
- mote: plugin-provider-options.test.cjs (new, 5 languages, 980/420px,
  Chromium + WebKit), plugin-gateway.test.cjs and i18n-keys.test.cjs:
  28 of 28 pass.
- The whole GUI suite (make test-ui) on WSL magpie-desktop (mote was at
  load ~100 with other sessions' suites, #4125), at the 8f804396f base:
  cut off after 498 test entries, when the session's background jobs
  were killed; 495 ok, 3 red, none on a page this change touches. Run
  again alone at origin/main 85e37162e, the same files are red there
  too: account-eye webkit (#4244), agent-expand-steady webkit 980px
  (#2935), add-button zh's 3000ms waitForFunction (filed #4792). The
  rest of the suite was not run.
Broken by hand (each red, then put back):
- host.go dropping the "usage" event: TestPluginReportsOwnUsage fails.
- plugins.go reading optionsExample for middleware/hooks only:
  TestProviderPluginOptionsExample fails.
- purpose.go without the Cache keep-alive kind:
  TestPluginKeepaliveIsCounted fails (purpose {}).
- plugins.js without ownOpts: plugin-provider-options.test.cjs times
  out waiting for the Options button in every language.
Not tried: a real Devin account's keep-alive ping reported into a real
magpie (needs a live Devin conversation idle for 285 s); a plugin can
report a row for any provider id, as magpie.load can.
2026-11-01 22:14:19 +08:00
yetone d614f21721 gateway: a HEIC photo goes to the vendor as JPEG, or PNG with alpha (qikamatata on X)
Pi and Pi Desktop send an iPhone photo dragged in as image/heic, and
DeepSeek flash on WorkBuddy (a plugin's fetch) turned it away; most
vendors take JPEG, PNG, GIF and WebP only.

What: heicAsJPEG (heic.go) runs at the top of Server.serve, after
offAsNone, so every route below sees the converted image: a provider's
own, a plugin's fetch, the describer, every translation. count_tokens
does the same. It walks images through walkImages, the one image walker,
so it covers Chat image_url (string or object), Responses input_image,
Anthropic image blocks and Gemini inlineData, tool results included. It
goes by the bytes (ftyp + an HEVC still's brand), so a HEIC labelled
image/jpeg or image/png is converted too, and a JPEG labelled heic is
left alone. Other fields of the block (detail, cache_control) are kept.
Transparent images go as PNG, opaque ones as JPEG q90.

Cost: a body with no "image/hei" and no base64 ftyp mark ("eXB" + 5
chars, at the same place in any base64 that starts at the file) is not
walked. Caps: 48 MB of base64, 50 MP, the long side written at 4096 px,
one decode at a time, 30 s wait (a late result is cached for the next
turn), a 64 MB / 32 entry cache by sha256, since agents resend a
conversation's images every turn. Any failure, panic included, leaves
the image as it came. Measured on mote (M5 Pro): 12 MP 0.44 s, 24 MP
0.86 s, 48 MP 1.6 s / ~1 GB held, freed at once with FreeOSMemory.

Why gen2brain/h265 v0.2.4: pure Go (release builds are CGO_ENABLED=0),
MIT, no dependencies, SIMD on amd64 and arm64, maintained (latest
2026-10-29). Not chosen: gen2brain/heic (wazero WASM or a libheif dylib
through purego), jdeng/goheif (cgo libde265), OS converters (Windows
needs the paid HEVC extension, Linux tools are often missing).

Tests (heic_test.go, fixtures made on mote with sips, 1.6 KB each):
12 shapes converted with their kept fields, pixels kept, 7 non-HEIC
cases byte-identical, a cut file / a panicking decoder / a timeout go
as they came, and a plugin's fetch (fake plugin, new FAKE_SEES image
model) gets JPEG on /v1/chat/completions and /v1/messages.

Run at this tree (733fac48f + this change), on mote:
- gofmt -l internal: clean
- GOOS=darwin/linux/windows go vet -tags nogui ./internal/gateway
  ./internal/plugin: ok
- CGO_ENABLED=0 go build ./internal/gateway for darwin, linux, windows
  x amd64, arm64: ok
- go test ./internal/gateway ./internal/plugin -count=1 -timeout 45m:
  ok (774s, 134s)
- win-run (Windows amd64) and wsl-run (Linux amd64, AVX2 path):
  go test ./internal/gateway -run HEIC: ok

Broken by hand, each red, then restored:
- no heicAsJPEG call in serve: TestHEICReachesPluginAsJPEG red
- media_type not set for Anthropic: the messages subtests red
- no base64 mark scan: the "labelled jpeg/png" subtests red

Not tried: a real Pi -> WorkBuddy request with a real account; a real
iPhone gridded HEIC (only sips files and Apple's 26 MB wallpaper); a HEIC
behind an http URL (not fetched, goes as it came); Anthropic document
blocks, Responses input_file and images/edits.
2026-11-01 15:04:28 +08:00
yetone 7503beee72 plugin, settings: a model's load goes past 100% for a vendor that queues (axelburks on Discord)
axelburks, on v0.1.2547: their vendor queues, so a model's load can be
past 100%, even 200%. magpie clamped every load to 100, and Busy models
last allowed 1-99 only.

- host.js reportLoad and plugin.noteLoads keep a load from 0 up. The
  floor is still 0, null still clears it, and a sanity cap of 10000
  (LOAD_MOST, plugin.LoadMost) keeps an absurd value from reaching the
  UI or the trace.
- settings.BusyLoad takes 1 to 9999 (BusyLoadMost-1). The segment
  choices stay Off/50/70/80/90, and a value set in settings.json (150)
  shows as its own choice, as before.
- The editor's badge reads "180%". It is a badge, not a bar, so nothing
  assumed 100 wide; the test checks it stays on one line.
- Docs: site plugins page (en, zh, ja) Values and Routing bullets, and
  provider-plugins.md and gateway-routing.md.

Run on mote via mote-run, on origin/main 8d8df0639+ rebased:
- go test ./internal/plugin ./internal/gateway ./internal/settings -run
  'ModelLoad|TestBusy' -v: all pass. TestPluginReportsModelLoad has
  over:250 kept and huge:1e9 at 10000. TestBusyModelGoesBehind has 180
  behind 120 at a threshold of 150, and 10000 refused.
- Broken by hand in a copy, with the old 100 clamps and the 99 limit:
  TestPluginReportsModelLoad red ("ModelLoad(over) = 100; want 250"),
  TestBusyModelGoesBehind red (150 refused).
- node --test model-load (with Queued 180% in every language, Chromium
  and WebKit, 420 and 900, plus Over 150% picked at 420) and i18n-keys:
  46/46 pass. go test ./internal/gui -run Budget: ok.
- gofmt -l: empty. GOOS=linux go vet -tags nogui and GOOS=windows go
  vet on plugin, settings and gateway: ok.

Not run before the push (owner: push and tag first): go test ./... and
the whole GUI suite. They are queued on mote behind another session's
suite.
2026-11-01 14:28:25 +08:00
yetone 8d8df06399 plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.

- A provider plugin calls input.magpie.load(provider, {"<model id>":
  0-100 | null}) whenever it likes, from its own timer. host.js
  (reportLoad) clamps each number to 0-100, null clears a model, every
  other value is dropped, at most 1000 a call, and it returns the count
  taken. A provider that isn't a string or loads that isn't an object
  throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
  id. ModelLoad answers unknown once a load is older than LoadFresh
  (5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
  ("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
  POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
  1-99 by hand): restLast puts a model reported over it behind the
  ready candidates, ahead of the resting. The trace row has busy:<load>.
  At a new turn affine moves a conversation off it (Why "busy",
  busyBehind); within a turn it stays. after, readyForNew and leastHeld
  skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
  table; docs/subsystems provider-plugins.md and gateway-routing.md.

Run, all on mote via mote-run at a42736807's tree rebased on
origin/main b683f1c0e:
- go test ./internal/plugin ./internal/gateway -run
  'ModelLoad|TestBusy' -v: TestPluginReportsModelLoad,
  TestModelLoadGoesStale, TestBusyModelGoesBehind,
  TestBusyModelNotKeptAtNewTurn pass.
- Broken by hand, each red: host.js not sending the event
  (TestPluginReportsModelLoad "the plugin's loads never arrived"), the
  busy case off in restLast (TestBusyModelGoesBehind order), the affine
  "busy" case off (TestBusyModelNotKeptAtNewTurn "kept true, why
  session").
- go test ./internal/gui -run Budget: ok. No budget raised. app.js
  +86 bytes, two comments trimmed to fit. The settings row lives in
  plugins/gateway/settings.js.
- node --test model-load, i18n-keys, bare-ids, model-rate: 69/69 pass.
  model-load is Chromium and WebKit, 420 and 900 wide, en zh zh-TW ja
  de.
- gofmt -l: empty. go vet ./... (darwin), GOOS=linux go vet -tags
  nogui ./..., GOOS=windows go vet ./..., go build: ok.

Not run before the push (owner: push and tag first): go test ./...
-timeout 45m and the whole GUI suite. mote and the WSL box were each
running another session's full suite. Both run next, and any red gets
its own commit.
Not tried: a real plugin and vendor reporting load. The plugin side is
tested through the real Bun host with a plugin written in the test.
2026-11-01 13:45:40 +08:00
yetone e84870f173 plugins: an option's words in the window's language, and a filtered model list says so (plugins#590)
anewuser6937 (Discord, plugins#590) saw one model in WorkBuddy's editor
and took the plugin for broken. They had turned on "Free models only"
themselves, but its label and description read in English in the Chinese
window, and nothing by the models said the list was filtered.

A plugin option (auth.options, magpie's own field; OpenCode's AuthHook is
provider/loader/methods and never reads it) may now give `labels`,
`descriptions` and `confirms`, each keyed by the window's language
("zh", "zh-TW", "ja", "de"), beside the plain strings, as a page's
`titles` do. The host keeps only non-empty strings under language names
of 16 or less, 16 languages at most, each capped as the plain one is
(60/300/300). The editor shows the exact language, then its first part
(zh-TW reads zh), else the plain words, in the row, the hint, and the
confirm dialog and its title. `filtersModels: true` says the plugin's
model list leaves models out while the switch is on; while one is on, as
saved, the Models field says under the chips "Only some models are
listed: the plugin option “…” is on." (zh 只列出部分模型:插件选项「…」已开启。,
zh-TW, ja, de too). An older plugin shows what it showed before, and an
older magpie shows a new plugin's plain words with no note.

WorkBuddy 0.2.10 gives "Free models only" in all four languages with
filtersModels (magpie-community/plugins aec58ae, on npm: `npm view
@magpie-community/opencode-workbuddy-auth@0.2.10 --prefer-online` on mote
says 0.2.10, latest), and the mover's min is raised to it so every moved
user gets it. The CLI's `magpie plugin options` stays English, as the CLI is.

The core scripts would have gone 608 bytes over their budget; three of the
provider editor's comments in app.js are cut down instead, no raise
(1,532,865 of 1,533,105).

Run, on mote (mote-run), at this tree:
- node --test plugin-option-words.test.cjs (new): Chromium and WebKit,
  1100 and 420 wide, en/zh/zh-TW/ja/de, switch on and off: each
  language's label and description, zh-TW falling back to zh and ja/de to
  the plain words for a zh-only option, the note exactly once under the
  chips in a .hint inside the editor with no sideways scroll, none while
  off, the confirm in the language. With app.js put back: 19 of 21 red
  in Chromium (only "en off" passes, both widths).
- With plugin-options.test.cjs and i18n-keys.test.cjs, both engines:
  68 pass, 0 fail.
- go test ./internal/plugin ./internal/provider ./internal/cli: ok.
  TestPluginOptions with host.js put back: red (empty maps, FiltersModels
  false). The real WorkBuddy 0.2.10 index.mjs loaded into this host
  (a temporary test, not kept): plugin.Providers lists free_only for
  workbuddy and workbuddy-ai with all four languages and filtersModels true.
- go test ./internal/gui: TestCoreScriptBudget ok after the cut. Red,
  and red the same at origin/main ed5872d18 (run there too):
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners
  /macOS_26_SDK on macOS 27 (#3949); TestColdTurnsTaken red once in the
  package run and passed at origin/main (#4510, the same 0.00s red).
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- plugins: HOME=$(mktemp -d) bun test packages/workbuddy 303 pass 0
  fail; the new freeonly test red 2 of 2 with index.mjs put back.

Not run: the whole GUI suite. mote and the WSL box were each running
another session's full GUI suite (hours left on both), and one runs per
machine; it runs on mote once that one ends. Not tried: a real WorkBuddy
account in the real app window. go test ./... was not run.
2026-11-01 13:24:50 +08:00
yetone a6217e83d3 plugins: a plugin npm said nothing of offers Install, not Coming soon (zhudabao8433 on Discord)
zhudabao8433 on Discord (#general, 11-01): PowerContext
(@magpie-community/gateway-powercontext) could be installed yesterday and
today reads 即将上线 again.

Cause: PowerContext was never pulled. It is in registry.json since
plugins 1e4c8a2 (10-29) and on the dist branch (0.2.0, every dist commit
since), and not on npm (E404), so magpie learns its version from the
dist branch's ~1.7MB index.json. Coming soon is drawn whenever a listing
has an npm answer with no version, and three paths gave one without
anything confirming the package is missing:
- builds before v0.1.2413 kept a dist read cut off at npmEach (6s) as
  "not on npm" in plugin-npm.json (ferock, e0eb74987). After an update,
  InfoCached (the listings) and Info ("what it said last") still served
  that empty answer while a new ask couldn't read the branch;
- the page turned every listing /api/plugins/npm said nothing of
  (unknown: npm or the branch not read in time) into { weekly: 0 }, i.e.
  Coming soon, and never asked again;
- /api/plugins/market gave every listing &NPM{} even when Info had no
  answer for it.

Fix:
- market.go: a cached "not on npm" over an hour old is unknown
  (npmEntry.missingStale): left out of InfoCached and of Info's seed.
  One said within the hour stands, as before.
- plugins.js: a listing npm said nothing of is marked unknown ({ u: 1 }), which
  offers Install (installDist waits for the branch with its own read);
  the page asks again up to 4 times, 15s apart, and the answer replaces
  it. A listing npm answered with no version still reads Coming soon.
- plugins.go: pluginMarketState leaves NPM nil when Info has no answer.

Old data: an old "not on npm" is unknown once an hour old, for every
user, with nothing to do on their side.

Tests:
- TestStaleMissingIsUnknownWhileDistUnread (internal/plugin): an
  hours-old "not on npm" with the dist branch 503 is in neither
  InfoCached nor Info; a minute-old one stands; once the branch answers,
  Info has 0.2.0.
- plugin-npm-unknown.test.cjs: PowerContext with no npm answer shows
  Install (enabled), Qoder answered without a version shows Coming soon,
  and after the 15s re-ask (page.clock) PowerContext shows v0.2.0. en,
  zh, zh-TW, ja, de; 980 and 420px; Chromium and WebKit.

Run (mote, at this commit rebased on origin/main 36af588e2):
- gofmt -l clean; go vet darwin, GOOS=windows, GOOS=linux -tags nogui on
  ./internal/plugin/... ./internal/gui/...: ok.
- go test -count=1 -timeout 45m ./internal/plugin/...: ok.
  ./internal/gui/...: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  TestMainWindowCorners/macOS_26_SDK (#3949) red, the same on an
  origin/main 36af588e2 copy; TestCoreScriptBudget green (plugins.js is
  1 byte under main's, a comment cut, no raise).
- node --test plugin-npm-unknown (22/22), plugin-market, i18n-keys: ok.
  plugin-market webkit "the Plugins tab" was red once in the run after
  the Go suite, its output lost; 3 of 3 green after, alone.
- Broken by hand: the Go test is red on origin/main's market.go (an
  hours-old "not on npm" served; want it unknown); plugin-npm-unknown is
  red (waits for Install) on origin/main's plugins.js.
- Earlier GUI batch (70 files: plugin*, market*, i18n*,
  deprecation-notice, list-sort), before the rebase: 968/974; the reds
  are plugin-move-unserved (#4410, #4392, red the same on main) and
  plugin-github-filter chromium en 420px, batch only (#4679).

Not tried: a real slow network from China; zhudabao8433's version is not
known.
2026-11-01 12:12:05 +08:00
yetone 2c6b7c0632 gateway, provider, gui: Accounts at once keeps the first N accounts taking requests, the others in reserve
01huadalang on Discord (#feedback 1566170404542742740): three ZCode
accounts used at once from one address got the address refused with a
405; two were served. They asked for one account to be used until it
runs out, then the next. Even under "In order", ZCode's maxConcurrency 3
spilled a full lane onto the next account (laneMate) and rests spread
the load, so every account was in use at once.

A provider's MaxAccounts (the editor's Advanced → "Accounts at once",
beside Concurrency; `magpie provider at-once <id> [n|off|default]`) is
how many of its accounts or keys take requests at the same time.
provider.AtOnce() is the user's own value, else what its plugin
declares (maxAccounts on the auth hook or package.json magpie, read by
host.js atOnceOf), else no limit; the user's 0 is no limit over the
plugin's. perKeyBarred keeps the first N in the user's own order
(rank), preferring ones not resting, and keepAtOnce puts the rest after
everything as asides with candidate.reserve (Weighed.Reserve). So in any
routing mode a reserve is asked only once the kept ones failed or rest,
and a kept one that rests gives its seat to the first reserve next time.
Guards: laneMate never spills onto a reserve; a full queue (laneErr)
drops the provider's reserves (dropReserves) and turns the request away
with the 429; session affinity moves a conversation off a reserve once
the kept ones can take it (affine "reserve"; Strict still holds).
Routing says "in reserve · {n} at once" on the row and why in the
request's story. zcode 0.1.40 (plugins 26864ec, on npm) declares 2, and
its mover min is raised to 0.1.40 two commits on.

Known leak, in docs/subsystems/gateway-routing.md: a failure that rests
nobody (a 5xx on one try) still passes that one request to the reserve,
as it does to any next candidate.

Tests: TestAtOnceKeepsFirstInUserOrder (every routing mode, a dragged
order, a resting key handing over its seat), TestAtOnceFullLaneWaitsForTheKept,
TestAtOnceReserveTakesOverAndGivesBack, provider TestAtOnce, plugin
host maxAccounts (hook and package.json), gui TestAtOnceSave, cli
TestAtOnceCmd, provider-at-once.test.cjs (both engines, five languages,
900 and 360px).

Broken by hand, each red then restored: laneMate's reserve guard
removed (FullLane times out); affine's reserve case removed
(ReserveTakesOver answers on k3); keepAtOnce disabled (all three red);
dropReserves disabled (FullLane gets no reply); the Routing row's
reserve branch removed (provider-at-once's Routing test red in all 10
engine/language runs).

Core budget: the field adds ~530 bytes to app.js; the neighbouring
editor comments are cut to fit, so TestCoreScriptBudget passes with no
raise.

Run on mote, Go 1.26.8:
- full suite, -timeout 45m, at a7d4c662d (on origin/main e4384fc3c):
  gofmt and vet clean; every package ok but internal/gui, whose reds are
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners
  (#3949) and TestColdTurnsTaken (#4510), each red on that main too, and
  TestCoreScriptBudget, fixed by the comment cut above.
- at this tree on bbdd9eb55 (the pushed head less 51f2f22ce and
  73b957069, gateway and provider): gofmt, go vet (darwin, and
  linux and windows with -tags nogui), and internal/gateway, provider,
  gui, cli, plugin and settings: all ok but internal/gui's
  TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners
  (#3949), both red on main; TestCoreScriptBudget passes
- at the pushed head (on 51f2f22ce): go vet of gateway and provider,
  and -run AtOnce|Nameless|ModelAPI|Reserve|FullLane over gateway,
  provider, gui and cli: ok
GUI, Playwright 1.62.0, both engines:
- the whole suite on Linux (WSL) at an earlier head; every red file run
  again at head and at main on mote, the same reds on both (filed:
  #4641 is new, the rest open already, e.g. #4600, #4461, #4082, #4210).
- at a7d4c662d on WSL: every editor-*, provider-* file, i18n-keys,
  gui-ja and seven routing files, 1185 pass, 34 red; all but four red
  on main e4384fc3c too (#4580, #3292, #4394 to #4397, #4600). The four:
  routing-many-keys (#4082) is red on main in two of three reruns as
  well; provider-gemini webkit ja's thumb (#4210) was red in 2 of 3 runs at head beside
  other files (318px off), 0 of 3 at main; alone, 4 of 4 green at both.
  The test reads the thumb 350ms after a click, a fixed wait (#4210,
  numbers added there).
- provider-at-once.test.cjs: green in both engines, five languages, at
  900 and 360px; editor-advanced-align 20 of 20 alone with the next
  commit.

Not tried: real ZCode accounts (none used, per the task) and a real 405,
so whether two at once always stays under ZCode's limit is the
reporter's finding; the user can set 1.
2026-11-01 07:39:08 +08:00
ggbdpq c26d16018f gateway: a plugin model that refuses temperature is asked without it, relayed or translated (#2492)
What changed: the plugin host carries a model's temperature where it is
said - the config model's temperature (Factory 0.1.31's configModels,
plugins#154), models.dev's own, or a models hook's model field - into
plugin.Model and pluginCatalog's catalog model, where
RejectsTemperature reads it as it reads a built-in's. A Chat or
Responses request relayed as it came to a model whose list refuses
temperature and top_p now leaves them out (passthrough), as the
translation of one (build) already did. A model nothing says so of
keeps what the client sent. OpenCode's capabilities.temperature is not
read: its false is what it reads a models.dev silence as, not a refusal
said.

Docs: the sampling row of gateway-routing, and provider-plugins' new
"A plugin model's sampling".

Run at ea3dee96 + this change, sandbox HOME:
go test -tags nogui -p 2 -run TestPluginModelRefusingTemperature
./internal/gateway/ - red at ea3dee96 without this change (the plugin's
fetch got temperature 0.7, top_p 0.9 relayed, temperature 0.7
translated; the model that says nothing keeps them), green with it;
ablation removed the four product files and went red the same way.
go test -tags nogui -p 2 -timeout 45m ./internal/gateway/ ok (291s);
go test -tags nogui -p 2 ./internal/plugin/ ok; -run
'TestRejectsTemperature|TestPluginModel|TestPluginCatalog|PluginParity|TestPlugin'
./internal/provider/ ok; -run
'TestSampling|TestUpstreamBytes|TestPassthrough|TestRelay'
./internal/gateway/ ok.
gofmt -l internal/ clean; go vet ./... (darwin, the
trayimage_darwin.go cgo warning as before), GOOS=linux go vet -tags
nogui ./... and GOOS=windows go vet ./... clean; go build and
GOOS=linux/windows go build ok.

Landed (yetone). Broken by hand on mote: with gateway.go, host.js,
internal/plugin/providers.go and internal/provider/plugins.go at
origin/main, TestPluginModelRefusingTemperature is red. passthrough
strips temperature and top_p for a provider whose catalog says
temperature false on Chat and Responses alike, the same rule build
applies. Run at the pushed head: go test ./... -timeout 45m on mote with this branch on 41b5c0f19: 83 packages ok. internal/gui is red on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red alone at 41b5c0f19 too, and on TestColdTurnsTaken (#4510). internal/update is red on TestRelaunchOpenTriedAgain (#3881). The last two pass alone at 41b5c0f19 and here. Rebased on f856d381a: agent, gateway, plugin, provider and sessions ok, gui red on #4514 and #3949 only, gofmt -l clean, go vet ok for linux (nogui), windows and darwin. Rebased on bb478f0e5: agent and gateway ok, gui the same. The last rebase, onto 573b21f4b, brings in only internal/gui/providers*.go and internal/provider/models.go, which this branch doesn't touch.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-01 06:21:39 +08:00
yetone b19d085935 plugin: a plugin's market icon parses the cached list once per copy
Before the market is fetched, or with no network, plugin.Icon read the
cached plugin-market.json and parsed it whole for every look. The
Providers page looks once for each plugin's row on each poll: 13 MB of
what twenty polls allocated with real accounts.

The copy is now read through filememo.Read, which parses it again only
when the file changes. The built-in list is parsed once (sync.OnceValue).
Both are shared and only read.

Test: TestMarketIconParsesTheCopyOnce. It caches the built-in list as the
copy and allows at most 20 allocations a look. With the old ReadFile and
parseMarket put back by hand it fails at 260 allocations a look. It also
checks that a rewritten copy is read again and that with no copy the
built-in list answers.

Run on mote at this tree:
- gofmt, go vet, and GOOS=windows and GOOS=linux vet of internal/plugin
  and internal/provider: ok.
- TestMarketIcon* and TestMarketSources alone, 3 times: ok.
- go test -timeout 45m ./internal/plugin ./internal/provider: ok.
- ./internal/gui: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  TestMainWindowCorners (#3949) fail, both already filed. Nothing else
  failed.
2026-11-01 05:51:13 +08:00
yetone c30d3b7b63 plugin pages: a page the reader left is told, and let go after 10 minutes unless it keeps itself
A plugin's page kept its frame, with its scripts, timers and
connections, for as long as the window was open once it had been
looked at: show() only hid its view, and a frame in a hidden view isn't
hidden to itself (its visibilityState doesn't change), so a page
couldn't even pause on its own. Asked by the owner: is that by design?
Only the lazy first load was.

- The kernel's leave hook now reaches the page part: the page is told
  {event: "visibility", data: {visible}} as the reader leaves and comes
  back. The bridge has magpie.visible and magpie.onVisibility(fn); hello
  carries visible, for a page left before it said hello.
- A page left 10 minutes (IDLE_MS) has its frame removed and loads again
  when next opened. Back sooner, it is the same frame. Its hello timer is
  cleared, so nothing says it broke.
- magpie.page.keepAlive: true (plugin.PageSpec.KeepAlive, keepAlive in
  /api/plugin-pages) keeps a page however long, for one that works while
  no one looks at it. Anything but true is false, read as raw JSON so a
  wrong type never drops the package's page.
- plugin-runtime.md's page row says so.

Run on mote. The Go suite and most GUI files ran at this change on
557f51dbf. After rebasing onto 30cd39f19 (none of these files changed
upstream), the budgets, TestWindow* and the page GUI files ran again
at this tree:
- plugin-page-idle (new), plugin-page and plugin-panels, chromium and
  webkit: 14/14 at 557f51dbf. At the rebased tree, the first run was
  13/14: plugin-page's chromium "draws in its frame, shut in" was red
  once, and its assertion wasn't kept (#4589). After that: 42/42 over
  3 runs, then 16/16 chromium over 4.
- i18n-keys, plugin-actions, plugin-kinds-discover, plugin-kernel,
  plugin-replaced, plugin-proxy-page: 51/52. The red is i18n-keys'
  "Unmarked", the same on origin/main e0eb74987 (#4524).
- go test -timeout 45m ./...: every package ok except three reds, none in
  code touched here:
  - TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
    TestMainWindowCorners (#3949) fail the same on origin/main e0eb74987.
  - TestUnroutedHeldReportSaved (#4300) failed in the full run only.
    Alone, -count=5, it passes.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., go build ./..., gofmt -l: clean.

Broken by hand: with the leave hook taken out of the page part, the new
test is red in both engines.

Not tried: a real plugin page in the desktop app or WebKitGTK. The
IDLE_MS length (10 minutes) is a judgement, not measured.
2026-10-31 22:39:37 +08:00
yetone e0eb74987c plugins: a dist branch not read is unknown, not "not on npm", and its read isn't cut off by one ask
ferock on Discord (v0.1.2399): the Plugins page showed the Chat page
plugin (@magpie-community/page-chat, on the community repo's dist
branch only, never on npm) as Coming soon.

Cause: Info asks each package under npmEach (6s). npm said 404, and
npmAsk turned to distInfo -> distPkg, which read the ~1.6MB index.json
(GitHub and the jsDelivr mirror) under that same 6s context, holding
distMu. On a slow link the read was cut off, distPkg returned nil as if
the branch had no such package, and npmInfo kept "not on npm" (ok=true,
empty NPM) for an hour, saved to plugin-npm.json. distWait then held a
new read back for a minute.

Fix:
- distPkg returns (*distPackage, error): nil, nil only when the branch
  was read and lacks the package (or it is out of scope); an error
  wrapping errDistUnread when the branch couldn't be read (last read
  failed or not finished) and the kept index doesn't have it.
- The index is read in its own goroutine (readDist), apart from the
  asker's context, with its own distReadFor (2m). One read at a time
  (distReading); askers wait for it or their own ctx, distMu is not held
  across the network read. A read that ends after its asker stopped
  waiting is kept for the next ask.
- npmAsk: npm's errNotFound with the dist branch unknown becomes the
  dist error, so every caller that keeps "missing" (Info/npmInfo,
  newestOf in store.go, the update checks in updates.go) treats it as
  unknown and asks again. Readme says the branch couldn't be read instead
  of npm's not found. installDist returns the unread error rather than
  "has no".
- mendDist was checked: it reads only local files, no dist read.

Old data: a "not on npm" already kept in plugin-npm.json by an older
build is asked again once it is an hour old, as before.

Tests: TestDistReadSlowerThanAnAskIsntMissing (index.json held past
npmEach: not kept as missing, and the next Info after the read ends has
0.1.7) and TestDistReadFailedIsntMissing (index.json 503: unknown, asked
again; a read branch without the package is still errNotFound).
fakeDist's reset waits for a read under way (distSettled).

Run (mote-run; vet at base 2cfb8351d, tests again at this commit rebased
on origin/main 484b45d82, which changed no Go in plugin or gui; pushed on 7dc8a18d0, which
touches only internal/provider and internal/gateway):
- gofmt -l: nothing
- go vet ./internal/plugin/..., GOOS=windows go vet ./...,
  GOOS=linux go vet -tags nogui ./...: ok
- go test -count=1 -timeout 45m ./internal/plugin/... ./internal/gui/...:
  internal/plugin ok (103.6s). internal/gui FAIL, two tests only, both
  red the same on a fresh origin/main 484b45d82 run alone and filed:
  TestSettingsSaveKeepsWhatItDoesNotSend (SearchAll, #4514) and
  TestMainWindowCorners/macOS_26_SDK on mote's macOS 27 (#3949).

Broken by hand (mote-run, -run DistRead):
- npmAsk's errNotFound -> dist error override removed: both new tests
  red (the market kept an empty entry).
- readDist given the asker's ctx (the old cut-off): the slow test red
  (after the dist answered, still no version).

Not tried: a real slow link or ferock's machine; the real index.json
from the dist branch; the GUI page itself (actionFor already shows a
spinner for a package with no npm entry yet).
2026-10-31 22:22:12 +08:00
yetone d8cf4f74f9 plugins: a plugin's package.json names its row with magpie.name (#4558, MYCF711)
A plugin installed from git whose package.json says
"magpie": { "name": "华为云 HUAWEI" } read as its dependency key
(magpie-officeace) on Settings → Plugins. Bun takes no non-ASCII key, so
a package outside the community's list had no way to show a readable
name. magpie.name was never read at all: #3608's route (MYCF711's branch
1cc33700) didn't reach main, so no release has it, git or npm.

plugin.InstalledName reads magpie.name from the installed package's own
package.json, beside magpie.icon (installedOwn, one parse for both): one
line of at most 80 bytes, no control or format characters (a bidi
override would show it as another name), else nothing. /api/plugins gives
each row it as ownName, and plugins.js's shownName takes it after the
community list's name and before the git package or the spec, so a
listed package is still named by the list. The row's page, the "is up to
date" status and every message that names the row (options, prefer, Update
all) go through shownName; a page plugin's sidebar tab takes it when the
page names no title (windowParts). It is never used to resolve a name and
never shown with the community badge. Not changed: the CLI's plugin list
(the dependency key, as the reporter expects), Discover's cards for
uninstalled GitHub/npm packages, and magpie.summary. Documented in
docs/reference.md and site/public/docs (en, zh, ja).

Run:
- mote: go test -timeout 45m ./internal/plugin/ ./internal/gui/ — plugin
  ok; gui red only in TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  the AppKit window tests killed at their deadline (TestPanelCloseHidesIt,
  TestPluginPageLoadsItsFilesInTheWindow, TestMainWindowCorners, …;
  #4125, #2645). The first three run the same red on origin/main 7aa67e9e5.
- mote: go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet on
  internal/plugin and internal/gui: clean. gofmt -l internal/: nothing.
- wsl-run (magpie-desktop): plugin-own-name.test.cjs, Chromium and
  WebKit, en/zh/zh-TW/ja/de at 980 and 420: 22/22. Every plugin*,
  plugins-*, agent-plugin*, account-plugin*, signin-paste-plugin,
  sidebar* and i18n-keys file (67): all green but i18n-keys "a plugin's words are its own" (#4524), plugin-card-update webkit en/zh (#3079) and plugin-github-filter webkit ja 420px (#4564, filed now), each red the same at origin/main 7aa67e9e5
- Rebased on origin/main 7b883cc61, mote: -run "Budget|OwnName|TestPluginsState|
  TestWindowParts" on internal/gui and internal/plugin: ok (core scripts
  under the budget, no raise).

Broken by hand:
- InstalledName returning "": TestPluginsStateGivesAGitPackagesOwnName red
  (ownName "", and the sidebar title magpie-officeace).
- shownName without e.ownName: plugin-own-name.test.cjs red, the row
  reads 'magpie-officeace'.

Not tried: the desktop window itself, and a real git repository with
magpie.name (the fixture is shaped from the reporter's installed
package.json: name magpie-officeace, version 0.2.4).
2026-10-31 18:30:39 +08:00
JoeyWu-tech d0a61b856a plugin: the pi tests keep the pinned pi's Bun cache between runs (#2865)
installPinnedPi's `bun install --frozen-lockfile` used the install
cache bunCommand names, which lies in the test's home. testenv makes a
new home for every go test process, so every run fetched pi's 118
tarballs before the host could start, inside the test's 4 minutes.
yetone saw TestPiPackage red at 86fef947e after 226s, most of it that
install, with gateway's tests run beside it on a Mac at load 26.

Now the install gets a Bun cache that outlives the home,
magpie-test-bun-cache-<uid>-<n> in os.TempDir() (pinnedPiCache), as
the last BUN_INSTALL_CACHE_DIR in its environment. The first run fills
it, and a run after that installs pi from it and asks npm for nothing.
Bun names each entry by package, version and registry, so a new pin,
or a run through another registry, fetches only what is missing. It
holds about 155 MB here. This is the first thing the tests leave
behind between runs, on purpose: testenv's own bound is the temp
folder (checkChild), so the folder is inside it, but it is outside the
test home, which goes when the run ends. agent-wiring.md's "Tests
never touch the real machine" now says so.

Why that folder:
- It is none of the user's own folders. testenv moves HOME, the XDG
  folders, APPDATA and LOCALAPPDATA into the sandbox, not the temp
  folder, and ~/.bun, ~/.cache and ~/.config/magpie are never named.
  Only the install's own process gets the variable, so the host and
  anything else a test starts never see it. The host keeps the home's
  cache, and pruneInstallCache, which prunes the app's cache, never
  touches this one.
- It is this user's. The uid is in its name, as Linux's temp folder is
  shared (macOS' and Windows' are the user's own). It is made 0700, and
  used only when it is a folder, not a link, that no one else has any
  permission on (not checked on Windows, where Go reports no real modes)
  and that this user can make a file in. One someone else made fails
  one of those, and the install then uses the home's cache as before.
  Root always uses the home's cache: root passes those checks in a
  folder another user made, and would run what that user put there.
- Its files are never old enough for a temp folder's cleaner. macOS
  takes files under its temp folder that went unread for about 3 days,
  and Bun doesn't notice a file missing from a cached package: it
  installs the rest, and pi doesn't load (shown below). So the folder
  is a new one every two days (<n> counts two day periods), the one
  before is kept for a run still using it, and older ones are taken
  out by the next run. The first run in a new period fetches pi again.
  TestPinnedPiCacheMovesOn checks the folder moves, the one before
  stays and older ones go.
- Two go test runs can share it. Bun unpacks each tarball into a folder
  of its own and renames it into the cache. When another install got
  there first, it swaps the two or removes the old one and renames
  again (move_to_cache_directory in Bun 1.4.2's extract_tarball.rs,
  written for concurrent installs sharing one cache; on Windows it
  retries the move). Two runs started at once on an empty cache both
  passed here.
- Bun's documented default on Linux is to hardlink the installed files
  to the cache (not looked at here), so a test that wrote into pi's
  installed files in place could change the cache. None does.

No assertion in the pi tests goes red when the cache is taken out: they
pass either way while npm answers inside their 4 minutes. What
regresses is the fetches, counted below; the times move with npm.

What was run (tree 93b344b1, on origin/main acdc85ac, go1.26.8,
linux/amd64, Linux 5.15, umask 077):
- npm's registry through a local relay (BUN_CONFIG_REGISTRY, Bun 1.4.2)
  that passes every request on at once and logs it, with `go test -tags
  nogui -count=1 -v -run <tests> ./internal/plugin/`, load 16 to 26,
  the cache folders removed first:
  - TestPiPackage alone: pass, 29.38s, 118 tarballs asked (no
    manifest). Run again: pass, 1.13s, nothing asked.
  - Then TestGatewayHookMixedPiPackage and TestPiPackage: pass, 0.92s
    and 1.04s, nothing asked.
  - Two TestPiPackage runs started at once: both pass (227.40s and
    115.58s), with every tarball asked twice (236 asked, 118
    distinct). A run after them: 1.13s, nothing asked.
- Broken by hand:
  - The cache not given to the install (the home's cache, as before
    this commit), the folder left full: TestPiPackage passes in 141.92s
    with 118 tarballs asked again.
  - One file of pi-coding-agent's cached package taken out, as a temp
    cleaner would: TestPiPackage red in 0.49s, nothing asked,
    `@earendil-works/pi-coding-agent isn't installed: add it as a
    plugin's dependency, or reinstall the pi plugin`.
  - The folder's name without its period: TestPinnedPiCacheMovesOn red,
    `after two days the cache is ".../magpie-test-bun-cache-<uid>-0",
    not a folder other than ...`. Older folders kept: red, `a folder
    four days old is kept (<nil>)`.
- go test -tags nogui -count=1 -timeout 45m ./internal/plugin/ (Bun
  1.4.2, npm direct): ok, 341 PASS lines counting subtests, 2 skip
  (TestFlowBigReplyProd wants MAGPIE_FLOW_BIG, TestRenewOtherHost is
  run by TestRenewOnceAcrossHosts). TestGatewayHookMixedPiPackage
  9.88s, TestPiPackage 1.08s.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
  vet for windows, go build -tags nogui for linux and darwin and go
  build for windows: exit 0 each. go vet and go build without the tag
  on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- Not run again at this tree: -race and the full suite. This tree
  differs from tree f2b71fdd only in pi_test.go and agent-wiring.md;
  at f2b71fdd internal/plugin passed with -race, and the full suite
  had 79 packages ok, internal/plugin among them, and 7 tests red in 2
  packages, each filed: agent TestInstalledVersion,
  TestCursorFolderFromTheEditorIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141); gui TestGatewayHeldByAContainer and
  TestGatewayFixQuitsOnlyAMagpie (#3649).

Not tried: macOS and Windows (their checks and cleaners were only
read), a run as root, a real temp cleaner, and the pi tests under a
load like yetone's.

Reviewed and run again by the maintainer at the stack's tree 45994757c
(this commit and the six beside it, on origin/main 90518de26), go1.26.8:
- mote (macOS, arm64): gofmt -l clean; go vet and go build for darwin,
  GOOS=linux -tags nogui and GOOS=windows (library, plugin, gui): exit 0.
  go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  internal/proc TestNoCommandBypassesProc (#4491), both red on main
  from b09349d17 and c59c547c5, in files this stack doesn't touch.
  go test -race -run 'TestWSL|TestTagged|TestPinnedPiCache' for
  library and plugin: ok.
- magpie-desktop (Linux, wsl-run; WebKit hangs on mote), Chromium and
  WebKit: every library-*, sync-*, s3-sync, github-sync and i18n-keys
  file, 4 at a time: 1003 of 1020. The 17 reds are in 6 files no commit here
  touches: i18n-keys ("Unmarked", #4524), library-chip-fan, -items,
  -mcp-health, -mcp-hub (#4483) and -mcp-tools. Those 6 alone, one at a
  time, at load ~60: 74 of 92 here, 77 of 92 at 90518de26 itself. Red
  in both: i18n-keys, -chip-fan and -items in WebKit, -mcp-tools in
  Chromium ja 420; -mcp-health green in both; -mcp-hub's WebKit case
  red here only, the case #4483 has red on main. -chip-fan and -items
  are #3072's and #4501's kind, WebKit under load.
- On macOS (mote), the pi tests twice in a row: TestGatewayHookMixedPiPackage
  21.41s then 0.96s, TestPiPackage 1.23s then 1.24s, and
  TestPinnedPiCacheMovesOn ok: the second run installs from the kept
  cache. It sits in os.TempDir(), outside a test's HOME, by design.
- The stack rebased on origin/main e4c784177 (main's 7 commits since
  share only docs/subsystems/agent-wiring.md with it, a line apart),
  with no conflict: on mote gofmt -l, go vet (linux nogui,
  windows), go test -tags nogui -count=1 ./internal/library
  ./internal/plugin ok and internal/gui's budget tests ok; on Linux
  sync-note-show and library-wsl-asleep, both engines: 92 of 92.
2026-10-31 17:03:55 +08:00
JoeyWu-tech a246ad4cfc plugin: the pi tests' host loads the pinned pi, not npm's latest (#2865)
TestPiPackage added testdata/pi, and TestGatewayHookMixedPiPackage a
copy in a TempDir. Neither folder has a node_modules above it, so as the
host started, Bun took each import of pi from there as one to install
itself (its auto-install): first pi.js's resolve of
@earendil-works/pi-coding-agent from the package's folder, then the
extension's own imports, which jiti 2.7 imports natively under Bun
(tryNative) from the extension's folder. Each start asked npm for 115
manifests, and init waited on them under its 2 minute bound. This would
explain the red yetone sees under a full run, and with npm slow it is
red alone.
The host then ran npm's latest pi (1.4.0 today), not the 1.2.0
installPinnedPi installs from testdata/pi-lock, so #1879's pin never
reached the host. The test's Version(piAgent) check reads the plugins
folder's copy, so it passed.

Now both tests put their package in the plugins folder
(Dir()/fake-pi-package, Dir()/mixed-pi-package), beside the node_modules
installPinnedPi fills. pi.js and the extension both resolve the pinned
pi, and nothing is asked of npm as the host starts. fakepi.ts tells the
VERSION its import of pi reached, and TestPiPackage checks it is the
pinned one. With the old layout and npm reachable, that check is red.

Not changed: the app. A pi package added from a folder with no
node_modules above it should go the same way (the tests add theirs
through the same Add, as a path): pi.js and its extensions get npm's
latest from Bun as the host starts, and the pi ensurePi put in the
plugins folder for it isn't the one that runs. Making pi.js resolve
from the plugins folder alone isn't enough. Tried here with the old
layout, the host then waited on @earendil-works/pi-ai's manifest for the
extension's import instead, and both tests were still red. Each way out
changes how plugins load: JITI_TRY_NATIVE=0 in pi.js (every pi extension
then goes through jiti's transform and pi's aliases), `bun run
--no-install` for the host (auto-install also stops for OpenCode plugins
on disk), or a Bun.plugin onResolve for pi's scopes. That is the
maintainer's call, so it isn't in this commit.

Also not changed: installPinnedPi's `bun install --frozen-lockfile`
still fetches pi's 118 tarballs on every run, as the sandbox's install
cache starts empty, and the test skips when that fails (noted in #2865).

What was run (tree 8aee6487, on origin/main acdc85ac, go1.26.8,
linux/amd64, Linux 5.15, umask 077). This tree only rewords
TestPiPackage's version check message from tree 859ae995, where the
rest was run.
- At this tree (Bun 1.4.2, npm direct): TestPiPackage and
  TestGatewayHookMixedPiPackage pass. Broken by hand (TestPiPackage's
  package back in testdata/pi): red, `the extension's import reached pi
  1.4.0, not the 1.2.0 the lock installed`.
At 859ae995:
- A local npm relay as BUN_CONFIG_REGISTRY (Bun 1.4.2) that passes
  tarballs through at once and holds each manifest 150s, with
  `go test -tags nogui -count=1 -v -run
  'TestPiPackage$|TestGatewayHookMixedPiPackage$' ./internal/plugin/`,
  load 10 to 16:
  - origin/main acdc85ac: both red. `mixed package lost Pi providers:
    [] starting plugins: context deadline exceeded` (157.92s), and
    `Plugins = [], starting plugins: context deadline exceeded`
    (157.69s). Each test's host asked the relay for
    @earendil-works/pi-coding-agent's manifest as it started.
  - this tree: both pass (29.35s, and 181.28s, most of it the frozen
    install's tarballs through the relay), and the relay was asked for
    no manifest. With a print-only probe around the first Providers or
    Plugins call, the host started in 0.5s in each test.
  - main's layout with pi.js resolving pi only where a node_modules
    above the folder has it (tried, not kept): both still red (host
    start 122.0s and 104.8s), the relay asked for
    @earendil-works/pi-ai's manifest by the extension's import.
- Broken by hand: both packages back where main puts them (testdata/pi
  and a TempDir), the version check kept, the relay passing manifests
  through at once. TestPiPackage red on the version check (pi 1.4.0,
  not 1.2.0). The mixed test passed with a 60.7s host
  start (TestPiPackage's took 27.8s). 230 manifest requests: 115
  packages, once per host start.
- go test -tags nogui -count=1 -timeout 45m ./internal/plugin/ (Bun
  1.4.2, npm direct): ok, 340 PASS lines counting subtests, 2 skip
  (TestFlowBigReplyProd wants MAGPIE_FLOW_BIG, TestRenewOtherHost is run
  by TestRenewOnceAcrossHosts). TestPiPackage 10.49s,
  TestGatewayHookMixedPiPackage 22.77s.
- The same with -race: ok, the same counts, no race reported.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
  vet for windows, go build -tags nogui for linux and darwin and go
  build for windows: exit 0 each. go vet and go build without the tag on
  linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2; 9m49s,
  load 16 at its start): 79 packages ok, internal/plugin among them,
  and 8 tests red in 2 packages, each filed: agent TestInstalledVersion,
  TestCursorFolderFromTheEditorIsNotTheCLI,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141); gui TestGatewayHeldByAContainer and
  TestGatewayFixQuitsOnlyAMagpie (#3649). Run by name at origin/main
  acdc85ac, all are red there too but the Qoder test, which passed
  alone.

Not tried: the real app, and macOS and Windows (the tests ran on Linux
only).

Reviewed and run again by the maintainer at the stack's tree 45994757c
(this commit and the six beside it, on origin/main 90518de26), go1.26.8:
- mote (macOS, arm64): gofmt -l clean; go vet and go build for darwin,
  GOOS=linux -tags nogui and GOOS=windows (library, plugin, gui): exit 0.
  go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  internal/proc TestNoCommandBypassesProc (#4491), both red on main
  from b09349d17 and c59c547c5, in files this stack doesn't touch.
  go test -race -run 'TestWSL|TestTagged|TestPinnedPiCache' for
  library and plugin: ok.
- magpie-desktop (Linux, wsl-run; WebKit hangs on mote), Chromium and
  WebKit: every library-*, sync-*, s3-sync, github-sync and i18n-keys
  file, 4 at a time: 1003 of 1020. The 17 reds are in 6 files no commit here
  touches: i18n-keys ("Unmarked", #4524), library-chip-fan, -items,
  -mcp-health, -mcp-hub (#4483) and -mcp-tools. Those 6 alone, one at a
  time, at load ~60: 74 of 92 here, 77 of 92 at 90518de26 itself. Red
  in both: i18n-keys, -chip-fan and -items in WebKit, -mcp-tools in
  Chromium ja 420; -mcp-health green in both; -mcp-hub's WebKit case
  red here only, the case #4483 has red on main. -chip-fan and -items
  are #3072's and #4501's kind, WebKit under load.
- Broken by hand on mote: TestPiPackage's package back at testdata/pi
  is red, "the extension's import reached pi 1.4.0, not the 1.2.0 the
  lock installed".
2026-10-31 17:00:14 +08:00
JoeyWu-tech 75d63a1545 plugin: Discover no longer keeps a stale read from just after a push (#4067)
The Plugins page's Discover lists the repositories tagged
magpie-plugin, and keeps what each one's package.json, npm and the
file it names made of it by `owner/repo@pushed_at`, so a repository
is read once a push. raw.githubusercontent.com can answer from before
a push for a while after it (its answers, a 404 too, say they stand
five minutes): the package.json or the file it names missing, or the
package.json as it was. A read then was kept for the push, so a
repository read as missing stayed out of the list until magpie
started again or the repository was pushed to again (MengXiangxi
on #3821, #4067).

Now a read less than rawFresh, ten minutes, after the push is shown
as any read is, and read again at the next ask; one rawFresh or more
after the push is kept for the push, as before. When it was read is
what counts: a whole list stands ten minutes, so the next ask is
often past rawFresh, and judged then, a 404 read a minute after the
push would be kept. A read again that comes in after the page stops
waiting is shown at the ask after, as any late read is; one that
gets no answer leaves the repository as it was read. A list is asked
again when its time is up: ten minutes for a whole one, 20 seconds
for one cut short, a minute after a failed search, and at once on
Try again when it isn't whole. So such a repository is read about
once more.

raw's answers have no Age, and their Expires is each answer's own
date plus five minutes, but they carry Source-Age, how long raw's
cache has held them, a 404's too: 2s after a push, raw's 404 had
Source-Age 20, cached before the push (below). This reads no headers
(fetchJSON keeps none) and goes by the time since the push.

What was run (tree 00637ea4, on origin/main 174250b2, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, the Go tests at umask 077:
- raw.githubusercontent.com, on a branch of JoeyWu-tech/magpie made
  for it and deleted after, twice: at a commit without a file, the
  file read 404, x-cache MISS, then HIT; the branch pushed on to a
  commit that has the file, raw still answered 404 (x-cache HIT) 1s
  or 2s and 23s after the push, and 200 (MISS) at 48s and 49s. The
  second time kept Source-Age: 0, 6 and 13 for the 404s before the
  push, 20 and 41 for those after it, 0 for the 200. An earlier try
  stopped at its first read after the push: 404, HIT, 2s after.
- TestTaggedReadSoonAfterAPushIsReadAgain, new: GitHub's search, raw
  and npm faked, someone/fresh pushed a minute ago and someone/old an
  hour ago, each with word-guard's files (a middleware alone), npm
  having neither. Six asks, each with the list's ten minutes run out:
  with raw's 404 for fresh's package.json, then for the middleware
  file it names, fresh is left out; with both there, the next ask has
  it at 0.1.1; with its package.json at 0.1.2, the next has 0.1.2.
  rawFresh then set under the minute since the push, as ten minutes
  on, the next reads it again and has 0.1.3, and the one after keeps
  0.1.3 with 0.1.4 on raw. old's package.json is read once in six.
- TestTaggedLateReadSoonAfterAPushIsShown, new: the same fakes, old
  read first, taggedWait at 2s. fresh's package.json held, the page
  stops waiting with one missing; once that read is in, the next ask,
  raw answering 503 for fresh at once, has fresh at 0.1.1 with no
  error; the next, its package.json at 0.1.2 and held again, has 0.1.1
  still, with no error; once that read is in, the next has 0.1.2 with
  no error. old's package.json is read once in five.
- Both at -count=20: 20 of 20 each.
- Broken by hand, each red, then put back: a read shown and never
  read again, as on main: the first test red at its third ask, and in
  the late test 0.1.2 is never read; soon judged when asked, not when
  read: red at the fifth ask, 0.1.2 not read again; a read that found
  the repository kept at once: red at the fourth ask, 0.1.1, and in
  the late test 0.1.2 is never read; no read kept for good: red at the
  sixth ask, 0.1.4, and the late test reads old's package.json 5
  times; a read that soon after the push not kept: the late test red,
  its late read never kept; a read again with no answer taking the
  place of the one shown: the late test red at its third ask, fresh
  missing (503).
- go test -tags nogui -race -count=20 -run '^TestTagged'
  ./internal/plugin: 160 of 160 pass (the eight TestTagged tests),
  no race reported.
- go test -tags nogui -count=1 -v ./internal/plugin, Bun 1.4.2 first
  on PATH: 228 pass, none red, 2 skip (TestFlowBigReplyProd, opt in;
  TestRenewOtherHost, run by TestRenewOnceAcrossHosts).
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
  vet for windows, go build -tags nogui for linux and darwin and go
  build for windows: exit 0 each. go vet and go build without the tag
  on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log kept;
  8m55s, load 31 at its start): 71 packages ok, and 14 tests red in 6
  packages, none in internal/plugin: agent TestInstalledVersion,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141), TestCodexBehindReverseProxy (#3398),
  TestReasonixCLIRequiresSupportedNativeVersion and
  TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
  TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (#3640, at
  umask 077); gateway TestPluginToldWhereTheAgentWorks (#3675, the
  /tmp/.git); gui TestGatewayHeldByAContainer and
  TestGatewayFixQuitsOnlyAMagpie (#3649).

Not tried: macOS and Windows; a repository tagged magpie-plugin,
pushed to and read by the real Plugins page (a tagged repository is
listed for every user).

Reviewed and run again by the maintainer at the stack's tree 45994757c
(this commit and the six beside it, on origin/main 90518de26), go1.26.8:
- mote (macOS, arm64): gofmt -l clean; go vet and go build for darwin,
  GOOS=linux -tags nogui and GOOS=windows (library, plugin, gui): exit 0.
  go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  internal/proc TestNoCommandBypassesProc (#4491), both red on main
  from b09349d17 and c59c547c5, in files this stack doesn't touch.
  go test -race -run 'TestWSL|TestTagged|TestPinnedPiCache' for
  library and plugin: ok.
- magpie-desktop (Linux, wsl-run; WebKit hangs on mote), Chromium and
  WebKit: every library-*, sync-*, s3-sync, github-sync and i18n-keys
  file, 4 at a time: 1003 of 1020. The 17 reds are in 6 files no commit here
  touches: i18n-keys ("Unmarked", #4524), library-chip-fan, -items,
  -mcp-health, -mcp-hub (#4483) and -mcp-tools. Those 6 alone, one at a
  time, at load ~60: 74 of 92 here, 77 of 92 at 90518de26 itself. Red
  in both: i18n-keys, -chip-fan and -items in WebKit, -mcp-tools in
  Chromium ja 420; -mcp-health green in both; -mcp-hub's WebKit case
  red here only, the case #4483 has red on main. -chip-fan and -items
  are #3072's and #4501's kind, WebKit under load.
- Broken by hand on mote: with a read just after a push kept as any
  other (`if true || !soon`), TestTaggedReadSoonAfterAPushIsReadAgain
  ("raw has its files now: someone/old@0.1.1") and
  TestTaggedLateReadSoonAfterAPushIsShown ("late read never kept:
  0.1.1, want 0.1.2") are red.
2026-10-31 17:00:14 +08:00
yetone e647a1fd54 plugins: an npm registry of the user's own is used for installs and lookups (timwangdev on X)
timwangdev asked on X for plugins to take a custom npm registry. Zero-config
first: Registry() (internal/plugin/registry.go) takes, in order, the one set
in magpie (settings npmRegistry: `magpie plugin registry <url>|default`, or
Plugins › Discover's new npm registry row), BUN_CONFIG_REGISTRY /
NPM_CONFIG_REGISTRY / npm_config_registry in magpie's environment, then the
login shell's (cached probe only, proc.LoginEnvKnown, never waits on a
shell), install.registry in the plugins folder's or the user's .bunfig.toml,
registry= in the plugins folder's or ~/.npmrc, then the 国内镜像 switch's
npmmirror, then npm's own. The switch no longer puts npmmirror over a
registry the user named: before, bun was handed BUN_CONFIG_REGISTRY=npmmirror
whenever it was on, over the user's .npmrc. bun is told the registry only
where it wouldn't find it itself (magpie's setting, the shell's, the
switch's). magpie's own npm questions (latest version for the market,
Update and the hourly check, README, search) go to the same registry, a
package's @scope:registry= to that scope's, with the .npmrc's
//host/path/:_authToken (${VAR} expanded, longest prefix) sent to that host
alone, dropped on a redirect to another host, never logged or shown.
Download counts stay npm's. Only http(s) with a host, no userinfo, query
or fragment is taken; anything else is refused and not saved, and a bad
value hand-written into settings.json is passed over. /api/plugins says
which registry is in use and where it came from.

The GUI row is in registry.js, imported when Discover draws it, so the
core script budget isn't raised (plugins.js is 292 bytes smaller than
before, one long comment there condensed).

Left out: bunfig [install.scopes] for magpie's own lookups (bun reads them
for installs), .npmrc _auth and username/password, NPM_CONFIG_USERCONFIG
and npm's global npmrc, and internal/agent/cliupdate.go's agent CLI update
lookups, which still ask npm's own.

Run (mote and wsl-run). First at this change on 2ac423f4f:
- go test ./internal/plugin/ ./internal/source/ ./internal/gui/
  ./internal/proc/ ./internal/cli/ ./internal/settings/ -timeout 45m:
  plugin, source, cli, settings ok. gui: only the real-window AppKit tests
  killed at their deadline on mote (dock, panel, titlebar, tray; #2645,
  #4125), TestCoreScriptBudget and TestSettingsSaveKeepsWhatItDoesNotSend
  green after the fixes in this commit. proc: TestNoCommandBypassesProc red
  on origin/main itself (internal/claudetui/tui.go:183), filed as #4491.
- gofmt -l internal: clean. GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: ok.
- GUI (wsl-run, magpie-desktop): plugin-registry.test.cjs in Chromium and
  WebKit, 5 languages each, 980px and 380px; i18n-keys, old-webkit and
  plugin-market (WebKit): 19/19 pass. On mote the browser runs timed out
  launching (#4125).
Again at this tree rebased on fa5e86cf2 (upstream changed app.js and
i18n.js): go build ./...; go test ./internal/gui/ ./internal/cli/
./internal/plugin/ ./internal/settings/: cli, plugin, settings ok, gui only
the same ten AppKit window tests killed on mote (#2645, #4125), the core
budget green; gofmt clean; plugin-registry (Chromium, WebKit), i18n-keys
and old-webkit on WSL: 22/22 pass.
Rebased once more on 45de2ddb9 (app.js and i18n.js again): gofmt clean,
go vet of gui and plugin ok, TestCoreScriptBudget and
TestSettingsSaveKeepsWhatItDoesNotSend ok, i18n-keys 4/4.

Broken by hand, each red, then restored:
- A: old registryEnv (npmmirror whenever the switch is on):
  TestBunTakesTheUsersRegistry red.
- B: lookups always to npm's own: TestLookupsAskTheUsersRegistry red.
- C: no URL check: TestSetRegistryRefusesWhatIsntOne red.
- D: the switch before the user's registry: Precedence, BunTakes and
  Lookups red.
- E: no token sent: Lookups red.
- F: scopes ignored: Lookups red.

Not tried: a real private registry (Verdaccio, GitHub Packages, Nexus) with
a real token; a real bun install through one; Windows (the login shell
probe is a no-op there, so only env, bunfig and .npmrc apply).
2026-10-31 04:24:59 +08:00
ggbdpq 7da972969b provider, gui: a listing's budgets add up, and one provider's fetch models no longer re-lists past them (#4065)
What changed

The budgets a listing of the plugins' providers is made of added up past
the budgets its callers set: the host let one provider spend listWait
(20s) on its models hook plus the wait for a due renewal (RENEW_WAIT,
15s) before it, and a provider with two accounts spent them back to
back. One provider could be allowed 35s (40s with a second account) —
past the 30s refreshDeadline the background refresh asks under and past
the editor's own 20s — so pressing Fetch models, or a refresh, died with
a bare "context deadline exceeded" while no vendor had failed: every
provider is asked side by side, and the sum of the budgets was the only
thing over.

Now the host's own bounds hold by construction:

- host.js info(): the wait for a due renewal (fresh) spends the models
  hook's own budget — the hook is given what is left of listWait, and
  the renewal wait can no longer be added on top of it.
- host.js providers(): a provider's accounts are listed side by side
  (the first no longer waited for before the rest), so one provider
  costs one listWait, not one per account.
- gui/providers.go, case "models": the editor's budget is 30s, the same
  the host bounds one providers RPC with, instead of 20s — shorter than
  even one provider's worst case under the old arithmetic.

A provider whose renewal is slow then lists late (its hook given up on
alone, said so in listError as any other stuck listing) instead of
taking the whole listing past the caller's deadline (#4065).

Run

- TestProviderListCoversAccountsSideBySide, two accounts whose hooks
  each take 3s under a 4.5s caller budget: with the product files at
  the base (68b31ce23) and the tests kept, the listing dies with
  "context deadline exceeded"; with the fix it stands and both accounts
  are listed.
- TestRenewalWaitSpendsTheListBudget, a renewal that never finishes
  waited 15s before a 10s hook given 11s of its own, under a 20s
  refreshDeadline: with the product files at the base the listing goes
  past refreshDeadline and nothing is kept; with the fix the listing
  stands and the provider fell back, its listError saying so.
- internal/plugin full suite (go test ./internal/plugin -tags nogui):
  ok, and gofmt/vet clean.

Review (magpie): the two tests' timings were widened from gua's 1.5s
hooks under 2.5s and a 5s hook under 17s, which left ~1s and ~2s of
room, to the numbers above, so a busy CI box can't turn them red
either way. Run at this head on the Mac mini: go test ./internal/plugin
-count=1 ok (254s); go vet ./internal/gui ./internal/plugin clean.
Broken by hand: host.js put back at the base, tests kept - both tests
red (context deadline exceeded at 6.1s; past refreshDeadline at 35s).
Not tried: the reporter's Windows box with 35 real providers. Left
open: /api/sync, the CLI's refresh and the editor's other Fetch calls
still give a plugin provider's fetch 8s while it lists every plugin
provider; one provider's fetch still re-lists them all.

Generated-by: GLM-5.3-Flash (ZCode)
2026-10-31 02:00:10 +08:00
ggbdpq a5ccf3f23f plugins: an update of an unfixed git source re-resolves the branch, not the lock's old commit (#2954)
What changed
- Before Bun resolves a git plugin's spec, the branches and tags of its
  repository are fetched into the bare clone Bun keeps in its install
  cache (refreshGitCache in gitrev.go): best-effort before install's
  bun add (a remote that can't be reached leaves the install to what the
  cache has), an error before reinstall's bun update (an update that
  didn't happen is not reported as done).
- When bun update exits 0 but the plugin is still behind the commit the
  update checks saw the repository at, reinstall says so instead of
  claiming the update.
- A spec that names a commit (#<sha>) is left alone: nothing is resolved
  for one, and its pin stands.
- docs/subsystems/provider-plugins.md: this git update path.

Why
A plugin added from an unfixed git+https://... URL could not be updated
(#2954): plugins/package.json named no commit, but Bun resolves a git
spec through its own bare clone of the repository in the install cache,
whose refs stay at the first install - a fetch there moves FETCH_HEAD,
not the clone's refs/heads. Every resolve after the first, bun update as
much as a bun add after a remove, therefore named the old commit again,
bun.lock re-recorded it (name@git+...#bb961b2...), and the update said it
had installed while node_modules kept 0.1.3. The lock is the record of
that resolution, not its cause. Verified with Bun 1.4.2 (the version
magpie runs) against a local git+file:// repository: after the branch
moved, bun update my-plugin answered "no changes" and exited 0, and so
did bun install with the lock entry dropped, bun update --force and bun
install --force; with the clone's refs fetched, the same bun update
installed the branch's commit now.

Run
go test ./internal/plugin/ -count=1 (ok; new: TestGitUpdateInstallsTheBran
chsCommitNow and TestGitUpdateKeepsACommitPin on the bun on PATH against
a local git+file:// repository, TestGitUpdateSaysWhenItDidnt with the
fake bun keeping the lock's commit, TestRefFixed,
TestSameRepoAndCloneOrigin)
go test ./internal/cli/ ./internal/provider/ -count=1 (ok)
gofmt -l (clean); go vet ./internal/plugin/ on darwin, linux and windows
(ok); builds of darwin and of windows (CGO_ENABLED=0 -tags production,
as the Makefile cross-compiles it) and of the 79 Linux packages that
don't need Linux GTK cgo (the GUI and cli are built natively per machine,
as the Makefile says).

Review (magpie): patch sha256 checked against the issue; read whole.
Run at the batch head on the Mac mini: go test ./internal/plugin
-count=1 ok, the real-Bun git e2e among them (not skipped); on the
Windows box TestGitUpdate* pass. Broken by hand: store.go at the base -
TestGitUpdateInstallsTheBranchsCommitNow ("still at 1.0.0, want
2.0.0") and TestGitUpdateSaysWhenItDidnt red; only install()'s refresh
removed - "installed again: 2.0.0, want 3.0.0". Not tried: a real
plugin from a real GitHub branch.

Generated-by: GLM-5.3-Flash (ZCode)
2026-10-31 02:00:10 +08:00
yetone 261117363e plugin host: a sign-in again joins its account when an older plugin named it another way (#4473)
officeace-auth 0.1.14 to 0.1.17 kept an account as accountId = the masked
phone ("189****8051") and uid = the Huawei domain id. The CodeArts
plugin's OfficeAce card (plugins#522) names a new sign-in by the domain
id, uid the same. settle joined a new sign-in to an old record only on an
equal account id, so signing in again added a second row (fakeco#xxxxxx)
and left the old one "Sign-in required", holding the user's name, proxy
and gateway keys.

settle now also joins two records with the same uid when one of them is
named by that uid (renamedBy): then the uid is the account's own id. The
joined record keeps the old record's accountId, since the user's name,
proxy and gateway keys are kept by it (#4416), as the CodeArts plugin's
renewals already keep a stored accountId.

The issue suggested joining on any equal uid. That is not safe: Kiro
keeps how an account was signed in to as its uid ("google"), so two
different Google sign-ins share one. The test signs in two such accounts
and checks they stay apart; with a uid-only rule they were joined.

Not covered: a re-sign-in where neither record is named by its uid (a
WorkBuddy nickname changed at the vendor) still adds a row; nothing in
the records proves those are one account.

Run:
- Reproduced first on origin/main's host.js: TestPluginReSignInJoinsAnOldIDShape,
  with the old record as officeace-auth 0.1.14's callback and
  credential.mjs write it (read from the npm tarball), was red: the
  sign-in again went to "fakeco#9oncv2" beside the old record.
- Broken by hand: renamedBy on uid alone -> red (two Google accounts of
  uid "google" joined); joined without keeping the old accountId -> red
  (accountId became the domain id). Green with the fix, and
  TestPluginSameNameOtherUID (#413) still green.
- Full go test ./... -timeout 45m on mote was still running at push
  (pushed without waiting, per the owner's rule); a red it shows that
  isn't on origin/main gets its own issue.

Not tried: a real Huawei Cloud sign-in in a running magpie; the CodeArts
plugin with the OfficeAce card is not on npm yet (plugins#522 is open).
2026-10-31 01:11:31 +08:00
yetone 3b5dccd527 accounts: a plugin account goes by its usage's name, not its id (#4416)
A Huawei Cloud CodeArts account is kept by its accountId, an IAM id
(iam::<domain>:user:<name>), and every list showed that id while its
quota card showed the masked phone the plugin's usage() names it by.
Display only: an account now reads as the name the user gave it, else
the `user` its plugin's last usage read gave (PluginUserOf: the
in-memory read, else quotas.json), else its id. The id stays the key
everything is kept by; nothing stored changes or migrates. A read that
fails keeps the last good name; nothing read yet is the id, never blank.

One rule in provider (AccountShown, AccountShownOf, AccountLabelOf),
used by every list: cards' Alias (Usage page, tray panel,
/v1/magpie/quotas, magpie quota), magpie accounts, magpie providers,
the TUI's Providers rows and quota titles, usageapi's Account filter,
the quota alert. The GUI gets it as /api/providers' accountUsers
(accountShownOf in app.js): the editor's account rows (the id in the
tooltip), the per-account proxy lines, Routing's userShown, the
Providers search, Hide accounts. app.js's account lookups share one
helper, so the core stays in its budget (1,536,561 of 1,536,586), with
no room added.

Run:
- go test ./... -timeout 45m on mote at 2f5a3f1c0 + this change: all ok
  but internal/agent TestPiModelsAskedOnTheirNativeAPI (fixed on main
  by 7474a86f1, green there; this is rebased onto it),
  internal/update TestRelaunchOpenTriedAgain (#3881, green alone x3),
  and internal/gui's real-window AppKit tests (TestPanelCloseHidesIt,
  TestMainWindowCorners, TestTrayCellClickReleasedPanel red the same
  on origin/main 99ad38b7c; #2645, #4125, #1936).
- go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet of the
  touched packages; gofmt -l clean.
- TestPluginAccountShownByItsUsageUser (new, real plugin host and fake
  plugin): id before a read, phone after, phone after a restart from
  quotas.json, phone kept over a failed read, own name wins, id when
  nothing is known. Red on the old code.
- GUI on the Linux box (mote's Chromium segfaults on these pages on
  origin/main too, #4125): account-plugin-user (new),
  routing-account-name (extended) and account-alias, Chromium and
  WebKit, every language, 34/34; the new checks red on the old code;
  the whole suite (make test-ui on the Linux box) was still running at
  push: 417 files in, 5 reds, none on a page this changes
  (account-models' row-moved check in WebKit, 81 vs 79px, and
  agent-models-all-hidden), not yet compared with origin/main; any
  that are new get an issue once it ends.
- At the rebased head (3bce283df): go test of provider, cli, tui,
  usageapi, plugin, agent -run TestPi, gui -run
  Budget|Provider|Quota|Account: all ok. Core scripts 1,535,513 of
  1,536,586.

Broken by hand: dropping the quotas.json fallback turns the test red
at "after a restart".

Not tried: a real Huawei CodeArts account (none here). A plugin whose
windows are all model pools isn't kept in quotas.json, so after a
restart it shows its id until its first read.
2026-10-31 01:01:49 +08:00
yetone 2f65a33aaf library: a tools plugin is a Library server of its own, in the MCP hub (Search1API)
chenxiang0010 (Discord #general) asked for a tools plugin's tools, Search1API's
(@magpie-community/tools-search1api), to be in magpie's aggregated MCP server.
Until now plugin tools were served only at /mcp/magpie/tools, wired by hand;
the hub listed Library servers only.

Now each plugin that is on and gives tools becomes a Library server once the
plugin host has noted its tools (plugin-tools.json, new plugin.ToolsNoted):
- named by the plugin's short name (search1api, search1api-plugin beside a
  user's server of that name), `plugin` set, `local`, its URL the new
  /mcp/magpie/tools/<short> (gateway ToolsMCPOne), which serves that
  plugin's tools alone by their own names;
- added with the hub on, it is on for the agents given the hub's entry, so
  their hub lists search1api__search etc. at once; with the hub off it is on
  for none until switched on. Per agent and per tool it is switched like any
  server;
- the hub lists and runs its tools in process (gateway.PluginToolsOf,
  RunPluginToolOf, under the Plugin tools gate); with the hub off an agent is
  given the per-plugin URL at the address it reaches the gateway (through),
  with a key from another machine;
- offered once (pluginsOffered): removed by the user, it comes back only when
  the plugin is removed and added again. The plugin removed takes the server
  out; turned off it stays and lists nothing; an unreadable plugins.json
  changes nothing (plugin.ReadList). Edited in the Library's editor, which
  doesn't send `plugin`, it stays the plugin's.
Docs: docs/subsystems/plugin-tools.md, mcp-hub.md, site docs plugins (en, zh, ja).

Run (mote; full suite at this change on origin/main 024393fbb, then rebased on
acdc85ac8, whose 5 commits touch internal/plugin/page.go and a gateway test;
library, gateway and plugin focused runs again at the pushed head: ok):
- go test -tags nogui ./internal/library ./internal/gateway ./internal/plugin
  -run 'PluginTool|Hub|ToolsMCP|ServingGates|OwnMCPRejects|Tool': ok.
- TestReadOnlyKeyEveryRoute also covers the new route.
- New tests: TestPluginToolsInHub, TestPluginToolsServerComesAndGoes,
  TestPluginToolsServerThroughAnotherAddress (library), TestToolsMCPOnePlugin
  (gateway).
- go vet (darwin, GOOS=linux, GOOS=windows) on the three packages; go build: ok.
  gofmt -l: clean.
- Full suite, go test -tags nogui -count=1 -timeout 45m ./... (log kept):
  80 packages ok, internal/gateway red on TestReadOnlyKeyEveryRoute: the new
  route wasn't classified for read-only keys. Added to readOnlyRefused's
  list in the test (a read-only key is refused there, as at
  /mcp/magpie/tools); internal/gateway whole package again: ok (846s).
- Real run, sandbox HOME on mote, built binary, MAGPIE_ADDR on a free port:
  `magpie plugin add @magpie-community/tools-search1api` (latest from npm),
  `magpie serve`. library.json got the search1api server (plugin, local,
  url .../mcp/magpie/tools/search1api, pluginsOffered); the per-plugin
  endpoint listed search, news, ask, crawl, sitemap, trending, send_feedback;
  with the hub on, /mcp/magpie/hub listed search1api__search ... and
  search1api__search answered isError "Sign in with `magpie plugin login
  search1api`, configure apiKey ..." from the plugin.

Broken by hand (each red, then restored):
- hub ignoring plugin servers (backend path): TestPluginToolsInHub red
  ("claude's hub tools [fake/a fake/b fake/c]").
- adoptPlugins returning false at once: both library tests red ("no server
  for the plugin").
- through's plugin branch off: TestPluginToolsServerThroughAnotherAddress red.
- the ToolsMCPOne route removed: TestToolsMCPOnePlugin red (404).

Not tried: a signed-in Search1API account (none here), so no search went
through; a real agent (Claude Code, Codex) calling the hub; WSL/remote
agents through another address (unit test only); the GUI's Library page
showing the server (no GUI file changed, GUI suite not run).
2026-10-30 22:33:25 +08:00
yetoneandggbdpq 2e088a5916 plugin pages: a config dir reached through a Windows junction registers its pages again (#4265)
The page containment check (inside, in internal/plugin/page.go)
resolved its two paths with filepath.EvalSymlinks. Since Go 1.23 that
gives up on a Windows path that crosses an NTFS junction, so under
Scoop, whose data folder is junctioned from persist and whose exe runs
through the `current` junction, every page of every plugin was dropped
without a word: no tab, no `page` line in `magpie plugin list`,
/api/plugin-pages empty.

inside now resolves both sides with proc.RealPath, the reader magpie
already uses for junctions (GetFinalPathNameByHandle on Windows,
EvalSymlinks elsewhere). Containment is unchanged: a link out of the
page's folder, or a dead one, is still refused.

Diagnosis and a first patch by ggbdpq (their branch
hunt102-d-4265-junction-pages). That patch carried a 130-line copy of
EvalSymlinks with junction handling; this uses the shared
proc.RealPath instead, and its test uses real junctions, not a faked
Lstat (the faked test passed on the old code once it compiled).

Run:
- TestWindowPageThroughLinkedConfigDir (new): Scoop's layout with real
  junctions on Windows (mklink /J for data and for current), symlinks
  elsewhere. On origin/main, on xiaomi-gpu (Windows 11, win-run): FAIL,
  "Window through ...\apps\1.0\data = <nil>". With the fix: ok.
- Broken by hand: the Rel containment check turned off, the test goes
  red on Windows at "a link out of the page's folder served".
- Reporter's case on Windows, real build (go build -tags nogui) in
  Scoop's layout under a sandbox USERPROFILE, run through
  apps\magpie-ai\current\magpie.exe, `plugin add
  github:Magiczerowxy/magpie-chat` then `plugin list`: origin/main shows
  no page line; this build shows "page  Chat (reads nothing)".
- go test ./internal/plugin ./internal/proc on mote (macOS): ok.
  go test -tags nogui ./internal/plugin on Linux (wsl-run): ok.
- GOOS=windows go vet, GOOS=linux go vet -tags nogui on
  ./internal/plugin: ok. gofmt -l: clean.

Not tried: the GUI's sidebar tab on Windows (it reads the same
/api/plugin-pages list `plugin list` does); a real Scoop install.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-30 21:46:47 +08:00
yetone 387e8572a8 plugins: the sharing key magpie made itself reaches a hook as origin magpie-key, any other gateway key stays gateway-key
A gateway hook's ctx.origin was "gateway-key" both for the sharing key
magpie makes and writes into this computer's own agents (a WSL distro
under NAT, MAGPIE_ADDR beyond loopback) and for a named key the owner
made for a friend. A plugin couldn't tell them apart: plugins PR #526
(nowledge-mem)'s "Agents using a Magpie key" switch would have put the
owner's memories into a friend's requests.

Now access.Authenticate marks the default sharing key (Identity.Default:
the key marked lan, the one LANKeyID names, or an older magpie's
settings-only key, as access.Default tells it), and gatewayOrigin
returns "magpie-key" for it. Every other key, on loopback too, stays
"gateway-key": one the owner made, a value a user brought, or a
sk-magpie- key that didn't authenticate. magpie has no "this named key
is mine" mark, so none of those is treated as the owner's.

Why a new value and not a new field: every consumer in
magpie-community/plugins (agent-office's track.mjs, powercontext, and
#526) compares origin to "local" only, and treats anything else, an
unknown value included, as not local. None compares to "gateway-key" in
code. So "magpie-key" lands in their not-local branch, where the
sharing key already was: no plugin gains or loses a request it serves.
host.js passes the context through untouched. A plugin that wants the
owner's agents checks one value.

docs/subsystems/gateway-request-hooks.md says what each value is. Not
changed: the plugins repo has no type or doc for origin; #526's own
README and switch are its author's to scope (asked on the PR).

Tests:
- TestAuthenticateTellsTheDefaultKey (access): the ConfigureLAN key, a
  key named by LANKeyID only, and the legacy settings key read Default;
  a made key and a user-brought value don't.
- TestAsyncGatewayOrigin (gateway, real Bun host): the sharing key from
  10.0.0.1 and from loopback reaches onRequest and onResponse as
  magpie-key; a friend's own-value key as gateway-key.

Run (on mote, at this tree):
- go test -timeout 45m ./...: 80 packages ok (access, gateway 760s,
  plugin among them); internal/gui red only in its real-window AppKit
  tests (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt,
  TestMainWindowCorners and 7 more, each killed at its deadline). Three
  of them run at a fresh origin/main 48edbcb67 on mote fail the same
  way: #4125 (mote's AppKit tests hang) and #2645.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet of access,
  gateway and plugin.

Broken by hand: origin/main's middleware.go put back, the two magpie-key
subtests red ("request origin=gateway-key, want magpie-key"); Default
forced false in Authenticate, TestAuthenticateTellsTheDefaultKey red in
its first two subtests.

Not tried: a real plugin in the GUI app with a WSL agent sending the
sharing key; npm-published plugins outside magpie-community weren't
searched.
2026-10-30 20:09:09 +08:00
JoeyWu-tech ef7f55fe98 plugin: Discover lists a repository of gateway hooks alone, as a request hook (#3821)
MengXiangxi (#3821): a GitHub repository tagged magpie-plugin whose
package.json has magpie.hooks and no main, exports or index.js, a gateway
request hook alone that installs and runs, never showed in the Plugins
page's "Unofficial, on GitHub". readTagged read the magpie block's
middleware, agent and page but not hooks, so such a package was taken for
a provider: the file #1327's check looks for in the repository was its
entry as Bun resolves it, index.js, which it hasn't, and the 404 left it
out without a word. An inert index.js, as the reporter tried, lists it,
as a provider.

readTagged reads magpie.hooks. A package with hooks, no main or exports,
and none of middleware, agent or page is of kind "hooks", and the
file #1327's check looks for is its hooks file, so one whose hooks file
isn't committed (a dist built only to publish) is still left out, as a
middleware's is. The Plugins page picks "hooks" out with middleware, as
both run in the gateway (kindOf), and its chip says Request hook, as an
installed one's row does, through the word kindChip takes since the
previous commit. docs/subsystems/gateway-request-hooks.md says so. Not
changed: a raw 404 that GitHub's cache answers just after a push is
still kept for that push in this process (the reporter's second
point, #4067).

plugins.js grows 51 bytes for it. With the previous commit the core's
scripts are 24 bytes under main's, 1,527,948 of 1,528,076.

What was run (tree 79884772, on origin/main 56602426, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, the Go tests at umask 077:
- TestTaggedHooksAlone, new. IvanXxxxyyuffff/magpie-system-prompt-file's
  package.json as it is (a repository the report names) is kept, of kind
  hooks, with its spec, package and version 0.3.0, and its hooks file is
  the file asked for, never an index.js. someone/hooks-gone, whose hooks
  file is only in a dist it doesn't commit, is left out. With
  TestTaggedRepos*, -count=50: 350 of 350 pass; -race -count=20: 140 of
  140, no race.
- plugin-github-hooks.test.cjs, new. Seven repositories of
  /api/plugins/github's real answer of 2026-10-27 (two providers, three
  middleware, two of hooks alone): each of hooks alone has the gateway's
  chip saying Request hook and is picked out under Middleware, in
  English, Chinese, Traditional Chinese, Japanese and German at 980px and
  420px. Chromium and WebKit, 3 runs: 22 of 22 each run.
- Broken by hand, each red:
  - no kind made of magpie.hooks, as on main: TestTaggedHooksAlone,
    hooks alone not kept.
  - the kind made but the file looked for still the entry, index.js:
    the same.
  - the hooks file not looked for: TestTaggedHooksAlone, the hooks file
    not among the files asked for.
  - kindOf without hooks, so a Provider: plugin-github-hooks 0 of 22.
  - the card's chip not given its word: 0 of 22.
- TestCoreScriptBudget: ok.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
  vet for windows, go build -tags nogui for linux and darwin and go
  build for windows: exit 0 each. go vet and go build without the tag
  on linux: exit 1 (no libsoup-3.0 or gio-unix-2.0 here).
- The Plugins page's GUI files near the change, 24 with the new one and
  i18n-keys, each run by itself in Chromium and in WebKit: 42 of 48 runs
  green. The other 6 are red the same at 56602426, each file run the
  same way, and none is in what this changes:
  - i18n-keys, both engines: "a plugin's words are its own", for
    plugins/routing/i18n.js "masking…", which internal/masking/masking.go
    says too (#4053).
  - builtins, WebKit: Plugins › Built-in, the Observability switch's
    click times out, the stuck Plugins header (.lib-head.pm-head.stuck)
    over it taking the pointer.
  - plugin-github, WebKit: de 440, a click scrolls #view-plugins, 74 to
    139 (65 to 119 at 56602426; #3218 has the same check red in
    Chromium).
  - plugin-github-wait, Chromium: de 440, Try again moves #view-plugins
    by 2.
  - plugin-release, WebKit: en and zh read "Serves Zed\n" for "Serves
    Zed".
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2, log
  kept; 8m48s, load 32 at its start): 71 packages ok, internal/plugin
  among them, and 16 tests red in 6 packages, none of them this
  commit's tests or what they cover (internal/gui's are its gateway
  tests): agent TestCodexDriftReached (#3398); TestInstalledVersion,
  TestHowInstalled, TestCursorFolderFromTheEditorIsNotTheCLI,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141); TestReasonixCLIRequiresSupportedNativeVersion
  and TestReasonixCLIRecoversAfterProbeTimeout (#3641); davsync
  TestSyncTeraCloudStillSeesOtherWrites (#3420); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask
  077, #3640); gateway TestPluginToldWhereTheAgentWorks (the
  /tmp/.git of #3675); gui TestGatewayHeldByAContainer and
  TestGatewayFixQuitsOnlyAMagpie (#3649).

The rest is what was run for 31a99237, at tree 2dd21699 on origin/main
508911e4, the same Go change (github.go has since taken e4ccf67b's
search timeout, in askTagged, not readTagged; 31a99237's plugins.js
named the card's chip by hand, not through kindChip, and had three
lines of comment this leaves out; not this tree):
- Real use: magpie web built at 508911e4 and at that change's code
  (529f07e5, the same but for the new GUI file), each in a sandbox HOME,
  asked real GitHub for /api/plugins/github. 508911e4 listed 163 and left
  IvanXxxxyyuffff/magpie-system-prompt-file out. That change listed 164,
  it and MengXiangxi/magpie-openviking (which now has the inert index.js)
  of kind hooks. cyberElar/magpie-x-search (#1327's, a command only) was
  left out by both.

Not tried: macOS and Windows; the real app's window (no display here, the
page in Playwright's browsers only).

Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
  nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
  077; agent, provider, library and gateway with an empty .git above
  TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
  changed tests in agent, provider, gateway and gui; the timing tests
  -count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
  TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
  1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
  at umask 077 and two Reasonix tests under an empty .git; on Linux
  (wsl-run) TestProgram at umask 077 with the old program.go. With
  each fix's code taken back to main's, the Gemini imageConfig tests,
  TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
  TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
  plugin-github-hooks, plugins-more-discover, plugin-namesake were
  red. Broken by hand: claudeKeyed always true (both
  OwnEndpointNeverAsked tests red), claudeAsk a no-op
  (TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
  (the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
  gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
  Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
  plugin-card-update, plugin-github, plugin-move*, segs-glide,
  tray-totals, update-*), and run again side by side they fail the
  same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
  there). They are click-scroll guards ("the click must not scroll
  the page"), varying by language from run to run (#4385).
  copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
  too. In Chromium on mote, Chromium segfaulted partway through files
  (#4125): context-map, context-scroll-end and context-tune fail the
  same on origin/main 0911a65e7, so the batch's own files
  (plugin-namesake, update-auto, plugins-more-discover,
  plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
  at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
  whose five reds were #4362's (Antigravity turned-away and
  TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
  the rebase on 244d80e23 the five pass, and gofmt, the three vets
  and the targeted runs above were run again: ok. In Linux the
  sign-in, copilot, plugin-github*, plugins-more-discover,
  plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
  and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
  #1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
  gui, gateway, provider and plugin, TestCoreScriptBudget (core
  1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
  GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
  update-mirror, plugin-namesake, plugins-more-discover,
  plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
2026-10-30 15:53:22 +08:00
yetone f11bf27c1f video: a plugin's model that gives video makes videos through its fetch on the account
XYenon asked for video for account-backed plugins: customVideomakers
left out every provider with an Account. A plugin's model that says it
gives video (capabilities.output.video / modalities.output) is now a
video maker (the Grok plugin keeps its own). Start, poll and content go
OpenAI-shaped to <base>/videos, /videos/{id} and /videos/{id}/content
through the plugin's fetch (videoBase now takes Provider.OpenAIBase,
the Chat base for any other provider). The video's id names the account
that started it (keyMark: "a" + signer), and markedKey asks after it on
that account of the plugin's (AlsoOn), as a key provider's videos are
asked on their key. Account and model holds (videoAsker,
videoModelHeld) and the start's usage row are the existing paths'.

Test: TestPluginMakesVideos (fake $FAKE_VIDEO, two accounts): started
by a key held to the second account, polled and fetched on it, a key
held to the first gets 403 on the poll, a key held to other models 403
on the start and the poll; the start is in the ledger. Broken by hand:
with the old video.go the video makers are empty (red); without the
account mark the poll goes to the first account and the content is
refused 403 (red).

Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider
./internal/plugin for darwin, linux (-tags nogui) and windows; go test
-count=1 -timeout 45m ./internal/gateway ./internal/plugin
./internal/provider ok at the tree of the video commit (7b8456f88), the three plugin-media commits
rebased on abd94e0b1 (gateway 504s, plugin 265s, provider 95s).
Not tried: a real Veo account through a plugin; no plugin serves
/videos yet.
2026-10-29 22:54:06 +08:00
yetone 6cb73ec4f0 gateway: embeddings and speech reach a plugin through its fetch whatever API its chat is on
XYenon asked how /v1/embeddings and /v1/audio/speech reach a plugin
whose models are all on Gemini's API. serveRetrieval sent them under
the provider's Chat base, which a plugin has only with an
@ai-sdk/openai-compatible model, so such a plugin was turned away 400
"has no OpenAI-style API". Provider.OpenAIBase is plugin://<id>/v1 for
a plugin (the Chat base for any other provider), and serveRetrieval
(embeddings, rerank, speech, transcriptions, translations) sends under
it: the request reaches the plugin's fetch OpenAI-shaped at
<base>/embeddings or /audio/speech, with the model's own id, for the
plugin to put in its vendor's shape. magpie converts none of them to
Gemini's embedContent or TTS; the plugin owns its vendor's protocol.
Key holds, account holds, masking and usage are serveRetrieval's, as
before.

Test: TestGooglePluginTakesEmbeddingsAndSpeech (fake $FAKE_GOOGLE: every
model on @ai-sdk/google, with $FAKE_KINDS' embedding and TTS): both
reach the vendor through the fetch, both are in the usage ledger, a
key held to other models gets 403 on each. Broken by hand: with the
old Base(provider.Chat) it is red (400 "has no OpenAI-style API").

Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider
./internal/plugin for darwin, linux (-tags nogui) and windows; go test
-count=1 -timeout 45m ./internal/gateway ./internal/plugin
./internal/provider ok at the tree of the video commit (7b8456f88), the three plugin-media commits
rebased on abd94e0b1 (gateway 504s, plugin 265s, provider 95s).
Not tried: a real Google AI Studio account through XYenon's plugin.
2026-10-29 22:54:06 +08:00
yetone e2b7233499 draw: a plugin's Gemini image model draws on generateContent through its fetch
XYenon (magpie-google-ai-studio, Discord) asked how a plugin's image
models reach /v1/images/generations and /v1/images/edits. A plugin's
model on Gemini's API (@ai-sdk/google) that says it gives images
(capabilities.output.image / modalities.output), or is named for them,
is now a drawer: Drawers lists it, and draw sends it to drawCodeAssist
(pluginDrawsGemini), as a Google sign-in's image models are drawn. That
asks generateContent with responseModalities ["TEXT","IMAGE"] through
the plugin's fetch, an edit's pictures as inlineData, and reads the
pictures from the answer. Request.draws asks for the IMAGE modality of
a model not named for images. Imagen (catalog.ImagesAPI, :predict) is
left out. The OpenAI-compatible plugin path (SenseNova) is unchanged.

Test: TestGeminiPluginDraws (fake plugin $FAKE_GEMINI_DRAWS: a model
named for images, one that only says it gives them, an Imagen).
Broken by hand: with the old draw.go the drawers are empty (red); with
the old codeassist.go the declared-only model is sent no
responseModalities (red).

Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider
./internal/plugin for darwin, linux (-tags nogui) and windows; go test
-count=1 -timeout 45m ./internal/gateway ./internal/plugin
./internal/provider ok at this commit on its first base 172e65c80
(gateway 515s, plugin 104s, provider 104s), and ok again with the next
two commits on top, rebased on abd94e0b1 (tree 7b8456f88: gateway 504s,
plugin 265s, provider 95s; vet for the three systems there too).
Not tried: a real Google AI Studio account through XYenon's plugin.
2026-10-29 22:54:06 +08:00
yetoneandggbdpq 8c63c5b787 provider, plugin: a plugin model that says it gives no text leaves the chat lists (#3279)
A plugin provider's list counted every model it named as a chat model.
XYenon's Google AI Studio plugin put gemini-embedding-001 and its TTS
models in the chat chips, the agents' lists and /v1/models. The plugin
does declare them: the embedding's capabilities.output is
{"text": false} and the TTS's says audio only. But the host's kinds()
kept only the true keys. That made "said it gives nothing" look the same
as "said nothing", and pluginCatalog never read Outputs.

- host.js passes outputsSaid, which is whether capabilities.output says
  yes or no to any kind (kindsSaid). It goes into plugin.Model.OutputsSaid.
- pluginCatalog leaves out a model whose outputs were declared and name
  no text, image or video (pluginTalks). Every chat list is built from
  that list: /v1/models, provider.Catalog (the agents' lists and routing),
  and Available (the editor's chips).
- A plugin that says nothing about outputs keeps every model, whatever
  the id. Image-only and video-only models stay where they are; #2792
  decides where they go.

Ported from ggbdpq's hunt65-c-3279-kinds (7391b0df2), with changes
after review. That patch found the right place (pluginCatalog) and
wrote the provider tests kept here. It judged an embedding by "embed" in
its id, because the host drops the declaration. So an embedding named
otherwise (bge-m3, text:false) stayed in the list. A plugin that says
nothing about outputs lost any model whose id held "embed" or "-tts",
which changes today's behaviour. An image-only model (outputs ["image"])
was dropped, though the patch said it left #2792's models alone. This
version fixes the declaration in the host instead and guesses nothing
from ids. catalog.textModel is unchanged.

Docs: docs/subsystems/provider-plugins.md, "A model that gives no text".

Run (mote, at base 96a703a59; then rebased onto 9f25de56c, which
changed only two mover mins, and ./internal/provider plus the e2e test
run again there: ok):
- TestPluginModelGivingNoTextLeavesTheChatLists (gateway, a real Bun
  host with the fake plugin under FAKE_KINDS, using XYenon's literal
  capabilities) is red on main: the embedding and the TTS are in
  /v1/models, the agents' catalog and Available. It is green with this
  change.
- go test -count=1 -timeout 45m ./internal/plugin ./internal/provider
  ./internal/gateway: ok (plugin 165s, provider
  121s, gateway 759s).
- GOOS=linux and GOOS=windows go vet of the three packages: clean.
  gofmt -l: clean.
Broken by hand:
- host.js without outputsSaid: the e2e test is red (embedding, bge-m3
  and TTS listed; rerun at this base).
- pluginTalks always true: the e2e test and both provider tests are red
  (rerun at this base: embedding, bge-m3 and TTS listed in each).
- ggbdpq's original product change with these tests: the e2e test is red
  on bge-m3. The unit test is red on bge-m3 kept, imagen-4 lost and
  embedder-chat lost.
Not tried: the reporter's real plugin with a Google AI Studio account.
The fixture is the plugin's parseModels output and the report's own
row. A TTS or embedding model still has no route of its own here.
Not run: the full ./... suite, and the GUI suite (no GUI file changed).

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-29 18:17:55 +08:00
yetone 5eab14a8cc plugin pages: magpie web reaches a page's local service on its own address, so the chat page works from another computer
aigcfree (Discord DM) runs `magpie web --addr 0.0.0.0:3430` on an Ubuntu
server behind nginx and opens it from a Windows PC. Plugins -> 对话
(@magpie-community/page-chat) showed "127.0.0.1 refused to connect": the
page sends its frame to the chat server on 127.0.0.1, which in that
browser is the Windows PC.

A plugin now declares its page's service (package.json
magpie.page.service {port, option}: the port, or the plugin option that
holds it, from its plugins.json options; plugin.ServiceSpec). Served to a
browser (isWeb), /api/plugin-pages gives the page `service`:
_magpie/service/ under its token, and the bridge hands the frame
magpie.service as an absolute address. The desktop window and slot pages
get none, and the routes answer 404 there, so the local path is as before.

servePageService reverse-proxies /_magpie/plugin/<token>/_magpie/service/…
to 127.0.0.1:<port>. The service stays on loopback. The way in is the
page's own: the per-run token that only a signed-in /api hands out,
behind AllowGuard. Nothing is weakened:
- Host is set to 127.0.0.1:<port>, which the service's rebinding check
  wants.
- The window's cookie is taken off.
- Origin must be absent or null (403 otherwise).
- Set-Cookie is dropped.
- Every reply is sandboxed (sandbox allow-scripts; frame-ancestors
  'self'), with Referrer-Policy no-referrer and nosniff.
- The gateway's own port is never served, since a request from this
  server is loopback and the gateway takes that without a key.
- Event streams flush as they come (FlushInterval -1, X-Accel-Buffering:
  no for nginx). webCompressed no longer gzips text/event-stream, which
  held a stream back until gzip's buffer filled.
- A redirect to the service's own address is made relative.
- The entry starts the plugin host as the page's HTML does (pageHost).
- A service not up yet answers its frame with a 502 page that tries
  again in 2s.

page-chat 0.1.2 (magpie-community/plugins 4a46212, on dist) declares the
service, goes to magpie.service when given one (else 0.1.1's path:
127.0.0.1 on loopback, the SSH-tunnel note from elsewhere), and asks
api/… by relative address.

Docs: plugin-runtime.md P4 (the page row), gui-shell.md (no gzip for event
streams).

Tests: TestPluginPageServiceListedToBrowserOnly, TestPluginPageServiceSpec,
TestPluginPageServiceProxied (through webHandler: Host, cookie, Set-Cookie,
CSP, escaped path and query, foreign Origin 403, made-up token 404,
redirects, SSE first event before the end and not gzipped),
TestPluginPageServiceDown, TestServiceLocation; plugin-page.test.cjs
checks magpie.service in a browser page and its absence in a slot.

Run at 276683d85, this change on origin/main e61e10535. It was rebased
since onto c1660481c, a one-line WorkBuddy mover min in internal/provider.
181fd0a68
(another session's proxy, path _service/, {portOption}) is reverted
there by 3870ddf0a, and nothing of it is left:
- go test ./internal/gui/ ./internal/plugin/ -timeout 45m, native on the
  Windows box: every new test ok. 8 reds, none in code this touches:
  - 6 fail the same at origin/main c1660481c, run there by name:
    TestGatewayHeldByAContainer, TestLodyImportHandoff,
    TestImportStatusUnreadableIsUnknown, TestAionUiImportRow,
    TestUpdateThatWontStart, TestPiPackage. All are in #4115.
  - TestLoadConcurrentWithSavesAndEdits is red 2 of 3 alone here and red
    at c1660481c too (a rename "Access is denied"); it is in #1827.
  - TestDesktopSessionTitlesOnPages passes alone (3 of 3). In the package
    run it listed the box's real WSL Codex session. Filed as #4185.
- Earlier, at bc247a8cc, on mote: the new Go tests, and go vet of both
  packages.
- Not run at this tree: the full go test ./... . mote was at load 300+
  with three other sessions' full suites, and the Linux box had one. A
  run at an older base (fa5ff2fec) had 25 packages ok, internal/agent
  among them, and none red when it was stopped for the rebase.
- gofmt -l: clean. go vet ./internal/gui ./internal/plugin: darwin on
  mote, native Windows on xiaomi-gpu. A Linux vet from mote fails in wails'
  cgo files, and in WSL for lack of gtk4/webkitgtk-6.0 headers, both
  unrelated to this change; CI vets Linux with its headers.
- plugin-page.test.cjs on the Windows box, both engines: WebKit 3/3.
  Chromium's first test is #4180, which fails the same on origin/main
  f463a8aaf. The next commit fixes #4180 at its cause.
- Real: a sandbox magpie web on mote (0.0.0.0:3561, sandbox HOME,
  MAGPIE_WEB_KEY, the real chat package from a folder, a fake gateway).
  Playwright on the Windows box opened Plugins -> chat over the LAN in
  Chromium and WebKit. The frame went to
  http://mote.local:3561/_magpie/plugin/<tok>/_magpie/service/?theme=…
  with origin null. Its fonts.css and style.css came through the proxy. A
  sent message streamed back "remote chat works", and the fake gateway
  logged both POSTs.
  - From the Mac over the LAN: /api/plugin-pages without the cookie
    gives 401. A made-up token gives 404. A foreign Origin gives 403.
    POST api/chat without the chat token gives 403 (the service's own
    check). mote.local:3563 directly is refused (loopback only).
  - Before bun was reachable in the sandbox, the frame got the 502 retry
    page.
- Broken by hand, each red then restored:
  - Without the event-stream exclusion, the stream arrives gzipped.
  - Without the Host rewrite, the cookie strip or the web gate, each
    assertion is red.
  - With the bridge's service dropped, plugin-page.test.cjs is red in
    WebKit ("magpie.service").

Not tried:
- A real nginx in front.
- A WebSocket through the proxy (httputil handles the upgrade; the chat
  page uses none).
- TLS (--tls-cert).
- The desktop app with page-chat 0.1.2: its fallback is 0.1.1's path,
  covered by the plugin's launcher tests.
2026-10-29 14:28:24 +08:00
yetone 3870ddf0a2 Revert "plugin pages: magpie web forwards a page's local service under the page's address"
This reverts commit 181fd0a68. Another session has the fuller version of the
same feature on branch plugin-page-remote (pageservice.go, its contract
magpie.page.service {port, option} and an absolute magpie.service), which
page-chat 0.1.2 on the community dist already speaks; two contracts for one
feature would only confuse plugin authors.
2026-10-29 13:40:21 +08:00
yetone 181fd0a682 plugin pages: magpie web forwards a page's local service under the page's address
A page whose plugin runs a service on 127.0.0.1 (the community chat page)
sent its frame there, which works only in a browser on magpie's machine:
opened from another computer through magpie web it was refused (Discord DM:
AIGCFREE). magpie.page.service names the port (or the option holding it);
/_magpie/plugin/<token>/_service/ forwards to it with the page token as the
key, without magpie's cookies, and the bridge tells the page (magpie.service).
2026-10-29 13:38:49 +08:00
yetone 5957d45ac1 plugin: a GitHub listing takes package.json's licence when GitHub names none (plugins#468)
GitHub's search gives NOASSERTION for a LICENSE file it can't match to a
licence (MIT's text with a line of credit added) and nothing for none;
magpie drops NOASSERTION, so such a card on Plugins > Discover had no
licence, while the same package from npm shows package.json's.
readTagged keeps package.json's license (a string) as PkgLicense, and
License falls back to it, on a fresh read and across searches (fresh).

Run (mote, at this tree): gofmt -l clean; vet on three OSes; go test
-tags nogui -timeout 45m ./...
(go test -tags nogui -timeout 45m ./... at base 5bfd76cd8: 77 packages ok, none failed (log kept whole). Rebased onto 602ad84ad and run again there: vet on three OSes ok; go test -tags nogui -count=1 ./internal/provider (195s) ./internal/plugin (268s) ./internal/gateway (677s) ok. Rebased onto b5d2858f4 and run again: usage, provider, plugin, gateway ok. Rebased onto 87a983423, the pushed base, and run again at this tree: gofmt -l clean; go vet ./internal/... ok, GOOS=linux and windows go vet of provider, plugin, gateway ok; go test -tags nogui -count=1 ./internal/provider (126s) ./internal/plugin (180s) ./internal/gateway (588s) ./internal/codexcat (1s) ok. Then rebased onto 3ec9babe7 to push; its three commits (WorkBuddy mover min, redact, sessions) share no file with this one, and the same packages are run again at the pushed head after the push).
Broken by hand: on the old github.go TestTaggedRepos is red:
"NOASSERTION, package.json MIT: {... License: ...}".
Not tried: the GUI card against a real NOASSERTION repository (the card
reads r.license as before; no GUI file changed).
2026-10-29 00:52:19 +08:00
yetone 602ad84adc plugin: the host is told the gateway's address (MAGPIE_ADDR), so a page's own service reaches it on any port
yuesh1_ on X (reply to 2115451149633626237) opened the community chat
page (Magiczerowxy/magpie-chat, @magpie-community/page-chat 0.1.16) and
got "127.0.0.1 拒绝了连接". That is Chromium's frame error: the plugin's
chat server on 127.0.0.1:3477 wasn't listening. Before v0.1.1905
(ca499953e) nothing started the host when the page opened (the WebKit
form of it is magpie-chat#2), so that symptom is most likely an older
magpie; it doesn't reproduce at main.

What does still fail at main is the next step. The chat server finds
the gateway from MAGPIE_ADDR, else http://127.0.0.1:3425, and magpie
never put MAGPIE_ADDR in the host's environment. With the gateway on
any other port (Settings, portable builds: magpie-chat#1) the page
opens with an empty model list and "Unable to connect".

hostEnv now sets MAGPIE_ADDR to hostAddr(): magpie's own MAGPIE_ADDR,
moved onto 127.0.0.1 when it listens on every interface, else Settings'
port on loopback (settings.SavedAddr). The running host records the
address it got, and proxyMoved replaces it once that differs, as it
already did for a moved proxy. plugin.Warm (called when a hosted page
opens) now goes through get() for a running host too, so opening the
page is the call that picks up a changed port.

Run:
- TestHostToldTheGatewayAddress (new): a probe plugin writes the
  MAGPIE_ADDR it was given. Settings port 3591 -> 127.0.0.1:3591; port
  moved to 3592, Warm -> 127.0.0.1:3592; MAGPIE_ADDR=0.0.0.0:4999 ->
  127.0.0.1:4999. Passes on mote and on Windows (win-run, -count=3).
- Broken by hand, each red: the old host.go ("with Settings' port 3591
  the plugin was told MAGPIE_ADDR=unset"); the addr check taken out of
  proxyMoved, and Warm's old Running() short cut, both ("after the port
  moved to 3592 ... told MAGPIE_ADDR=127.0.0.1:3591").
- Real use, sandbox HOME, real page-chat 0.1.16 from GitHub (7dbf8ff),
  gateway port set in Settings: at main its /api/bootstrap said
  gateway http://127.0.0.1:3425 with "Unable to connect" on mote and on
  Windows; with this change gateway http://127.0.0.1:3686 (mote) and
  :3591 (Windows), no error. Changing the page's options restarts the
  host and 3477 comes back, at main and here.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...; go build for darwin, linux (nogui) and
  windows: all on mote.
- Full suite on mote: go test -tags nogui -timeout 45m ./... at base
  fc6f1d5e8, 77 packages ok, no FAIL. Rebased onto b69f8e96a (one
  usage commit), then go vet ./internal/... and internal/plugin,
  internal/usage and internal/gui again: ok. Pushed on 298bfce59, whose
  one line (Cursor's mover min in migrate_side.go) touches nothing here
  and wasn't run again with it.
- Windows, go test ./internal/plugin: TestPiPackage and
  TestLoadConcurrentWithSavesAndEdits red, both also red on origin/main
  b69f8e96a there (run alone, the latter 3 of 3); both are in #1827.

Not tried: a real WebView2 desktop window with the page open; the
reporter's magpie version is unknown, so their 拒绝 screen itself was
not reproduced.
2026-10-29 00:01:12 +08:00
yetone d4f1d6480c plugin: a program a plugin starts with no folder runs in plugin-work, not beside magpie's settings
jiakun_zhao on X asked whose page_<hash>.html, magpie_home.html,
magpie_install.sh and magpie_*.md files they had found after using the
chat page plugin (Magiczerowxy/magpie-chat). That plugin starts the
user's MCP servers from the plugin host with node:child_process spawn
and no cwd, and runs their tools for a model. The host runs in magpie's
config folder (~/.config/magpie), so every file such a tool saved by a
relative name went beside settings.json and providers.json, and a tool
told to write "providers.json" would have written over magpie's.

host.js's spawn wrapper (which already hands on the proxy and keeps
programs off the host's stdio) now starts a program that names no
folder of its own in <config>/plugin-work, created on first use, with
PWD to match outside Windows. A folder the plugin gives is kept.

Not the cause of files in the user's home folder: magpie's host never
runs in ~, and no magpie code names a file page_<hash>.html or calls a
user's MCP tool itself. Files in ~ come from a process whose folder was
~: the chat's server started by hand (node serve.mjs) from ~, or
another agent run there. Filed on magpie-chat for the plugin to give
its MCP servers a workspace of its own and tell the model where it is.

Run (mote, macOS):
- TestPluginProgramsRunInTheirOwnFolder (new; testdata/clicwd checks
  child_process spawn, spawn with env, execSync and Bun.spawn, plus an
  own cwd kept): ok. Red with origin/main's host.js put back by hand
  (plugin-work not made; programs ran in the config folder).
- go test ./internal/plugin ./internal/agentplug ./internal/pluginrt
  -count=1: ok (plugin 261s).
- go test ./internal/gateway -run Plugin -count=1 at 581d64b7d: ok.
- Windows (xiaomi-gpu, win-run): TestPluginProgramsRunInTheirOwnFolder,
  TestPluginCLIHasTheProxy, TestFakePlugin: ok.
- gofmt -l: clean.
Not tried: the full go test ./... suite, the real magpie-chat plugin
with a real MCP server and model, Linux.
2026-10-28 22:20:56 +08:00
yetone ca499953e7 gui: a plugin page with a host part starts the host when it opens
guesssssssswhat on X: the Magiczerowxy/magpie-chat page ("对话") sits
on its loading text and never opens. The page says hello and then
navigates its frame to http://127.0.0.1:3477, a server the plugin's
index.mjs starts inside the Bun host. The host was started only by a
call: at launch while providers are first read, and after a Restart
(a plugin installed, updated or set, a Bun update) or a crash only once
something asked a plugin again. With the host down, WebKit (the macOS
window's WKWebView, WebKitGTK) leaves a frame whose navigation is
refused on its old document with no error, and the hello had already
cleared the 10s broken timer, so the page waits forever. Chromium shows
chrome-error instead.

Now serving the entry HTML of a page or panel whose plugin is not
page-only starts the host if none is up (plugin.Warm), waiting at most
7s, then serves the page. Page-only plugins, and the page's other files
and the bridge, don't touch the host.

Reproduced on mote (sandbox HOME, magpie web on a free port, plugin
0.1.16 from GitHub): with its 3477 listener killed, old main's page
stays on "正在连接到本地对话服务…" in Playwright WebKit (chrome-error
in Chromium); the fixed build restarts the host on open and the chat UI
loads in both engines. In the real macOS app (wails://) the frame
reaches 127.0.0.1 (seen by a logging server). TestPluginPageStartsItsHost
is red with the pageHost call removed by hand.

Run at this head (84a6a2c42 + this), on mote: gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build; go test ./...
-timeout 45m: every package ok except internal/gui's
TestMainWindowCorners/macOS_26_SDK, red on macOS 27 and filed as #3949
(titlebar, untouched here). plugin-page.test.cjs and
plugin-kinds-discover.test.cjs, Chromium and WebKit, 14/14 each.
Rebased on 29181eb78 (usage, gateway; no file here), then go vet and
go test ./internal/gui/ ./internal/plugin/ again: same, only #3949 red.
Pushed on b586fdf1e, whose two commits (app.css, usage pricing) weren't run with this.
win-run: go test -run 'TestPluginPage|TestWindowPage' ./internal/gui/
./internal/plugin/ ok.

Not tried: the reporter's OS and magpie version; the real Windows and
Linux app windows (wsl-run can't build internal/gui: no gtk4 or
webkitgtk-6.0 dev packages in magpie-desktop, internal/plugin ok); a
real Restart in the background (simulated by killing the host); the
full GUI suite (no asset changed). magpie-chat 0.1.9 to 0.1.13 had no
main or exports, so they are page-only and no host ever starts them;
0.1.14 restored main, and that's for the plugin to tell its users.
2026-10-28 21:27:47 +08:00
yetone ba37e78b4c provider: a plugin model's test is told a queue at once and warms its host first
mingxia_16024 on Discord (v0.1.1862): testing models on Qoder (CN and
international) and WorkBuddy always failed with "qfmodel: context deadline
exceeded", even though agents got answers from the same models.

Cause, checked with the owner's real Qoder account in a sandbox HOME:
- The test already takes the gateway's route: p.Do, then the plugin's
  fetch in the host.
- The Qoder plugin waits out Qoder's free-plan queue (plan queue p3) for
  up to 4 minutes, unless X-Magpie-Fallback is "1". magpie never sent
  that header.
- The probe gives up after 20s. A raw request with no deadline got its
  head after 3m49s.
- The probe's 20s also had to cover the plugin host's cold start and the
  account loader's first run, which can renew the sign-in. A first
  WorkBuddy AI test took 8.4s.

Changes:
- For a plugin provider, probe sends X-Magpie-Fallback: 1, so a queued
  model answers at once with the plugin's queue message.
- It starts the host and runs the account's loader (warmPlugin, through
  the account's proxy) under the caller's deadline, not the probe's.
- A plugin probe waits up to pluginTestWait (60s). The GUI gives a model
  test 3 minutes.
- host.js lists x-magpie-fallback in MAGPIE_ONLY, so no vendor receives
  it.

"Recent calls" lists only the gateway's own calls, for every provider. A
test is written to the Requests page as magpie's own test, timed-out
tries included, so that is unchanged.

The gateway still never sends the header when another candidate follows,
which Qoder 0.2.40 and CodeArts 0.2.3 expect: #4049.

Run (mote-run):
- New tests TestPluginModelTestSaysQueued and TestPluginModelTestColdHost.
  They use the fake plugin's new $FAKE_QUEUE and $FAKE_LOAD_WAIT, with a
  cold host from plugin.Restart.
- go test -tags nogui -timeout 45m ./... at 76218200a: every package ok (77), none FAIL.
- GOOS=linux and GOOS=windows go vet of internal/provider and
  internal/plugin, go build ./..., and gofmt -l.
- Real Qoder account, sandbox HOME, a TestModels of qfmodel:
  - before: failed at 20.00s, twice;
  - after: "Qoder queued the request for qfmodel (this plan's queue: p3);
    try again in 30s" in about 0.5s, twice. One more run got a 200 in
    767ms.

Broken by hand, each red:
- Without the header set: SaysQueued fails with "context deadline
  exceeded" at its 5s wait.
- Without warmPlugin: ColdHost fails with a deadline at 2001ms.
- Without the MAGPIE_ONLY entry: the vendor gets fallback="1".

Not tried:
- WorkBuddy CN with a real account. It reads the desktop app's sign-in,
  which the sandbox doesn't have.
- A cold start on a slow machine or on Windows.
- The GUI button itself. The handler is unchanged.
2026-10-28 18:24:50 +08:00
yetone c48fccfad7 plugin: the dist index is read from GitHub beside jsDelivr's copy, so a plugin npm doesn't have is offered its newer version
star21321321124 on Discord: CodeArts 0.2.3 showed "已自动更新", the page said
every plugin was up to date, and Update did nothing, with 0.2.4 on the
plugins repo's dist branch. npm has neither CodeArts nor River (E404), so
npmAsk's version is the dist index's latest. With the 「国内镜像」 switch on,
index.json was read from jsDelivr first, and a 200 from it was final. A
jsDelivr edge serves the branch as it was when it cached it (s-maxage=43200):
on 10-28 gcore.jsdelivr.net served the index with codearts latest 0.2.3
(age 6631s) while raw.githubusercontent.com, cdn and fastly had 0.2.4. So
the hourly update, Check for updates and Update all saw 0.2.3.

readDistIndex now asks raw.githubusercontent.com beside the mirror (with
the switch on) and merges the two copies: every version either names,
each package's newer latest. Each version keeps the sha512 its own copy of
the branch names, which installDist checks the tarball against as before.
GitHub is waited for 5s (distGrace) past the mirror's answer; unreachable,
the mirror's copy is read alone, as before. Switch off: one read, as before.

River: on dist at 0.1.0 only, nothing newer; the test holds it "current".

Run (mote, at this tree rebased on f20118304):
- go test -tags nogui ./internal/plugin ./internal/source: ok
- go build ./...; go vet (darwin, linux, windows) of both packages: ok
- gofmt -l: clean
Broken by hand: the index read mirror-first again (the old rule) turns
TestDistOnlyPluginUpdatesPastAStaleMirror red in both subtests with
"Status:current Latest:0.2.3", what the user saw. The pure no-mirror case
(npm 404, dist 0.2.3/0.2.4, 0.2.3 installed) already passed on the old code.
Not run: full suite, GUI suite.
Not tried: a real magpie with the switch on against a stale edge (tests
can't reach the network); the stale gcore edge and fresh raw copy were
checked with curl only.
2026-10-28 13:55:16 +08:00
yetone 955cb43812 plugin: Bun reads the system's trust store itself (NODE_USE_SYSTEM_CA)
明霞 (Discord, Windows) behind an HTTPS-scanning box whose root is in the
OS store: every plugin request answered "self signed certificate in
certificate chain" (WorkBuddy AI on Routing), and updating the Qoder
plugin failed with UNABLE_TO_GET_ISSUER_CERT_LOCALLY.

magpie gave Bun only NODE_EXTRA_CA_CERTS, a file of the roots as magpie
read them: on Windows the current user's ROOT view only. Bun's own system
loader (root_certs_windows.cpp, Bun 1.4.2) reads ROOT, CA and
TrustedPeople of the machine, the user, group policy and the enterprise,
server-auth certs only: an intermediate a proxy doesn't send and a root
pushed by policy are there and weren't in magpie's file. bunCommand,
which starts every bun (the plugin host, bun add/update, the dist-branch
install), now also sets NODE_USE_SYSTEM_CA=1. Bun's runtime fetch and
bun add's HTTP client both build their store in us_get_default_ca_store,
which merges the system store when that variable is 1 (checked in
Bun's source at bun-v1.4.2, and by running it). Verification is never
turned off. A NODE_USE_SYSTEM_CA the user set (0 too) is kept; a
NODE_EXTRA_CA_CERTS the user set is kept and Bun takes it beside the
system store. magpie's own file is still given when the user has none,
for an older MAGPIE_BUN without the variable.

Go side unchanged: magpie's own clients (the dist-branch tarball
included) use crypto/x509's platform verifier on Windows and macOS and
SSL_CERT_FILE/SSL_CERT_DIR plus the distribution bundle on Linux; no
RootCAs is overridden anywhere.

Run:
- TestBunTrustsTheSystemsStore (new): a local TLS server signed by a test
  root, sending leaf+root, serving a one-package npm registry; real Bun
  1.4.2 fetch and bun add through bunCommand. Root in neither store:
  both refused. Root in the system store (Linux: SSL_CERT_DIR, the
  machine's store untouched): both get through. Root in the user's
  NODE_EXTRA_CA_CERTS: both get through.
  Linux (wsl-run, magpie-desktop): pass. Old systemca.go: the system-store
  case is red (fetch and bun add both fail), as is TestBunReadsTheSystemsStore.
  Windows (win-run, xiaomi-gpu) and macOS (mote): pass; the system-store
  case is skipped there, since it needs a change to the real trust store.
- TestBunReadsTheSystemsStore (new), TestBunIsGivenTheSystemsRoots: Linux,
  Windows, macOS pass.
- go test -tags nogui ./internal/plugin on mote: ok (116s). Windows
  TestHost* on xiaomi-gpu: ok.
- go build ./..., GOOS=windows and GOOS=linux go vet ./internal/plugin on
  mote; gofmt -l clean.
- On xiaomi-gpu, bun 1.4.2 with NODE_USE_SYSTEM_CA=1:
  tls.getCACertificates("default") 183 (121 bundled + 62 system); without
  it 121. magpie's own ROOT file there loads whole (35 certs).

Not run: full suite.
Not tried: a root actually installed in the Windows or macOS store (the
real trust stores were left alone), and the reporter's antivirus/proxy.
2026-10-28 13:50:41 +08:00
yetone 69626580bc checkin: each account is checked in through its own proxy, not the global one (#2777)
zRain on Discord (Windows, 0.1.1788, Loomy plugin 0.1.4): the global proxy
is a residential entry, the Loomy provider is set to direct. The balance
read went direct, but every check-in, the loop's and a press, went out
through the global proxy and got ECONNRESET. The usage read wraps its ctx
in ViaLogin (loginQuota); no check-in did, so netproxy.Choice was empty
and the plugin host fell back to the global proxy.

The wrap is made once, where checkiner runs an account's do
(checkin.go): ViaLogin(ctx, a.provider, a.User). That covers every
check-in at once: a plugin's own (plugin.AccountCheckin) and magpie's
Trae CN, MiniMax, Qoder and WorkBuddy check-ins, which reach the vendor
through plugin.Fetch(req.Context()). a.provider is the card id the
proxies are kept under (PluginID, as loginProvider gives the usage read),
and a.User the account's label as the accounts list shows it.

Sibling found on the way: Provider.Origin asked the plugin's loader
(LoaderOptions, which can renew the sign-in) with the bare ctx, before
WorkBuddy's search and draw paths put p.Via on it. It now asks through
p.Via(ctx). The other plugin-host entries were read and already carry
the proxy: sign-in (signInFlow.via, Via in PluginAPIKey and the CLI),
the move's Check (ViaLogin), usage (loginQuota), model lists
(listingProxies) and the gateway's fetch (p.Via in the gateway).

The direction is the one #2777 lays out; skygunner's fork wired the same
wrap per runner.

Test: TestPluginCheckinGoesThroughItsProxy. The fake plugin's check-in
asks $FAKE_CHECKIN_URL (http://vendor.invalid/checkin/<key>); the global
proxy (settings.Proxy, set before the host starts) and the account's own
are recording proxies that answer for it. The provider is direct, one
account has its own proxy. The loop and then a press must leave the
global proxy unasked, claim through the account's proxy, and fail the
direct account (vendor.invalid is reachable by no one).

Broken by hand: a.do(ctx) back in checkin.go turns it red as reported:
the global proxy was asked for both accounts, the direct one claimed
through it, and the account's own proxy saw nothing.

Run (on mote, at this tree): go test -tags nogui -count=1 -run
'TestPluginCheckin|TestMovedLoginProxy|TestPluginSignInGoesThroughItsProxy'
./internal/provider ok; full suite
go test -tags nogui -timeout 45m ./...: every package ok (76), at base a05b37353

Not tried: a real Loomy check-in on Windows; the Origin change has no
test of its own (the fake plugin's loader makes no request).
2026-10-28 10:09:51 +08:00
yetone a05b373538 checkin: a plugin's until is when its answer stops holding (Qoder's 10:00 UTC+8)
sdytman on Discord: Qoder's daily credits start at 10:00, can the plugin's
check-in follow it? Qoder's /me/campaigns opens each day's CLAIM_BENEFIT
campaign at 10:00 and closes it at 09:59 the next day, UTC+8 (startAt and
endAt, read with a real account on 10-28; Qoder.app polls the list every 5
minutes). A check-in before 10:00 meets the day before's campaign. Since
#2696 the Qoder plugins are asked again every 30 minutes, so today's was
claimed somewhere between 10:00 and 10:30; a plain plugin was settled for
the Beijing day.

auth.checkin may now answer until (RFC 3339 or epoch ms); host.js passes
it as RFC 3339 (plugin.Checkin.Until), kept as ValidUntil. settled holds
an answer only until then, whatever its outcome; the loop wakes at it
instead of its next 30-minute look; an early done that carries it is not
provisional (#3326), as the vendor said when its day turns. Instants
throughout, so the machine's zone doesn't matter. The Qoder plugins send
until from 0.2.43 (plugins fd40b20): the check-in now lands at 10:01.

Run (mote): TestPluginCheckinAsksAgainAtUntil, minute by minute from
09:27 Beijing to the next day's 10:30, with time.Local UTC, UTC-8 and
Beijing: asks at 09:27, 10:01, 00:00 (the Beijing day), 10:01; a failure
in the 09:59 gap asked at 10:01:00 only. GOOS=linux and windows go vet;
go test -tags nogui -timeout 45m ./... all ok (76 packages). gofmt -l
clean.
Broken by hand, each red: settled ignoring ValidUntil (no 10:01 asks);
tick not waking at it (10:27 instead); provisional ignoring it (asked
every 30 minutes from 00:00 to 10:00); host.js dropping until (ValidUntil
zero).
Not tried: the Qoder plugin's recheck path with until (the fake plugin
is fakeco; the tick and settled it goes through are the same); a GUI
change (none: until isn't shown).
2026-10-28 09:51:43 +08:00
yetone 8bade6c5e2 provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.

- host.js passes a finite balance on (at least 0), anything else as null.
  plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
  Aside, so routing knows the account with no Used invented. allowanceOf
  copies it into Limit.Balance; an empty wallet counts as used up.
  Allowance.Left(model) is the least balance of the windows that count
  the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
  provider and unit). Smart, pace and usage (least used) put the seat
  with more left first where they would otherwise tie (byLeft), only
  when every seat with a balance shares one LeftIn: balances in two
  units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
  text, no bar, a why sentence, the account list), magpie accounts and
  the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
  providers-accounts, plugin-runtime, host.js typings and the site's
  plugins page (en, zh, ja).

Run, at base f13aafa87, on mote:
- go test -tags nogui -timeout 45m ./...: 72 packages ok; red were
  TestQuotaSpanCarriesEveryWindowField (this change's: its fixture now
  sets Balance, green after), and on the unchanged base too
  TestWSLColdPlaceOpensNothing (#3924), TestFetchAsksASharedBaseOnce and
  two siblings (#3854), TestTUIFetchesSubscriptionModels (#3919), all
  fixed on main since and run again after the rebase; and
  TestPluginStreamsPastTheBudgetWait (#3946), green alone on both.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/..., go
  build ./..., gofmt -l: clean.
- New tests: TestPluginWalletBalanceIsAReading, TestAllowanceLeftIsTheLeastBalance,
  TestPluginHostPassesABalanceOn (through real Bun and host.js),
  TestWalletsGoByWhatTheyHaveLeft, TestWalletLeftWithinItsTier,
  TestWalletWithMoreLeftGoesFirst, TestQuotaCell's balance cases;
  usage-wallet-balance.test.cjs and routing-wallet-balance.test.cjs,
  34 of 34 in Chromium and WebKit, en zh zh-TW ja de, 1100/900/420/390px.
- GUI: every quota*, usage*, panel*, routing*, i18n* and tray* file (220
  files, 2928 tests), concurrency 4: 130 red, in 21 files. Those 21 files
  run again on an unchanged base copy and on this change, concurrency 2:
  the same 19 files red on both (126 and 131), the differing subtests
  being routing-rule-remove / rules-line / intent-entry flaps that go
  both ways. Each is filed (#3679, #2115, #3410, #3404, #3411, #3897,
  #1905, #3096, #3593, #3408, #3409, #3799, #3789, #3412, #3947, #3415,
  #3414, #1345); routing-story-shrinks had none and is #3954.

After rebasing on origin/main 833f51adc, on mote: Linux and Windows vet,
go build, gofmt clean; go test -tags nogui of internal/routes, provider,
gateway, cli, plugin, gui (the script budgets), agent and tui: all ok;
the two wallet GUI files and i18n-keys: 37 of 38, the red being
i18n-keys' "Runs as" (#3897, not this change).

Broken by hand, each red then restored: quotaReport's Balance copy
removed (TestQuotaSpanCarriesEveryWindowField red); byLeft always nil (routes and
gateway tests red); host.js's balance line removed (host test red);
quotaOfPlugin's balance copy removed (provider tests red); app.js and
client.js at base (both GUI files 34 of 34 red, "0% used" / "已用 0%").

Not tried: a real SuperMagic account or the magicrew plugin (it isn't
in the community repo; it needs to send balance), Windows and Linux
GUI apps, and the WebKitGTK app.
2026-10-28 08:28:56 +08:00
yetone f6ed2c99bc effort: a vendor's light and extra_high are low and xhigh, in dsh, Pi and the gateway
nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free
Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are
Trae's own names, light, high and extra_high, and dsh offered only
default and high: dshModelLevels (and Pi's piThinkingLevels) matched a
model's efforts to pi-ai's level names only, so light and extra_high
were dropped. The gateway dropped them too: effortOf read "light" as no
effort, and NearestEffort fitted an agent's low or xhigh to the plugin's
high.

catalog.EffortAliases names light as low and extra_high as xhigh
(EffortLevel). NearestEffort places a model's levels by the level they
name and returns the model's own word; the gateway's effortOf reads an
alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map
dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai
sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai
reads each value as "the spelling dispatch sends"). Levels a user kept
are untouched: only the names a model lists are mapped.

Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords
(catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a
real plugin host with the fake plugin listing light/high/extra_high).
Broken by hand: modelEffort without the alias, dsh levels [high] (the
report's picker); NearestEffort without EffortLevel, low/xhigh sent as
high; effortOf without the alias, light/extra_high sent as nothing.

Run on mote at this tree (base e4ccf67b1): go build, GOOS=linux and
GOOS=windows go vet -tags nogui ./... ok; go test -tags nogui -timeout 45m
./... : 73 packages ok, three red that are red the same on origin/main
7f32f0ec9 run alone: internal/agent TestWSLColdPlaceOpensNothing (#3924),
internal/tui TestTUIFetchesSubscriptionModels (#3919), internal/provider
synctest crash in TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so
the rest of internal/provider didn't run. No GUI file changed.
Rebased on 7f32f0ec9 (one agent file changed there): go build ./...,
internal/catalog whole and gateway/agent -run Effort|Dsh|Pi|ThinkingOff|Level
ok at this head.

Not tried: a real dsh session against the user's plugin (no Our Free
Model account here); dsh's parsing of a non-pi-ai wire value was read
from its source, not run.
2026-10-28 04:34:45 +08:00
yetone e4ccf67b11 plugin: GitHub's search gets 60s a page, and a mirror is asked without the token (#3923)
MYCF711 (#3923) measured a page of GitHub's search from mainland China:
29-36s straight to api.github.com, 3-7s through gh-proxy. The Plugins
page's GitHub list was empty there, for two reasons:

- askTagged's taggedWait (8s) bounded the search pages as well as the
  wait for the repositories' reads. The first page timed out, the ask
  failed whole, and nothing was cached. Each search page now has its own
  taggedSearch (60s). taggedWait starts after the search and bounds only
  the reads, as before. Through a mirror, candidateContext gives the
  official address half of the 60s and the mirror the rest.
- source.Do never used a mirror for a request carrying Authorization,
  and ghtoken sets it on every api.github.com request when a GitHub
  token is set. With a token in Settings, MAGPIE_MIRRORS did nothing.
  A request to a GitHub host whose only credential is Authorization
  (bare) now goes to the official address with the token and to the
  mirror without it. A cookie, a key header, a token in the query, URL
  userinfo, or any other host still keeps the request official. The
  caller's request keeps its header.
- ghtoken.Do now reads who answered from resp.Request: a mirror's answer
  to the bare request doesn't count as carrying the token, and a 401 from
  a mirror doesn't mark the token refused.

Tests:
- TestTaggedReposSlowSearch: a search answering after 3x taggedWait
  still lists; one that never answers fails at taggedSearch.
- TestDoKeepsCredentialsOfficial, rewritten to the new contract: the
  official address gets the token, the mirror gets none, and the
  caller's request is unchanged. Cookie, query token and npm still stay
  official.
- TestMirrorAnswerIsNotTheToken (ghtoken).

Run on mote:
- go test -tags nogui -count=1 ./internal/source ./internal/ghtoken
  ./internal/plugin ./internal/library: all ok.
- Broken by hand: with the old source.go, ghtoken.go and github.go, all
  three tests went red ("requests = [https://api.github.com/repos/o/r]";
  "token=true"; "context deadline exceeded" at taggedWait).
- Locally: gofmt -l clean; go vet for linux and windows on the three
  packages; go build -tags nogui ./...

Not tried:
- The real network from mainland China.
- A live gh-proxy answer to an anonymous api.github.com search.
- Not changed: the mirror for api.github.com still waits for
  MAGPIE_MIRRORS. Without it, the 60s alone covers the ~30s page.
- No GUI file was run: the page's fixtures fake /api/plugins/github, and
  nothing in the window changed.

Reported by MYCF711.
2026-10-28 03:57:51 +08:00
yetone dc1af8231b ghtoken: a Settings token GitHub refuses is said, and requests go without one (#3926)
A GitHub token in Settings → Network and sharing that GitHub refused
(401, expired or revoked) failed every plugin and skill check, so a
stale token was worse than none. Now it is treated as an environment
token already was: the request is asked again without it, the token
isn't sent again while magpie runs or until the field changes, and the
anonymous answer (60 an hour) is the one taken. This overturns the
package comment and TestSettingsTokenRefusedStaysAnError: the token
being the user's choice is a reason to tell them, not to fail the
check.

The page stays honest about it:
- Settings › Network and sharing still shows the token, masked, with
  Remove, and says in red that GitHub refused it and requests go
  without one until it is replaced (/api/settings githubTokenRefused).
  Before, a refused token simply read as none being set.
- After a Settings token's refusal requests go anonymous, not with
  GITHUB_TOKEN/GH_TOKEN: the user put the Settings one ahead of those,
  and the page says "without one".

Patch by MYCF711 (fix/settings-token-fallback, 7d93f1b5): the ghtoken
change and its tests. Changed from it: the notice is in Settings' row,
where the token lives, instead of the patch's Plugins page note,
which cost ~630 bytes of core script the budget (28 bytes of room at
c54478904) doesn't have; the Library's skill checks reach Settings'
row too. Token() doesn't fall through to the environment; the
library's skill check test (the sibling the patch left red) expects
the anonymous answer; the unreachable new Refused() message is
dropped (Refused's "where" now holds for a refused Settings token).
app.js stays in its budget by shortening renderGitHubToken's comment.

Run at this tree (base c54478904), on mote:
- go test -tags nogui ./internal/ghtoken ./internal/plugin
  ./internal/library ./internal/gui: ok (TestCoreScriptBudget
  included; no budget raised). GOOS=linux and windows go vet, go build
  ./...: clean.
- github-token-refused.test.cjs (new; chromium and webkit, en and zh,
  1000 and 440px): red 8 of 8 against origin/main's assets, green
  with the change. With github-token and i18n-keys: 21 of 22; the red
  is i18n-keys "a plugin's words are its own" ("Runs as"), red at
  origin/main 74dcf40aa alone too (#3897).
- Every GUI file that opens Settings › Network and sharing
  (allow-ips, api-key-theme, bare-ids, browser-access, cors-origins,
  gateway-port, lan-docker, proxy-test, settings-proxy-auth,
  settings-proxy-remember): 126 of 126.
- Broken by hand: Token() falling through to GITHUB_TOKEN after the
  Settings token's refusal turns TestSettingsTokenRefusedGoesWithoutEnvToken
  red; MYCF711 showed TestSettingsTokenRefusedAskedAgainWithout red with
  from == "settings" back in Do.

Not tried: a real revoked token against api.github.com. The Plugins and
Library pages have no notice of their own (Settings' row says it).
2026-10-28 03:50:46 +08:00
yetone f8cd964aec plugin: a fetch past the host's 128 streams waits for one, not a local 502 (#3890)
The plugin host holds streamBudget/streamWindow = 128 streaming calls'
windows. begin(true) failed the 129th at once with errTooManyCalls, before
anything reached the plugin child, and the gateway counted it as a 502
try and sent the request again. The reporter's 192 concurrent MiniMax
streams through one plugin all came back 200, but over 298 local 502
tries that never reached MiniMax (65 requests retried).

Fetch now takes its window through beginStream: when all 128 are held
it waits for one to come free, outside h.mu (the transition that frees
one takes it), while its request's context lives, the host is up, and
for streamWait (1 minute) at most, past which it is errTooManyCalls as
before. RPCs keep their reserve and still never wait; begin(false) and
begin(true) are unchanged for their other callers.

Tests:
- TestHostFetchWaitsForAStreamWindow (internal/plugin): one window;
  a second fetch waits, runs once the first is released, gives up on
  a cancelled context and after streamWait, and leaves no window taken.
- TestPluginStreamsPastTheBudgetWait (internal/gateway, new file): 192
  concurrent streams through the real Bun plugin host to a local vendor
  that holds each open until 128 are live. Every request is 200 on one
  try, the vendor sees 192 requests and never more than 128 at once.

Run at this head (on ff7048dec):
- gofmt -l internal/plugin internal/gateway: clean
- go vet -tags nogui ./internal/plugin/ ./internal/gateway/ for GOOS
  linux, windows, darwin: ok
- go test -timeout 45m ./internal/plugin/: ok (99.0s, before the rebase
  over two usage/provider commits that don't touch plugin or gateway)
- go test -timeout 45m -run Plugin ./internal/gateway/: ok (52.0s, same)
- After the rebase: TestHostFetchWaitsForAStreamWindow,
  TestHostAdmission*, TestPluginStreamsPastTheBudgetWait: ok
- Broken by hand (beginStream returning errTooManyCalls at once, as
  begin did): TestHostFetchWaitsForAStreamWindow fails ("want it
  waiting"); TestPluginStreamsPastTheBudgetWait fails with 960 lines
  of "a try 502 too many plugin calls are in flight".
- Real account: a sandbox HOME with only the ZCode plugin and its
  account, this head's build on 127.0.0.1:3581, 8 concurrent streaming
  zcode/GLM-5.3-Flash requests: 8 of 8 200, each with its [DONE].

Not tried: 192 real concurrent streams against a vendor (the reporter's
MiniMax setup); the full gateway package (only its Plugin tests).
2026-10-28 00:58:50 +08:00
yetone 2b0387574e draw: an OpenAI-compatible plugin's image models draw (SenseNova's sensenova-u1.5-lite)
01huadalang (Discord, #feedback): SenseNova's sensenova-u1.5-lite can
draw, but magpie's image generation picker doesn't list it.
ab546a4ee (v0.1.1707) covered SenseNova added as a key provider. The
SenseNova plugin (aqiu817/magpie-sensenova, @ai-sdk/openai-compatible at
token.sensenova.cn/v1) lists the model from SenseNova's /models too, but
Drawers returned nothing for any plugin provider (p.Account != nil), so
neither the picker nor generate_image could reach it there.

- provider.PluginOpenAICompatible: the plugin speaks the model on
  @ai-sdk/openai-compatible.
- Drawers: a plugin provider's listed model that DrawsID and ImagesAPI
  and is spoken on openai-compatible is a drawer; drawImages sends it to
  /images/generations or /images/edits under the plugin's base, through
  its fetch (pluginFetch maps /v1/... onto the loader's base), in the
  shape ab546a4ee sends SenseNova (b64_json, JSON edits). An image model
  on another package (a vendor's own API) is not listed. Grok's and
  WorkBuddy's drawers are unchanged (checked before this branch).
- Fake plugin: $FAKE_SENSENOVA adds sensenova-u1.5-lite and a flux-2 on
  @ai-sdk/anthropic.
- docs/subsystems/provider-plugins.md says it.

Test: TestSenseNovaPluginDraws (internal/gateway) installs the fake
plugin as "sensenova" in a real Bun host in front of the fake SenseNova
of TestSenseNovaU1Draws: Drawers lists sensenova-u1.5-lite alone, a
generation and an edit come back through the plugin (b64, JSON images,
chat never asked). Broken by hand: without the plugin branch it is red
(drawers []); without the openai-compatible check it is red (drawers
[sensenova-u1.5-lite flux-2]).

Run at this head: gofmt -l, go vet, GOOS=windows go vet, GOOS=linux go
vet -tags nogui on internal/gateway and internal/provider (clean); go
test -tags nogui -timeout 45m ./internal/gateway ./internal/provider
./internal/plugin ./internal/catalog: gateway (716s), plugin, catalog
ok; provider crashes in TestUnreadLoginsWriteErrorsKeepCredentials
(#3632, open), and with it skipped fails TestFetchAsksASharedBaseOnce,
TestFetchAsksOneListOnceForTwoBasesOfIt and
TestFetchUnionsProtocolListsWithoutChat, red the same at the base
a47596ea6 without this change (#3854, open). Neither touched here.
After the rebase onto origin/main b103ed058: gofmt, vet (three OSes),
internal/gateway -run 'SenseNova|Draw|Image|Edit|GrokPlugin|Plugin',
internal/catalog, internal/provider -run Plugin: ok.

Not tried: a real SenseNova account or the real plugin (none here); the
images API shape is from SenseTime's launch post as ab546a4ee read it.
Not run: the full ./... suite and the GUI suite (no GUI file changed).

Reported by 01huadalang (Discord).
2026-10-27 23:45:57 +08:00
yetone f4a575954b plugin: the update check asks npm now, not what it said within the hour
ysm119 on Discord tested Cursor's claude-haiku-5-5-thinking a quarter of
an hour after plugin 0.2.25 was published and magpie updated. CheckUpdates
(30s after start, then hourly) read npm's versions through Info, which
asks npm at most hourly and otherwise answers from its disk cache, so a
magpie started after a community fix was published could find the
version before it and update nothing for up to another hour (two in all
for the hourly look). latestOf now asks npm of every installed package
(infoWithin, age 0); the plugins page keeps Info's hourly cache, and a
package npm doesn't answer for is still what it said last.

Run: go test ./internal/plugin -count=1 -timeout 45m (ok, 305s).
Broken by hand: latestOf back on Info, TestUpdateCheckAsksNPMNow is red
(the check saw 1.2.3 while npm had 1.2.4).
Not tried: a real magpie restart against npm's registry.
2026-10-27 18:43:32 +08:00
yetone 9bfe680481 plugin: a changed plugin option lists the providers again (plugins#430)
WorkBuddy's plugin 0.1.38 adds a "Free models only" switch (a plugin option)
that lists only WorkBuddy's free models and refuses any other before it is
sent. Its list goes by the switch, but SetProviderOptions only handed the
values over: the host cleared its infos while Go kept provCache, so the
Providers page and /v1/models showed the old list until something else
re-read it. SetProviderOptions now forgets the kept providers (whether the
host runs or not), so the next Cached() lists them again. Nothing else runs
on a change. The workbuddy mover's min is 0.1.38 (npm view --prefer-online
at landing: 0.1.38).

Run:
- go test ./internal/plugin ./internal/provider -count=1 -timeout 45m at
  this head (5a3292354 + this): internal/plugin ok (389s); internal/provider
  FAIL on TestUnreadLoginsWriteErrorsKeepCredentials, "close of synctest
  channel from outside bubble" in filememo.Forget, which is #3632 (open, on
  main since 091153bf, nothing here touches it). TestPluginOptions now lists
  a model only while its option is on, and only base-model after it is off.
- Rebased onto 3aead9c62 after the run; its new commits touch only
  internal/provider/codex_daemon*.go and codex_app_server_test.go. go vet
  ./internal/plugin ./internal/provider ok there; a rebuild to test again
  failed to link for a full disk (291MB free).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/plugin
  ./internal/provider ok.
- Real accounts, sandbox HOME, dev build of this tree on 3516/3517 with the
  plugin added by path: POST /api/settings/plugin-option free_only on for
  workbuddy-ai took its list from 26 to 2 (hy3, deepseek-v4.1-flash) within
  2s with no restart; workbuddy kept 19. gpt-5.4 got the plugin's 404 and
  was not sent; hy3 and deepseek-v4.1-flash answered. Off: 26 again, and
  gpt-6-luna and gpt-5.4 answered.
Broken by hand: without forgetProviders in SetProviderOptions,
TestPluginOptions fails ("with beta on, optco lists "base-model"").
Not tried: the switch clicked in the GUI window (the API it calls was);
Windows and Linux apps.
2026-10-27 17:44:02 +08:00
JoeyWu-tech 6cb1cfb794 plugin: a lock behind package.json's dist tarball is mended, its tarballs kept (#3622)
Part 1 of 2, pruneDist (coffemon's first commit):

pruneDist took out every tarball in plugins/dist that
plugins/package.json doesn't name, as encoding/json reads it. Bun
installs a package from the tarball bun.lock's packages has it at, and
that can be one package.json has moved on from: gkd2323c's lock (#3622,
Windows, Bun 1.4.4) had autoclaw, codearts and cloudflare-workers-ai at
the tarballs before the ones package.json names, and those were gone
from plugins/dist, where nothing but pruneDist takes a file out. With
Bun's own copy of such a tarball, every bun command that changes
plugins/ puts the older version back; with none, every add and removal,
of any plugin, fails with "ENOENT extracting tarball from <that
package>" (part 2 has the likely why there was none).

Now a tarball the lock's packages has a package at stays, beside the
ones package.json names. Kept, it is what Bun installs: a package whose
lock is behind package.json stays at the older version without a word,
where 4e5b2ad8, once Bun had no copy, failed every command with ENOENT.
part 2 sends such a lock back to package.json before each bun
command when package.json has the package at a dist tarball too; with
package.json at npm it stays behind (#3720). package.json is read as
text, every dist/<file> in it counting, where encoding/json keeps one
value of a key named twice: Bun 1.4.0 adds a tarball's package a second
time instead of replacing it, the new tarball first, which Bun reads,
and encoding/json reads the second, so 4e5b2ad8 took out the tarball Bun
installs from. No magpie runs plugins on that Bun unless MAGPIE_BUN
names it (BunVersion has been 1.4.2 since 10-03, before plugins/dist
was), so that is how a decoded package.json loses it, not a path a user
is known to have taken. A tarball only the lock's workspaces names goes:
Bun 1.4.2 and 1.4.3 leave the one an add replaced there until their next
command, and nothing installs from it. With no bun.lock, package.json
alone decides, as before; with one that can't be read, nothing goes, as
with a package.json that can't be read.

This keeps the tarballs a lock has from going, and mends no lock: one
behind package.json's dist tarball, the reporter's or one that falls
behind later, is sent back by part 2, its tarball there or
gone.

What was run (tree 8f285445, on origin/main 4e5b2ad8, go1.26.8,
linux/amd64):
- TestDistTarballTheLockNamesStays (new): the reporter's package.json
  and lock, built around the lines #3622 quotes; the package.json real
  Bun 1.4.2 writes for `bun add ./dist/<0.2.6>` over 0.2.1, and the one
  Bun 1.4.0 writes (the package named twice), each with the lock both
  write, and the Bun 1.4.0 one with no lock; no lock; a lock that can't
  be read (a folder in its place). The tarballs the lock's packages or
  package.json name stay, the one only the lock's workspaces name goes,
  and one nothing names goes; with no lock package.json alone decides,
  and with an unreadable one nothing goes. With the change the TestDist
  tests are ok on each Bun. Broken by hand, each put back after, with
  Bun 1.4.2, 1.4.3 and 1.4.4 (outside graftcp, the proxy wrapper this
  box runs commands in, umask 077, logs kept):
  - 4e5b2ad8's pruneDist: the reporter's, both named-twice and the
    unreadable-lock cases red on each ("<tarball> taken out");
  - package.json decoded as 4e5b2ad8 did, the lock still read: the
    named-twice case with no lock red on each ("<0.2.6> taken out");
  - the whole lock read for tarballs instead of its packages: the
    workspaces case red on each ("0.2.1 kept"), and
    TestDistInstallsAPackageNPMDoesntHave red on 1.4.2 and 1.4.3
    (0.1.4's tarball stays after 0.1.3 is pinned: those two leave it in
    the workspaces).
- internal/plugin, -tags nogui, with Bun 1.4.4, the one magpie runs now:
  ok but TestPluginSOCKSProxy, red the same at origin/main 7a60e78c
  (#2207, open, filed for 1.4.3); TestFlowBigReplyProd and
  TestRenewOtherHost skip by their own condition.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
  nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build
  -tags nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet
  and go build without the tag on linux: exit 1 (no GTK, WebKitGTK or
  fontconfig headers on this box).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
  (systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
  45m, log kept): 64 ok, internal/plugin among them, and 8 red, none in
  what this changes:
  - agent TestCodexDriftReached and TestCodexBehindReverseProxy: #3398;
    TestCursorFolderFromTheEditorIsNotTheCLI,
    TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
    TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
    TestOmpDetectedWithPiDir: #3141;
    TestReasonixCLIRequiresSupportedNativeVersion and
    TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
    #3641.
  - davsync TestSyncTeraCloudStillSeesOtherWrites: #3420.
  - edit TestWriteAtomicReadOnlyHardLink: this box's umask 077, #3640.
  - gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
    #3675.
  - gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
    this box's millions of open fds, #3649.
  - provider: "fatal error: close of synctest channel from outside
    bubble" in TestUnreadLoginsWriteErrorsKeepCredentials, main's CI
    red, #3632; the package's tests after it didn't run.
  - sessions TestAgyTitleLater: a same-size write in the same mtime
    tick, 2 of 200 on main alone, #3708.
  - testenv TestProgram: this box's umask 077, #3640.

Not tried: Windows, where the reporter is (CI's Windows job runs none of
these tests: it compiles them and runs a named few). package.json and
the lock are read for the forward-slash form magpie hands Bun
("./dist/<file>"), which the reporter's Bun 1.4.4 on Windows kept in
both. A tarball they name only with backslashes goes, where 4e5b2ad8 on
Windows kept one package.json named so (it read package.json through
filepath.ToSlash).

Part 2 of 2, mendDist (coffemon's second commit):

The commit before keeps the tarballs bun.lock has packages at, but a
lock behind package.json stays behind: gkd2323c's (#3622, Windows, Bun
1.4.4) had autoclaw, codearts and cloudflare-workers-ai at tarballs
pruneDist had taken, while package.json and the lock's workspaces had
moved on. Bun installs what the lock has, at every command that changes
plugins/. From that tarball, kept now, or from its own copy of it, it
put the older version back without a word; with neither, every install,
update and removal, of any plugin, failed with "ENOENT extracting
tarball from <that package>". Bun keeps its copy of a local tarball in
its install cache as @T@<16hex>@@@1 on 1.4.2 and 1.4.3, and as
@T@sha512-<32hex>@@@1, the start of the tarball's sha512, on 1.4.4, so a
Bun moved to 1.4.4 has no copy of one an older Bun made (magpie takes a
Bun release two days after it is out, bunSettle: 1.4.4, out on 10-22,
from 10-24). pruneInstallCache leaves these copies alone (no package
name before their first @). On Linux, such a lock and copies made by
1.4.2 or by 1.4.3 give an add on 1.4.4 the reporter's error, for both
packages locked at gone tarballs; the same Bun's add succeeds and puts
both back at their older versions.

Now mendDist runs before each bun command that changes plugins/ (in
runBun and install, under installMu): the packages the lock has at a
dist tarball package.json doesn't name, while package.json has them at
one plugins/dist holds, get one `bun update --ignore-scripts` of them
all, which resolves them from package.json again. It comes after
a9242eb6's mendPackageJSON, which cuts what follows package.json's
object (plugins#405): mendDist decodes package.json, and with that tail
there it would return without a mend, leaving the lock behind for the
command. A package.json that names the lock's tarball too, as Bun
1.4.0's names a package twice, isn't behind. Nothing is asked of the
registry: no package on dist has a dependency (its index.json, 42
packages, on 10-26). `bun add` of them doesn't do it on Bun 1.4.2 and
1.4.3, which keep what the lock has, and with no copy of them, an update
of one package alone fails on the others still locked at gone tarballs.
Each mend is logged with the packages it sent back, so a lock that falls
behind again, which nothing here explains, leaves a line saying when.
What it can't mend is left to the command it comes before, as before:
package.json's tarball gone too, or a package.json or bun.lock it can't
read. A lock behind package.json across npm and plugins/dist it leaves
alone, and Bun installs the lock's version (#3720). A lock with nothing
stale costs reading the two files, decoding package.json and a scan of
the lock; a tarball is looked at only where the lock and package.json
name different ones.

A lock already behind, the reporter's among them, is sent back at the
next bun command magpie runs that changes plugins/, as package.json's
tarball is in plugins/dist: pruneDist never takes one package.json
names.

What was run (tree 5ae0b4a1, on origin/main 4e5b2ad8, go1.26.8,
linux/amd64):
- TestDistLockBehindPackageJSONIsMended (new), with real Bun: autoclaw
  and codearts installed from plugins/dist at 0.2.1 and 0.2.0, then at
  0.2.6 and 0.2.1 (the reporter's), and the lock's packages given back
  the entries Bun wrote for the first ones; with Bun's copies kept, with
  them gone, with the older tarballs put back in plugins/dist, as the
  commit before keeps them, and with the copies gone and plugins#405's
  tail after package.json's object. From each state an unrelated
  plugin's add (zcode) and then its removal succeed and leave both
  packages at package.json's versions, in node_modules and alone in the
  lock, and package.json's specs for both as they were; the add's prune
  takes the older tarballs. With the change the TestDist tests are ok on
  each Bun, and the two new ones at -count=10 on 1.4.2 and 1.4.4. Broken
  by hand, each put back after, with Bun 1.4.2, 1.4.3 and 1.4.4 (outside
  graftcp, the proxy wrapper this box runs commands in, umask 077, logs
  kept):
  - no mendDist: every case red on each, the older versions back with
    the copies or the older tarballs kept (`is at "0.2.1", want 0.2.6`),
    the add failing with "ENOENT extracting tarball from" both packages
    with the copies gone;
  - mendDist before install's add only: every case red at the removal on
    each, the older versions back, or with the copies gone package.json
    still naming zcode after Remove;
  - one `bun update` a package: both copies-gone cases red on each, the
    add failing with "ENOENT extracting tarball from" both packages, as
    with no mendDist (each update alone fails on the other's gone
    tarball);
  - `bun add` of package.json's tarballs instead of `bun update`: every
    case red on 1.4.2 and 1.4.3, ok on 1.4.4;
  - the trigger as first written (the lock's tarball gone): the
    tarballs-kept case red on each, the older versions back (`is at
    "0.2.1", want 0.2.6`);
  - mendDist before package.json's tail is cut: in install, the tail
    case red on each at the add, "ENOENT extracting tarball from" both
    packages; in runBun, red on each at the removal, package.json still
    naming zcode after Remove.
- internal/plugin, -tags nogui, with Bun 1.4.4, the one magpie runs now:
  ok but TestPluginSOCKSProxy, red the same at origin/main 7a60e78c
  (#2207, open, filed for 1.4.3); TestFlowBigReplyProd and
  TestRenewOtherHost skip by their own condition.
- gofmt -l lists nothing; GOOS=linux, windows and darwin go vet -tags
  nogui ./..., GOOS=windows go vet ./..., GOOS=linux and darwin go build
  -tags nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet
  and go build without the tag on linux: exit 1 (no GTK, WebKitGTK or
  fontconfig headers on this box).
- Full suite, -tags nogui (CI's Linux job tags gtk3), outside graftcp
  (systemd-run, umask 077, Bun 1.4.2 first on PATH as on CI, -timeout
  45m, log kept): 65 ok, internal/plugin among them, and 7 red, none in
  what this changes:
  - agent TestCodexDriftReached: #3398; TestInstalledVersion,
    TestHowInstalled, TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
    TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
    TestOmpDetectedWithPiDir: #3141;
    TestReasonixCLIRequiresSupportedNativeVersion and
    TestReasonixCLIRecoversAfterProbeTimeout: this box's /tmp/.git,
    #3641.
  - davsync TestSync and TestSyncTeraCloudStillSeesOtherWrites: #3420.
  - edit TestWriteAtomicReadOnlyHardLink: this box's umask 077, #3640.
  - gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
    #3675.
  - gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
    this box's millions of open fds, #3649.
  - provider: "fatal error: close of synctest channel from outside
    bubble" in TestUnreadLoginsWriteErrorsKeepCredentials, main's CI
    red, #3632; the package's tests after it didn't run.
  - testenv TestProgram: this box's umask 077, #3640.

Not tried: Windows, where the reporter is (CI's Windows job runs none of
these tests: it compiles them and runs a named few); the reporter's own
plugins/ folder; the step that left their lock's packages at the
tarballs before while package.json and the workspaces moved on. On Linux
each Bun from 1.4.2 to 1.4.4 writes the packages at the tarball an add
names, so the test makes that state by hand.

Review (macOS arm64, go1.26.8, squashed into one commit per issue, on
origin/main 1cbdda25b), plus the class plugins#405 belongs to, a file
here written over a longer one without truncating:
- bun.lock: real Bun 1.4.4 reads the lock's first object and goes on
  past bytes after it (a lock with an older lock's packages appended:
  `bun install` checked 1 install, no changes, tail left as it was). So
  a tail doesn't stop Bun, but pruneDist's and mendDist's regexp read
  the whole file: the tail's older tarball was kept, and sent to bun
  update before every command. Both now read lockHead, the first
  object, braces and quotes inside strings skipped.
  TestDistLockTailIsntRead (bun update run for a lock whose object is
  behind, not for one whose tail is, nor one with "}\"{]" in a string)
  and a TestDistTarballTheLockNamesStays case (the tail's tarball
  goes). Broken by hand: lockHead returning the whole file turned the
  tail case and both tail subtests red ("0.2.1 kept", "bun update run:
  true"); escapes not skipped turned the braces-in-strings subtest red.
- package.json: every magpie write of it is temp+rename (mendPackageJSON
  since a9242eb68) but the first one install makes, an os.WriteFile;
  that goes through edit.WriteAtomic now. bun's own writes are bun's.
- TestDist* ok on Bun 1.4.2, 1.4.3 and 1.4.4; broken by hand with
  1.4.4: mendDist's calls removed turned
  TestDistLockBehindPackageJSONIsMended red, and the old pruneDist
  turned TestDistTarballTheLockNamesStays red ("taken out").
- internal/plugin whole package ok (144s); gofmt clean; vet ok for
  linux nogui, windows, darwin nogui.
Not tried: Windows, where both reports come from.
2026-10-27 15:57:59 +08:00