c9e8422fa8c2b8eb96dfb7ff0c91c2caef1306bd
318
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1c59acd36d |
plugin: a fetch whose head never comes is given up on; Devin min 0.1.45 (wu_chong4136 on X)
wu_chong4136 on X: with the Devin plugin a session sometimes hung for
10 to 20 minutes with no reply, until the effort or the context was
changed. The Devin plugin returns its fetch's head only once Devin sends
the reply's first content, and the host's headRead waited for that head
with no bound, while the gateway kept the agent alive on keepalives. A
request Devin took and never answered therefore hung silently. The body
already had bodyIdleWait (30m between bytes, #4934); the head had none.
- host.go headRead: the same bodyIdleWait bounds the wait for the head.
On it the fetch ends with "the plugin sent no reply in 30m0s; that
fetch was given up on", Fetch settles the call, and the host writes
"abort", so the plugin's fetch signal ends its vendor request too. The
gateway answers the agent its retryable 502 (an SSE error event on a
stream). This holds for every plugin fetch, not only Devin's.
- ReplyWaitForTest lets the gateway test shorten the wait.
- Devin mover min 0.1.45 (on npm, `npm view --prefer-online`): the
plugin itself gives up after 5 minutes of quiet from Devin (no head,
or no frame between reads) with a retryable 504. A real probe saw
Devin's first frame at 2.5s and at most 13s between frames.
(magpie-community/plugins e30f8ed0)
- provider-plugins.md says so.
Tests:
- TestHostHeadWaitEndsAFetchNeverAnswered: a head that never comes ends
in "sent no reply", the host is sent "abort", and the call is
released; TestHostHeadWaitSparesAHeadInTime: a head in time is kept.
- TestPluginHeadNeverSentEndsInAnError (gateway, through the fake
plugin in Bun): a vendor that reads the request and never answers
gives the agent the error on a stream and on a whole reply, and every
vendor request the plugin made is closed afterwards (asked 30, open 0).
Run:
- mote: the three tests above, ok.
- Broken by hand (headRead without the timer case): the host test fails
("held its reader for ever") and the gateway test hangs to its 60s
timeout in io.ReadAll.
- mica: gofmt -l clean; go vet for darwin, GOOS=linux and GOOS=windows
on internal/plugin, internal/gateway, internal/provider: ok.
- mica: go test -tags nogui -timeout 45m ./... at this tree (rebased on
|
||
|
|
50a38371df |
plugin: a page with its own service module is a page on the GitHub list (plugins#1226)
xiaopeng66/magpie-model-lab is a page plugin whose page talks to a local service it ships as its main (magpie.page.service). readTagged called any package with a main or exports a provider, so the GitHub list showed it under Providers. Dropping the !runs check alone would make every provider that ships a settings page (atomcode's diagnostics page, for one) a page, so the rule is narrower: a package with magpie.page.file and a module of its own is a page when its keywords say "magpie-page", as every page with a main in the plugins repository does (agent-console, amp-usage, chat, fingerprint, free-tokens, page-model-quota, page-usage-board, page-usage-tree, window-warmup). No provider or middleware there says it. The file looked for in the repository is still its main. Kind only decides the card's chip and filter; what an install loads is unchanged. The fixture is model-lab's package.json as it is, without its 900KB icon; a provider with a page and no keyword stays a provider. Run (mote): - go test -count=1 ./internal/plugin: ok (157.9s). - go vet ./internal/plugin: ok. gofmt -l: clean. Broken by hand: the old !runs rule with the new test: "a page with a main: kind """, red. Not tried: installing model-lab from the GitHub list in the real app. |
||
|
|
256910f174 |
plugin: Antigravity's plugin keeps serving whoever has it, and is given to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载". Google suspends accounts it sees on Code Assist through Antigravity's own client, so |
||
|
|
75ab21af4d |
plugin: a test binary takes no Bun from PATH (#6761, #6764)
TestRemoveListedAccountLeavesHiddenNamesake went red in every whole-package run of internal/provider since |
||
|
|
30de93e9e9 |
plugins: a request whose Bun is still downloading fails at once and fails over (#6735)
hixonchan (kyrierekkok123-del on GitHub): with magpie's own Bun missing and its download stalled, every plugin-served request hung with zero bytes, nothing in the log, no timeout and no failover, and `magpie plugin` hung too. The host's lock (hostMu) was held across Bun's download, which had no bound on the whole, so every caller waited on it whatever its context said. Now: - Bun is downloaded in the background, once at a time per Bun (bunready.go). The host waits for it up to 10s from when it began (bunReadyWait); then each call ends with BunNotReadyError, "Bun runtime not ready: downloading Bun 1.4.2 (12s so far)…" or "… failed: <why>", logged, and the gateway goes on to the group's next member. - A failed download is said at once for a minute, then tried again; installs (plugin.Bun) still wait as long as their context lets. - hostMu is a channel lock that a caller's context can end (LockCtx); the gateway's TryLock polling loops use it. - When the download fails, a Bun on PATH or in ~/.bun/bin is taken if magpie would run it itself: at least BunVersion, not set aside, passing the try a new release gets. It is copied in as magpie-bun (#1048). magpie's checksummed build stays first; the user's own Bun is better than no plugins, and it is what the reporter fell back on by hand. - Each stage is logged: download started, failed after N, downloaded in N, the PATH Bun taken or refused and why. - Every route through the host gets it: fetch, loader options, sign-in, the plugin listing (CLI and GUI). `magpie plugin` prints the list and the not-ready reason within ~10s. Self-restart and env (the reporter's point 4): Reexec, RelaunchBinary and StartBeside pass os.Environ; only the Mac's bundle relaunch (open -n) starts with LaunchServices' env. Filed as #6757, not changed here. With this change MAGPIE_BUN isn't needed. Tests (each red on the old code with a shim for the new test hooks, logs kept): - TestHostWhileBunDownloadStalls: old code, "a caller whose context ended still waits on the stalled Bun download"; now not-ready at 2s, the 100ms caller returns, then the host starts on the download, asked once. - TestHostAfterBunDownloadFailedSaysWhy: old code, a plain 500 error, not BunNotReady; now the 500 is said twice with one ask, Bun() retries. - TestBunOnPathAfterDownloadFailed: old code failed; now 1.4.2 taken, 1.0.0 refused. - TestPluginWhoseBunIsNotReadyFailsOver (gateway, real Handler): old code, "group/mixed still unanswered after 20s"; now 200 from the next member in 0.84s, and the plugin's own model answers 502 "Bun runtime not ready" after ~300ms. Run on mote at |
||
|
|
bf14062def |
plugins: a dist package Bun can't copy is unpacked from the verified tarball
CHENGJIAHEGOXIS on X, on v0.1.4241 (Windows): installing GoAnyAPI from
the Plugins page still failed with "Unexpected: failed copying files
from cache to destination for package @magpie-community/tools-goanyapi"
and "(LICENSE is missing)", at both of addDist's tries.
Cause, from Bun 1.4.4's source (src/install/PackageInstall.rs): on
Windows Bun copies each cached file by CreateHardLinkW, then CopyFileW,
with no other fallback; a Win32 error it has no errno for prints as
"Unexpected". On a machine where that copy fails (agency-agents failed
the same way there before) dropping the cache entry and trying again
can't help, which is all v0.1.4205 to v0.1.4241 did.
Now, when Bun's copy is still not whole after the second try, magpie
makes it from the tarball installDist verified against the index's
sha512 (unpackDist): the files go into a temp folder beside
node_modules/<name> with .bun-tag = the tarball's integrity, as Bun
writes it, and the folder is renamed into place. Bun takes a tarball
package whose .bun-tag matches as installed and never copies over it,
so bun add runs once more to write the dependency and bun.lock. Only a
package with no dependencies (optional, peer, bundled) whose
package.json names it is made this way; a path leaving the package is
refused. When magpie can't make it either, the add is errDistPartial as
before.
Run at
|
||
|
|
02f1cee794 |
plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.
A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.
The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.
Run, at this head (rebased on
|
||
|
|
96d1b93b23 |
plugin: a dist add is judged by the copy Bun leaves, tried again over a broken one
CHENGJIAHEGOXIS on X (Windows, Bun 1.4.4, after v0.1.4229) still couldn't install @magpie-community/tools-goanyapi from the dist branch: "Unexpected: failed copying files from cache to destination for package @magpie-community/tools-goanyapi ... installed ... Failed to install 1 package". |
||
|
|
38a90a34ce |
plugins: a dist add failed by another package, unnamed in Bun's last lines, is done (CHENGJIAHEGOXIS on X)
On v0.1.4210 the reporter (Windows) still couldn't add
@magpie-community/tools-goanyapi from the dist branch:
"bun add ./dist/magpie-community-tools-goanyapi-0.1.1.tgz: exit status 1:
Saved lockfile installed @magpie-community/tools-goanyapi@./dist/... 1
package removed ... Failed to install 1 package". Bun had installed
goanyapi; another package failed, but the line naming it comes before
"Saved lockfile", and the error kept only the last six lines, so
othersFailed found no name and the add failed. The tgz is fine (sha512
matches the index, no dependencies); nothing changes in the plugins repo.
- bunSaid: every Bun error magpie shows (add, update, remove, the dist
mend) keeps up to 8 failure lines from anywhere in the output before
its last lines, ANSI and CRs stripped.
- bunFailed reads every way Bun 1.4.4's source (install/*.rs) names a
failed package: failed to install/link <name>:, refusing to install
dependency, extracting tarball from/for, downloading tarball <name>@,
failed to download, Failed to open node_modules folder for, path for
package.
- othersFailed: a failure naming no package is another's when the add's
own package is in package.json and installed at the exact version asked
for (the spec's exact version, or the one installDist read from the
index; installDist now returns it). Its own package named still fails.
This covers every plugin kind, provider plugins and tools alike, as all
go through install().
Run:
- Old code (origin/main
|
||
|
|
ab3bcdb145 |
plugin tests: the slow-recall fixture renames its output into place (#6019)
TestGatewayHookSlowRecallUsesConfiguredBudget polls every 50ms for the file its onResponse writes and fails on the first read that succeeds. fs.writeFileSync creates the file empty before it writes the bytes, so a read in between saw "" and failed with `captured ` (mote at |
||
|
|
ab7cb55371 |
plugin: a page-only plugin's options are set under plugins.json's lock too (#4666)
0d6162c8a put every plugins.json change under the file's lock, but
SetPageOptions writes a page-only plugin's options itself, under listMu
alone, so another magpie's save meanwhile was still lost there. It now
takes listFileMu before listMu, as SetOptions does.
Run (mote, darwin/arm64):
- go test ./internal/plugin -run Meanwhile -v: the three Meanwhile tests ok
- page.go reverted with the test kept: TestPluginPageOptionsKeepWhatAnotherMagpieSetMeanwhile
red ("SetPageOptions went on while another magpie held plugins.json's
lock"); restored, green
- full suite (go test -tags nogui ./... -timeout 45m, mote) with this
stack at b566b9d3c on
|
||
|
|
5aa365349a |
plugin: a plugins.json change one magpie makes keeps what another saved meanwhile (#4666)
What changed: every change to plugins.json (Add, Remove, SetOff, Prefer, SetOptions — the GUI's Plugins page, a plugin page's options bridge, `magpie plugin options/prefer/remove`, migrate and backup) is now made under the file's lock, plugins.json.lock, the same shape the accounts' logins and mcp-signins.json are changed under: listMu is this process alone, so the gateway and a magpie run from a terminal read, changed and wrote whole lists past each other, and the later write went out with what the other had saved since its read. Under the file lock every change reads the file afresh, so both stand. A lock held longer than filelock.Wait goes on without it, as before there was one; a file system with no locks likewise. Reads are unlocked, as they were. Run (darwin/arm64, GOCACHE pinned, upstream/main |
||
|
|
ab08a9e7c1 |
plugins: an add from the dist branch drops a leftover too (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS (Windows) still couldn't install GoAnyAPI from Plugins after v0.1.4205's leftover fix: bun add @magpie-community/tools-goanyapi@latest: exit status 1: ... error: GET https://registry.npmjs.org/@magpie-community%2ftools-goanyapi - 404 (and from the community repo's dist branch: bun add ./dist/magpie-community-tools-goanyapi-0.1.1.tgz: exit status 1: Unexpected: failed copying files from cache to destination for package agency-agents installed @magpie-community/tools-goanyapi@./dist/...-0.1.1.tgz Failed to install 2 packages) GoAnyAPI isn't on npm (its first version waits for an owner's publish, as 77 other community packages do), so the add goes to the dist branch. ec97a4d7b's drop-and-retry ran only after the npm add, whose 404 names no broken package; installDist's bun add had none. And the dist error was wrapped with %v, so othersFailed read only the npm try's output and failed an add whose own package had gone in ("installed ..."). The "Unexpected:" wording was already matched by bunFailed. Fix: - bunAdd does the drop-and-retry itself (dropBroken, then once more), so every bun add has it: npm's and the dist tarball's (which keeps the package's name, its spec being a path). - The dist error wraps both tries (%w), and failedOf reads every bunRunError in the tree, so othersFailed sees what Bun said from dist. - depsState.undo loses its gone list: a dropped dependency isn't in package.json when undo reads it, so the list never changed anything. - Fake bun: MAGPIE_FAKE_BUN_NPM404 (Bun 1.4.4's 404, nothing written), ./dist/*.tgz adds, MAGPIE_FAKE_BUN_BUSY_SAYS (the reporter's literal Bun output). - docs/subsystems/provider-plugins.md says so. Tests: TestLeftoverDoesNotFailADistAdd, TestAnotherPluginsFailureDoes NotFailADistAdd (reporter's bytes), TestBunFailed (+ the literal output, LF and CRLF). Run: - Both new tests red on origin/main's store.go/leftover.go/dist.go (the reporter's error, word for word), green with the fix (mote). - mica-run at this tree: go vet ./internal/plugin/..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build ./..., GOOS=linux go build -tags nogui, GOOS=windows go build: ok; go test ./internal/plugin/...: ok (150s). - win-run go test ./internal/plugin/: only TestPiPackage red (fixture spawns `sh`), the same alone at origin/main 6256d9956; filed in #4115. - mote-run go test -tags nogui -timeout 45m ./... at this tree (base |
||
|
|
ec97a4d7bb |
plugins: a dependency no plugin needs no longer fails another's install
CHENGJIAHEGOXIS on X (v0.1.4178, Windows) couldn't install GoAnyAPI from Plugins: "agency-agents" failed with 从缓存复制到目标目录失败, and it was on no plugin's row, so nothing could remove it. Cause: every bun add/update/remove installs every dependency in plugins/package.json again, and a failed `bun add` writes its package there before exiting 1. agency-agents (a repository with no package.json) was left by such an add; on Windows a file of its copy in node_modules is held open, Bun fails "EBUSY: failed copying files from cache to destination for package agency-agents", and so every later install failed over a package nothing used. Fix (internal/plugin/leftover.go, store.go): - A package Bun says it couldn't install that no plugin is installed as (on the list, on or off, an add in flight, pi's agent) is taken out of package.json and node_modules and the command runs again: install() and runBun, so add, update, check and remove all get it. - A failed install puts back the dependencies and bun.lock it found. - An add whose own package went in while another listed plugin's failed succeeds; that plugin keeps its dependency. - Remove and add's clean-ups drop the dependency by hand when bun remove fails. - What is left from before is listed under Installed as "Not used by any plugin", each with a Remove (/api/plugins leftovers, POST /api/plugins/leftover; pmLeftovers in plugininstalled.js, imported when Plugins first draws), in every language. - plugins.json there and unreadable: nothing is a leftover. - Core script budget +51 for the one call left in plugins.js (reason in core_budget_test.go). Run: - mote-run: go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok. go test ./internal/plugin (169s) and ./internal/provider (148s): ok. - mica-run go test -count=1 ./internal/gui with the leftovers drawing moved into plugininstalled.js: ok (133s); main since touches none of internal/gui's core scripts, internal/plugin or plugins.go. - win-run go test -run 'Leftover|FailedAdd|AnotherPlugin|RemoveTakes| BunFailed' ./internal/plugin on xiaomi-gpu: ok. - Reproduced the EBUSY with Bun 1.4.2 on xiaomi-gpu (a file in node_modules/agency-agents held open, then bun add another package). - Red on the old store.go: TestLeftoverDoesNotFailAnotherAdd, TestFailedAddLeavesNoDependency, TestAnotherPluginsFailureDoesNotFailAdd, TestRemoveTakesDependencyOutWhenBunFails. - GUI: plugin-leftover.test.cjs 42/42 (chromium + webkit, en zh zh-TW ja de, 980/420px, with and without a plugin); old plugins.js: 21/21 chromium red. - mote-run, rebased on |
||
|
|
667ac8bd6f |
settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map and slice) for each caller. 133 places read one field of it and threw the rest away: the proxy for every outgoing request (netproxy), the GitHub token, the China mirror switch, a model's output cap, wire or price on a gateway request. With a real account in the tray, Load's clone was 26.6 MB of the 318 MB the process allocated in its first seven minutes, most of it through netproxy.For on each request. Each of them now reads settings.Shared(), the read-only settings every caller is given for the same settings.json. Only reads were changed: a scalar field (string, bool, int, float) or a map field's index read. A caller that keeps a whole map or slice, or calls a method on the settings, still takes Load's copy. |
||
|
|
48f9764027 |
plugins: a model served on more APIs keeps the client's (gaubeebangeel on X)
gaubeebangeel on X: OpenDesign's Anthropic requests to an Open Design Cloud account were all sent upstream as chat completions. The Open Design plugin declares each model on one AI SDK package (chat completions for most, Responses for deepseek-v4-pro and claude-haiku-5.5, plugins#141), and pluginAPIs gave a plugin model that one API alone, so attempt never relayed a /v1/messages request and translated it, though amr-link serves every model on all three (plugins#888). A DeepSeek API-key provider, the case first suspected, relays to /anthropic/v1/messages as sent: tried with OpenCode's, node's and no User-Agent, bare and prefixed ids, and web search. A plugin model can now list the other APIs its vendor serves it on, as their AI SDK packages (m.also; plugin.Model.Also through host.js, config model and models hook). pluginProtocols gives the model's own API first, then those; ListedAPIs, the catalog's APIs and the provider's bases come from it, so a client's request on any of them is relayed as sent. usable puts a plugin model's own API first, so a request on an API it isn't served on is still translated to the declared one. A model with no also is unchanged. opendesign 0.1.13 (plugins 397da020) sets also on every model. Test: TestPluginModelServedOnMoreAPIsKeepsTheClientAPI (fake plugin, FAKE_ALSO): Anthropic, Responses and Chat requests to the also model reach the upstream on their own path; fake-1 (no also) is still translated to /chat/completions. Red on HEAD's plugins.go: Anthropic and Responses reached /v1/chat/completions, ListedAPIs and usable were [chat]. Run (mote unless said): go test ./internal/provider ./internal/plugin ./internal/catalog ok; go test ./internal/gateway ok (972s); GOOS=linux/windows go vet of the three packages ok; gofmt clean. Not run: the full ./... suite (mote and mica each had full suites queued under suite.lock); not tried against a real amr-link account (keyblues's plugins#888 measurements are the evidence it serves /v1/messages for every model). |
||
|
|
04776ec6cb |
providers: a plugin subscription imports accounts from a file through its own auth.import, WorkBuddy's from 0.2.32 (marchen_cc on X)
marchen_cc on X: 「从文件导入账号」 took no WorkBuddy sign-in file. The cause
was not WorkBuddy's: magpie's import reached only built-ins (Codex,
Claude, Antigravity, Factory), and a plugin had no way to say it could
read a file. This adds that for every plugin subscription:
- A plugin's auth may have import(texts, {signal}), returning sign-in
results, with importFrom (and importFroms by language) saying which
file to choose. The host's importFiles op keeps each one as a sign-in
is kept (keptAs, saved under signInKey, settled), so an account
already there comes back "updated"; it is cancellable (signInSteps)
and takes at most 100.
- /api/signin/import and `magpie accounts import <plugin> <files>` go
to provider.ImportPluginFiles when PluginImportable(id); the editor's
「从文件导入账号…」 row and the import sheet show for such a plugin, in
its own words (importSay), moved subscriptions included (subOf).
- docs/subsystems/provider-plugins.md: "Accounts from a file".
- WorkBuddy's mover min goes to 0.2.32, which reads the desktop app's
.info sign-in or a JSON credential, and sends a cloud-hosted
enterprise account (*.sso.copilot.tencent.com, *.copilot.qq.com,
*.sso.codebuddy.cn, iOA apart) to its enterprise's address (emilochen
on X), published and checked with npm view --prefer-online.
- TestCoreScriptBudget +468 for the import branch, packed to one
statement. importSay is read as the Providers rows draw, so it has
no lazy page; nothing else was moved out (#2710). The budget's
arithmetic was checked over this tree: 1,267,762, at the new cap.
Run on mote (mica's disk is full; mote over its cores) at this change
on 3f6b1b0c9;
|
||
|
|
363adb3528 |
plugin: the auth-lock test checks the loop ran while the lock was held, not how often a timer ticked (#5271)
TestAuthLockWaitDoesNotFreezeTheHost counted a 20ms setInterval over a 300ms sleep and wanted 8 ticks. A loaded runner fires the timer late and counts fewer while the loop is free all the same: 7 of 8 on mote (#5271), 6 on ubuntu CI at |
||
|
|
47b51c8225 |
plugin: an OAuth sign-in with no refresh token is kept, and one with nothing to keep fails (plugins#998)
host.js keeps an OAuth sign-in only when "refresh" is in the plugin's
result, as OpenCode's CLI does. codearts' "Sign in from CodeArts Agent"
returned an access with no refresh field, so the callback said ok and
nothing was stored: the CLI printed "signed in" and no account showed.
callback now keeps an access with no refresh as an OAuth sign-in with an
empty refresh, and a success with nothing to keep (no refresh, key or
access) fails with "<provider>'s sign-in gave nothing to keep", as
apiKey's "gave no key" already did. The plugin side is fixed too
(codearts 0.3.14, plugins 4e3a7868); this covers any other plugin that
leaves the field out.
TestSignInWithNoRefreshIsKept drives both through the signinend fixture
(methods 8 and 9) and checks the kept record is oauth with refresh "".
Ran on mica: go test -count=1 ./internal/plugin/ ./internal/provider/ ok;
GOOS=windows and GOOS=linux go vet ./internal/plugin/ ok; gofmt -l clean.
Broken by hand: with host.js at its parent, the new test fails on both
cases (nil error, nothing kept).
Not tried: the full suite at this head (one is running on mica for
|
||
|
|
dd884058e7 |
plugins: a Discover plugin's README comes from the copy usemagpie.ai keeps, before npm or GitHub (River_WLan on X)
npm's human check answers 200 with a page that isn't the package's entry, so the README showed "npm didn't answer: unexpected end of JSON input". The community repo's tagged workflow now keeps each listed plugin's README at readmes/<key>.md on dist (plugins repo, pushed), usemagpie.ai serves it at /api/plugins/readme (edge 10 min, jsDelivr stands in for raw), and ReadmeIn asks it (5s an address, MAGPIE_PLUGIN_CATALOG=off skips) before npm / GitHub; an installed plugin's folder still comes first. A page that isn't npm's entry now says npm may be asking for a human check. Only the plain README.md is kept: a language README is read from npm/GitHub only when the copy is missing. Run: go test ./internal/plugin ok (wsl); site/worker.test.mjs 40 pass (wsl). Red on old code: TestReadmeFromTheKeptCopyBeforeNPM fails with "unexpected end of JSON input" and npm asked 2 times; worker test red with the route removed. tagged.mjs run on wsl against real GitHub: 369 plugins, 369 READMEs, a second run re-read none. Not tried: the Actions run itself, the GUI (no GUI file changed). |
||
|
|
14be7f69df |
plugins: Discover's list comes from a file CI builds, not GitHub from each desktop (River_WLan on X)
Plugins -> Discover read GitHub's topic search plus a package.json, an npm answer and an entry file for ~400 repositories on every desktop. Where GitHub is unreachable or rate-limited the page said "Couldn't ask GitHub". Now the community repo's `tagged` workflow (plugins repo, scripts/tagged.mjs, every half hour) builds tagged.json on its dist branch, usemagpie.ai serves it at /api/plugins/tagged (worker, edge-cached 10 min, jsDelivr and the last whole copy as fallbacks), and magpie asks: usemagpie.ai, the dist branch (jsDelivr with the China-mirror switch), then GitHub as before. parseCatalog keeps only entries whose spec is github:<repo> or the package named from it, and drops a file older than 48h. Degrades: a tagged repo shows within the hour, not ten minutes; stars/https icons are as of the last build; owner avatars and https icon URLs still come from GitHub hosts (data: icons work). Run (wsl-run, mote's disk is full): go vet + go test ./internal/plugin, node --test site/worker.test.mjs (21 pass), scripts/tagged.mjs against the real GitHub (367 plugins, 253 with icons, 0 unread; workflow run green and tagged.json on dist), usemagpie.ai/api/plugins/tagged after wrangler deploy (200, 4.8MB). Broken by hand: skipping askCatalog turns TestTaggedReposFromTheBuiltList red. Not tried: a real desktop with GitHub blocked; GUI suites (no GUI file changed); Windows/darwin vet. |
||
|
|
58fb070953 |
settings: named proxies, chosen as inherit, direct or a saved one anywhere a proxy is (@tsingchao on X)
Settings > Network keeps named proxies (name, address, optional login)
with a Test that says reachable and the latency. Everywhere a proxy can be
chosen (global, plugin downloads, a provider, a key, a Claude account) now
has a Saved mode beside the others; the value is "@<id>". Addresses typed
before are read exactly as before, nothing is migrated or overridden.
netproxy.Parse/Resolve/Redact/EnvWith/Dispatch resolve a reference at the
lowest layer, so a proxy edited once reaches the gateway, usage reads,
sign-ins and the plugin host at the next request; Claude Code's
settings.json env (a snapshot) is rewritten by provider.ProxyEdited.
A reference this computer lacks fails closed (DeadProxy), says the proxy's
name in the request error and as "Proxy missing: {name}" on the provider
row, and never goes direct. The password lives in settings.json (0600), is
never read back by the page, logged, or put in Settings sync. The list
rides with the providers part of a sync (Bundle.Proxies, MergeProxies by
id, passwords only with keys). A proxy in use can't be deleted (409).
The saved list's page code is in proxies.js, loaded when Settings draws it;
app.js grew by Saved-mode helpers only, paid for by 16 long comments cut
(core budget unchanged, no raise).
Run (mote refused ssh all session, so Go and GUI went through win-run on
xiaomi-gpu, Windows 11; gofmt and darwin/linux-nogui/windows go vet were
clean on mote before it went down, at the pre-sync tree):
- go test settings, netproxy, backup, settingsapi, davsync: ok on Windows
(earlier on mote: also gui, provider, plugin with real Bun, gateway).
- saved-proxies.test.cjs 20 of 20 (chromium+webkit, en zh zh-TW ja de,
420px) twice more on Windows; provider-proxy-missing.test.cjs 20 of 20.
One webkit de 420px run of saved-proxies failed once under 4-way
concurrency and passed 3 of 3 alone; not reproduced.
- TestCoreScriptBudget ok after the move (it was 3.4KB over before).
Red on this tree and on origin/main alike (Windows run, not mine):
settings TestSharedCheckedReadsOnceAndKnowsUnknown; provider
Codex keychain/Git tests; plugin TestHostRunsAsMagpieBun, TestPiPackage;
gui TestGatewayHeldByAContainer and others; old-webkit "compat.js is the
first" (headerpresets.js) and ":has() (Safari 15.4)" on origin/main
|
||
|
|
a982f34130 |
plugins: async gateway hooks get the request's kind, subagent or not (ahwulv on X, #4655)
GatewayContext had no subagent marker, so OpenViking could not skip memory recall for Claude Code's subagents. It now carries kind: "subagent" when the client says so on that request, "" otherwise (main conversation, or a client that doesn't say). hookKind (internal/gateway/middleware.go) reuses the gateway's own readings: Claude Code's x-claude-code-agent-id (subOf), and Codex's x-openai-subagent collab_spawn (callKind + usage.PurposeOf, so a Codex review or compaction is not a subagent). Headers from #4655's real Claude Code 2.1.312 capture. It is read per request, so onRequest and that request's onResponse see the same value and the main turn after a subagent in the same session is "". Never guessed from the prompt or Agent tool history. Documented in docs/subsystems/gateway-request-hooks.md. Before/after: a hook's ctx had no kind; ctx.kind is now "subagent" for such requests (the OV plugin already reads ctx.kind === "subagent"). Run: TestHookKindFromClientHeaders (claude subagent, claude main in the same session, codex collab_spawn, codex review, none) and TestAsyncGatewayHookKindReachesPlugin (real gateway + Bun: main, subagent, main again; onRequest and onResponse) on mote at the commit before the final rebase and on a WSL box; with Kind dropped from the context the e2e test goes red (saw "" want "subagent"). go vet darwin green. Not tried: the real OpenViking plugin; Claude Code itself against this build; linux/windows vet was still queued on mote when this was pushed. |
||
|
|
4df5256db8 |
plugins: a plugin's page shows its README in the UI's language (ahwulv on X)
A plugin that ships README.zh-CN.md still showed README.md on its details page with magpie in Chinese. GET /api/plugins/page now takes ?lang= (the page's document language) and plugin.ReadmeIn picks the README named for it: README.zh-CN.md, README_zh.md, README-zh.md, README.zh-Hans.md, README.CN.md and the like, any case (readmeTag/pickReadme). Order: the language's own tag, then its base (zh-TW takes a simplified README over English), then the plain README.md as before. Where it reads from: an installed plugin's folder; an npm package not installed from its files through jsDelivr's file list (the registry entry holds README.md only), public registry only, never a user's private one; a GitHub repository not installed from its contents list. Any failure keeps the old README.md path. The page cache in plugins.js is keyed by package and language. A package only on the community dist branch still shows the README its index carries (English). Before/after: zh UI + a package with README.zh-CN.md showed README.md; now shows the Chinese one. en UI, no such file, or jsDelivr down: unchanged. Run: TestPickReadmeByLanguage, TestReadmeInUILanguage (fake npm, jsDelivr, GitHub, installed folder) on mote at the commit before the final rebase and on a WSL box; broken by hand (lang forced to "" in ReadmeIn) the test goes red. GUI plugin-readme-lang (new, chromium + webkit, en and zh) green, red when &lang= is dropped from the request; plugin-detail-escape green. go vet darwin green. Not tried: a real npm package with a localized README against the live jsDelivr; the other plugin GUI files and linux/windows vet were still queued on mote when this was pushed. |
||
|
|
5068e46fb6 |
provider: raise ZCode's plugin min to 0.1.58; a coding plan's 1310 leaves the trials (plugins#438)
takomitkm (plugins#438) hit two problems. The busy hold armed with one account and one agent. A GLM Coding Plan model's weekly or monthly limit (1310) also rested the whole account, so its -Trial models got the cached 1310 without being asked. zcode 0.1.58 (ea3573bf in the plugins repo, on npm) fixes the first in the plugin and lists the -Trial entries free. magpie's PaidBesideFree then rests only the refused coding-plan model. Raising the min brings every moved user up to 0.1.58. TestZCodeCodingPlanLimitLeavesTrials holds both sides. With the trials free, the 1310 rests GLM-5.3 alone and GLM-5.3-Trial is still sent. With no free entries, or with another vendor, the same refusal still rests the account. The fake plugin's $FAKE_ZCODE_FREE marks the trials free, as 0.1.58 does. Run (mote): go test ./internal/gateway -run 'TestZCode' -count=1, ok; go test ./internal/provider ./internal/plugin -count=1, ok; go vet of the three packages on mote, in WSL (magpie-desktop) and on Windows (xiaomi-gpu), ok; gofmt -l is clean. All of this at this head, rebased on origin/main. A whole-tree Linux vet in WSL stops at Wails' cgo (webkitgtk-6.0 and gtk4 aren't installed there), so it doesn't cover the GUI. Broken by hand: with the fake's free mark dropped, the zcode 0.1.58 subtest fails, because the 1310 rests the account key. Not tried: a real dual ZCode account that has reached its weekly limit. Reported-by: takomitkm |
||
|
|
13a9f1263a |
plugins: Discover counts who uses and likes each plugin
Discover showed npm's weekly downloads, which CI, mirrors and magpie's own keepMovedCurrent updates inflate. Now each card and the hero say how many people use a plugin, counted by magpie itself, and a plugin's page has a like. - The daily stats send (stats.Send) also POSTs usemagpie.ai /api/plugins/report with the install id and the installed, switched-on plugins Discover lists, by their Discover key: the npm name, or github:owner/repo for a repository tagged magpie-plugin (plugin.Public). A folder, a private repository or an unlisted package is never named. It goes only while "Share the agents, providers, models and plugins I use" is on (noUsageStats), and only where the day's event goes at all (Count me as a user, DO_NOT_TRACK, MAGPIE_NO_STATS, release builds). - site/pluginstats.js on D1 magpie-plugins: users are the ids that reported a plugin in the last 7 days, reports drop after 30 days, a caller's address is kept only as a hash for an hour (60 asks an hour). /api/plugins/stats carries no id and is cached for an hour. - A like (POST /api/plugins/like through the GUI's /api/plugins/like) is taken only for a plugin installed and on here, can be taken back, and is kept in plugin-likes.json. - "Most liked" sorts by likes once a plugin has 20, below that by GitHub's stars. - plugincounts.js is loaded with the Plugins page, not the core, and redraws the cards only when the counts changed. - The privacy text follows: README.md, README.zh-CN.md, docs/reference.md, the site's privacy and start pages in en, zh and ja, llms-full.txt, and the Privacy switch's label and description in every language. Run at this tree (on origin/main |
||
|
|
0659dc66fa |
plugin: the default-budget hook test starts the host before it measures
TestGatewayHookDefaultBudgetStillCuts/10000 was red on macOS CI at
|
||
|
|
016763f237 |
plugins: host.js passes a usage window's pool and family on, so Antigravity's card shows its pools (plugins#935)
mk311 (plugins#935): the Antigravity plugin's Usage card listed every
model's own window (13 rows, each Gemini one at 85.1%, Claude and
GPT-OSS at 100%), then a bare "7 days" and "5 hours" twice. The plugin
(0.1.0) already groups them as the built-in did: each model's window
carries its family and its pool ("Gemini", "Claude & GPT"), each pool's
own 5 hours and 7 days carry the pool.
|
||
|
|
f92c0a2bdd |
plugins: a plugin is told the effort asked, and its usage windows keep their pool and family
What a ported Antigravity needs from the host, kept generic:
- The gateway puts the request's reasoning effort on a plugin's fetch as
X-Magpie-Effort (provider.EffortHeader), so a plugin that serves one
model at several levels can pick the level. host.js strips it with the
other magpie-only headers, so the vendor never sees it.
- A plugin's usage window may name a Pool and a Family; quotaOfPlugin
passes them through, so PooledWindows names a shared pool
("Gemini · 7 days") as it does for the built-in.
Run (WSL magpie-desktop; mote unreachable, kex reset):
- TestPluginToldTheEffort: xhigh, low and none reach the plugin; the
vendor gets no X-Magpie-Effort. Red with the MAGPIE_ONLY entry removed
by hand (the vendor saw the header).
- TestPluginWindowsKeepPoolAndFamily, TestPluginToldTheSession: pass.
- Full suite: in the next commit's body (run at the head of both).
|
||
|
|
e115b96411 |
plugin: an api sign-in whose prompts ask the key asks no second key
An OpenCode plugin's "api" auth method with its own prompts and an authorize (inkstone's API key ways, Devin's session token in magpie-community/plugins#928) asks the key in its prompts and returns it from authorize(inputs). The GUI asked those prompts and then always showed a key field of its own, so the user typed the same token twice and the second entry went nowhere. The host's save() also copied every answer into the account's metadata, so the token sat there a second time in plain text. - host.js marks such a method keyAsked (type api, prompts, authorize). The GUI's startPluginSignIn signs in with no key field for it, as for keyless, and a rejected answer asks the prompts again on Try again. PluginAPIKey and `magpie plugin` login skip the empty-key check for it (Method.NoKey). - save() keeps only select answers (choices, never secrets) beside the authorize result's own metadata. A method with no authorize still keeps every answer, as OpenCode does. - An authorize that gives no key, with no key typed, is now an error instead of an "ok" that saved nothing. OpenCode itself differs: its v1 CLI (providers.ts) asks the prompts, then always asks "Enter your API key", saves result.key ?? the typed key, and merges the answers into metadata; its TUI never calls authorize for api methods. magpie-community plugins are written for magpie's flow and read the key from inputs, so this follows them. Plugins that read prompt answers back from metadata (grep of magpie-community/plugins packages): zcode (site, a select), joycode (tenant) and agnes (keyProfile, consoleToken). None has an authorize, so none changes. Every api+authorize plugin (inkstone, cloudflare-workers-ai, sensenova, agnes-code, astudio, sap-aicore, Devin #928) puts what it needs in its result's metadata itself; sensenova's apiKey: undefined workaround is now moot. Run on mote (macOS 27, Go 1.26.8, Playwright 1.62.0) at this change on origin/main |
||
|
|
4011873001 |
catalog: models.dev unreachable falls back to the last copy or a shipped one, retried in minutes (creeksuen on X)
Where models.dev can't be reached (a network in China), the catalog that gives prices, context windows, reasoning levels and names degraded: - first run: no catalog file, so every model unpriced, no windows, and a plugin's provider listed no models, until a fetch got through; - a failed fetch: KeepFresh tried again only after an hour, and the app's backend waited up to 30s on models.dev before it asked the vendors for their lists; - Sync wrote models.json in place (os.WriteFile), so a reader could catch it half written, and a parse failure left no catalog at all. Now: - Sync writes the catalog through a temp file renamed over it (writeWhole, shared with labs.json). A refused, hanging or wrong answer (HTML, cut-off JSON) keeps the last good copy byte for byte. - The binary ships models.dev's api.json of 2026-11-10 (internal/catalog/bundled/api.json.gz, 608KB; go:generate refreshes it). loadGen reads magpie's copy, then OpenCode's, then the shipped one, passing over one it can't parse. Seed (app backend, magpie serve, the plugin host) writes the shipped copy into the cache when there is none or it is older, dated bundledAt, so the plugin host reads it and Stale still has the real one fetched. A test binary has it off (bundledOn). - The app's backend no longer waits on models.dev before the vendors' lists when a catalog is there; KeepFresh fetches beside them, and a failed fetch is tried again after 2 minutes, doubling up to the hour. - The fetch already goes through http.DefaultClient, which netproxy.Install routes through the proxy in Settings, *_PROXY or the system proxy; there is no models.dev mirror setting to honour. Run (mote, at the rebased head unless said): - gofmt -l: clean. go vet darwin (catalog, plugin, cli, gui), linux -tags nogui and windows: ok. - go test ./internal/catalog: ok at the rebased head; ./internal/plugin, ./internal/gui, ./internal/cli: ok at the pre-rebase head but for TestEveryRouteHasACommandOrIsNamed, red at that older base (a GUI route this change doesn't touch) and ok at the rebased head. - New tests, each fake models.dev on 127.0.0.1 (cut connection, hang, captive-portal HTML, cut-off JSON): TestFailedSyncKeepsLastGood, TestFirstRunOfflineAnswersFromShippedCopy, TestUnreadableCacheFallsBackToShippedCopy, TestSeed, TestSyncWritesThroughRename, TestFailedFetchRetriedSoon. - Windows (win-run): the catalog tests ok, 15 of 15 with -count=15; TestSyncWritesThroughRename skips there (it holds the file open). Broken by hand, each red: Sync back to os.WriteFile (TestSyncWritesThroughRename); load without the shipped copy (TestFirstRunOffline…, TestUnreadableCache…); Seed over a newer catalog and Seed dated now (TestSeed); first retry after the hour (TestFailedFetchRetriedSoon). Not tried: the real app started with models.dev blocked; the full suite (started after the tag). |
||
|
|
e39ecfec8d |
plugin: the hook-chain test leaves the first hook room for the host's start
TestGatewayHookChainStillTenSeconds gave each of two hooks 8s and had
both sleep 6s. On macOS CI at
|
||
|
|
86825005e2 |
plugin: a gateway hook given more than 10s gets up to 30s (#5890)
gatewayTimeoutMs was capped at 10000 and the Go side cut every hook RPC at 11s, so a recall hook (Nowledge Mem) asking for 15s was cut at 1s (any value over 10000 fell back to the default) and could never finish. - host.js: gatewayTimeoutMs takes integers 100-30000; a value outside is clamped to the nearer bound, a non-integer gets the 1000 default. gatewayBudget() is the old chain budget (sum, clamped 2-10s) or the longest hook's own timeout, whichever is larger. With no hook over 10s nothing changes. - gateway.go mirrors both (gatewayTimeout, gatewayBudget, cached with the HasGateway scan). GatewayBegin's request RPC, Finish's completion RPC and GatewaySignIn now wait the budget plus 1s, never less than the old 11s; host startup and the lock wait stay bounded at 11s. Caller cancellation still reaches the hook at once, a failing hook still rolls back, and the request-state limits are unchanged. - Docs: gateway-request-hooks subsystem page, plugins docs (en, zh, ja). site/public/llms-full.txt regenerated with `node llms-full.mjs`; it was already stale on origin/main (OpenCode 2 keys, billion-context tab, data-folder move, vendor presets, group rule), so those docs pages' text lands in it too. Run on mote at this tree (base 03a800ac6; origin/main has one newer commit touching none of these files): - gofmt -l internal/plugin internal/gateway: clean - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: rc 0 - go test -tags nogui -count=1 -timeout 45m ./internal/plugin/... ./internal/gateway/...: ok plugin 161.6s, ok gateway 897.0s - site: node --test worker.test.mjs: 38 pass (llms-full red before the regeneration) New tests (internal/plugin/gateway_budget_test.go): a 12s onRequest and onResponse with gatewayTimeoutMs 15000 both land (24.2s); the default and 10000 are still cut with outcome "timeout"; two 8000ms hooks still share 10s; 130000 is clamped, not dropped; cancelling a 15000ms hook's request stops its fetch at once (0.07s); the Go mirror matches host.js. Broken by hand, each red: - A host.js as on main: SlowRecall red at 1.10s, Clamps red - B Go RPC kept at 11s: SlowRecall red at 11.04s, Mirror red - C chain capped at 10s: SlowRecall red at 10.13s - D default per-hook 30000: DefaultStillCuts/default red - E caller signal off the begin chain: LongBudgetCallerCancellation red - F chain budget 30s for every config: ChainStillTenSeconds red Not tried: a real Nowledge Mem server; the full ./... suite; GUI tests (no GUI change); a Windows or Linux runtime run (vet only). Reported-by: aboat0625-cpu |
||
|
|
e4197144a8 |
perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299 package-level regexp.MustCompile calls, in 148 files across agent, provider, gui, library, codexcat, sessions, usage, plugin and the rest, now go through lazyre.New too, so a launch that never reaches them (`magpie statusline`, run by Claude Code on every message) doesn't compile them. Fields, maps and params that held them are *lazyre.RE. Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build (t42) against this one (t43): - GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765 - `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M, peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30 changed packages ok; GOOS=linux go vet ok except ., internal/cli and internal/gui, which stop in wails v3's cgo files when cross-compiled (the same at main). New TestAllLazyPatternsCompile at the root compiles all 574 registered patterns (ok), so a bad pattern fails a test rather than a first use. Not run before push: the changed packages' own test suites; they run on mote after it. |
||
|
|
84a6d6a813 |
usage: Cursor calls made outside magpie are counted on the Usage page (WaiooT on X)
WaiooT asked for Cursor's usage to be counted. The quota card was there
already (the plugin's auth.usage); what was missing was the calls the
account made in Cursor's own editor and cursor-agent, which never pass
magpie's gateway.
The Cursor plugin (0.2.44, magpie-community/plugins f73ba656) gains
auth.calls: it reads Cursor's own usage list,
DashboardService/GetFilteredUsageEvents (the call cursor.com's Usage
page makes), keeps the signed-in user's events (owningUser = GetMe's
userId), and leaves out the conversations it sent itself for magpie.
magpie side:
- host.js: a provider says `calls` when its plugin has auth.calls; a
`calls` RPC normalises the reply (a call without an rid or time is
dropped, cost only when a number >= 0).
- plugin.AccountCalls / plugin.OutsideCall.
- usage.ReadOutsideCalls, run by the gateway a minute after the start
and every 10 minutes: each account's calls since its mark go in as
reported calls (IngestReported, request id "cursor:<usageEventId>", so
each is written once across restarts), by agent "cursor", provider
cursor, with Cursor's own cost. The first reading goes 30 days back,
but never before the gateway's last call to that provider, which older
plugin versions couldn't tell apart. A failed reading keeps its mark;
each later one starts 30 minutes back for events listed late.
Marks are kept in plugin-calls.json beside usage.jsonl.
- Cursor's mover min 0.2.43 -> 0.2.44 (npm view --prefer-online: 0.2.44).
- docs/subsystems/provider-plugins.md: "Calls an account made outside
magpie".
Run (mote, at this head):
- go vet for darwin, GOOS=linux -tags nogui and GOOS=windows on
internal/usage, internal/plugin, internal/gateway, internal/provider: ok.
- gofmt -l: clean.
- go test -count=1 -timeout 45m ./internal/usage ./internal/plugin
./internal/provider ./internal/gateway: all ok (usage 36s, plugin 129s, provider 152s,
gateway 937s), at 96d9b9ccd before the rebase onto origin/main (2
commits, none touching these files).
- Plugin: the cursor package's whole suite (410 pass) and
scripts/check.mjs on mote; a real-account auth.calls read returned 43
calls with models, tokens and cents.
Broken by hand:
- lastThrough's start removed: TestOutsideCallsStartAfterTheGateway red.
- RequestID left empty: TestOutsideCallsCounted red (rows written again
after a restart).
- host.js's rid/time filter removed: TestPluginOutsideCalls red ("4
calls, want 2").
- Plugin: owningUser and own-conversation filters removed: calls.test.mjs
red.
Not tried:
- A full magpie gateway with the plugin installed reading a real
account end to end (the plugin read was real; the magpie side ran
against the fake plugin and stand-ins).
- A team account (teamId), and the Cursor editor itself (none installed
here); the editor's and cursor-agent's calls are one list, both shown
as the Cursor agent.
- Two computers running magpie on one Cursor account each count the
other's gateway calls as made outside magpie.
- No GUI change: the rows use the reported-row path the Usage page has.
|
||
|
|
4bfac12683 |
plugins: downloads take a proxy of their own, apart from the vendors' (JonahFu on X)
JonahFu on X: GitHub is unreachable without a proxy, while API requests may go direct, so plugin downloads' proxy should be set apart from the one model requests take. Before: plugin downloads already followed the global proxy (fetches through http.DefaultClient and netproxy.Func, bun add and git through netproxy.Env), so nothing ignored it; there was only no way to give them a different one. Now Settings › Network has a Plugin downloads row under Proxy: Same as above (the default, unset: downloads follow the global proxy as before), Direct, or Custom with its login, remembered as pluginProxyCustom as Proxy's Custom is. The CLI takes it as `magpie settings set pluginProxy <url|direct|"">`. It covers the plugins list and Discover's lists (fetchJSONFrom), a user's own npm registry (fetchRegistry), Bun's download (getURLFrom), bun add/update/remove and the git commands of GitHub-installed plugins (dlEnv). The plugin host (bun run) keeps the global proxy: its requests are the vendors'. Both fields belong to this computer (KeepOwn) and are left out of auto-backups, since a proxy URL may hold a password. Settings' Proxy row and the new one are drawn by one helper (proxyRow); the core's script budget is met by cutting the proxy rows' comments, no raise. Run (mote, through mote-run): gofmt -l clean; go vet of the touched packages (darwin), GOOS=linux -tags nogui ./..., GOOS=windows of the touched packages; go test -count=1 internal/settings, settingsapi, backup, netproxy, plugin, gui, cli all ok (gui after the comment cut; its first run had TestCoreScriptBudget 1,352 bytes over). GUI, chromium and webkit: settings-plugin-proxy (new, 5 languages x 2 widths), settings-proxy-remember, settings-proxy-auth, proxy-test, settings-sections, proxy-login-fields and the i18n files: 102 pass, 0 fail. plugin-proxy-page, proxy-own-wording, account-proxy, provider-proxy, routing-proxy, provider-many-keys-proxy and signin-proxy: 104 pass, 2 fail, both signin-proxy's "a subscription with no proxy offers the global one" at 380px in Chromium, red the same way on origin/main |
||
|
|
9309e28ced |
plugins: a plugin's provider in front of a vendor's API is that vendor to the gateway (songlairui on X, #5462, #5464)
A plugin whose provider's `api` is on a vendor's preset host (a Mistral Vibe plugin's https://api.mistral.ai/v1) got none of what magpie does for that vendor, since its Host() is the plugin's id. An earlier turn's thinking went to the plugin's fetch as reasoning_content, and Mistral turned the whole request away (422 extra_forbidden); the plugin had to rewrite the body itself. provider.VendorHost and VendorPreset now resolve a plugin's declared `api` host to the preset that names it (every Chat, Responses and Anthropic base of every preset and region; local and remote magpie presets excluded, and an api on loopback, a private address, .local or .localhost names no vendor). For every other provider, and a moved subscription, they are Host() and Preset as before. The gateway's vendor checks read them: 38 p.Host() sites, Mistral's, OpenRouter's, DeepSeek's, Kimi's and DashScope's preset checks. Host() stays the plugin's id where calls are kept and shown; requests still go only to the plugin's fetch. Search and the video plan check are unchanged. No community plugin's api is on a preset host today (checked at plugins 7b52e3fc), so none changes. Any plugin gets this with no new field; documented in docs/subsystems/provider-plugins.md and the plugin docs (en, zh, ja). Run (mote): go vet ./... darwin, GOOS=linux -tags nogui, GOOS=windows; go test -count=1 -timeout 45m ./internal/provider ./internal/plugin ./internal/gateway: ok (provider 209s, plugin 182s, gateway 1002s). gofmt -l clean. Broken by hand: pluginVendor resolving nothing (the old behaviour) turns TestPluginVendor red, and TestPluginInFrontOfMistralIsMistral red on both halves: the translated Claude Code turn is answered Mistral's 422 extra_forbidden, and the relayed Chat request carries reasoning_content. Not tried: a real Mistral Vibe key through the reporter's plugin; Windows and Linux runs of the tests (no OS-specific code). |
||
|
|
16dcfa504a |
plugin: a models hook that refused a sign-in isn't asked again for it at once (JZGiVvkSOA75376 on X)
Two dead Zed sign-ins were listed ~30 times a minute, each listing asking Zed for a model token and getting 401 again. A models hook that throws with signIn "expired" is now held for that sign-in (its access, refresh or key): the listing falls back as it did, with the same error, and the hook isn't asked until the same backoff as a failed renewal (30s doubling to 30 minutes) has passed. Signing in again asks at once. This is in the host, so it holds for every plugin, not only Zed. Run: go test -run 'TestRefusedListIsNotAskedAgain|TestFetchBuildsInfoOnce| TestPluginRenewsSignIns|TestRenewRetryBacksOff' ./internal/plugin on mote: ok. Broken by hand: skipping the hold makes TestRefusedListIsNotAskedAgain red (3 listings asked 3 more times). |
||
|
|
6e2dcc4a10 |
plugin: a sign-in that won't renew is asked again later and later, not at once (JZGiVvkSOA75376 on X)
Two dead ima accounts (magpie-ima-auth 0.3.0) were renewed ~80 times a minute: its auth.refresh catches ima's "sign in again", warns and gives back undefined, and the host took that as "nothing to do" without noting a failure, so every request, models listing and usage read asked again. A refresh that gives nothing back while the sign-in is due now counts as a failed renewal. A failed renewal of the same sign-in waits 30s, then doubles each time up to 30 minutes, for every plugin; a new sign-in starts afresh, and one the vendor turned away for good is still never tried again. Run: go test -run 'TestPluginRenewsSignIns|TestRenewRetryBacksOff|TestAuthLock' ./internal/plugin on mote: ok. Broken by hand: dropping the failure note on an empty refresh makes TestPluginRenewsSignIns red (r-none renewed three times); a flat 30s retry makes TestRenewRetryBacksOff red. |
||
|
|
ab3710de3a |
hooks: onSignIn tells a request hook of an account to sign in again
shannnnnks on X: with several Codex accounts behind the gateway, one is
now and then signed out, and they want the notify plugin to push it.
The magpie that serves the gateway now looks every 2 minutes (first
after 1) at the same sign-in states the desktop alert reads
(provider.WatchSignIns' checkSignIns, so every provider: Claude, Copilot
and plugin accounts that lapsed, and built-ins whose mark says the
sign-in expired or must be done again, Codex's revoked and refused
refreshes among them; accounts in use only). Each account to sign in
again, and each Claude sign-in ending within days, goes to every hooks
file that exports onSignIn, once until the account works again, kept in
signin-hooks.json beside the desktop alert's own file. The event is
{provider, providerName, account, state: "signed-out"|"ending", endsAt?}:
the account is its display label; no token and no vendor reason text.
It is fire-and-forget in the Bun host (gatewayRequest operation
"signIn"), each hook under its own timeout, one that throws doesn't stop
the next. With no hooks file nothing is looked at or marked. A hooks
file may now export onSignIn alone, without onRequest.
Docs: gateway-request-hooks.md (Sign-in notification),
providers-accounts.md, site plugins.html en/zh/ja.
Run on mote at d939dd699 (on origin/main 835439ebf; then rebased on
|
||
|
|
623e797fde |
plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.
- A page that asks for the "usage:day" read gets that day as
magpie.read("usage:day", {date, tz}): totals, each agent and its
models, the streak and the average active day (usageapi/day.go,
gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
of at most 16 MB. In the window they go through
POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
it to Downloads under a name made safe. In magpie web, the browser
saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
shares a picture. The core grows by its one call only, paid for by
comments cut, so the budget is not raised.
Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
covers the bridge, both engines and a refused SVG.
What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
- TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
this change's own reds. The new route now has a parity entry, and
the share code moved into lazy pageshare.js with no raise.
- TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
passed. Every red is filed and none touches this change:
- i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
- page-width-steady: #5013.
- plugin-card-update in WebKit: #3079.
- plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on
|
||
|
|
ddd6c649b3 |
draw: a plugin's model that says it gives images alone is an image model
maonekone (Discord #feedback, 11-09): a plugin can't say which of its
models draw; magpie took a plugin's image model only by its name
(DrawsID and ImagesAPI words). Now a model the plugin lists with
modalities.output ["image"] (no text), on its openai-compatible API, is
listed among the drawers and drawn at the images API through the
plugin's fetch, whatever its name. A model that answers in text and
images still chats.
Run (mote): TestPluginDeclaredDrawerDraws red on the old code ("drawers
[]"); with only the listing change, red again (the draw went to chat
completions); green with both. go vet ./internal/gateway ok; go test
-run "Draw|Image|SenseNova|Loomy|Plugin" ./internal/gateway ok (74s).
Not tried: a real plugin declaring such a model; the full suite.
Reported-by: maonekone (Discord #feedback)
|
||
|
|
22ffd4db69 |
plugin: a provider's models come from the plugin that serves it
Two plugins can sign in to one provider id. On the owner's MacBook Air,
tianpeng-dev's opencode-doubao-work-auth 1.1.6 was installed before
@magpie-community/opencode-doubao-work-auth 0.1.2. Both name
doubao-work. The third party's config hook ran first and wrote
cfg.provider["doubao-work"] with models: {}. Ours writes its entry with
??=, so it added nothing. Ours served the id, being the last to name it,
but info() read the shared config.provider entry: the provider showed
the other plugin's name and api and 0 models.
The config hooks still share one config object. Before each hook runs,
every provider it signs in to is set to the user's own entry, or to
this plugin's entry from the last load, never to another plugin's.
What the hook leaves there is kept as that plugin's (ownConfig).
info() reads the serving plugin's entry (providerConfig), so Prefer
moves the name, api and models with the provider.
Run (mote, at
|
||
|
|
5611e7274e |
plugin: a plugin's sign-in words show in the window's language when it gives them
mahiro233 on Discord (v0.1.3372, Kiro plugin 0.1.34): in a Chinese
window, the Kiro sheet's "Choose a sign-in method" and its choices read in
English, while the rest of the sheet is Chinese. magpie showed a plugin's
method labels, questions and choices only as the plugin wrote them, and no
plugin had a way to give them in another language.
A plugin may now give them by language, magpie's own fields beside
OpenCode's English, as a page gives its titles: a method's labels, a
question's messages, a select option's labels and hints, each
{"zh": "…", "zh-TW": "…", "ja": "…", "de": "…"}. host.js passes them on
(byLang: string values, codes of 1-16 characters, at most 16, empty ones
left out); plugin.Method and plugin.Prompt carry them; the app shows the
window's language, then its first part, else the English (inLang), on the
way picker, a question, its choices and their hints, a key's field and
the site step's other ways. `magpie plugin login` stays English. Kiro
0.1.35 gives its words in all four (plugins 588b3611).
Tests: TestPluginSignInWordsByLanguage (a plugin's words reach magpie as
given, bad ones left out, none for a plugin that gives none);
TestPluginOwnIconAndKeyHint compares a Method with reflect.DeepEqual now
that it holds a map. The GUI side is checked by plugin-ask-ways.test.cjs
in the next commit.
Run on mote at this tree: gofmt -l empty; go vet ./internal/plugin
./internal/provider ./internal/gui (darwin), linux -tags nogui, windows:
ok; go test -count=1 ./internal/plugin ./internal/provider ./internal/cli:
ok. Broken by hand: with origin/main's host.js the new test fails (no
labels, messages or hints reach magpie). Not tried: a real Kiro sign-in
(no keys or passwords entered anywhere); the full suite is queued on mote
under suite.lock after the push.
|
||
|
|
a6a99717e0 |
gateway: thinking with no signature never goes to Claude
citricdu (Discord, 0.1.3356): Claude Code auto-compacted a session on a
Smart group that had moved to Cursor's Grok 4.7, then the group went
back to Kiro's Claude Opus 5.5. The compacted history kept a thinking
block Grok made, which magpie hands a Messages client signed "", and
Kiro answered 13 times in a row with a bare invalid_request_error. The
same request without the block was answered.
withoutForeignThinking dropped only DeepSeek's UUID-signed blocks and
kept an empty signature on purpose ("a block with no signature Claude
takes"), and Kiro's refusal names nothing boundRefusal reads, so
refuseBoundThinking never mended it. Now every thinking block whose
signature is empty, blank or missing is left out for an upstream
serving Claude (api.anthropic.com, or a claude- model: relays, Bedrock
and Vertex ids, a plugin's fetch such as Kiro's), on every route
forwardOnce takes (relayed, translated, plugin, count_tokens), and
refuseBoundThinking runs it too. Text, tool_use and tool_result stay;
Claude's own signed thinking and redacted_thinking are untouched. A
model that learned thinkingBackNeeded (DeepSeek under another name)
keeps its unsigned blocks. Chat and Responses translated into Messages
already dropped unsigned thinking in anthropicBody.
Tests: TestUnsignedThinkingNotSentToClaude builds the reporter's shape
(the compaction summary, then two tool turns opening with Grok's
thinking signed "") against a fake Kiro that gives the same bare 400,
relayed and through the fake plugin's fetch (FAKE_KIRO model added).
TestGrokThinkingThenClaude runs the switch itself: a group answered by
a Chat Grok, then moved to Claude mid tool loop.
TestWithoutForeignThinking adds an unsigned block, Bedrock and Vertex
ids, a missing and a blank signature.
Run (mote, at this head rebased on
|
||
|
|
8a7f77cb71 |
provider, plugin: a sign-in whose refresh token rotates is never carried (#5583)
With Sign-ins ticked in Sync, a MiniMax Code sign-in went to both of the
reporter's computers. MiniMax spends a refresh token once: each computer
renewed it as it came due, the loser got invalid_grant 400 and was
signed out for good, with no newer generation anywhere in the sync path
to come back from. Qoder spends its refresh tokens once too.
The safest rule is that such a credential has one owner: it is never
carried. The auth hook declares `rotating` beside keepAlive and
refreshLead; the host passes it in the providers' row (Provider.Rotating),
and the carry path honours it: CollectSignIns leaves such sign-ins out of
what a backup or sync carries, and records() leaves out one an older file
carried, so MergeSignIns neither takes one in nor sends one up, and
RestoreSignIns writes none. Since the plugins don't declare it yet, and
the plugin host's list may not be read when a sync runs at start, magpie
also knows MiniMax Code (minimax-code, minimax-code-global) and Qoder
(qoder, qoder-cn) as rotating (rotatesKnown, read from their sources).
Nothing is deleted: local sign-ins stay, and a copy already on the server
falls out of the carried set by the usual removal.
The tradeoff, on purpose: each computer signs in to these itself. The
reporter's "relay" (carry one generation chain, re-read the store before
declaring a sign-in dead) would keep cross-computer sync for them; it is
a design of its own, not this fix, and stays open on the issue.
Ported from ggbdpq's patch on the issue, with rotatesKnown added so the
rule holds now and before the host lists its providers.
Run:
- TestCollectSignInsLeavesARotatingSignInOut,
TestMergeSignInsDoesNotTakeARotatingSignInIn,
TestRestoreSignInsLeavesARotatingSignInOut and
TestKnownRotatingSignInsStayWithNoPluginListed (new): all four red on
the old signins_carry.go ("a rotating sign-in is carried", "put in
here", Added:1, "minimax-code's rotating sign-in is carried"), green
after.
- go test -tags nogui ./internal/provider/ -run 'SignIns|Rotating' on mote.
- gofmt -l on the changed files: nothing.
Not tried: the two-computer race with real MiniMax Code or Qoder accounts.
Reported-by: skalitz-wolf (yetone/magpie#5583)
Reported-by: gua2100 (Discord)
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
7cce4b4d78 |
plugin: a host holding over 512 MiB is replaced by a new one
A headless magpie on a small Linux server had its shared plugin host at
783 MiB after 2h25m (main process 117 MiB), and the kernel OOM-killed it.
Four plugins went through it (cursor, kiro, qoder, workbuddy). Nothing
bounded the host: no heap cap, no collection when idle, no restart.
The host now checks its RSS every minute, from ten minutes after it
started. Past 512 MiB it runs a full collection (Bun.gc(true)), and if it
is still past, it says so ("heavy"). magpie then retires it as a plugin
update does (Restart): the calls it is answering finish on it, and the
next call starts a new host.
What was measured (host RSS; bench driver = host.js run as magpie runs
it, a fake vendor, 4 requests at a time, every 5th a JSON reply, every
7th cancelled mid-stream):
- fake plugin, 200KB bodies, 4000 requests: macOS 25 -> 115 MiB flat,
Linux (WSL) 47 -> 55-77 MiB flat.
- through an HTTPS CONNECT proxy, 600KB CJK bodies, 3000 requests:
macOS 138 -> 156 MiB, flat from ~1000.
- WorkBuddy's real fetch (gzip path) through the proxy, cursor, kiro,
qoder and workbuddy loaded with models.dev's 5.9MB catalog, 3000
600KB CJK requests: macOS 101 -> 218 MiB (creeping ~7KB a request),
Linux 92 -> 131 MiB, 84 idle. --smol: macOS 236, Linux 92 idle: no
better, so it is not used.
- Bun's node:http2 client (Cursor's transport), 1500 sessions opened
and closed: 58-60 MiB flat.
- 2000 provider listings with all four plugins: 64 -> 130 MiB flat.
None of these reach 783 MiB, so the cause in the report was not found;
the bound leaves 2x room over the largest of them. A plugin made to keep
each request's body grew the old host to 1048 MiB with nothing said; the
new host said "heavy" at 512 MiB (Linux).
Tests: TestHeavyHostIsReplaced (a 1 MiB bound: the host is replaced and
a call after it is answered) is red on the old code (not replaced 30s
on) and green now; TestLightHostIsKept checks a host under the bound is
left alone through fifty checks.
Run at this tree: gofmt -l (nothing); go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./..., go build for darwin,
linux (nogui) and windows on mote; go test ./internal/plugin/ on mote
(ok, 117s); the two new tests -count=3 on mote (-race), WSL and Windows
(ok). Not run before this push: the full suite (go test -tags nogui
-timeout 45m ./...), queued on mote behind five other sessions' suites
on its suite lock; pushed now, as the owner asked fixes not wait on it.
Not tried: a real signed-in Cursor, Kiro or Qoder account's requests and
background work (sign-in renewal, usage, model lists) under load; the
reporter's server itself.
|
||
|
|
e484b4ff26 |
update: a slow download still moving is never ended by a total time; Bun, Claude Code and pf-serve too
#5572: since |
||
|
|
1fd0bb9670 |
update: a download whose HTTP/2 transfer broke off tries again over HTTP/1.1
biubiu8802 on X (tweet 2118719081872540038): behind their proxy every
update failed with "download broke off, a network problem", while the
same proxy carried ordinary downloads. Confirmed in the code: download()
retried up to 5 times with Range, but each try went through
netproxy.Dispatch over HTTP/2 again; Dispatch moves a host to HTTP/1.1
only on a TLS record error (recordError: bad record MAC and kin), and
"unexpected EOF" or a stream reset is not one. So a proxy that cuts
HTTP/2 streams part way cut every try the same way.
- netproxy: OverHTTP1(ctx) sends every request under ctx through
Dispatch's HTTP/1.1 copy (route.h1), kept through With.
BrokeOff(err) says a transfer broke off (net.Error, unexpected EOF,
HTTP/2 stream error / GOAWAY / lost connection, a reset; not a
context that ended). AgainOverHTTP1 runs a download once more over
HTTP/1.1 after such a failure.
- update: the tries after a broken one go over HTTP/1.1, and still
resume with Range from the bytes kept.
- Siblings, the other big downloads through Dispatch's client: the
masking model and pf-serve (pii.fetch, one more try over HTTP/1.1
from what is on the .part file), Bun's zip (plugin getURLFrom),
Claude Code's binary (claudecode.download) and the Grok CLI
(grokDownload) each try once more over HTTP/1.1.
- docs/subsystems/providers-accounts.md names it.
Run (mote, Go 1.26.8, at this tree, base
|
||
|
|
3cbb7e0429 |
plugin host: a plugin's redirect to another origin is sent none of its key headers (#5508)
Bun follows any redirect anywhere and, on a hop to another origin, drops only Authorization and Cookie. Checked on Bun 1.4.2 before the change: x-api-key, x-goog-api-key and a custom header reached a second local server on each of 301, 302, 303, 307 and 308. So a vendor (or anything answering at its URL) that redirected elsewhere got a plugin's key headers, and an https vendor's redirect to http was followed. host.js now applies provider.KeepsCredentials' rule ( |