check.mjs handed every plugin process.cwd() as its directory, so a
plugin that writes state there (atomcode's atomcode-state.json) left an
untracked file in the checkout. magpie gives a plugin a data folder of
its own; the check now does the same, one temp folder per package,
removed at the end.
Run (mote, temp HOME, Bun 1.4.2): bun scripts/check.mjs exits 0, 59
packages ok, and no file in the tree is newer than the run's start.
Broken by hand: with main's check.mjs the same run leaves
./atomcode-state.json.
Reported-by: jinyue806
An agent that needs a runtime (miaocell's magpie-agent-deva) keeps its moejs agent file and adds a Bun module as main, as agent-kimi-desktop and agent-reasonix-desktop do. The README's agent convention now says so, and that such a package is kind "agent" in registry.json. check.mjs fails a registry entry whose package declares magpie.agent but whose kind is not "agent" (agentKindProblems in scripts/registry.mjs). magpie's side is v0.1.2995 (ed7aeb052): the GitHub list and the Installed row read the declaration, not the main.
Run: bun test scripts/check.test.mjs, 17 pass (the new test also checks the repo's real kimi-desktop, reasonix-desktop and aider packages); bun scripts/check.mjs exit 0. Broken by hand: agent-kimi-desktop's kind removed from registry.json made check.mjs fail with '@magpie-community/agent-kimi-desktop declares magpie.agent, but its entry's kind is null, not "agent"'; restored. No package version changes, so nothing publishes.
A new provider package, @magpie-community/opencode-sap-aicore-auth 0.3.0
(packages/sap-aicore). It signs in from a local SAP AI Core client-secret
credential file, discovers the account's running GPT (Responses) and Claude
(Messages, Bedrock) deployments per resource group, and sends requests only to
https://*.authentication.*.hana.ondemand.com (token) and
https://api.ai.*.hana.ondemand.com (inference). Image input is gated per model
on the catalog's inputTypes. Also: the root README row, a registry.json entry,
.DS_Store in .gitignore, and scripts/check.mjs accepts an empty static model
list for a package whose provider.models hook is a function with the same id
(npm and the loader are still required).
Reviewed at head b44b3e1b68889c2a12bcaa37ad5d546a398bdde0, with main 9bba5fed
merged in locally, on a Mac mini (macOS, Bun 1.4.2), no real SAP account:
- bun test packages/sap-aicore scripts: 351 pass, 0 fail.
- bun scripts/check.mjs: every package ok, sap-aicore included.
- The two tests that reached the network at e955194 now use inputs root()
really rejects (/oauth, /v1), and a new test stubs fetch and checks that
/oauth/token and /v2 are accepted and the token is posted to
<authUrl>/oauth/token once. plugin.test.js fails on any unstubbed fetch.
- Whole package under a preload that records every non-loopback fetch, connect
and DNS lookup: 0 attempts (the preload caught a deliberate fetch to
example.invalid, so it does record).
- Broken by hand: putting the e955194 inputs back turns the test red through
the new guard; making root() keep the given path turns the new
/oauth/token + /v2 test red; letting root() accept any path turns 3 URL
tests red.
- Not tried: a real SAP AI Core account (the author's run record covers one
GPT and one Claude turn, plain and with a tool call; no image turn).
The first version goes out through the dist branch (npm doesn't have the name).
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin
must export a default definition with an id and an effect or setup
function. (cause: SchemaError(Missing key at ["default"]))". 2.x
imports a package's exports["."] (a plugin dir and an npm install
alike) and has no V1 path at all, so every package here that serves
models failed the same way, not only trae.
Every one of the 32 model packages now has:
- opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an
adapter that runs the package's V1 plugins inside 2.x's promise
API. Config providers become 2.x providers (package pinned so the
aisdk sdk hook runs), V1 auth methods become integration methods
(oauth auto/code with forms; api without authorize as a key method),
V1 credentials are kept in metadata.v1, the loader's baseURL,
apiKey, headers and fetch are applied through the sdk hook, an
auth.set renewal is stored per credential, and credential.switched
/updated reload the account's own model list.
- opencode.mjs, main: re-exports the V1 plugin functions only.
OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's
main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin
export is not a function"); the new main fixes that too.
- both files in "files"; patch version bumped. devin already had 2.x
and is unchanged.
scripts/check.mjs fails a model package whose 2.x entry has no default
{id, setup}, whose opencode2.mjs differs from the canonical one, whose
entry is missing from files, or whose main exports a non-plugin.
Run at this head (mote):
- HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail
(4914 tests, 374 files). A first run set globalThis.fetch for the
whole process from opencode2.test and failed 528 tests in other
packages; the block is now set and put back around that file's tests.
- bun scripts/check.mjs: every package passes. With the network
blocked cloudflare-workers-ai fails on its fetched catalog, the same
on origin/main.
- Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae
0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN"
and trae-global "Trae Global" with their browser sign-ins; `auth
login` starts the trae.cn authorization and waits (cancelled there);
with a fake credential POSTed to /api/credential, `opencode models`
lists trae-cn's six models.
- Real 2.2.5 with a fake V1 key plugin through the same adapter
against a local fake server: `auth login` with a key, `models`,
`opencode run` reached /real/v1/chat/completions with the loader's
"Bearer loader-sk-fake" and header, and printed the fake's reply;
with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key
from the loader. This run found the key method missing after 2.x's
second integration transform (a once-only flag outside the
transform); fixed, and opencode2.test checks a rebuild.
- Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models`
lists trae-cn and trae-global models; 0.2.26 failed there.
Broken by hand (scratch copy, bun test scripts/ and check.mjs):
- trae's exports back to "./index.mjs": the trae 2.x test fails
(default.id undefined), check fails trae with "OpenCode 2.x:
./index.mjs has no default {id, setup} (plugins#657)".
- zed's opencode2.mjs changed: the copies test fails, check fails zed
"differs from scripts/opencode2.mjs".
- the key flag back outside the transform: the 1.x plugin test fails
on the rebuilt sign-ins (key missing).
Not tried: a real sign-in with a real account on 2.x; Windows (the
reporter's OS); chat.headers, chat.params, usage and tool hooks, which
the adapter doesn't carry to 2.x; the tools/pages packages (calc,
goanyapi, layerfs, search1api, aelios, agent-console, chat,
fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x.
scripts/check.mjs accepts a provider that declares auth.usage, an empty
model map and no npm or api (a quota-only provider). Its loader is still
required, and a provider with models, npm or api is still checked as
before. Tests in scripts/check.test.mjs cover the accepted case, the three
incomplete configurations and a missing loader. (sunny0826, split out of
#653 as asked there.)
Run at the reviewed head bc57c1362e, rebased on main d40a074, on mote
(Bun 1.4.2, temp HOME):
- bun test scripts/check.test.mjs: 11 pass, 0 fail
- bun test (whole repo): 4890 pass, 14 skip, 0 fail
- bun scripts/check.mjs: exit 0, no package marked ✗
- Broken by hand: dropping `&& !usageOnly` from the condition turns the
quota-only test red (10 pass, 1 fail).
bun scripts/check.mjs exited 0 on a registry.json that wasn't JSON, or
had an entry with a bogus kind, so a listing PR could break the Plugins
page's list and pass CI. check.mjs now checks registry.json first
(scripts/registry.mjs) and fails on:
- text that isn't JSON, isn't an object, or is over 1 MiB (what magpie
fetches); version not 1; plugins not a non-empty list;
- an entry whose package isn't a name magpie's pkgName pattern
(internal/plugin/store.go) matches, or over npm's 214 characters
(magpie drops such an entry); the same package listed twice;
- no name, no summary.en or summary.zh;
- a kind other than middleware, hooks, agent, tools or page (plugins.js's
kindOf; a provider has none), which would list it as a provider;
- a value of the wrong type for community, providers, replaces or
summary: market.go unmarshals the whole file into typed fields, so one
such value loses every listing; an icon with a scheme other than https
or data:image; a field magpie doesn't read (a typo like "kinds").
All 72 current entries pass, the 5 without community included (magpie
skips them; kept as they are).
Run on mote, HOME=$(mktemp -d), bun 1.4.2:
- bun test: 4709 pass, 12 skip, 0 fail (363 files).
- bun scripts/check.mjs: exit 0, ✓ registry.json.
Broken by hand on mote: "{" appended to registry.json -> exit 1, "not
JSON"; every "kind": "middleware" made "bogus" -> exit 1, each entry
named. registryProblems stubbed to return [] -> the three #612 tests go
red.
Open listing PRs (#611, #610) merged onto this commit pass the check;
#582 doesn't touch registry.json.
mail-watch 0.1.0: a hooks plugin that mails a rendered event (per event or as a digest) when a session ends, a turn fails, or a request is refused, through the user's own SMTP server.
The digest's due time is kept in the state file (digestAt/digestHours), so a restart neither resets nor fires it early; the timer step is capped at 2^31-1 ms and an early wake re-arms for the rest instead of sending.
Run at the reviewed head 8415dd9eb (sandbox HOME):
- mote: packages/mail-watch `bun test` 44 pass, 0 fail, three times; whole repo `bun test` 2982 pass, 8 skip, 0 fail; `bun scripts/check.mjs` exit 0; e2e.smoke.mjs against a local SMTP sink: onRequest returns undefined, onResponse returns without awaiting the mail, the mail arrives with the rendered event and subject.
- Linux (WSL2 Ubuntu 24.04): packages/mail-watch `bun test` 44 pass, 0 fail.
- Broken by hand, each red: no step cap (2 red: monthly digest, early wake), no due-time-ahead check (early wake), no persisted due time (restart test), no prune, raw guard, no shrink (1 red each). Making the persist write unconditional stayed green, as expected (a cost fix only).
- CI at this head: test and on-npm green.
Not tried: a real SMTP provider (Gmail, Fastmail); the smoke test uses a local sink.
Lists Magic_zero's (Magiczerowxy) magpie-chat as @magpie-community/page-chat:
a chat page in magpie's window over magpie's own gateway, models, MCP
servers, instructions and skills. Not a provider or a relay: it signs in
to nothing and every request goes through magpie's gateway.
- chat.test.mjs starts the service on a free port against a fake
gateway in a temp config folder: no token (Origin null and none), a
wrong token, another Origin and a rebound Host are refused and nothing
reaches the gateway; with the token a chat streams with the caller key;
the icon redirect has a Location; boot.js makes no request; app.js
sends the token.
- scripts/check.mjs takes the OpenCode v1 default export {id, server}
as magpie's host does, and doesn't start a page's server (it would bind
a port and write config); layerfs's tools are still checked.
- package.json declares the port option (3477) both parts read; boot.js's
comment says so instead of a fallback to 3478 that never existed.
- README in the repo's style with credit, what the service reads and
sends, who can use it, and the changes from the original.
- registry.json entry and a row in the Pages table.
Run on mote (bun 1.4.2) at this tree:
- cd packages/chat && HOME=$(mktemp -d) bun test: 11 pass.
- HOME=$(mktemp -d) bun test (whole repo): 3119 pass, 0 fail, 3127
tests across 261 files; bun scripts/check.mjs: exit 0, chat and
layerfs ok.
Broken by hand: with the token check off, "a page without the token
can't chat" went red; with the Host check off, "a DNS-rebound Host is
refused" went red.
Not tried: the page in a real magpie window (sandboxed frame navigation
and the host calling server()).
Co-authored-by: Magiczerowxy <magiczerowxy@users.noreply.github.com>
Adds packages/search1api as @magpie-community/tools-search1api 0.1.0
(fatwang2, replacing #340). It has six tools: search, news, ask, crawl,
sitemap and trending. Sign-in is one account by API key or OAuth: PKCE
S256, dynamic client registration and a loopback callback. Tokens refresh
through auth.refresh and on a 401. scripts/check.mjs now accepts a tools
plugin with auth and no loader, as long as its config gives the provider
no npm and no models.
Run at 7cf6a5c merged onto main, in a sandbox HOME, with HTTPS_PROXY
pointed at a dead port:
- bun test packages/search1api scripts/check.test.mjs: 19 pass.
- node --test on the package's own tests: 16 pass.
- tests/host.integration.mjs against main magpie's host.js: 2 pass.
- bun test across the whole repo: 2647 pass, 0 fail. This needs 017f05c.
Before it, gcp-ai's fetch guard refused this package's loopback
fixtures in the shared bun process.
- bun scripts/check.mjs: all ok.
Broken by hand, each one red:
- Dropping the SAME_SESSION check before a refresh: 1 test.
- Never refreshing an expired token: 3 tests.
- Ignoring the apiKey option: 4 tests.
- Not red: dropping the second check, which catches a logout during an
in-flight refresh. The first check covers it in the logout test.
Real use:
- A sandbox magpie took the package with `plugin add`. `plugin list`
shows its 6 tools. `plugin login search1api 2` with a key showed
Providers as "Search1API · signed in as API key …-384 · no models
exposed".
- The search tool ran against the real api.search1api.com with a fake
key and got 401.
- OAuth discovery is live: oauth-protected-resource points to
clerk.s1.dev, which has a registration endpoint and S256.
Not tried:
- A real OAuth consent, or a search with a real key. There is no
Search1API account here.
Notes:
- The plugin reads the signed-in record from
`<directory>/plugin-auth.json` itself, since tools get no getAuth.
magpie writes that file by temp-and-rename, so a read never sees half a
write.
- magpie's login line says "its models are search1api/<model>" for a
provider with no models. That is magpie's wording, not this PR's.
check.mjs now checks a plugin whose only hook is `tool`: each tool's name
is one an MCP client takes, and it has a description, args and execute.
It skips packages with magpie.gateway (routing strategies) and page-only
packages (magpie.page with no main), whose own tests check them.
middleware.mjs gains order() and checkStrategies(): a gateway plugin's
strategy is asked for an order the way magpie's gateway asks it
(internal/routes.Apply), falling back to the listed order on a throw or
an answer that isn't a permutation, and strategies.json cases are run
against it.
Run: HOME=$(mktemp -d) bun test (1554 pass, 0 fail) and
bun scripts/check.mjs (every package ok) at this tree with the three
packages that follow.
magpie (cb406c84) lets a plugin add an agent it has no setup of its own
for. This one writes Aider's ~/.aider.conf.yml: the model under litellm's
openai/ prefix, magpie's /v1 and Aider's own key. check.mjs skips agent
packages as it does middleware; README gains an Agents section.
Run: bun test packages/aider (2 pass); bun scripts/check.mjs; the module
loaded through magpie's agentplug.Compile and its connect returned the
three keys. The same module, in a sandbox magpie, wired a real aider
0.86.2 that answered from a real DeepSeek account, and Disconnect put
the file back byte for byte.