Commit Graph
36 Commits
Author SHA1 Message Date
Yaka e801e434f3 gcp-ai: Vertex models and Google Cloud credits with your own gcloud ADC (#307)
New package gcp-ai (Yaka88): Vertex models and Google Cloud credits through the user's own gcloud ADC, with multiple accounts, a signed-in model list, and a pipe-only Chrome for the credits read.

Reviewed at 8989b58 against the 10-24 review at 4586c99. I read the whole incremental diff (index.mjs, lib/browser, lib/credentials, lib/lock, test/*). Earlier rounds had already reviewed the rest.
- Tests reaching the network: fixed. test/network.mjs replaces fetch and blocks non-local net/tls/http/dns. `bun test` (40 pass, 1 skip [Linux-only lock test], 0 fail, 106s) ran in a sandbox HOME/TMPDIR behind a dead HTTPS_PROXY, with a preload that logged non-local fetch and connect calls: 0 lines logged. Broken by hand: with the fetch stub removed from "already filed", the guard prints "Unexpected network fetch … userinfo" and bun exits 1. Restored, it exits 0.
- Chrome background traffic: lsof on the test Chrome processes (56 samples during browser.test.mjs, 5 pass) found no inet sockets at all.
- Leftover work after a test: close() now awaits settled, and every sign-in test closes in finally before restoring fetch.
- Smaller points: the lock's age ceiling now comes after the Linux /proc check; settings() is auth > options > env for every field; resolveAdcDirectory and authorizeAdc are removed.
- `bun scripts/check.mjs gcp-ai`: ok. The merge onto main 98985a2 is clean. Loaded into magpie's plugin host (origin/main 4dfd88206) with scripts/try.sh in a sandbox HOME: gcp-ai, 12 models, not signed in.

Not tried: a real Google account or gcloud sign-in, Windows, Linux (the lock test is skipped on macOS). The headless Console credits scrape still runs for every signed-in account, cached on failure, as noted in the earlier review.
2026-10-25 14:33:15 +08:00
kassama efa41e36e3 joycode 0.1.1: JoyCode (JD Cloud) with JD's browser sign-in, account models, credit multipliers and usage (#347)
New package @magpie-community/opencode-joycode-auth 0.1.1 (provider id `joycode`) and its registry entry (en and zh). JoyCode is JD Cloud's own coding IDE subscription (joycode.jd.com, api-ai.jd.com), not a relay.

- Browser sign-in through JoyCode's own login page. The page sends the browser to http://127.0.0.1:<authPort>/ with authKey and pt_key; I checked this against the page's bundle. A request without the right authKey gets a 404 and leaves the sign-in pending. A ptKey can also be pasted, with an optional tenant.
- Chat completions are signed per request (HMAC over a fresh t), with userId, tenant and orgFullName from joycode_userInfo. A bare JSON error sent as HTTP 200 SSE becomes an error reply: code 401 is 401 with sign-in expired, AI_GRAY_ACCESS_DENIED is 403, anything else is 502. JD's msg is kept as the error text.
- Account models come from joycode_modelList, credit multipliers from plugin_config billingRate, and credit usage from get_newpoint_ide (windows set aside).
- Contacts only JD's hosts. No runtime dependencies, no install scripts, no logging. The ptKey is kept only in magpie's plugin-auth.json.

Reviewed every line at c80068f and again at 1cac30c, which fixed all five review points: the README link, JD's `msg`, tests for the authKey check and for the HTTP 200 SSE code 401, the stale header comment, and stray loopback requests.

Run at the reviewed head 1cac30cce31a1f3efeb39b2c61df257963e655a, whose parent is main 57ec655:
- packages/joycode: `bun test` (Bun 1.4.2) 30 pass, 0 fail. `node --test` (Node 22) 30 pass.
- Whole repo, as CI runs it: `HOME=$(mktemp -d) bun test` 2373 pass, 0 fail. `bun scripts/check.mjs` all ✓.
- Broke the code by hand: removed the authKey check, made a wrong authKey end the sign-in, mapped the SSE code 401 to 502, and dropped `msg` in chat and in usage. Each one turns a test red.
- magpie built from main, in a sandbox HOME: `plugin add` lists `joycode (JoyCode, 5 models)`, and `plugin login joycode` offers both methods. With a made-up ptKey, provider.models, `provider test` and `quota` each fail with "JoyCode 登录已失效" and mark the sign-in expired. plugin-auth.json is mode 600.
- JD's gateway answered the made-up ptKey with HTTP 200 `{"code":401,"data":…,"msg":…}` on joycode_userInfo, chat_completions (as text/event-stream) and get_newpoint_ide.

Not tried: no JoyCode account was available, so no successful chat, model list, multiplier or quota read was made against JD. The author reports live JoyAI-Code-1.6 streaming and tool-call runs.
2026-10-24 03:34:36 +08:00
Jeff Li 08ff18a438 nous: Nous Portal models with Nous Portal's device sign-in (#163, laojianzi)
New package @magpie-community/opencode-nous-auth (provider nous-portal): Nous Portal models, signed in with Nous Portal's own OAuth device flow (public hermes-cli client, inference:invoke scope). The plugin keeps its own sign-in (never reads ~/.hermes), renews the single-use refresh token through x-nous-refresh-token, and sends requests to the Nous inference API with the JWT, retrying once after a 401.

Review fixes in d2f8fa0 (from the review at e8831a8):
- A refresh refused with 401/403 and no OAuth error code (HTML or empty body from an edge or proxy) keeps the sign-in and retries after 30s. Only invalid_grant, invalid_token or refresh_token_reused ask for a new sign-in.
- registry.json and README describe the plugin as Nous Portal models with Nous Portal's device sign-in; plan sharing is one line pointing to Nous's docs.
- content-encoding and content-length are dropped from the decoded response, like grok and cline.
- A token reply with neither expires_in nor JWT exp is renewed after one hour, not every 30s. The fallback never extends an explicit expires_in or exp (the earlier bound wins).

Run at d2f8fa0 merged with origin/main 8e479f1 (clean merge), sandbox HOME/TMPDIR:
- bun test (whole repo): 2305 pass, 0 fail, 194 files.
- node --test packages/nous/index.test.mjs: 55 pass, 0 fail.
- bun scripts/check.mjs: ok, nous listed.
- Probe through createAuth with a stubbed request: 403 HTML, empty 401, empty 403 -> oauth_request_failed, kept (e8831a8: invalid_grant, expired); 400 invalid_grant, 401 invalid_token, 400 refresh_token_reused -> expired; 401 invalid_client -> kept. Expiry: none -> +3600s; expires_in 900 -> +900s; exp 600 -> +600s; expires_in 300 -> +300s; expires_in 0, exp in the past, or expires_in 7200 with a past exp -> 1.
- Broken by hand: restoring the old 401/403 -> invalid_grant mapping turns 3 tests red; fallback back to 1 turns 3 red; letting the fallback outrank explicit bounds turns 4 red; keeping content-encoding/content-length turns 2 red.

Not tried: a real Nous Portal sign-in or request.
Follow-up: #328 (null or string expires_in beside a valid JWT exp gives expires=1).
2026-10-23 12:16:41 +08:00
yetoneandnetube 43ffb46018 agent: PiG (Pi in Go), with Magpie's endpoint and model catalog (#264)
New package @magpie-community/agent-pig 0.1.0, a connect-only Agent:
it manages the whole providers.magpie object in ~/.pig/agent/models.json
(name, baseUrl, apiKey, api openai-completions, models) and nothing else.
settings.json and auth.json are not touched; disconnect restores a prior
same-name provider or removes the provider whole. Models keep their ids,
names, image input, positive limits (output capped at the window), and
map Pi's seven thinking levels onto the model's efforts (off -> none,
unsupported -> null).

Re-review of head 7134b1038: both points of the 10-21 review are fixed.
The package README no longer names e2e scripts that aren't shipped, and
installs with `magpie plugin add @magpie-community/agent-pig`. Code is
unchanged from the reviewed 43fb5d927.

Run at this tree (PR squashed onto origin/main 397a890), sandbox HOME:
- bun test: 2093 pass, 0 fail.
- bun scripts/check.mjs: ok.
- Broken by hand, pig.test.mjs red each time: unsupported level as
  undefined (2 fail), no output cap (1), zero context written (1), off
  not mapped to none (1), hardcoded apiKey (1), ids rewritten (3).
- Read every line: no imports, no file or network access, no install
  hooks; the icon is a URL (pi-in-go.dev) as aider's is.
- npm has no @magpie-community/agent-pig yet, so 0.1.0 stays.

Not tried at this head: a real PiG binary or the magpie host. The 10-21
review ran both at 43fb5d927 (PiG v0.5.1 darwin-arm64 offline parse,
fake-upstream request, host connect/disconnect); the runtime file is
byte-identical since.

Co-authored-by: netube <61469467+netube99@users.noreply.github.com>
2026-10-22 02:24:08 +08:00
Rahayu Kertawiguna 6579f0682a codearts 0.2.0: Huawei Cloud CodeArts (码道) coding plans, with Huawei Cloud OAuth sign-in (#284)
New package @magpie-community/opencode-codearts-auth 0.2.0 (Sakura-Natsu): Huawei Cloud CodeArts (码道) coding plans, with Huawei Cloud OAuth sign-in, request signing (SDK-HMAC-SHA256), a per-account cap of 3 in-flight sessions, per-account free/regular model lists, and requests signed only for https Huawei Cloud hosts.

Reviewed head 31099104 (two rounds; the first asked for changes at a793ca5, all fixed here). Run at the reviewed head, macOS, bun 1.4.2, with a preload that allows only loopback network:
- HOME=$(mktemp -d) bun test packages/codearts: 91 pass, 0 fail
- HOME=$(mktemp -d) bun test (whole repo): 2011 pass, 0 fail
- bun scripts/check.mjs: 21 ok
- 10 parallel bun test --rerun-each 40 in packages/codearts: 0 fail
- 22 hand breaks (signature, DPoP proof, 403 expired mark, session clamp, host check, per-account lists, callback server, refresh mark); 21 went red. The one green is the callback's prefix-path match (follow-up).

Not tried against Huawei's real API (no credentials); sign-in, signature acceptance, session counting and metering rest on the author's use on two accounts. Follow-ups: list the exact Huawei hosts instead of *.myhuaweicloud.com / *.huaweicloud.com; fail at once on a callback with no code; drop the unused ticketId; exact callback path match. This is a new npm name, so its first publish needs an owner.
2026-10-21 07:55:51 +08:00
yetone 0a998a8a7f antigravity-cloak 0.1.0: Claude Code and Claude Desktop on an Antigravity account
Antigravity answers a system prompt that reads as Claude Code's or the
Claude Agent SDK's with a 429 "Resource has been exhausted", whatever
quota is left (xzplzpl on X). Tried with a real account, it matches
"x-anthropic-billing-header:" and "You are a Claude agent, built on
Anthropic's Claude Agent SDK", and lets the same prompt through with a
U+200B inside each. This middleware puts one after the first letter of
both words, in system text only (Anthropic system, Chat/Responses system
and developer messages, Responses instructions, Gemini
systemInstruction), and only in what an Antigravity account is sent: it
uses magpie's new onProvider hook (v0.1.1283), so a Claude subscription
or any other provider in the same routing group gets the prompt as the
agent wrote it. Options: extraWords, accounts, off. The README says the
ban risk and what happens if Google changes its match. After hexiaolv's
magpie-antigravity-cloak (MIT), which changes every request.

scripts/middleware.mjs: a case's "provider" runs the request on through
onProvider with ctx.provider, and expect_request is that try's body.

Run:
- HOME=$(mktemp -d) bun test: 1783 pass, 0 fail (the package's 12 cases
  among them). bun scripts/check.mjs: every package ok.
- Real use: magpie built from e44b9aef3 in a sandbox HOME, a real
  Antigravity account, this package added from its folder. Claude Code
  2.1.302 `claude -p` on antigravity/gemini-3-flash answered; with
  {"off": true} the same run got the 400. /v1/messages with the billing
  line, the SDK line and Claude Code's three system blocks: 200 each on,
  400 each off.
2026-10-18 01:15:12 +08:00
kupakupa 646776060f kimi-desktop: Kimi desktop Work as an agent, through its local runtime (#169)
Adds agent-kimi-desktop 0.1.0 (kupakupar): Kimi desktop Work on magpie's
Agents page. It moves the runtime's daimon-kimi-code baseUrl to a
loopback bridge and back, through Kimi's local control API.

Re-reviewed at dd8ed2c against the last review at 6c584bb:
1. menu-hook.cjs and selection.mjs are removed; no injected code ships.
2. No full config backup is written. Only before-menu-models.json (the
   model list and current choice) is kept, and it is removed on a clean
   disconnect.
3. providers.json and settings.json are never opened. The catalog comes
   from the gateway's /v1/models with the agent's key and its registered
   UA "Desktop Kimi Work".
4. No signal handlers and no process.exit. Restore runs on the 'exit'
   event, which fires when magpie closes the host's stdin (host.js
   rl.on("close") -> process.exit(0)). The README gives manual recovery
   after a SIGKILL.
5. macOS record: COMPATIBILITY.md (macOS 26.6.2 arm64, Kimi 3.2.17
   build 3.2.17.4, magpie 0.1.1276, Bun 1.4.3). All four control methods
   succeeded, a streamed request returned 200, and a restore followed.
   The README says what happens when a private method fails.
6. Search and fetch pass Kimi's own request, with its own key, to Kimi's
   own origin, unchanged. This is the user's own account used by that
   user, the same rule as #171, so it is accepted.

Run at dd8ed2c, and merged onto origin/main 2ea25b9 together with #171:
- HOME=$(mktemp -d) bun test: 1660 pass, 0 fail (merged: 1668 pass, 0 fail).
- bun test packages/kimi-desktop: 12 pass.
- bun scripts/check.mjs: ok (it skips agent packages).
- git diff --check, npm pack --dry-run (8 files), node scripts/dist.mjs
  (packs agent-kimi-desktop@0.1.0).
- Broken by hand: re-adding a SIGTERM handler and a full config backup
  turns 3 tests red.
- No CI ran on the PR. No real Kimi or credential was used.
2026-10-17 04:33:01 +08:00
kupakupa adcc7252d0 kimi-work: a Kimi desktop Work subscription through the desktop's own sign-in (#171)
Adds kimi-work 0.1.3 (kupakupar): a provider for the Kimi desktop's Work
subscription, using the desktop app's own local sign-in. It stores only
a hashed account reference, rereads the desktop's tokens on each call,
writes nothing to disk and logs nothing.

Re-reviewed at d9fe48d against the last review at fc3e395:
- (1) the desktop credential: decided acceptable (same as WorkBuddy,
  Qoder, ZCode: each user's own allowance).
- (2) macOS record: COMPATIBILITY.md, macOS 26.6.2 arm64, Kimi 3.2.17
  (3.2.17.4), magpie 0.1.1276 (released 2026-10-16 17:11Z, before the
  20:09Z run), Bun 1.4.3. The path and four field names match readDesktop.
- expireTime: resetsAt dropped, window renamed 会员共享额度.
- efforts: every advertised level is kept (redacted real catalog fixture).
- kimi-work-opencode overlap: the README credits it and says not to
  enable both.
- Request input: handled; body, headers and signal are kept, and the
  desktop credential replaces any caller Authorization or Cookie.
- Icon is shipped once (package.json); the UA reads the package version.

Run at d9fe48d, and merged onto origin/main 2ea25b9 together with #169:
- HOME=$(mktemp -d) bun test: 1656 pass, 0 fail (merged: 1668 pass, 0 fail).
- bun test packages/kimi-work: 8 pass.
- bun scripts/check.mjs: ok (kimi-work checked).
- git diff --check, npm pack --dry-run (4 files), node scripts/dist.mjs
  (packs opencode-kimi-work-auth@0.1.3), scripts/new-to-npm.sh (new).
- Broken by hand: String(input) for Request and the old effort allow-list
  each turn their new test red.
- No CI ran on the PR. No real Kimi account or credential was used.
2026-10-17 04:32:42 +08:00
unisong 7687314d07 codex-history: opt-in Codex Responses history filter middleware (#152)
An opt-in gateway middleware for Codex Responses history after a provider
or account switch. For a provider whose rule turns historyFilter on, it
drops old reasoning items and items typed encrypted_content, removes the
optional server id from message and tool items, and sets store false. It
keeps text, tool arguments, results and call_id pairing. It rejects
previous_response_id, conversation, item_reference, encrypted compaction
and /responses/compact with a message, instead of dropping them silently.
Every provider passes through unless configured. No network, file, env or
child-process access.

Run at the reviewed head 96881ead, merged with origin/main:
- bun test packages/codex-history: 22 pass, 0 fail.
- The same 22 cases.json cases through magpie's own engine (moejs, via
  internal/middleware Begin/Request in a throwaway test): 22 ran, all equal.
- Broke it by hand (reasoning items kept): bun 4 fail, moejs 4 BAD; restored.
- Whole repo: bun test 1606 pass, 0 fail; bun scripts/check.mjs exit 0.
2026-10-16 15:11:17 +08:00
yijiemaooo-ux 118cf2edcc raccoon 0.1.0: SenseTime Raccoon (商汤小浣熊) provider plugin (#88, yijiemaooo-ux)
Adds packages/raccoon, @magpie-community/opencode-raccoon-auth, for SenseTime Raccoon (商汤小浣熊, xiaohuanxiong.com).
- Sign-in: through the browser, or reusing Raccoon desktop's live sign-in.
- Lists the models and makes chat requests.
- Reads account credits (balance and bills).
- Runs the daily check-in through auth.checkin, plus the desktop's first-login grant. The grant is marked settled only when the vendor gives a definite answer.

What was run, at the reviewed head 6078f92 merged onto origin/main 4e64f26:
- HOME=$(mktemp -d) bun test packages/raccoon: 21 pass, 0 fail.
- bun scripts/check.mjs: every package ✓, raccoon included.
- Whole repo, HOME=$(mktemp -d) bun test: 1575 pass, 1 fail.
  - The failure was grok's "a login's link is still handed on", a 5s timeout. Another full suite was running on the machine at the same time.
  - The test passed 5 of 5 when run alone.
  - It is filed separately.
- The raccoon code is byte-identical to c068cc5. That head was reviewed line by line on the PR, and every fix was broken by hand to check that its test goes red. 6078f92 only merges main.
- The package isn't on npm yet. magpie serves it from the dist branch until an owner publishes 0.1.0 (scripts/new-to-npm.sh).

Not verified: a real Raccoon account. Only the reply bytes the author captured were used.
2026-10-16 15:00:23 +08:00
yetone df3a04070a README, registry: tools, pages and routing strategies, and how to write your own
registry.json lists tools-calc (kind "tools"), page-usage (kind "page")
and middleware-reserve (kind "middleware"), community, with en/zh
summaries and no icon (magpie has none that fits).

README: sections "Routing strategies" (under Gateway middleware), "Tools
for every agent" and "Pages", each with a table and what a package of
that kind is a folder with; "Write your own" pointing to
usemagpie.ai/docs/plugins (#tools, #pages, #gateway-points, #middleware,
#agents, #quick) and to a template package of each kind. The market
section names the kinds.

Run: registry.json parses (26 entries); HOME=$(mktemp -d) bun test 1554
pass, 0 fail; bun scripts/check.mjs ok.
Known: magpie main's Plugins > Discover (plugins.js kindOf) treats any
kind but middleware and agent as a provider, so the tools and page
entries show with the provider chip until magpie learns those kinds.
2026-10-16 02:57:51 +08:00
yetone 80baa27570 scripts/owner.sh: an npm owner's first publishes and Trusted Publishers in one command
Finds from the registry, for origin/main, each package npm doesn't have
(first publish, then publish.yml as its Trusted Publisher with
--allow-publish) and each whose version npm lacks (its trust revoked and
made again with --allow-publish, then publish.yml dispatched). Runs npm 11
through npx, since npm trust needs 11.5.

Run: sh -n; --dry-run against the real registry lists opendesign 0.1.4 and
type4me 0.1.0 as new, zed 0.1.7 and zen-free 0.1.8 as behind, and leaves
no worktree behind. The trust-id parser was tried on sample JSON. The
publish and trust steps themselves need an owner's 2FA and weren't run.
2026-10-15 18:07:43 +08:00
Kun Chen c4f7bea372 type4me: Type4Me (macOS voice input) as a magpie agent (#136, kchen0x)
Adds @magpie-community/agent-type4me: Type4Me (macOS voice input) as a magpie agent. magpie writes the picked model, its /v1 address and Type4Me's key into ~/Library/Application Support/Type4Me/magpie-agent.json, which Type4Me reads before each dictation (joewongjc/type4me#343, merged). The folder is the one Type4Me and Type4Me Dev share (AppDataLocation.sharedProfileName).

Run at the reviewed head dc9d19bd: bun test packages/type4me (4 pass), bun scripts/check.mjs (green). Checked every field against magpie's agentplug.Desc and the file path, keys and folder against Type4Me's MagpieAgentFile and AppDataLocation.

Not done: the first npm publish of a new package name is manual (the package has no trusted publisher yet), and registry.json is not updated in this PR.
2026-10-15 13:15:03 +08:00
dbydd 3db704a677 opendesign 0.1.4: Open Design Cloud (Design Plan) as a provider (#84, dbydd)
New package @magpie-community/opencode-opendesign-auth 0.1.4, provider id `opendesign`: an Open Design Cloud account's Design Plan as a magpie provider (dbydd, #84).

Reviewed at this head (37ef688), as in the PR's last review: `HOME=<temp> bun test` for packages/opendesign, 19 pass; `bun scripts/check.mjs opendesign` ✓; the package loads under Node and Bun; `npm pack --dry-run` packs 5 files; a stubbed usage call sent its User-Agent to amr-api.open-design.ai only. The only hosts in it are amr-api.open-design.ai and amr-link.open-design.ai, with no install script, child process, or write outside OpenCode's auth store.

It no longer waits on its first npm publish: the publish workflow packs it onto the dist branch, and magpie 0.1.1243 and later install it from there until npm has it.
2026-10-15 06:44:45 +08:00
yetone da27d87de5 README: magpie 0.1.1243 is the first release that installs from dist 2026-10-15 06:44:09 +08:00
yetone f5308cdb0f publish: every version is packed onto the dist branch, so a new plugin merges without waiting for npm
A new package's first npm version can't go through trusted publishing
(a Trusted Publisher is set on a package that exists, with an owner's
2FA), so reviewed plugin PRs (#84 and others) sat unmerged until an owner
published by hand. Now publish.yml's dist job packs every package's
version (scripts/dist.mjs, npm pack --ignore-scripts) onto the dist
branch: tgz/<file> and index.json with each tarball's sha512. magpie
installs a @magpie-community package from there when npm doesn't have
the version. A new package without NPM_TOKEN is a notice, not a failed
run; a version npm refuses still fails it, now naming the stage-only
default of trusts made since 2026-09-03 and --allow-publish.

Run: node scripts/dist.mjs into an empty folder packed all 22 packages
(index.json 164K); the zed tarball's sha512 equals npm pack's integrity;
a second run packs nothing. The workflow itself is tried on main after
this push (workflow_dispatch).
2026-10-15 04:42:51 +08:00
yetone 4ef68fbf3f publish: an NPM_TOKEN secret publishes what trusted publishing can't, a new package's first version and one with no Trusted Publisher, so nobody publishes by hand
Every publish run on main since 13:27 UTC 10-14 is red: opencode-zed-auth
0.1.7 and opencode-zen-free-auth 0.1.6 answer 404 because their Trusted
Publisher isn't set, and a new package (opendesign-auth, AstraFlow) can't be
created by OIDC at all. Each of those needed an org owner's OTP by hand.

npm tries OIDC first and falls back to the token in .npmrc, so publish.yml
now hands setup-node's NODE_AUTH_TOKEN the repository's NPM_TOKEN secret.
publish.sh publishes a new package when the token is there instead of
passing it by, and its errors say which of the two is missing or that the
token expired. The PR check now notes a new package instead of failing,
since the merge publishes it. README gains a Publishing section with the
one-time token setup.

Run: sh -n on both scripts; scripts/new-to-npm.sh against npm (every
package is on npm); scripts/publish.sh with GITHUB_ACTIONS=true and a fake
npm on PATH (zed-auth "new"): token -> published with the token, exit 0; no
token -> ::error naming it, exit 1; token refused -> ::error saying replace
the token, exit 1.
Not tried: a real publish with a token, since the secret doesn't exist yet.
2026-10-15 01:58:21 +08:00
yetone 6e720301aa agent-aider 0.1.0: Aider as a magpie agent plugin, the first of the new agent kind (#78)
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.
2026-10-10 22:52:47 +08:00
yetoneandClaude Opus 5.5 2b0b2d9401 ci: a pull request runs the tests and fails while a package in it isn't on npm yet (#52)
Trusted publishing can't create a package, so #39's block-patterns,
merged before its first version was on npm, left every publish run on
main red after it (8 runs, the last 37781353941), and a real refused
publish would have hidden behind it. pr.yml runs bun test and check.mjs
on each pull request, and scripts/new-to-npm.sh names any package npm
doesn't know, so its first version is published by hand and its Trusted
Publisher set before the merge. The README's market section says so.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 21:59:38 +08:00
yetone 96c5b0f992 skills: magpie-quota, an official skill that lets an agent check what is left of every subscription, plan and key balance magpie has (magpie quota --json, or GET /v1/magpie/quotas) and wait for allowance (magpie quota wait); it never spends a Codex reset (ttmouse on X: suggested an official skill to go with magpie quota) 2026-10-08 03:46:47 +08:00
xiaofei f5dc146c2c Add OpenCode Zen Free provider plugin (#31)
* Add OpenCode Zen Free provider and market listing

* Guard Zen tool calls and address provider review

* Preserve upstream SSE error frames in Zen tool guard

* Restore Zen Free package name and simplify README title
2026-10-07 08:24:54 +08:00
yetone c5c9d33e48 README: the auth hook's checkin(getAuth, provider) — a plugin can press its vendor's daily check-in itself, which magpie runs once a day per account and shows on the Usage card (Lemon on Discord); outcomes, captcha never solved, failed alone retried; links magpie's contract (yetone/magpie 87487c5e) 2026-10-06 18:45:32 +08:00
yetone d9236e976f middleware: param-override, model-map, system-prompt, word-guard and think-tags — gateway middleware that magpie runs on every agent's requests and replies, mostly New API's channel settings with the same JSON (the owner) — magpie can now run a plugin as gateway middleware (onRequest, onEvent, onResponse, in-process on moejs), and these are the first ones: param-override is New API's param_override (both forms, operations with gjson paths and conditions, return_error); model-map is model_mapping (chains, /regex/ keys with $1) and puts the asked-for name back into replies; system-prompt adds a prompt in each API's own place, keeping an agent's own unless override (New API's semantics), by agent or model; word-guard is the sensitive-word filter (reject or mask the user's text, optionally replies); think-tags strips a leading <think>…</think> from replies across stream chunks, or puts Chat reasoning_content into the text (thinking_to_content). Each is one file with no imports, named @magpie-community/middleware-<name>, with magpie.options as the example the app's editor starts from; registry.json lists them with "kind": "middleware" and no providers; check.mjs skips middleware-only packages. scripts/middleware.mjs calls the hooks as the gateway does (events split, [DONE] passed by) and runs each package's cases.json. Tested with a real DeepSeek account and real Claude Code through magpie's gateway: a mapped model named back in message_start, max_tokens capped, a system prompt appended for claude only, a word turned away as a 400 in Anthropic's shape, return_error as a 403 in Chat's, <think> stripped from Chat and Responses streams and an Anthropic whole reply, reasoning_content moved into the text. bun test (61 for these five) and bun scripts/check.mjs pass; packages/devin's two image tests fail on this machine only, as on main. Their first npm version has to be published by hand (trusted publishing can't create a package); until then magpie shows them as Coming soon. 2026-10-05 20:49:42 +08:00
如是andyetone 42783f0033 trae: one package, two realms — Trae Global folds into packages/trae (#23)
* trae: one package, two realms — Trae Global folds into packages/trae

The review asked for this and it is the right shape: the two deployments
share one implementation. 86 of the 89 top-level names were already the
same code; what differed was a table's worth of values (hosts, client,
versions, usage page, fallback models, error codes) and two realm-only
branches. A separate copy meant every request, stream and tool-call fix
had to be made twice, and it had already drifted (the 0.1.15 Max fix
came back as a bug there).

packages/trae now holds a SITES table with two entries — trae-cn and
trae-global — and makePlugin(site) builds a provider from one. Exported
as TraeCNAuthPlugin and TraeGlobalAuthPlugin. The CN values are moved
verbatim, not re-derived: same hosts, client id, app id, IDE/client
versions, plugin version, brand, functions, fallback models, credits
page, and its own check-in pages. The international entry carries what
only it has: the second (US) deployment and the region that selects it,
the dollar billing's entitlements page, its own model names, and its
extra lapse/quota codes (20101, 4011).

The CN plugin needs the stream fix too (the review's point), so the
AbortController the loader now builds per request, openai()'s abort, and
sse()'s finally are in this one implementation for both realms — as is
the wrong-function retry releasing the read it leaves behind.

fake.mjs takes a realm id, defaulting to CN so every test written before
the fold is unchanged. The global tests move to global.test.mjs, plus
new ones for what only the international realm does: the US/SG routing
of a request and of a saved sign-in, its own error codes and error name,
the dollar usage page, and its fallback model list. chatModel gains the
picker's invisible-entry filter (paygo/auto twins, search agents) and
the config hook names the realm's own provider.

The acceptance test: packages/trae/*.test.mjs' 48 CN tests are untouched
and green — that is the proof the refactor changed no CN behaviour, with
its constants verified line by line against HEAD. bun test: 63 pass
(48 CN + 15 global); bun scripts/check.mjs trae: ok.

registry.json: one entry, providers [trae-cn, trae-global]. README: both
realms, each realm's endpoints, usage page and codes; the verification
range stated honestly (CN never run live; Global on one Free SG account,
no Pro and no US account).

* trae: Trae CN's model lists stay whole; only Global hides is_invisible_to_user

The fold filtered is_invisible_to_user for both realms, which took 40 of
Trae CN's 76 models out of its list. CN is served as before; Global (a
site flag, hidesInvisible) keeps the filter. Also: the unsupported-request
error names the realm, and two duplicated/merged comments are tidied.

---------

Co-authored-by: yetone <yetoneful@gmail.com>
2026-10-05 17:18:12 +08:00
如是 228628689f Add Trae Global (trae.ai) plugin - trae-global provider (#22)
* Add Trae Global (trae.ai) plugin — trae-global provider

Trae international (trae.ai, ByteDance's AI IDE international build) as a
provider plugin: sign in with Trae's own browser flow, free tier included,
models served through the international llm_utils_chat gateway.

Same plugin contract and request/response machinery as the Trae CN
plugin (packages/trae), a separate deployment: different domains, OAuth
client, model catalog, plus a US region (coreva) routed by the account's
AIRegion. The usage card reads the dollar billing's entitlements
(basic+bonus allowance) from the pay host, with the Free plan's /month
allowance riding it.

bun test: 41 pass; bun scripts/check.mjs trae-global: ok

* trae-global: a stream the agent walks away from closes Trae's connection

The bug: an answer whose tool call the agent acts on is cancelled mid-read,
and the read to Trae was left hanging. A generator's return cannot break a
read that is already waiting on reader.read(), so the SSE reader kept its
half of the connection open, and the host the next ask reused was one Trae
had dropped — a stream that runs, then dies, exactly around tool calls.

The fix: the answer's fetch is what gets stopped. The loader builds one
AbortController per request, follows the caller's abort signal into it, and
openai() aborts it when the stream is cancelled. sse() also lets its reader
go in a finally, for the paths that end the generator rather than the fetch.

stream.test.mjs: the agent reads, then cancels with nothing more coming, so
only aborting Trae's fetch can release the read — red before, green after.
bun test (42 pass); bun scripts/check.mjs trae-global: ok

* trae-global: the review's three blockers — planLocked, the 0.1.15 Max, usage's error code

planLocked is gone. It read display_contact_config's identity_list and
assumed every account is Free (identity 0), so a paying account lost
exactly the models it pays for — gpt-5.5, the gpt-5.6 family, gpt-6,
glm-5.2 — and could never pick them. The plugin is never told the
account's own identity (not at sign-in, not in the entitlement answer),
so nothing is filtered on identity now: the list is the account's own,
the IDE greys out what the plan locks, and a locked model answers Trae's
own 1005 when asked. The picker's invisible entries (paygo/auto twins,
search agents) stay out, as before.

maxModel takes the 0.1.15 fix: a model's Max is found across every list
that names it, not just the one entry the model is listed through —
chat_v3 can name the __max model while the SOLO list names only __dev,
and the window can be another entry's again. Without it the same
"no -max model" bug the CN plugin fixed in 0.1.15 comes back here.
maxes holds each model's Max for the models hook, as CN's does.

usage: a 200 carrying an error code (e.code !== "0") now says Trae's own
message instead of "no entitlement pack in the answer", as CN's does.

README: the verification range is stated honestly — one Free account,
SG realm, no Pro and no US account tried; paid-account behaviour is
implemented from the interface's shape, not confirmed on a live one.
registry.json marks Trae Global experimental, as Trae CN is.

usage.test.mjs: the locked-model test now asserts the paying account's
list, and a new one asks a paid account's gpt-5.5 through the gateway.
stream.test.mjs: a Max split across lists is listed and asked where its
__max model is named. Each red before its fix, green after.
bun test (46 pass); bun scripts/check.mjs trae-global: ok
2026-10-05 16:10:35 +08:00
yetone 6c048c7fc2 trae 0.1.0: Trae CN (trae.cn) accounts, free tier included, with Trae's browser sign-in (experimental; Discord pdzebkbd0701)
Sign-in is trae.cn's authorization page back to a 127.0.0.1 /authorize
callback (userJwt + userInfo, or a refresh token exchanged), with a device
made at sign-in and kept for the account. ExchangeToken renews the JWT
through auth.refresh (refreshLead 10 min, one renewal per refresh token).
Requests go to the IDE agent's llm_utils_chat (chat_v3, then
solo_work_lite on 4001/4023/1005), its SSE events turned into OpenAI
chunks; tools named natively and as <tool_call> blocks. Usage is the
entitlement packs' credits. Worked out from wangqi233/trae2api and
autumnsentiment/Trae2api-cn; not run against a real account.
2026-10-03 14:34:31 +08:00
volcanic 8b4f759455 Cline: usage billing, ClinePass and the free models, with Cline's own device sign-in or an API key (#2)
* Cline: usage-billed models, ClinePass's and Cline's free ones, on your own Cline account — Cline's device sign-in (WorkOS device code, traded at /auth/register) or an API key; chat completions on api.cline.bot with Cline's own client-identity headers (pinned to the current CLI release — what the free models' gate reads), the non-stream data envelope unwrapped, the model list from Cline's recommended-models feed, usage from the account's balance (counted in millionths of a dollar). cline-pass answers 403 ENTITLEMENT_ERROR without the subscription and the message says so; so does an empty balance, with the top-up URL.

* cline 0.1.0: the pinned CLI version and the workos: prefix move to Cline's current client — apps/cli is at 3.0.68, and provider-auth-registry's formatProviderOAuthApiKey lowercases before it startsWith("workos:") so a token stored as WorkOS: is not double-prefixed here either; bearerOf's "once" test fails against 0.1.0.

* cline 0.1.0: the model list is Cline's whole catalog, not just the recommended feed — the title promised usage-billed models but the plugin read only recommended-models (6 paid models), while Cline's own clients also load /api/v1/ai/cline/models (loadCloudModels), so most usage-billed models were missing. The four feed arrays are now read by name instead of walking every value (a tag or description could become a model, and one in both recommended and free lost its "(free)"), clineCloud stays out as the client leaves it out, a raw-id name is prettified, and the bundled snapshot drops gemini-2.5-pro and minimax-m2.5 (not in cline-recommended.generated.ts) and gains the missing cline-pass/* entries; the parseFeed, snapshot and models-merge tests fail against 0.1.0.

* cline 0.1.0: a refresh failure no longer fails a request that still has a good token, and a rotated pair survives a failing auth.set — a 4-minute token plus a 500 from /auth/refresh answered the chat 502 and never sent it, and with auth.set throwing the next request re-spent the old refresh token, got invalid_grant and marked the account expired. fresh now keeps the current token on a transient failure while it is still good (Cline's getValidClineCredentials), failing only once it has expired, and the latest rotated pair is held in memory beside the save (kiro's held), used when getAuth still hands back the spent token; the still-good-token and rotated-pair tests fail against 0.1.0.

* cline 0.1.0: failure() keys on Cline's error codes and whole phrases, not loose substrings — a 403 whose text mentioned "tokens" (max_tokens exceeds…) became "the sign-in lapsed — sign in again" and lost the real message, and any message containing "credit" became a 429 usage limit. The 401/403 token check, the out-of-credits and entitlement checks and the 429 check now match what Cline's client matches (ENTITLEMENT_ERROR, insufficient_credits, SPEND_LIMIT_EXCEEDED, the not-subscribed wording), and a renewed token clears the lapse mark through the error path too as qoder's renewed() does; the codes-and-phrases and renewed-mark tests fail against 0.1.0.

* cline 0.1.0: device polling grows the interval for good and rides out a bad poll — slow_down raised it for one poll only (RFC 8628 and Cline's pollWorkOSTokens do interval += 1 permanently), the minimum was 0.25s where the client clamps to 1s, and a single 5xx, non-JSON reply or network error ended the sign-in with "the token answer had no access token". The poll now keeps polling through those; the slow_down, one-second and bad-poll tests fail against 0.1.0.

* cline 0.1.0: the held pair covers every refresh token this run has spent, not only the last — when auth.set goes on failing (which a store that failed once usually does) getAuth keeps handing back the first pair, and a second rotation overwrote held.from, so the third request refreshed the already-spent r1 again: /auth/refresh went r1, r2, r1 and the chat answered 401 expired. held.from is a Set every rotation adds to now, and the held pair is used whenever the refresh token getAuth hands back is in it; the two-rotation test fails against 0.1.0 (200, 200, 401).

* cline 0.1.0: X-CORE-VERSION moves to 0.0.90 with the CLI release — the header set pinned 3.0.68 beside 0.0.89, but cline@3.0.68 depends on @cline/core 0.0.90 (0.0.89 is what 3.0.67 shipped) and resolveProviderRequestHeaders sends X-CORE-VERSION from that dependency, so the number the comment calls the one that has to match was a release behind; the client-header test pins the pair now and fails against 0.1.0.

* cline 0.1.0: a poll reply that isn't JSON and isn't a 5xx fails the sign-in at once — a body that wouldn't parse was read as WorkOS having a moment, so an HTML 400 (a proxy's error page, say) kept the poll going to the deadline, ten minutes, before failing there anyway. Only a network error and a 5xx are a poll to try again now; a 4xx that isn't JSON is the poll refused. The refusal test fails against 0.1.0.

* cline 0.1.0: a renewal's mark survives a network error on the chat itself — the 502 the fetch throws after a renewal returned without signed(..., renewed(cred)), so the request that never left the machine dropped the mark while the request that came back refused kept it; it is wrapped the way the !res.ok path is. The network-error test fails against 0.1.0.

* cline 0.1.0: the held pair is kept per rotation chain, so no account is sent on another's token — magpie calls ClinePlugin once for the provider and hands every account its own getAuth, so the one `held` pair outlived them: with two accounts, a save failing every time and every token wanting renewal, A, B, A went out as A-jwt1, B-jwt1, B-jwt2 and A's third request refreshed with B's token, spending it and billing B (yetone's two-loader repro, page-for-page the same). A spent refresh token now maps to the newest pair its own chain reached — the token getAuth handed back and the one the refresh spent both point at that chain — so a request offering either finds its own account's pair; the per-chain test fails against 0.1.0 on the third request's Authorization, with the 51 before it passing.
2026-10-02 23:03:54 +08:00
yetone 7c859cc532 minimax 0.1.0: MiniMax Code (mcode) accounts' credits and M Plan, China (minimax-code) and international (minimax-code-global), with MiniMax Code's own device sign-in (Magic_zero on Discord)
A new package, @magpie-community/opencode-minimax-auth, written from MiniMax Code 0.6.2's bundle.

Sign-in: MiniMax Code's OAuth device flow, the same one mcode uses (account.minimax.cn / account.minimax.io, client mcode-public, scope agent.default, audience agent-backend, PKCE S256). It also handles MiniMax's own variant, where there is no device_code, the user_code is polled for, and expired_in may be an at-ms. The account is named from MiniMax's signed /v1/api/user/info. mcode's ~/.minimax sign-in is never read or written. Each account is a sign-in of its own, so magpie can hold several.

Refresh: two minutes before the token ends, or once on a 401. One refresh runs per account (keyed by the refresh token it spends), and its result answers for the old token for a minute, so a late reader doesn't spend a rotated token twice. Only invalid_grant with HTTP 400 signs the account out (signIn: expired); any other failure keeps it and uses the token in hand while it lasts.

Chats: Anthropic messages at <agent>/mavis/api/v1/llm/v1/messages, carrying:
- Authorization: Bearer <token>
- x-api-key sk-xxx (mcode's placeholder)
- User-Agent MiniMaxAgent
- X-Mavis-Agent-Id main
- X-Mavis-Timezone-Offset
- X-Mavis-Session-Id, from chat.headers' sessionID (otherwise a fixed id per run)

A 402, 403 or 429 whose body says credits or quota ran out goes on as a 429 "usage limit reached".

Models: the live config at GET /mavis/api/v1/models?region=&buildEnv=prod (asked again without auth on a 401/403), with mcode's built-in four as the fallback: MiniMax-M3.1-Flash-Preview, MiniMax-M3, MiniMax-M2.7 and MiniMax-M2.7-highspeed. Variants follow what mcode sends: adaptive thinking at an effort (output_config.effort), and none to turn thinking off.

Usage: mcode's signed account API: user info, the type-0 workspace from get_user_extra_info, then get_membership_info. The card shows credits left (op_credit_summary / opcredit_balance), Free or "M Plan <tier>" with its end, and, for an M Plan, coding_plan/remains with X-Group-Id. That is read as magpie's readMiniMaxPlan reads it. There is no check-in.

Tests: fakes only. nonet.mjs is imported first, so only 127.0.0.1 can be reached. They cover:
- sign-in, the variant, refused, and other errors
- refresh, a three-way race plus a late stale reader, per-account refreshes, invalid_grant, other failures, and 401 then refresh then retry
- request headers and chat.headers
- credits running out going on as a 429
- the live list, the retry without auth, and the fallback (the given object back)
- signing, against fixed vectors and the bundle's formula
- usage parsing (readMiniMaxPlan's own fixture), Free, M Plan, and a refused account

bun test packages/minimax (27 pass) and bun scripts/check.mjs pass.

End to end through magpie: origin/main b0486663, built with -tags nogui in a worktree since removed, under env -i with a sandbox HOME, a fake upstream on 127.0.0.1:47811, and a copy of the package with its hosts pointed there:
- plugin add
- plugin login minimax-code: the device flow and the account named; a second login of the same account merged into one
- the live list: 2 models
- provider test minimax-code: the chat went out with the headers above
- quota: M Plan Plus, 321.5 credits, 5 hours and 7 days windows
- an expired token refreshed and saved

No request was made to MiniMax.
2026-10-02 22:38:41 +08:00
yetone cc57432d16 zcode: Start Plan requests go as ZCode's own, with its headers and system prompt (0.1.7) (#5)
ARNO on Discord: the plugin's Start Plan requests were answered 405 / 3012
"blocked due to unusual activity" while his own plugin (Freeflow, provider
zcode-start) worked from the same machine. zcode.z.ai serves the plan only
to what looks like ZCode's own request: a Start Plan request now carries
ZCode's headers and its body is dressed as ZCode's (three cached system
blocks, the environment section, the date reminder as the first turn, one
cache mark on the last block, metadata.user_id naming the sign-in's
device). The prompt texts are magpie's (901fd87e), each matching ARNO's
plugin's hash. Coding Plan and team requests are unchanged. The Start Plan
is advertised again.
2026-10-02 19:28:42 +08:00
yetone 8c7e31911e qoder: Qoder CN (qoder.cn) as a second provider, qoder-cn (#1) (#4)
Hosts, client id and paths read from Qoder CN's own CLI (@qodercn-ai/qoderclicn 1.1.65): sign-in on qoder.cn, accounts on openapi.qoder.com.cn, models and chat on gateway.qoder.com.cn, client id e883ade2-…; signing unchanged. The same as magpie's built-in Qoder CN. When qoder.cn refuses a job token the account chats on its device token, renewed through /api/v1/deviceToken/refresh, as the CN CLI does. cn.test.mjs (12 tests, a local server standing in for every host) covers sign-in, polling, both tokens' refresh, a chat, models, usage and qoder.com unchanged; 6 fail with the CN chat host pointed back at api3.qoder.sh or the fallback off. Version 0.2.0.
2026-10-02 18:30:00 +08:00
yetone bd5e91ee00 zcode: stop advertising ZCode's free Start Plan — zcode.z.ai serves it only to requests carrying the official ZCode client's system prompt and answers others HTTP 405 'request has been blocked due to unusual activity'; the plugin, like magpie, never rewrites prompts or poses as the official client, so the plan can't be used through it. registry.json's summary (en/zh), the root README's table, the package's description and its README now name the GLM Coding Plan and team seats only, and the package README says why the Start Plan isn't usable. Text only; no code or version change. 2026-10-01 23:11:00 +08:00
yetone 03c948b6bb registry.json: the list magpie's Plugins tab shows, and how to add to it 2026-09-30 18:57:46 +08:00
yetone d7385c87c4 cursor: Cursor — cursor-agent's browser sign-in (PKCE poll), its existing sign-in or an API key; agent.v1 Run over HTTP/2 as magpie's gateway does it, with tool calls; tried with real requests. README lists every package so far 2026-09-30 17:17:06 +08:00
yetone 5a18bbdac4 Name the scope @magpie-community (the org's name, spelled right) 2026-09-30 17:04:47 +08:00
yetone 631b29b1c0 README: the packages so far 2026-09-30 17:01:55 +08:00
yetone 2578f471bb Scaffold: conventions for OpenCode provider plugins of coding-plan subscriptions, a hook checker and a sandboxed magpie runner 2026-09-30 16:55:58 +08:00