The Library's RTK page took ~3.9s to open and the Plugins page's
Installed list ~2.2s, every time.
- Installed named each plugin's subscriptions from plugin.Providers,
the whole providers RPC: each plugin in turn fetching its vendor's
model list. The page uses only the names, which plugin.Cached keeps
without starting the host (refreshed in the background when a sign-in
or the plugins change). It now reads those: 2.2s to 13ms with seven
plugins. A plugin added a moment ago has no names yet, so its row no
longer claims it "signs in to nothing magpie can use" until the
plugins have answered (plugin.Answered, the row's named).
- ReadRTK waited up to 3s for GitHub and the package manager; winget
show refreshes its sources and takes ~7.7s, so every open waited the
full 3s and #1025's "waiting for winget" tag never came from it.
GitHub stays on the first read; the package manager is asked in the
background, its answer kept 6 hours as before. 3.9s to 1.6s.
- ReadRTK and SetRTK detected the agents twice per call; once now.
wizzy-yang's PR head 12342aa3, which conflicted with main: plugins.go
keeps main's clash rows (plugin.Clashes) with the names from Cached,
idName filled from Cached too; plugins.js keeps main's middleware/agent
and clash branches ahead of the PR's named one; providers.go keeps
main's Told and Settle beside the PR's Answered.
Run: see the next commit.
peterroe's plugin signs in to several providers. Each provider gets its own
picture from the auth hook, and package.json's magpie.icon is the picture
for the plugin itself. Settings → Plugins → Installed only took a plugin
picture from the market listing. A plugin that isn't listed (installed from
a path, git or an unlisted npm package) had none, so its row and its page
showed its first provider's picture.
- plugin.InstalledIcon reads magpie.icon from the installed package.json.
It goes through the same ownIcon check as a listing's icon (data: or
https only).
- pluginsState stores the picture through provider.RepoIcons, as listed
plugins' pictures are, and returns it as `icon` on each plugin entry.
- plugins.js: the installed row and the detail page use the listing's
icon, then the plugin's own, then its first provider's, as before.
- Docs (en, zh, ja): magpie.icon is the plugin's picture (Discover card
and Installed row) and the fallback for providers without their own. A
plugin of several providers gives each provider auth.icon.
Run:
- go test ./internal/plugin ./internal/gui: ok.
TestPluginsStateGivesThePluginsOwnIcon covers a data: icon (kept), no
icon and a plain-http icon (both "").
- internal/gui/tests/plugin-own-icon.test.cjs: Chromium and WebKit, en,
zh, zh-TW, ja, de, at 980 and 420 wide. It fails on the old plugins.js
(the row shows pa.png).
- The plugins GUI tests: 34/34 in each engine.
- gofmt; go vet darwin, windows, and linux -tags nogui.
- Full go test ./...: the only red is gateway OTel timing under load ~79.
That's #1794, commented there; alone it passes 3/3.
Not tried with peterroe's real package; the fixture follows the layout
the issue describes.
What changed: every sign-in started in magpie now leaves through the
account's own proxy (ProxyOfLogin: the account's, else the
subscription's, else the global one). Before, the sign-in's token
exchange and checks went through the global proxy while the account's
later refresh and usage calls went through its own (ViaLogin), so the
vendor saw one account come from two exits.
- signin.go: SignInOptions{Site, Proxy, User}, StartSignInWith; the flow
picks its proxy (pickProxy, validated with settings.CheckProxy) and
every request goes through s.via. Each built-in sign-in (Claude,
Codex/ChatGPT, Grok, Zed, WorkBuddy, Copilot, ZCode, Factory, MiMo,
Qoder, Command Code, Kiro) uses s.via; Claude Code's own login gets the
proxy as *_PROXY (netproxy.EnvWith).
- proxy.go keepSignInProxy: a proxy picked for the sign-in is kept as
the subscription's when the account is its only one, else as that
account's own entry. "" (global) is refused while the subscription has
a proxy and other accounts, since nothing could keep it.
- plugin host: authorize and callback run under via.run(proxy), so a
plugin's sign-in fetches go through the same proxy; plugins_cli.go
does the same for `magpie plugins login`. PluginAPIKey goes through Via.
- gui: POST /api/signin and /api/plugin-signin take proxy and user.
What was run:
- go test -tags nogui ./... (sandbox HOME), all packages ok.
- gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
- Red without the change (each broken by hand, then restored):
TestSignInGoesThroughItsProxy, TestDeviceSignInGoesThroughItsProxy,
TestPluginSignInGoesThroughItsProxy, TestClaudeSignInGoesThroughItsProxy
(internal/provider) and TestPluginSignInProxy (internal/plugin) each
fail with the s.via / EnvWith / via.run / keepSignInProxy removed.
Not tried: a real vendor account through a real proxy. The browser's own
leg of an OAuth sign-in goes through the browser's network, not magpie's.
Devin's CLI probes still use the global proxy.
ARNO installed opencode-codearts-auth as github:yuweihao17/codearts. Its row
on Plugins always had an Update button, and still did right after updating
it to the newest commit. The page drew Update for every git plugin whatever
its commit, since npm has no version to compare for one, and nothing asked
the repository. ba0e2a8a fixed the same complaint for pinned npm plugins
only.
A git plugin is now compared by commit:
- internal/plugin/gitrev.go reads the commit Bun installed: the package's
.bun-tag (owner-repo-<sha7> for GitHub's, the full sha for a clone),
else bun.lock's "#<sha>". It asks where the spec's branch or tag (the
default branch without #ref) is now: GitHub's API (commits?per_page=1
[&sha=ref]) for github:o/r, o/r, https://github.com/o/r and
git+https/git+ssh/git:// URLs on github.com; git ls-remote for gitlab:,
bitbucket: and any other git URL (an annotated tag's commit, not the
tag's). A spec pinned to a commit is that commit, asked of nobody.
Answers are kept 10 minutes (GitHub allows 60 unauthenticated requests
an hour).
- updates.go: the hourly CheckUpdates and the Check for updates button
(CheckNow) report a git plugin as current or update, with its commit
and the repository's head, in place of the old "git" status. A waiting
git update is dropped once the installed commit is the head.
- GUI: /api/plugins/git gives the heads, asked after load and after an
install or update. The row shows the commit installed. Update, the
"New commits" chip, the Discover card's Update and Update all show only
when the repository is at another commit. Five new strings are in zh,
zh-TW, ja and de.
- Docs: the Updates list in site/public/docs (en, zh, ja) says how a git
plugin's update is told.
Tarball specs are unaffected, since magpie plugin add refuses them as not
a package name.
Run:
- go test -tags nogui ./internal/plugin ./internal/gui (temp HOME): ok.
- New TestGitPluginUpdateOnlyWhenItsRepositoryMoved, for
github:yuweihao17/codearts, its #main form, owner/repo, the
https://github.com URL, git+file and git+file#main, against a fake
GitHub API and bare repositories. After add, nothing waits. A new
commit at the same version is an update. After Upgrade, nothing waits
again.
- TestGitCommitAsBunWritesIt uses ARNO's literal bun.lock line and
.bun-tag. TestGitSource covers spec parsing and the pinned-sha form.
- Broke GitBehind by hand (any installed commit is behind): the new test
goes red in every form. Restored.
- GUI: plugin-git.test.cjs now checks no Update at the head, then New
commits with Update and Update all once the head moves, then none after
Update. It went red with the old condition put back. All 28 plugin-*
files plus click-scroll, i18n-keys, gui-ja and gui-de pass in Chromium
and WebKit.
- Real case, sandbox HOME, magpie web on a spare port: magpie plugin add
github:yuweihao17/codearts installed c594984. /api/plugins/git and
/api/plugins/check say current at c594984 against the real GitHub, and
nothing is waiting. In both engines the row shows "v0.1.0 c594984" with
no Update and no Update all.
- gofmt -l clean; go vet -tags nogui darwin, GOOS=linux and GOOS=windows
on internal/plugin and internal/gui.
yetone: 这里的 agent plugin 为什么没有 logo. Aider's card in Discover › Agent
showed the generic agent glyph: the registry entry has no icon, and the
card only read the registry's, which is one of magpie's icon names. A
GitHub-tagged plugin's card already read package.json's magpie.icon; a
listed one didn't.
- plugin: npm's /latest answer carries package.json, so NPM.Icon is its
magpie.icon, an https URL or data:image URI only (ownIcon, now shared
with the GitHub listing's check).
- gui: listings, market and /api/plugins/npm keep that picture as an
installed plugin's is (provider.RepoIcons) and send the page a file:
icon, never the data URI or the remote URL.
- plugins.js: card, plugin page and installed row use l.icon, then
l.npm.icon.
- Registry icons stay names, so older magpies aren't handed a URL they
would draw as a broken mask.
- docs: magpie.icon also shows on the Discover card (en, zh, ja).
agent-aider 0.1.1 (magpie-community/plugins bcc94e5) gives aider.chat's
icon as magpie.icon and agent.icon.
Ran:
- go test ./internal/plugin ./internal/gui; go test ./internal/provider
alone (504s, pass); go test ./... otherwise ok.
- gofmt -l; vet linux/windows ./internal/plugin.
- internal/gui/tests/plugin*.test.cjs in chromium+webkit; plugin-agent's
new check goes red (11 fail) with the card reading l.icon only.
- Sandbox HOME with the real npm package 0.1.1: the Discover card,
Installed row and Agents row all show Aider's icon, in chromium and
webkit at 1100 and 420.
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.
- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
ua?, icon?, notice?} and an optional connect({gateway, model, models,
agent}) returning the other keys to write. Compiled in moejs, reloaded
when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
magpie's own. JSON, YAML and env files are edited key by key, comments
kept; what each key held is stashed typed under plugin:<id>:<path>, and
its own model or Disconnect puts every key back. A built-in id is
refused; a connect that throws writes nothing. Key magpie-<id>; usage
names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
section (market kind "agent"), and an installed row line "Adds X to
Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
agent-wiring.md, gateway-middleware.md.
Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
chromium and webkit); all plugin-*.test.cjs, i18n-keys,
deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
openai/, connect writes openai-api-base/key) installed in a dev build;
picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
user's comment and keys; real aider 0.86.2 `--message` answered through
magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
provider deepseek, 200; Disconnect restored the file byte for byte.
RepoIcons starts every fetch, then waits for those not in yet, so the
list's first answer has them; one slower than the wait shows the next
time. The fetch takes fetchPluginIcon before its goroutine starts.
Ran: go test ./internal/provider ./internal/gui; the new test -race
-count=10, and red with a 1ns wait. A sandbox build (fresh HOME, real
GitHub): the first /api/plugins/github answer has all 8 icons the 13
tagged repositories give, screenshot in light and dark.
neiko on Discord installed a third-party plugin beside a plugin of their
own, added by its folder. Only the third-party one could be seen. Both
plugins' auth hooks name the same provider id. The host's auths() keeps
the last plugin in plugins.json for an id, as OpenCode does, so the
user's own plugin silently lost it:
- its row read "Signs in to nothing magpie can use";
- its provider was gone from the Add sheet;
- keepUnloaded could list the id a second time, from the
plugin-providers.json kept before.
A package-name clash and a display-name clash were tried as well. Both
plugins stay visible in those cases, because a folder plugin's name is
its path.
What changed:
- host.js:
- init gives each loaded plugin the ids it signs in to (provides) and,
for each id another plugin serves, that plugin's spec (servedBy).
- auths() honours plugins.json's new prefer map (id -> spec).
- Only the serving plugin's provider.models hook runs for the id.
- plugin:
- Clashes() turns provides and servedBy into {id, by, with} per spec.
- Prefer() records a pick and restarts the host.
- Remove drops the removed plugin's picks.
- Re-adding a plugin under a new spec carries its picks over.
- remove, off, options and prefer find a plugin by its exact spec
before its package name (indexOf), so acting on one plugin never
reaches another of the same package.
- keepUnloaded no longer re-adds a provider from before when another
plugin serves its id now.
- GUI:
- /api/plugins rows carry clashes, with the provider's listed name.
- POST /api/plugins/prefer {spec, provider}.
- The serving row says "{other} signs in to {name} too; this one
serves it".
- The other row says, in amber, "{name} is served by {other}, which
signs in to it too", with a "Use for {name}" button.
- New strings in zh, zh-TW, ja and de.
- CLI: `magpie plugin` prints the same lines, with the command that
fixes it, and `magpie plugin use <name> <provider>` makes the pick.
- Docs: docs/subsystems/provider-plugins.md, docs/reference.md and
site/public/docs/{,zh/,ja/}plugins.html.
What was run:
- Reproduced under a sandbox HOME with magpie web on 3562: a fake npm
plugin and a folder plugin, both on id "acme".
- Old binary: the local row had providers [] and /api/providers
listed acme twice.
- New binary: both rows carry the clash; prefer moves acme to the
folder plugin; remove clears the pick and leaves the other plugin
serving acme.
- New Go tests:
- TestTwoPluginsOneProvider, a real Bun host: Prefer, restart,
off/on and Remove.
- TestClashes, TestPluginNamedExactlyFirst and
TestKeepUnloadedLeavesAServedID.
- TestPluginsClashRows (gui) and TestPluginListSaysClash (CLI).
- Each fails when its piece is broken by hand: prefer ignored in
host.js, the keepUnloaded id check removed, name before exact spec,
Remove keeping picks, no provides, no clashes in the rows, no
prefer route.
- plugin-clash.test.cjs, in Chromium and WebKit, in en, zh, zh-TW, ja
and de, at 1100 and 560px: 22/22 pass. It times out on the old
plugins.js.
- gui-de, gui-ja, gui-zh-tw, i18n-keys and every plugin-*.test.cjs:
248 tests.
- 245 passed in the 4-wide run.
- plugin-moved-signin (webkit) failed once in that run, then passed
3/3 alone and 26/26 in a smaller 4-wide rerun.
- gofmt -l; go vet ./...; GOOS=linux and GOOS=windows go vet -tags
nogui ./...; go build ./...
- The full go test -tags nogui ./... under a temp HOME with the caches
pinned: 44 packages ok, none failed.
- After rebasing onto 05917100 (plugins.css conflict with a3a8e257's
chip rules, both kept): plugin, gui and the root plugin tests, vet on
darwin, linux and windows, and the 248 GUI tests above, all green
(248/248 this time).
Not tried: a real third-party plugin, neiko's own plugins, and Windows
beyond vet.
magpie.icon, an https URL or a data:image URI, is read with the rest of
package.json and kept through pluginOwnIcon as an installed plugin's is;
the card shows it, else the puzzle piece.
Ran: go test ./internal/plugin ./internal/gui ./internal/provider; the
plugin GUI tests in Chromium and WebKit (en/zh/ja/de, 980 and 440).
GitHub's search for topic:magpie-plugin (not archived, not a fork, not
magpie-community's own, which the market lists) is asked at most every six
hours and kept on disk, so a restart or GitHub being down shows what it said
last. Each repository is read from its package.json on the default branch.
When npm has that package published from the same repository, it is
installed from npm, because a repository often builds its dist only to
publish and Bun runs no build for a git install. Otherwise it is installed as
github:owner/repo, and only if the file it loads (exports, main or
magpie.middleware) is in the repository. Its page warns that it is
unofficial, says whether npm or the repository is what gets installed, and
shows the repository's README until it is installed. MAGPIE_PLUGIN_MARKET=off
asks GitHub nothing.
Checked against real GitHub with the topic set to opencode-plugin in a
sandbox: 43 repositories came back, and 32 were kept (30 from npm, 2 from
git). github:ndom91/open-plan-annotator, one of the git ones, really
installed and loaded. alfaoz/opencode-see-image, whose dist isn't in its
repository, failed to load before the entry check and is now left out. The
test fixtures are GitHub's and npm's real answers.
Ran: go test -race -count=3 ./internal/plugin, go test ./internal/gui, go
vet, and plugin-github.test.cjs (Chromium and WebKit, 980/440, en/zh/ja/de,
18/18). The full GUI suite passed 3343 of 3348. The 5 failures were WebKit
number-units, purpose-filter and routing-failed-open, which pass 3/3 on
their own and don't touch the Plugins page.
Settings → Plugins adds a plugin by npm package name or by a path, and the
path had to be typed in full: the market's field was the only way in, with
nothing to pick the folder from. And a plugin added from a folder had no page
of its own — its README comes from plugin.Readme, which answers only for an
npm package name ("%q isn't an npm package name"), so opening one said "npm
didn't answer" and offered an npm link for a folder that npm has never heard
of.
The field now has the system's folder picker beside it, and a folder plugin's
page shows the README that folder carries.
- POST /api/plugins/choose asks Windows.ChooseFolder, which the app answers
with the system's panel — the Library's "Choose a project" already used it,
and a page served by another magpie forwards it to the magpie it is served
by. pluginsState carries "picker" beside "bun", false for `magpie web`: a
browser has no such panel (webHost.ChooseFolder refuses it), and the page is
then left with the field to type into, as before.
- plugin.Readme takes a path: folderReadme reads README.md whatever its case,
else a markdown or a text one named beside it, and says so when the folder
has none rather than answering with npm's silence. Updated is that file's
mtime, and the text is capped at 200 KB as npm's answer is.
- A folder plugin's page drops what only npm can say: no npm link, no version,
downloads or license, and a failure names the folder rather than npm. Its
row and its title name the folder it was added from (opencode-mine, not
/Users/me/plugins/opencode-mine).
TestReadmeFromFolder (internal/plugin) fails without the change: with a
README.txt and an unsuffixed README beside it, the README.md is still the one
read; ReadMe.MD is too, and through file:// and a trailing .; a folder with
none is an error, as is one that isn't there.
TestPluginsPickerWhereItCan (internal/gui) fails without the change: the
picker is offered for the app, not for `magpie web` nor for no host at all.
plugin-local.test.cjs (new; Chromium and WebKit, en and zh) fails without the
change: the picker is beside the field and titled as such, a click asks for it
and what it answers is what the field holds and takes the focus, what the
field holds is what Install posts, the Installed row names the folder rather
than its path, its page renders that folder's README with no npm link, and a
market that offers no picker draws no button (english and Chinese).
Not only the faked page: a sandbox `magpie web` in a HOME of its own, with a
plugin added by path, read that folder's README.md — its mtime as Updated —
and listed it by the folder's name.
go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows
go build, go test -tags nogui ./internal/gui/ pass; plugin-market,
plugin-signin and plugin-local pass in Chromium and WebKit, en and zh.
TestPluginProxy (internal/plugin) and the hermes tests (internal/agent,
internal/profile) fail on main on this machine too — its own proxy and a
hermes install it finds — and are unrelated.
Not done: the panel itself hasn't been clicked in the app. It is the system's
own, and the call under it is the one the Library's folder chooser already
uses, but the screenshots here are the page with a faked backend underneath
(the app's own picker is offered, `magpie web` has none), plus the real
`magpie web` for the README.