larchsis (Windows, no system proxy, magpie's own proxy on) saw no
unofficial plugins on the Plugins page, and saw them with the system
proxy on and magpie's set to automatic.
No request bypasses magpie's proxy. Every listing and install read
(market.json, npm info and search, GitHub's search, package.json and
README, Bun's download, plugin icons) goes through http.DefaultClient or
DefaultTransport, which netproxy.Install routes through settings.Proxy,
else the environment, else the system proxy (HKCU Internet Settings on
Windows). Checked with a counting CONNECT proxy in a sandbox magpie on
macOS and on the Windows box: every connection to api.github.com,
raw.githubusercontent.com and registry.npmjs.org went through it, and
lsof / Get-NetTCPConnection showed none going direct.
The cause is timing. askTagged gave the whole listing 8s, six package.json
reads at once, each bounded by that same 8s, and a repository whose read
hadn't finished was left out. The cut list was then kept ten minutes, and
on disk for a restart. Through a sandbox proxy that adds latency per
chunk: no delay 29 repos, 150ms 21, 300ms 6. A slow proxy loses most of
"Unofficial, on GitHub", and when it loses all of them the section is gone.
The two setups differ in latency and in what was cached, not in proxy
handling.
Now:
- Reads go on past the page's wait (taggedEach 20s each, 12 at once), on a
context detached from the request. They are kept by repository and push,
as before, so the next ask has them.
- A repository whose read didn't come in time is as the last list had it
(in memory, else on disk), with the search's current stars and
description.
- A list that left one out is asked again after 20s, not ten minutes. Its
copy on disk is dated so that a restarted magpie asks again too.
Run:
- TestTaggedReposSlowRead (new) holds word-guard's package.json past a
300ms wait. It fails on the old code (5 repos, word-guard missing). It
also fails with each part broken by hand: no fallback to the last list,
a partial list kept 10 minutes, reads cancelled at the wait, and the disk
copy not aged back.
- Sandbox magpie web (own HOME, own ports, proxy 127.0.0.1:3481 with
injected latency), no cache: at 300ms 11 repos at 8s, then all 29 25s
later (the old code kept 6 for ten minutes). At 1s none at first, all 29
25s later.
- go test ./... on 5e7efce3b (origin/main): green. go test -race -count=5
on the tagged tests. gofmt -l clean. go vet on darwin, GOOS=windows
./..., GOOS=linux -tags nogui ./internal/plugin.
- Windows box: plugin.test.exe with the tagged tests, 3 of 3. In the full
package run only TestMarketIconsAreBundled failed, because it reads
../gui/assets, which wasn't copied over.
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.
TaggedRepos knew a package.json's magpie.middleware but not magpie.agent
(cb406c84's new kind). An agent package has no main and no index.js, so it
was looked for at index.js, not found, and dropped from Plugins › Discover.
It is now kind "agent", its entry checked at magpie.agent, and the GUI's
kindOf already shows it under Agents.
Fixture: someone/agent-aider, the bytes of magpie-community's
packages/aider package.json and aider.agent.js.
Run: go test -tags nogui ./internal/plugin ./internal/gui ok;
TestTaggedRepos fails on the old github.go (agent-aider missing); gofmt;
GOOS=linux/windows go vet ./internal/plugin.
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).
A repository tagged magpie-plugin whose npm copy (from that repository)
names no file to load (no main, no exports) was listed and installed from
npm without the entry check the GitHub route has; it then failed every
host start with "has no entry" and a stack. Now:
- the Unreviewed list checks npm's copy the same way: one that names no
file needs the index.js the repository's own route needs (askTagged);
- `magpie plugin add` / the Plugins page refuse a package that names no
file, has no index file and is neither pi's nor a middleware, take the
package just installed for it out again, and say it isn't an OpenCode
or magpie plugin, and, for one with a bin, to add an MCP server under
Library → MCP servers (notPlugin);
- the host says the same, without a stack, for one already on the list.
Run: TestCommandOnlyPackageIsNoPlugin (magpie-x-search 1.2.0's real
package.json) fails without the change (Add = <nil>; with only host.js
reverted, the stack message), TestTaggedRepos with the real GitHub
package.json and npm latest of cyberElar/magpie-x-search fails without it
(listed), both pass with it; TestNotPluginKeepsPlugins (index.mjs, main,
exports, middleware, pi, a file stay plugins). go test -tags nogui
./internal/plugin under a temp HOME ok; go vet -tags nogui for darwin,
linux, windows. The built binary in a sandbox HOME: `magpie plugin add
magpie-x-search@latest` from real npm prints the new error, and
plugins/package.json no longer lists it.
Co-Authored-By: Claude <noreply@anthropic.com>
GitHub's search was asked at most every six hours. An author who had opened
the Plugins page before tagging their repository, as lee04052822 had,
didn't see it until the six hours were up. It is now asked at most every
ten minutes. A search is one request of the ten a minute that GitHub allows
without a token. What each repository's package.json, npm and entry file
said is kept while its last push stays the same, so asking again costs one
request, not three per repository. An answer GitHub or npm didn't give (a
503 for the entry, say) isn't kept, and is asked again next time.
Against real GitHub: the topic has two repositories,
mu-zi-lee/magpie-doubao-translate and SadWood/magpie-gaccode. Both are
listed as github: installs, the first time in 3.8s and in 0.2s once the ten
minutes are up. Both installed and loaded in a sandbox magpie, giving the
Doubao Translation and GACCode providers. TestTaggedRepos checks that
asking again after ten minutes reads only flaky-entry again, and it fails
with 21 reads when the per-repository cache is turned off. go test -race
-count=2 ./internal/plugin and go vet pass.
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.