Commit Graph
304 Commits
Author SHA1 Message Date
yetone b93c9eca8c scripts: check tools-only plugins, skip pages and routings, run strategies.json
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.
2026-10-16 02:57:19 +08:00
yetoneandsryimnoob ffc06aca49 opendesign 0.1.6: each model is asked on the API amr-link thinks on, and reasons at max too (#141, sryimnoob123)
sryimnoob123 measured a streaming request to every model on each of
amr-link's three APIs: chat completions carries the thinking of most,
claude-haiku-5.5 and deepseek-v4-pro think longer on Responses, and
glm-5.3-flash thinks only on Anthropic's messages. The vendor also names
max beside low and high. #141 was written against 0.1.4 and conflicted
with 0.1.5 (#137's levels), so it is ported onto main here:

- WIRE/MODEL_WIRE/wireOf as the PR had them; the provider default is
  chat completions, and a live list's and the seed's models each carry
  api.npm/provider.npm, which magpie's host reads per model.
- The config hook sets every model's wire again over a kept copy, so a
  model 0.1.5 left on the Responses API moves to its own.
- max joins every measured level list.

Run: bun test in packages/opendesign, 22 pass (a new test holds a kept
0.1.5 model moving to its wire; the old Responses-only expectations were
changed to the measured ones). Not tried against a real amr-link account.

Co-authored-by: sryimnoob <314134180+sryimnoob123@users.noreply.github.com>
2026-10-16 00:53:37 +08:00
yetone b549b40b14 opendesign 0.1.5: a signed-in account's models reason in magpie, at the low and high levels amr-link took (#137, sryimnoob123)
sryimnoob123 measured amr-link with reasoning_effort high and low on all
11 models (magpie 0.1.1254, Windows): every one answered 200, and all but
gpt-6-luna streamed reasoning, four the catalog calls "standard" too.
Their install showed all 11 with reasoning false and no levels. Two
causes:

- provider.models gave the live list in the config's shape
  (reasoning: true, modalities: [...]). magpie's plugin host reads a
  listed model's thinking from capabilities.reasoning and its kinds from
  capabilities.input, so for a signed-in account every model read as not
  reasoning, with no image input. It now gives OpenCode's model shape
  (servedOf: api, capabilities, variants), as minimax/workbuddy do.
- No model had levels: nothing declared variants, and magpie shows a
  model's levels only from them. models.mjs now records the measured
  levels (efforts): ["low", "high"] on the 10 that thought, [] on
  gpt-6-luna (took it, never thought). Only the two levels the table
  shows were given. A model with levels reasons whatever its capability
  word; one the seed doesn't know keeps the old rule (advanced reasons)
  with no levels. refresh-models.mjs keeps efforts like names.

Run:
- bun test packages/opendesign: 21 pass, 0 fail. New: "a signed-in
  account's models reason at the levels amr-link took (#137)", "the
  seed's models carry the measured levels as the config's variants";
  the live-list test now pins the OpenCode shape.
- Broken by hand: modelsOf back on modelOf (config shape) -> 2 fail;
  efforts not passed from the seed to the live list -> 1 fail.
- magpie origin/main internal/plugin/host.js run under bun with a
  preloaded fetch stub serving a 3-model catalog (init + providers, a
  stored oauth account): with 0.1.4 gpt-6-luna, deepseek-v4-pro and
  claude-haiku-5.5 all list reasoning=false variants=[] image=false;
  with this change luna false/[]/image true, v4-pro true/[low high],
  haiku true/[low high]/image true, url the amr-link base.
- refresh-models.mjs against the same stub: efforts kept per model.
- bun scripts/check.mjs: every package ok.
- TMPDIR/HOME isolated bun test (whole repo): 1526 pass, 0 fail. A first
  run had 1 fail, packages/grok/login.test.mjs "a login's link is still
  handed on" timing out at 5s with load average ~100; alone 3/3 pass and
  the rerun of the whole repo passed. Untouched package; not filed.

Not tried: a real Open Design account (none here) or magpie's
`model efforts` command end to end; the levels rest on the reporter's
table.

Full suite: bun test (whole repo, with factory 0.1.30 below it): 1527 pass, 0 fail
2026-10-15 21:11:53 +08:00
yetone b8717aa860 factory 0.1.30: requests say droid 0.242.0, the current release (sky杨 on magpie's Discord: every model 403 "Factory: Forbidden" from Claude Code on 0.1.29)
sky杨, on magpie 0.1.1254 with this plugin at 0.1.29, got 403 "Factory:
Forbidden" from Claude Code on every model, GPT, Claude and Gemini alike.
Factory's body was a bare "Forbidden", not a phrase-specific refusal.

Header diff against droid 0.242.0 (npm droid and @factory/cli-darwin-arm64
0.242.0, unpacked with --ignore-scripts into an empty directory and read
with strings, never run). Its model requests carry: Authorization,
X-Factory-Client: cli, X-Client-Version, X-Factory-Org-Id, User-Agent
factory-cli/<ver>, x-session-id, x-assistant-message-id, x-api-provider,
x-provider-routing-source (registry_default without a routing claim),
OpenAI-Platform: org-bHuLtG1fGmYk5YaOihAAXFBw for openai/azure_openai,
and X-Api-Key "placeholder" from its Anthropic client. The plugin sends
each of these with the same value, apart from the release: 0.233.0, nine
releases behind. The WorkOS client id is unchanged. droid's binary still
reads a server-side min_cli_version flag and runs a forced auto-update.

0.1.16 was the same case (JL: every model 403 "Forbidden" from pi and
Claude Code while droid worked; the plugin said 0.231.0, two behind), and
JL's later reports (0.1.25) were about models, not refusals. Whether
Factory refuses an old release with a 403 is still not confirmed: there is
no Factory account to try with. This is the one header difference found.

Run: bun test in packages/factory, 143 pass. With VERSION put back to
0.233.0, droid.test.mjs goes red (Expected "0.242.0", Received
"0.233.0"). bun scripts/check.mjs factory: ok.
Not tried against Factory itself.

Full suite: bun test (packages/factory) 143 pass
2026-10-15 21:01:58 +08:00
yetone da27b4ce6b zen-free 0.1.9: a free model Zen lists is offered the hour it lists it, before OpenCode's catalog or docs describe it, and a list read with them out of reach isn't said as fallen back (yetone/magpie#2385)
Zen made deepseek-v4.1-flash-free free (in its /models as the public key
reads it, 2026-10-15) and the plugin never offered it. Two causes:

- buildModels left out a listed model that neither the catalog
  (models.opencode.ai) nor the docs' endpoint table described: a free
  model Zen lists before they catch up, or every model but the snapshot's
  when either can't be read. A listed id ending in -free with no word from
  either is now asked through the provider's own package
  (openai-compatible, chat), as OpenCode asks a model with no package of
  its own. A paid or unknown id that doesn't say -free still needs the
  catalog; the docs saying SystemOne still keep one out.
- A discovery with the catalog or the docs unread was marked
  magpie.fellBack, though Zen's own list was read. magpie answers a
  fallen-back list by keeping the last list read in full
  (plugin.keepListed), so a user who can't reach GitHub's raw host or the
  catalog kept that old list, and every model Zen made free since stayed
  out. Only a failed read of Zen's /models is fallen back now; models
  verified before are still kept while Zen lists them.

Tests (no network; the fixture server serves
fixtures/zen-models-2026-10-15.json, Zen's /models byte for byte):
- "a free model Zen lists that the catalog and the docs don't describe is
  offered, on chat (#2385)": catalog 503, docs 404 -> the ten free models
  Zen lists (Jev, "test" and the paid ones out), deepseek-v4.1-flash-free
  on chat, muse-spark-1.3 on Responses, not fallen back; a request for it
  goes to /chat/completions
- "... before the catalog has it is offered with the catalog read (#2385)"
- models.test: an unknown -free id is offered on the provider's package,
  "unknown-paid", "freebie" and "free-model" aren't, SystemOne stays out
  (replaces "unknown models require a known protocol rather than a
  guessed chat endpoint")
- two partial-discovery tests now expect no fellBack
Broken by hand: models.mjs back to 0.1.8's -> 3 fail; provider.mjs back
to 0.1.8's -> 3 fail; both fixed: bun test 174 pass, 0 fail (bun 1.4.2).
bun scripts/check.mjs zen-free: ok.

Not tried: a live request to deepseek-v4.1-flash-free through the plugin
(one GET of Zen's /models was the only network used). A future free
model Zen serves on Responses or Messages that the catalog doesn't
describe yet would be offered on chat and refused by Zen until the
catalog has it.

No magpie mover to raise: zen-free isn't a moved built-in, and magpie
updates @magpie-community plugins by itself within the hour.
2026-10-15 19:46:57 +08:00
yetone c59ee33efe scripts/owner.sh: npm asks for 2FA on the terminal, and a run with none stops first
Run through Claude Code's ! (no terminal), every npm step printed the 2FA
link and failed with EOTP at once: npm waits for the browser only when it
can ask on a terminal. npm now reads from /dev/tty, so piping the script
to sh still works, and a run with no terminal says so before any npm step.

Run: with no terminal, --dry-run lists the four packages and the real run
stops with the message, exit 1, nothing asked of npm. Not run on a terminal
(that takes the owner's 2FA).
2026-10-15 18:13:30 +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
yetone 2b67811af8 cursor 0.2.15: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Run at this commit: packages/cursor `bun test` (isolated HOME) 263 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 17:51:41 +08:00
yetone 1bf9113390 cursor: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Cursor's tool_requests_listed (InteractionUpdate 27) counts every call of
the model's step, and is sent after them. That count includes calls the
plugin answers itself: a tool the request doesn't have (0.2.14's native
path refuses those) and Cursor's get_mcp_tools (exec 36). 0.2.14 counted
only the calls it accepted. A step with a refused call then either waited
30s for a call that never came (502 "did not complete its declared native
tool batch") or met the next step's count with the stale one (502
"inconsistent native tool count", the reporter's error). The stateless
decoder had the same miscount and hung. Both paths now count answered
calls toward the step and end a step whose calls were all answered without
one.

503 "native outbound messages limit reached": a long history goes out as
one blob per message, and Cursor asks for every blob at once. The native
transport caps its pending writes at 256 messages / 16 MiB and failed the
Run when a slow link backed them up past that. KV replies now wait for
room (NATIVE_LIMITS.writeWait, 30s) and fail only if the link doesn't
drain for that long. The stateless path writes directly and has no cap.

The fixtures are real Cursor frames captured on 2026-10-15 (model auto,
cursor-agent's agent.v1): get_mcp_tools plus a refused WebSearch in one
step followed by read_file, which gave 0.2.14 the reporter's exact
"inconsistent native tool count"; and read_file, refused WebSearch,
read_file under a count of 3, which gave 0.2.14 the batch timeout.

Run at this commit (on origin/main 43d93b0):
- packages/cursor `bun test` (isolated HOME): 263 pass, 0 fail.
- `bun scripts/check.mjs`: every package ok.
- Broken by hand: with native-session.mjs and index.mjs reverted to
  0.2.14, the new tests fail with "inconsistent native tool count",
  "native outbound messages limit reached", the batch wait, and the
  stateless decoder's hang; 4 of 5 red (the stateless mixed case passes
  on 0.2.14, which hands WebSearch to the caller there).
- Real Cursor, before the fix: the captures above reproduced both 502s
  through the plugin's native path. The 503 was not reproduced on a real
  link (my queue peaked at 160 of 256); it is reproduced in the test with
  a 16-message bound and a slow fake write.
- Real Cursor, after the fix (owner's account, model auto, the mixed
  prompt): native path 3 of 3 runs 200 with read_file a.txt and b.txt
  (WebSearch refused to the model), stateless 3 of 3 runs 200; a native
  Run with 1200 history messages 200.
- Not proven: the reporter's empty replies. They are likely the turns
  after these failures and are not addressed separately.
2026-10-15 17:51:41 +08:00
yetone 43d93b0cf9 devin 0.1.18: each model carries the price Devin lists for it, and SWE-2 is free again beside its Lightning variants (太陽と向日葵 on Discord)
太陽と向日葵 on magpie's Discord: Usage no longer shows what calls through
Devin cost. Two causes, both in what the list gives magpie:

- Every model went with a price of 0 (runtimeModel's cost), and magpie
  falls back to models.dev, which has none of Devin's own models (SWE-2,
  SWE-1.7 Lightning). Devin lists each paid model's price in
  GetCliModelConfigs: field 32 of a config, one per "Input", "Cached input"
  and "Output", a float32 in USD per "1M tokens". parsePrices reads it
  (fields() now keeps a fixed32's bytes), and listed() gives an entry the
  price its variants share, none when they differ. Read from Devin's own
  response on 10-15: Opus 5.5 4/20 (cache 0.2), its fast run 8/40, SWE-1.7
  Lightning 2.5/12.5, SWE-2 Lightning 1/5, GLM-5.2 1.4/4.4. The Free tier
  lists none.
- Devin now files swe-2-high-, -medium- and -max-lightning under SWE-2 at
  the High cost tier. A family was free only when every model under it
  was, so swe-2 lost free (seen in the owner's plugin-providers.json on
  0.1.17), and with it 0.1.16's rule that a used-up day and week don't hold
  SWE-2. A family is now judged by the variants variantFor sends it as:
  those at an effort and its default.

Run: HOME=<mktemp -d> bun test in packages/devin: 84 pass. prices.test.mjs
uses Devin's real GetCliModelConfigs bytes of 10-15, cut to 11 configs
(testdata/model-configs-1015.bin, no account data in it). Without the
index.mjs change: 3 of its 4 tests red. Broke by hand: the family's free
over every model again turns 2 red; cost back at 0 turns 1 red.
bun scripts/check.mjs devin: ok. Every price above checked by decoding the
full real response with a separate Python reader.
Not run: magpie end to end with this version (magpie reads a plugin's
price from its next commit on).
2026-10-15 17:39:13 +08:00
yetone 9a4ec8600c workbuddy 0.1.24: a refused sign-in on a request over 2 MiB says the 401 and to sign in again, not ECONNRESET (wyp on Discord)
wyp's WorkBuddy AI requests worked for a while, then every turn failed as
"502 WorkBuddy AI: ECONNRESET: The socket connection was closed
unexpectedly". Measured on www.workbuddy.ai and copilot.tencent.com: the
front door answers a token it refuses with 401 only for a body up to
2097152 bytes. At 2097153 bytes and above it resets the connection with no
reply. With an accepted token, 20 MB bodies go through, and app errors
(400 11128) still come back on big bodies. So once a long Claude Code
session is past 2 MiB and the account's sign-in is refused, every turn is a
reset, and nothing about it is temporary.

Keep-alive reuse was ruled out: the server closes an idle connection with
a FIN at 60s, and Bun opens a new connection for requests at 59.99s and
59.995s.

When a chat over 2 MiB fails before any reply, the loader now asks the meter
(POST /billing/meter/get-user-resource-summary, 401 for a refused token) once.
On a 401 it returns that 401 with the reason and the remedy (sign in again,
in magpie or in the desktop app), marked kept like the plugin's other 401s.
Any other answer, a failed meter read, or an abort leaves the original
error. The chat is never sent again.

Run: HOME=<temp> bun test in packages/workbuddy: 97 pass (reset.test.mjs is
a socket fake of the front door that resets past 2 MiB). Broke it by hand
(unanswered rethrows at once): 3 of the 5 new tests go red. bun
scripts/check.mjs workbuddy: ok. Against the real endpoint in a sandbox
HOME: refused token + 2.2 MB body gives 401 with the message (0.1.23:
ECONNRESET); refused short chat gives the front door's HTML 401; good
token + 2.2 MB body gives 200. Not run: magpie's gateway end to end with
this version. Why wyp's token was refused is not yet confirmed.
2026-10-15 17:25:38 +08:00
yetone 103bb24b65 trae: ownclient's tests open one fake at a time, so global.test finds the realm's own hosts (0.2.14's publish run)
checkIn() opened a fake over the one the test had already opened; closing
the second put the first's 127.0.0.1 origin back as trae-cn's hosts, so
global.test.mjs, run after it in one process, read a fake host. The
publish run for 2009f49 went red on it and 0.2.14 never reached npm.
checkIn now closes the fake before it opens another.

Ran: HOME=$(mktemp -d) bun test at the repo root: 1509 pass, 0 fail.
Broken by hand: without the close, `bun test ./ownclient.test.mjs
./global.test.mjs` fails "the realm's table is its own" (26 pass, 1 fail),
as the publish run did.
2026-10-15 17:07:59 +08:00
yetone 2009f49751 trae 0.2.14: the account Trae CN's own client is signed in as checks in on the client's device, not one the plugin made up (yetone/magpie#1920)
On one account Trae CN's desktop client's claim went through while the
plugin's, on a device id it had made up (digits(19)) with a hard-coded
brand and OS, came back 9074 every day (MiFaZhan on yetone/magpie#808;
aliceh1 on #1920, where Buddy Switch reads the local client). Now, for a
check-in (/trae/api/v2/ug/*) only, the account whose uid matches the
userId of this machine's Trae CN client sends the client's own device id,
the one Trae's device service registered: the digits in the client's
storage.json key iCubeAuthInfo://icube-dc:<id> (seen in real clients'
files, #808 and #1705). x-device-type and x-os-version are this machine's
(Windows' product name, else its build; elsewhere the kernel release),
and no brand is sent, as the client's fb leaves it out with no model.

The uid comes from the client's sign-in envelope
(iCubeAuthInfo://icube.cloudide), plain JSON or the client's fixed
AES-128-CBC codec, read as dingminhua/dsh-connect-trae (MIT) reads it;
only userId is looked at, the client's token is never used. The file is
only read, never written. Every other account keeps its own device; a
missing or unreadable file, one that can't be made out, a failed
integrity check, or zero or several icube-dc keys change nothing. No id
is made up, changed or rotated (the owner's ruling on #1705 stands).

Ran: bun test in packages/trae, 140 pass (11 new in ownclient.test.mjs);
bun scripts/check.mjs trae ok. Broken by hand: matching every account
instead of the client's uid fails "an account the client isn't signed in
as keeps its own device"; not passing the client's device to ugHeaders
fails the two matched-account tests. Tests never read this machine's
client (fake.mjs points ownClient.paths at nothing). Not tried: a real
Trae CN client or account (none here), so whether the claim now goes
through for the matched account is unproven; the Linux paths are guesses.
2026-10-15 16:57:55 +08:00
Kun Chen 8c4bf5cc72 registry: Type4Me (agent-type4me 0.1.0) under Agents (#139, kchen0x)
Lists @magpie-community/agent-type4me (merged in #136) on the Plugins tab under Agents, with an en/zh summary like Aider's. Not on npm yet (E404 on registry.npmjs.org); magpie 0.1.1243+ installs it from `dist`, which the README's Publishing section says is no reason to hold a listing.

Run at the reviewed head 1ff93d8 (on top of origin/main e543ab1):
- registry.json parses; `bun scripts/check.mjs` exits 0; `bun test` in packages/type4me: 4 pass. PR checks (test, on-npm) green.
- dist: `tgz/magpie-community-agent-type4me-0.1.0.tgz` hashes to the sha512 index.json names; its type4me.agent.js is byte-identical to packages/type4me on main. Icon URL answers 200.
- Upstream Type4Me (joewongjc/type4me) reads `AppDataLocation.profileDirectory/magpie-agent.json` (MagpieAgentFile.defaultURL) and reloads it on mtime/size change, so "used from the next dictation" holds.
- Sandbox HOME (magpie 0.1.1208, the dist tarball's package added): Type4Me shows on `magpie agents` once ~/Library/Application Support/Type4Me exists; `magpie type4me magpie/fakeco/fake-1` wrote baseURL http://127.0.0.1:3425/v1, apiKey magpie-type4me, model fakeco/fake-1 and kept a user key beside them; `magpie type4me default` put back the user's own {"model":"user-own","extra":1}.

Not tried: the real Type4Me app dictating through magpie, and installing from `dist` (needs magpie 0.1.1243; the local one is 0.1.1208).
2026-10-15 15:38:05 +08:00
yetone e543ab1ae8 cursor 0.2.14: Run tool calls stay on one native Cursor session, and a tool past Cursor's limit resumes stateless, not as a failed turn (#135, nicegui)
Run at this commit: packages/cursor `bun test` (isolated HOME) 258 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 13:40:06 +08:00
nicegui 33cdf7c1a8 cursor: Run tool calls stay on one native Cursor session and resume stateless after a long tool, not a failed turn (#135, nicegui)
Cursor's Run (native) calls stay on one Cursor session across a tool result. With them, a tool that runs longer than Cursor's limit resumes stateless, not as a failed turn. The session pool lives in native-session.mjs. It applies to a conversation's first user turn, and a new user turn goes stateless (see the README). X-Magpie-Cursor-Continuity says which path a request took.

The dashboard-usage ledger counts two distinct events in one response that share a millisecond, as main did. Only timestamps claimed by earlier fetches are left out. A new deferred-usage test covers it.

Run at the reviewed head 398aeddc0186cfc38189b1f05577b181aa2d587d (merge base 5d5d86e; main has no packages/cursor change since):
- packages/cursor `bun test` 3 times: 258 pass, 0 fail each time.
- `bun test latency` 12 times with fresh HOMEs: 12/12 pass.
- Broken by hand: putting back `if (claimed.has(key + "\0" + ev.timestamp) || at >= before()) continue` makes the new test "distinct same-millisecond events in one response are billed together, not again on later fetches" fail (2 pass, 1 fail). The head's line passes.
- `bun scripts/check.mjs`: all packages pass.
- `npm pack`, extracted into a fresh dir: index.mjs, native-session.mjs, package.json, README.md. `import("./index.mjs")` exports CursorAuthPlugin and _internal, and native-session.mjs imports.
- CI: test and on-npm green.

Not tried: a real Cursor account. The owner's stored plugin sign-in has no access token. The author reports a real Claude Code run through an isolated gateway: a child resumed stateless after a 125s tool, and all 6 requests returned 200.
2026-10-15 13:39:14 +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
yetone ec8ae09cc8 workbuddy 0.1.23: credits used up leave the free models counted out, so magpie doesn't put the account last for deepseek-v4.1-flash (#138, hheei)
WorkBuddy serves a model at x0.00 (deepseek-v4.1-flash) with the account's
credits used up: hheei's account at 560 / 560 was still served it. The
usage read gave one Credits window over every model, so at 100% magpie's
routing ranked the account spent for its free models too: put behind every
other account, and moved off by conversation affinity.

The Credits window (personal and enterprise) now carries notModels: the
ids the account's live list (/v3/config) prices at x0.00. A model free only
some hours (a night promotion) still counts, as the list never says it is
free. A list that can't be read leaves the window as before. magpie reads
notModels as it does for Devin's and Cursor's windows (Limit.applies), so
For(free model) no longer sees the full window, and a 14018 on a paid model
rests only that model (Pooled), as PaidBesideFree already did.

Run: HOME=<temp> bun test in packages/workbuddy: 92 pass. Broke it by hand
(no notModels set): the two new usage tests go red. bun scripts/check.mjs
workbuddy: ok. Not tried against a real account at 100% credits; the
behaviour that free models are still served there is the reporter's.
2026-10-15 13:11:46 +08:00
yetone b015ee515e factory 0.1.29: Claude Code on GLM and other /api/llm/o models goes without the phrases Factory refuses, not "403 Factory: Forbidden" (Echoo on magpie's Discord)
Echoo, with Factory moved onto this plugin, got "API Error: 403 Factory:
Forbidden" from Claude Code on GLM-5.3-Flash, while Codex worked on the
same account and model. GLM is a chat model Factory serves on /api/llm/o,
so magpie translates Claude Code's Messages request into chat completions
(or Responses) before the plugin gets it. Only anthropicBody, the
/api/llm/a route, adapted Claude Code's fixed phrases Factory refuses (its
identity line, "You have been invoked in the following environment", "You
are powered by the model", update-config's "not Claude, so memory", tool
output quoting them). droidBody, for /api/llm/o, only added droid's line,
so all of them went to Factory as they were. The headers, the model and
the account are the same for both agents; Codex's prompt has none of the
phrases.

anthropicBody's per-text adapters are now functions of their own
(claudeIdentity, promptText, systemMessageText, userBlockText), and
droidBody applies them to chat completions and Responses:
- chat's first system message and Responses' instructions as a system
  prompt; other system and developer messages as system messages;
- user text as a user block; a chat user string, where magpie joins a
  turn's blocks with nothing between them, also reminder by reminder;
- chat's tool messages and Responses' function_call_output as tool output.
The Messages route is unchanged: the refactor kept every earlier test
green before the new code went in.

testdata/claude-code-2.1.300-glm-{chat,responses}.json are magpie's
translations of a real Claude Code 2.1.300 request, captured in a sandbox
HOME (paths changed to /Users/me, tools left out).

Run: bun test in packages/factory, 143 pass. With index.mjs at 0.1.28 the
new claude-chat.test.mjs fails 4 of 5 (the Codex one passes on both).
bun scripts/check.mjs factory: ok. Routed the captured request through the
plugin: each refused phrase is 0 in the chat and Responses bodies now, as
on /api/llm/a (1 each with 0.1.28).
Not tried against Factory itself: there is no Factory account to try with.
2026-10-15 12:53:14 +08:00
yetone cbff94eb43 zen-free 0.1.8: the free models Zen lists are offered again when OpenCode's docs or catalog can't be read, and the docs are read from where they moved (yetone/magpie#2305, MiniFullC)
The reporter, on 0.1.7 with the public key, saw only Big Pickle, Space
Bunny Free and Muse Spark 1.3 Free: the three models the plugin knows
offline. Two causes:

- DOCS pointed at packages/web/src/content/docs/zen.mdx, which OpenCode
  removed on 2026-10-12 (anomalyco/opencode#54761, "replace old Zen and Go
  pages with V2 console docs"). It answers 404, so every discovery since
  was partial. The endpoint table now lives in
  services/www/src/docs/content/console/models.mdx; parseProtocolDocs
  reads its rows as they are.
- A listed model the catalog (models.opencode.ai) didn't describe and the
  docs didn't name was left out. When the catalog can't be read, that is
  every listed model but the three in bootstrapProvider, which is the
  reporter's list exactly. bootstrapProtocols is now a snapshot of the
  console docs' free rows (2026-10-15), used under whatever the docs say,
  and bootstrapProvider gains the catalog's metadata for Cat Jam, Step 5
  Preview, LongCat 2.5 Preview, MiMo-V2.6-Flash and Nemotron 3.5
  Lightning Free.

Not changed, on purpose: jev-1.13-free is a SystemOne decision model
(docs: endpoint /v1/systemone, no AI SDK package), which can't answer a
chat, so it stays out as SystemOne models always have. exo-free is
"deprecated" in the catalog and not in Zen's /models list now.

Tests (no network; the fixture server): "listed free models are offered
when the catalog and the docs can't be read" (catalog 503, docs 404,
listing big-pickle, step-5-preview-free, cat-jam-free, jev-1.13-free,
paid -> the three free chat models only) and "reads the console docs'
endpoint table, and Jev stays out as SystemOne" (literal rows from the new
page). Both fail on 0.1.7's models.mjs/provider.mjs (2 fail, 170 pass)
and pass with the change; bun test: 172 pass. bun scripts/check.mjs ok.

Real use (live Zen, public key, this checkout): discovery now lists
big-pickle cat-jam-free longcat-2.5-preview-free mimo-v2.6-flash-free
muse-spark-1.3-contributor-free nemotron-3.5-lightning-free
space-bunny-free step-5-preview-free, not fallen back (0.1.7: the same
eight with the docs 404 marking it partial). A request to cat-jam-free
through the plugin's fetch streamed 200; step-5-preview-free answered
Zen's own 429 "Upstream request failed: Endpoint is unavailable." twice.
The reporter's catalog failure itself wasn't reproduced from here.
2026-10-15 12:08:28 +08:00
yetone 157c7c0f88 devin 0.1.17: a tool whose schema has a list type, an array with no items, or properties or an enum with no type goes to Gemini models in a shape they take, not "There is an issue with this request" (7eleven on Discord)
7eleven, in ZCode on devin/gemini-4-argon, got every turn refused:
"Devin: There is an issue with this request, please try a different
model." (invalid_argument). It is the request content, on Gemini models
only. On a real account, gemini-4-argon, gemini-3-1-pro and
gemini-3-8-flash refuse a request offering a tool whose schema has, at
any depth:
- a list type: ["string","null"], ["string"], ["string","number"];
- type "array" with no items, items true, or items that are a list;
- properties with no type;
- an enum with no type.
claude-sonnet-4-6 and swe-2 take all of them. Nullable written as anyOf,
items {}, nullable:true, const, $ref/$defs, additionalProperties and
format all go through on Gemini.

geminiSchema rewrites them, for a Gemini uid only:
- a list type becomes its one type, nullable when it had "null", or
  anyOf of each type;
- such an array's items become {} (a one-schema list becomes that
  schema);
- a schema with properties gets type object;
- an enum gets its values' type, and an enum of mixed values is dropped.
The caller's schema is not changed. Claude and swe-2 requests are byte
for byte what they were.

What was run:
- HOME=$(mktemp -d) bun test packages/devin: 80 pass.
- gemini-schema.test.mjs, with the gemini line in build() turned off by
  hand: 10 red, one per refused shape.
- bun scripts/check.mjs: ok.
- Real account: each refused schema, sent as built here, went through on
  gemini-4-argon-medium and gemini-3-1-pro-high.
- build() end to end with a search tool holding a list type, an array
  with no items and an untyped enum: gemini-4-argon called the tool, where
  0.1.16 got invalid_argument. claude-sonnet-4-6 called it on both.

Not tried: ZCode itself against the plugin. The reporter's exact tool is
not known; ZCode's own zod 4 tools write anyOf, so it is likely one of
their MCP or plugin tools.
2026-10-15 11:08:07 +08:00
yetone 5d5d86e225 qoder 0.2.16: a tool call written into the text that can't be read, or that the stream ends inside, ends the turn as an error, never as the answer (#132)
A <tool_call> block whose JSON wasn't whole ({"path":}) was reprinted as
text, and one the stream ended inside was flushed as text; either way the
turn finished "stop" with a 200, the call lost and nothing to fail over on.
Mirrors trae since 0.2.5 (#38): a block on its way to being a call (its
content starts with "{" or holds "<function=") that can't be read, or is
cut short at the end, ends the turn as an error: the stream with the error
frame and no finish, a request not streamed (or one with nothing before the
block) a 502. A block whose JSON (or XML function) is whole when the stream
ends without its close is still the call. A tag in a code fence or inline
code, or one that isn't call-shaped (<tool_call>incomplete), stays text.

Siblings: only trae (already fixed) and qoder parse calls out of the text;
grep for tool_call/function=/invoke/DSML across packages/*/index.mjs finds
no other parser.

Run at this head:
- textcall.test.mjs (new, the issue's literal frames: closed with bad JSON,
  stream ends inside, readable control, whole JSON without its close, XML
  form, look-alike text; streamed whole and 3 chars per frame, and not
  streamed): 7 of 9 red on the 0.2.15 code (the control and look-alike
  tests passed there), all green after.
- packages/qoder: 118 pass, 0 fail.
- Whole repo as CI runs it: HOME/TMPDIR in a scratch dir, bun test:
  1320 pass, 0 fail; bun scripts/check.mjs: ok.
Not tried against a real Qoder account; the frames are the reporter's.
2026-10-15 07:10:01 +08:00
yetone 8a28086bf1 opendesign tests: the real fetch is put back after each test, so every package's tests after it pass again (publish red since #84)
bun test runs every package's files in one process. opendesign's tests
set globalThis.fetch directly, and mock.restore() doesn't undo that, so
every file after it (minimax, trae, zcode, zen-free: 148 tests) got
opendesign's stub and failed. The publish run at 3db704a went red at its
test job, so neither dist nor npm ran. #84's review saw these failures
and wrongly put them down to load.

Run: `bun test packages/opendesign packages/minimax packages/zen-free
packages/trae/usage.test.mjs` with HOME in a temp dir: 234 pass, 0 fail.
Without this change: 34 fail.
2026-10-15 06:57:55 +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 3351e47715 cursor 0.2.13: a Run cancelled while it opens is closed upstream (#130), and dashboard usage is counted per account (#131)
#130: a cancel that landed between the HTTP/2 head and runOnce's abort
listener left the Run streaming upstream with its heartbeat, for nobody.
#131: claimed/owed/flights are keyed by account and conversation, so one
account's Run no longer collects another's debt from its own dashboard.

Run at this commit: full `bun test` (isolated HOME) 1292 pass, 0 fail;
`bun scripts/check.mjs` ok. Version bump only.
2026-10-15 04:15:31 +08:00
nicegui 7c49260ac1 cursor: isolate dashboard usage accounting by account (#131)
Cursor's dashboard usage accounting is kept per account, not per conversation.

claimed, owed and flights were keyed by conversation_id alone. When one
conversation's steps ran on two accounts (magpie moving a session between
Cursor accounts), account B's Run collected A's debt from B's own dashboard:
B's own event was counted as A's earlier Run's usage (magpie_deferred) and
B's turn-ending step polled for a debt its dashboard can't have. The keys
are now sha256(token) + conversation_id (usageKey), used by collect, owe,
ledger and the flights cleanup alike. A token change starts a new identity,
as misses/unreadable already were keyed.

Reviewed at 19bbdf8d7162735d7ddafd015d8dfadbb233c3bd, then merged main
(ca6415f, #130) into the branch at 74578e51e4214b75056746aa81ecc8fcba104ed2;
the only conflict was the _internal export line (both openH2 and usageKey
kept). Diff against main unchanged (168+/34-).
- full `bun test` (isolated HOME/TMPDIR): at 19bbdf8 1267 pass/0 fail; at
  74578e5 (with #130) 1292 pass/0 fail; `bun scripts/check.mjs` ok; PR CI
  green at 74578e5.
- own test: A owes one Run on conv, the next step runs on B whose dashboard
  shows B's own event. On main B's owed(true) returns B's event as A's debt
  and polls B's dashboard; here it returns null with no request, and A later
  collects its own event.
- broke by hand: usageKey back to conversation alone fails the three new
  stepusage tests.
Not tried: real Cursor accounts. A conversation moving accounts leaves the
first account's collected-but-unreported carry under that account (expires
after owedFor) instead of reporting it on the other account's row.
2026-10-15 04:15:03 +08:00
nicegui ca6415f959 cursor: cancel and clean up stateless Run transports (#130)
A Chat cancelled while its Run opens is closed upstream, not left running.

Before, a cancel that landed after the HTTP/2 head arrived but before runOnce
subscribed to the signal was never seen ({once:true} listener added to an
already-aborted signal): the Run kept streaming upstream for nobody with its
5s heartbeat interval, and the session was never closed. open/openH2/openH1
now check the signal at each hand-off, close what arrived, and remove their
abort listeners; runOnce checks again before starting the heartbeat. HTTP/1's
write callback now waits for its BidiAppend, so backpressure and close see
the pending upload. A cancelled open answers 410 instead of 502.

Reviewed at a4e1db1b0d734c1a1b15c1fe0cafb0f9cb5313c0 (on main 5fc0a75):
- full `bun test` (isolated HOME/TMPDIR): 1288 pass, 0 fail (main: 1265/0);
  `bun scripts/check.mjs` ok.
- own plugin-level test (fake HTTP/2 session, abort a microtask after the
  200 head, upstream never ends): on main the request hangs, req never
  closed or destroyed; at this head it answers at once, req closed once.
- broke by hand: dropping runOnce's aborted check fails "the plugin: head
  abort ..."; reverting the H1 write callback to an immediate cb() fails
  three openH1 append tests.
- checked: destroying the H1 Duplex with a write in flight emits no
  'error' (bun and node); 410 "the request was cancelled" doesn't match
  magpie's modelRetired words.
Not tried: a real Cursor account or a real proxy (offline fakes only).
2026-10-15 04:13:01 +08:00
yetone 5fc0a75292 zen-free 0.1.7: free models answer again, asked at opencode.ai/inference/v1 with stand-in tools that take a parameter (c9cu on Discord)
c9cu on magpie v0.1.1239: "opencode muse 1.3 又不行了". Every free model
answered 403 FreeTierError "OpenCode's free tier can only be used from
within OpenCode" through 0.1.6 and magpie's built-in alike.

Found against the real upstream on 2026-10-15, with OpenCode 1.19.0's
own requests captured through a local proxy under a sandbox HOME:
- OpenCode now asks https://opencode.ai/inference/v1 (models.dev gives
  it this URL). Its own captured request, replayed word for word, is
  200 there and 403 at /zen/v1.
- Zen also refuses bash or read offered with no parameters, as the
  stand-ins here were ({"properties":{}}); one property is enough.

Now:
- DEFAULT_BASE is the inference API. A request still sent to a model
  listed at /zen/v1 is accepted and asked at the inference API.
- Each stand-in takes OpenCode's own first parameter (bash command,
  read/edit filePath, glob/grep pattern), still "Never call this tool".

Run:
- bun test in packages/zen-free: 170 pass. With 0.1.6's provider.mjs
  put back by hand: 13 fail (the 12 tool-guard tests on the stand-ins'
  parameters, and the new inference-API test).
- bun tools-smoke.mjs against the real Zen: big-pickle,
  mimo-v2.6-flash-free and muse-spark-1.3-contributor-free, streamed and
  not, all 200 with a Bash call.
- npm shows 0.1.1 as latest: publish runs refused this package (no
  Trusted Publisher), so 0.1.2 to 0.1.6 never reached users; 4ef68fb's
  NPM_TOKEN path is what publishes this one.
2026-10-15 02:00:11 +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 9cfc18ae52 grok 0.1.15: a sign-in without Grok Build says GROK_BIN_DIR takes one put in a folder of your own, not only the curl installer (yetone/magpie#2223, evier12345)
In magpie's Docker image there is no curl to run xAI's installer, and a
grok binary dropped on PATH outside a .grok folder isn't taken (isGrokBuild
keeps another program named grok out). GROK_BIN_DIR already took one as it
is; the error now says so, and the README says where the CLI is looked for.

Run: TMPDIR=<scratch> HOME=<scratch home> bun test in packages/grok (41
pass, 0 fail); bun scripts/check.mjs grok (✓). With index.mjs put back to
0.1.14, import.test's "no Grok Build … is refused first" fails on the new
GROK_BIN_DIR assertion. Not tried in a real container from this commit;
magpie's own fix (installing Grok Build before `magpie plugin login grok`)
is in yetone/magpie.
2026-10-15 00:33:49 +08:00
yetone f2f4ff4014 cursor 0.2.12: Grok Bot is among magpie's three panel rings ahead of an On-demand with no limit (yetone/magpie#2213, Morganwan90)
The usage windows went Cursor Models, Other Models, On-demand, Grok Bot,
Total. magpie's tray panel draws an account's first three, so on an
account that may spend on-demand without a limit, the On-demand ring
(always 0%, only a dollar figure) pushed Grok Bot out, while an account
with no on-demand showed Bot third.

An On-demand with no limit (aside) now goes after Bot, beside Total. One
with a limit keeps its third place ahead of Bot: it is the window that
can stop the account's requests, with the pools aside.

Run: bun test in packages/cursor (89 pass), bun scripts/check.mjs (all
packages ok). The new test fails on 0.2.11's index.mjs (Bot fourth,
On-demand third). Not tried with a real Cursor account that has Grok Bot
and on-demand.
2026-10-14 23:22:05 +08:00
yetone e8fdbdb616 cline 0.1.8: a model takes images where Cline's catalog says it does, not "text only" for every model (silent on Discord)
runtimeModel said input.image false for every model, so magpie, which
takes a plugin's said capability over models.dev's, treated ClinePass's
DeepSeek V4.1 Flash and GLM 5.3 Flash as text-only: the image tick stayed
off and images went to a describer model.

/ai/cline/models already carries architecture.input_modalities (Cline's own
client reads images from it). fetchCloudModels now keeps it; a feed model
gets its own entry's, else the entry of the model after its prefix
(cline-pass/deepseek-v4.1-flash is deepseek/deepseek-v4.1-flash; :batch
variants count as the model) when every such entry agrees. Where the
catalog says nothing, image is left unsaid, so magpie asks models.dev
instead of being told no. attachment follows image.

Run: bun test packages/cline (80 pass); the new hook test fails with the
old hardcoded input (79 pass, 1 fail); bun scripts/check.mjs cline passes.
The models hook against Cline's live public catalog (no sign-in) gives
cline-pass/deepseek-v4.1-flash and glm-5.3-flash image true, glm-5.3 and
deepseek-v4-pro false, qwen3.8-max unsaid. Not tried with a signed-in
ClinePass account sending a real image.
2026-10-14 23:10:01 +08:00
yetone 9803210691 trae tests: a stream that breaks off breaks after the caller has its first event, not 30 ms after it was sent (#124)
The test's fake server sent one event, waited 30 ms and errored the body.
The plugin reads its first part before it answers. Under the whole repo's
`bun test` that read sometimes started after the reset, and Bun then drops
the event it had already received. The read threw ECONNRESET out of the
plugin's fetch instead of reaching the mid-stream path the test covers
(1259 pass, 1 fail at a6bed5e). The reset now waits until the caller has
read "half", so the plugin has always read it first. Only the test
changed. index.mjs is untouched, so there's no version bump.

Run at a6bed5e + this change, TMPDIR and HOME set to a scratch dir:
- before the change, repo-root `bun test`: 1259 pass, 1 fail (this test).
  A 200 ms pause put by hand before the plugin's first read failed it
  every time when run alone.
- after: repo-root `bun test` 1259 pass, 0 fail, 1 skip (exit 0);
  packages/trae `bun test` 129 pass; stream.test.mjs alone 3/3;
  `bun scripts/check.mjs` exit 0.
- with the same 200 ms pause in place: passes.
- broke it by hand: index.mjs ending a broken stream with finish "stop"
  and no error turns this test red.
- grep found no other test that resets a body on a timer.

Not tried: CI's Linux runner. CI's publish runs had passed this test so
far (e.g. 38572309548). Their red was the zed and zen-free Trusted
Publisher 404s.
2026-10-14 22:12:50 +08:00
yetone 95af6cf375 factory 0.1.28: the Fast Mode models are listed last, so a provider with nothing picked shows GPT-5.3-Codex, Grok and GLM again (#119, psylch)
magpie shows a provider with no models picked only the first 24 of its
list. 0.1.27 placed each Fast Mode model beside its base model, which
pushed GPT-5.3-Codex, Grok 4.7, Grok 4.6, GLM-5.3 and GLM-5.3-Flash past
24 ("not exposed"). The six Fast Mode models now come after every other
model, so the first 24 are 0.1.26's again. Asking a base model for fast
still reaches its Fast Mode model (fastBody), and a Fast Mode model can
be picked by name.

Run: bun test packages/factory (138 pass), bun scripts/check.mjs (all
plugins pass). The new fast.test.mjs case fails on 0.1.27's order (put
back by hand: 3 pass, 1 fail) and passes with this one.
Not tried: a real Factory account; magpie's exposure was not run against
the published package, only the list order checked.
2026-10-14 22:12:00 +08:00
yetone a6bed5ec54 workbuddy 0.1.22: an MCP server's tool schemas reach Kimi and DeepSeek, not 400 11133 "Invalid request parameters" (#122, clearmann)
Cause: Kimi's tool-schema check (kimi-k3-1, also kimi-k2.7) turns away
schemas that MCP servers and plugins commonly send, with 400 11133
"the request parameters were rejected by the model provider". It is
the request's content, not the account: on the owner's China account
each shape alone in an otherwise plain chat failed every time, and the
same chat with it mended passed. Shapes refused: an enum with no type
(all strings too, under items, anyOf, an unused $defs), an empty enum,
an enum whose type lists two types besides null, true/false where a
schema goes (properties.x, items), a required that isn't a list, and an
unknown type ("any", "String"). Claude Code's own 24 tools have none of
these, which is why tool-less side requests passed for the reporter.

fitShape walks schema positions only (a property named enum or type is a
name) and gives each the shape Kimi takes, meaning the same: an untyped
enum takes its values' type, or [T, "null"]; several types become an
anyOf of typed enums; true is {}, false is {"not": {}};
additionalProperties booleans are left. An empty enum (which nothing
fits) is left out. It runs for every model, as fitTools already does.

WorkBuddy 5.5.6's own CLI (codebuddy.js, read-only) only cleans schemas
for Gemini and only drops temperature for kimi-k3, so it would hit the
same 400 with such an MCP tool.

Ran, real account (China build, plugin loader fetch, old vs new):
- 14 refused shapes on kimi-k3-1: each 400 11133 before, 200 after.
- one MCP-like tool holding all of them: kimi-k3-1 and kimi-k2.7 400
  11133 -> 200; deepseek-v4.1-flash and deepseek-v4-pro 400 11129 ->
  200; glm-5.3 400 11133 -> 200; minimax-m3 and hy3 200 both.
- HOME=$(mktemp -d) bun test in packages/workbuddy: 89 pass; the new
  tests go red (4 fail) with the fitShape call taken out.
- bun scripts/check.mjs: ok.
Not tried: WorkBuddy AI (international) models, and a real MCP server
through Claude Code end to end. glm-5.1 answers 11150 to every chat on
this account (unrelated, also before).
2026-10-14 21:15:24 +08:00
yetone a810ee7e88 zen-free 0.1.6: a free-model request carries exactly the headers OpenCode 1.19.0 sends to Zen, and none of the caller's (xiaoxiaofeixz on magpie's Discord, #100, #108)
Since 10-13 Zen answers 403 FreeTierError ("OpenCode's free tier can only
be used from within OpenCode") to a free-model request that isn't
OpenCode's. npm still serves 0.1.1, which gets that 403 on every model;
0.1.5's OpenCode-form session id (9074723) fixed it but never reached npm.
The owner allows mimicking OpenCode's client on this route (client
mimicry is allowed for every vendor but Claude Code), so this reverses
643ef50's README note.

Diffed against the release binary itself: OpenCode 1.19.0
(anomalyco/opencode v1.19.0) run in a sandbox HOME with the opencode
provider's baseURL pointed at a local capture server, on chat, responses
and messages. It sends accept */*, content-type, user-agent
"opencode/1.19.0 ai-sdk/provider-utils/<v> runtime/bun/1.3.14" (4.0.23
chat, 4.0.40 responses, 4.0.46 messages), x-opencode-project, -session,
-request, -client, -session-id, and the key (authorization, or x-api-key
with anthropic-version). It sends no x-session-id or x-session-affinity
to its own gateway (session/llm/request.ts). 0.1.5 differed in: those two
extra headers, accept text/event-stream, the chat UA on every protocol,
and every header the caller sent going on (through magpie: the agent's
own User-Agent, x-stainless-*, anthropic-beta...).

0.1.6 builds the upstream headers from that list alone: the caller's are
read only for the session and project, anthropic-version/-beta kept on
messages. The new per-protocol test checks the exact set and fails on
0.1.5 (4 fails); the forced-streaming test now expects no
x-session-id/x-session-affinity.

Run:
- bun test in packages/zen-free: 169 pass, 3 runs; bun scripts/check.mjs
  zen-free passes.
- Real opencode.ai, anonymous key "public": npm's 0.1.1 gets 403
  FreeTierError on big-pickle, mimo-v2.6-flash-free and
  muse-spark-1.3-contributor-free, streamed and not. 0.1.6's
  tools-smoke.mjs: 200 with a Bash call on all three streamed and on
  big-pickle not streamed; muse non-streamed 200 without a call;
  mimo non-streamed timed out at 90s, the same on 0.1.5.
- magpie 0.1.1208 in a sandbox HOME (scripts/try.sh zen-free): sign-in
  with public, then `provider test opencode-zen-free`: chat (big-pickle)
  and responses (muse-spark) both pass.
Not tried: a messages-protocol free model (Zen has none free now), Windows.
2026-10-14 18:57:57 +08:00
yetone 98911ae4d4 trae 0.2.13: publish #106 (the call a service left mid-wrapper in a native call's name)
#106 merged as 0.2.12, which main had already published for the cache
fix (4df82ce), so it needs its own version to reach npm. Version bump
only. Ran: bun test in packages/trae, 129 pass.
2026-10-14 18:36:53 +08:00
YuCreateandyu b32b510c9d trae 0.2.12: the call a service left mid-wrapper in a native call's name is read as the call (#106)
trae-cn/glm-5.3 under DSH (2026-10-13): over three turns, 28 of 54 native calls
arrived with the model's call in `function.name` instead of `function.arguments`
— the JSON wrapper the tool prompt asks for, with GLM's own
<arg_key>/<arg_value> tags where Trae's service stopped reading it, and a value
whose close left off:

  {"name":"bash","arguments":{"command</arg_key><arg_value>ls -la</arg_value>
  {"name":"bash","arguments":{"command":"grep -n x a.ts | head -3</arg_value>
  {"name":"bash","arguments":{"command":"grep -n "x" a.ts","description":"…"}}
  bash_abstract_command_0>{"name":"bash","arguments":{"command":"…scan.mjs</description>Re-run scan</arg_value>

Each went out under a name no request declares, so the agent answered "unknown
tool" and the call was lost — twelve steps in a row before the model recovered.
All 28 sit in the context the session compacted at the end of turn 8: turn 9's
input went from ~5k to 94.5k tokens. Whether the compaction is what makes the
service hand a call back this way is not established — only that the two line
up, and that the session's earlier turns on workbuddy-ai/hy4-preview-f and
group/auto-hy4-preview-f sent 270 whole calls and none of this shape. No
workbuddy/glm-5.3 call was routed that day, so nothing is claimed about it.

- A name holding the wrapper is read as the call: the tool, then the fields the
  text between the tags still spells out. The tags are the service's own
  handoff, so what stands between them is the model's text as the model wrote
  it: a quote left unescaped is read as the quote it is, a value the service
  cut at its tag keeps the text it got, a comma inside a value is the model's
  own (`sed -n 1,9p` reads whole), and a closing tag that is a field's own
  (`</description>`) ends the value before it — what follows such a tag is the
  service's text, not the model's.
- A field the tool's schema says is no string is its JSON where the text is
  one, and its text where it isn't.
- The native call's own arguments are kept, and the name's fields are filled in
  beside them: the service moves the arguments it read into the call and leaves
  the rest in the name, so the two halves are one call (command in the name,
  description/workdir in the call).
- A name whose tool the request doesn't have, or one no field can be read from,
  goes on as written, as any other unknown tool does — including one the
  service cut before it wrote a value (at a key, at a colon, at an open quote),
  where an empty call read out of it would be a call the model never wrote.
  Calls already written into a session's history under a mangled name still go
  back on as that name; the plugin reads what it is handed and cannot rewrite
  what was already sent.
- What main already read of a whole name keeps reading the same (`input`,
  `parameters`, arguments given as a string, the flat fields, a wrapper written
  with a space), and a call's own arguments that are not a set of fields — text
  the service cut, a value that isn't a call's fields — go on as they stand, as
  main passed them, for the agent to answer.

The wrapper and the tags are upstream's; the plugin reads what it was handed.
The same shapes are already handled by the DSH-ecosystem relays (trae2api's
_ARG_KEY_VALUE_RE takes a key whose opening <arg_key> was dropped) and by
@ai-sdk-tool/parser's GLM-5 name resolution (a declared name followed by a
structural tag is that tool), which is where the fail-closed reading of an
unknown name comes from.

Run: namecall.test.mjs (16 tests; the real payloads, a name in front of the
wrapper, a field's closing tag cut into a value, a comma inside a value, the
whole-name shapes main reads, the shapes the reader must leave alone, and the
streamed path) — 11 of 16 fail on main's index.mjs, the five that pass being
the ones that pin what main reads.
HOME=<tmp> bun test, 125 pass 0 fail; bun scripts/check.mjs trae green. The 28
payloads this was drawn from were replayed through NativeCalls.take: 28
recovered into calls to tools the request declares, and the 270 calls that
arrived whole in the same session unchanged, byte for byte. Against the same
names and calls main can take (187 pairs) the only differences are the fields
the name's side fills in beside the call's own, and the names main could not
read at all.

Co-authored-by: yu <wowyuarm@users.noreply.github.com>
2026-10-14 18:36:39 +08:00
unship a6f09a0e9a qoder: add PAT (Personal Access Token) sign-in method (#103)
* qoder: add PAT (Personal Access Token) sign-in method

Add a new auth method that exchanges a PAT for a job token via
/api/v1/jobToken/exchange, bypassing the OAuth device flow. PATs are
long-lived (up to 1 year), avoiding the ~3-day re-authentication cycle
of OAuth refresh tokens.

Changes:
- Add patSignIn function for PAT → job token exchange
- Add "Sign in with Qoder PAT" method with password prompt
- Handle PAT accounts in usage (no device token available)
- Add pat.test.mjs with 10 tests covering both sites
- Update vpc.test.mjs for new method count

* qoder: use text prompt type for PAT (magpie has no password type)

magpie's prompt system only supports "text" and "select" types.
Change the PAT prompt from "password" to "text" to match.

* qoder: use password prompt type for PAT input

Now that magpie supports "password" prompt type, use it for PAT input
so the token is masked when typed in both GUI and TUI.

* qoder: address PR review — PAT kept, fields read as Qoder's client does

1. Store the PAT on the credential; when the job refresh lapses
   (SignInGone from refreshJob), re-exchange the PAT instead of
   marking the account signed out. The PAT lasts a year, the refresh
   two days.

2. Read the exchange response as Qoder's client does:
   - token from token, device_token or access_token
   - refresh from refresh_token or refreshToken
   - expiry from expire_time or expires_at (date) first, then
     expires_in in seconds (not milliseconds)

3. Use the openapi() helper for the exchange (no custom User-Agent);
   400/401/403 say "refused the PAT" rather than passing through the
   raw body.

4. Try the usage endpoint with the job token for PAT accounts; fall
   back to the "PAT" plan label if it won't accept it.

5. Exclude the PAT method from Qoder CN: its CLI uses device chat
   directly and never makes a job token, so a PAT exchange may not
   produce one the chat endpoint accepts.

* qoder: fix expires_in unit — milliseconds, not seconds

The real exchange response shows expires_in: 86400000 (24h in ms),
not 86400 (seconds). The expires_at date field takes precedence in
exchangeExpiry, so the fallback was not hit in practice, but correct
it for completeness.

* qoder: drive the renew test through the real refresh path, usage through fetchUsage

The renew test called the PAT sign-in directly, so it never met the
fallback it was named for. It now loads a stored expired credential
whose job refresh is refused, and checks the exchange is asked with the
stored PAT, the request goes on with the new token, and the saved
credential still carries the PAT — and fails when the fallback is
taken out. A second case keeps no PAT on the credential and expects
the sign-in gone to come out.

The PAT branch of usage built fetchUsage's request by hand and turned
every error into a plan of its own; it calls fetchUsage now, its
errors surfacing as the device path's do. A live PAT account answered
the usage endpoint 200 with a qoder envelope on the job token from the
exchange, said so in the comment there.

* qoder: a refused PAT re-exchange ends the sign-in

The renew fallback let a refused PAT through as a plain error, which
magpie read as a server fault and kept the account on. A PAT lapses
like a device sign-in does — expired, or revoked — so renew turns the
exchange's refusal into a lapsed sign-in: usage says "expired" and the
request answers 401, asking for a new PAT. Interactive sign-in keeps
the plain error.
2026-10-14 18:34:37 +08:00
yetone e87ea310c3 zen-free tests: the other 32+ MiB guard tests get the CRLF test's 60 s timeout
"cumulative pending chat tools are limited across choices and calls" and
"chat: completed tool buffers release their cumulative budget" push 33-34
MiB through guardToolResponse and timed out at bun's 5 s default on a
machine at load ~200-280 (5104 ms, 5299 ms, 5525 ms). The CRLF test had
the same cause and already carries { timeout: 60_000 }; its two siblings
that also move 32+ MiB ("single SSE event limit is 32 MiB...", "text
streams larger than 32 MiB...") get it too. The work itself is the
point of the tests (the 32 MiB limit), so it isn't shrunk.

Run: bun test in packages/zen-free 3x at load ~200: 166 pass each time.
Before the change the same file failed at this load. Tests only, no
version bump, nothing published.
2026-10-14 18:28:35 +08:00
yetone 2170a3781e factory 0.1.27: droid's Fast Mode models, and fast asked of their base model goes to them (#119)
psylch on #119 (plugin 0.1.26): claude-opus-5-5-fast answered "Factory:
Not found.", and Opus 5.5 asked with speed "fast" was recorded as
tier_asked fast, tier_served standard, with nothing said.

The plugin now offers droid 0.240.0's Fast Mode models: Opus 5.5/5/4.8
Fast on Anthropic's API, GPT-5.5/5.4/5.3-Codex Fast on Responses, each
at its base model's limits and efforts. They go out as droid 0.240.0
sends them (read from its binary, saved in testdata/droid-0.240.0-fast.txt):
the Fast Mode id itself as the model, with speed "fast" and the
fast-mode-2026-02-01 beta for anthropicFastMode models, at service_tier
"priority" for the GPT ones (their apiRequest Ee). A request asking a base
model for fast (speed "fast" on Messages, service_tier "priority" on
Responses) is sent to its Fast Mode model, as droid's fast toggle
switches to it. A model with no Fast Mode model is sent as asked. Left
out: Opus 4.6/4.7 Fast and GPT-5.4 Mini Fast (base not offered), GPT-5.6
Sol Fast (unreleased:!0), GLM-5.2 Fast (feature flag, a Baseten id).

Run: the full bun test (1222 pass, 0 fail) with a sandbox HOME; the new
fast.test.mjs and the picker test fail on the old index.mjs (4 fail).
Not tried: a real Factory account (none signed in here), so whether
Factory serves the Fast Mode ids at fast speed to a plan, and what its
usage says about speed, is unverified. A non-stream request magpie
translates for a plugin account drops speed before the plugin sees it,
so there only the -fast ids reach fast.
2026-10-14 17:53:22 +08:00
yetone 779e9b2368 kiro 0.1.11: a thinking model offers xhigh as its own level, so Claude Code's xhigh isn't routed as max (#120)
The variants came from BUDGETS (low, medium, high, max), while thinking()
already read xhigh. magpie fits an effort the model doesn't offer to the
nearest it does, so Claude Code's xhigh on a moved Kiro was recorded and
sent as max: 166 of the reporter's requests on 10-14, after the built-in,
which takes xhigh, had served it as xhigh the day before.

BUDGETS now has xhigh at 50k, the budget thinking() and the built-in's
kiroThinkingBudget give it, so what Kiro is asked is unchanged; only the
level magpie records and passes is. Both configModel and runtimeModel
read BUDGETS.

Run: bun test across the repo (TMPDIR+HOME in the scratchpad), all pass;
the new effort.test.mjs fails on the old BUDGETS. Not tried with a real
Kiro account (none signed in on this machine).
2026-10-14 17:28:46 +08:00
yetone 15d16f5ff0 workbuddy 0.1.21: a model free only at night is never said free; a whole-day discount shows the price before it (#121)
WorkBuddy's /v3/config prices a model by its "credits" and by a
modelPromotions list the picker reads for its badges: Hy3 限时免费 (whole
days to 10-31), Step-5-Preview 独家限免 (10-12..10-25), Hy4 preview 夜间免费
(free 23:00–8:00 only), GLM-5.2 and DeepSeek 夜间折扣. The plugin read only
"credits", and magpie keeps a plugin's model list until it next asks, so a
list read at night said Hy4 preview was free all day (#121's screenshot:
免费 in magpie, 0.29x and 夜间免费 in WorkBuddy).

priceOf now reads both. A model under a promotion with daily hours is given
at its full price and never as free (unpriced when the credits read 0 under
a night discount). A running whole-day discount is the price now, with the
credits before it as rateWas, which magpie already shows struck through.

Run:
- bun test across the repo (TMPDIR+HOME in the scratchpad): 1219 pass. The
  new price.test.mjs, built from the promotions copilot.tencent.com gave on
  2026-10-14, fails 3 on the old code.
- The owner's real WorkBuddy and WorkBuddy AI accounts through liveModels
  (17:10 CST): Hy4 preview 0.29, Hy3 and Step-5-Preview free, the rest at
  their credits, matching WorkBuddy's picker.

Not tried: the config as served at night (whether "credits" itself reads
x0.00 then); the unpriced branch covers that case.
2026-10-14 17:16:39 +08:00
yetone 4df82ce1b5 trae 0.2.12: what Trae's token_usage says the prompt cache read and wrote reaches magpie (01huadalang on magpie's Discord: K3, 53 calls, every one 0 cache hits)
tokensOf kept only prompt_tokens, completion_tokens and total_tokens of
Trae's token_usage, so every request reached magpie with no cache count
and Usage/Routing showed 0 hits. Trae's event carries more: TRAE SOLO
CN 3.5.20's ai-agent (libai_agent.dylib, the serde field list of
infrastructure/adapter/llm/event.rs's TokenUsageEvent, read from the
binary's __DATA_CONST) is name, prompt_tokens, completion_tokens,
total_tokens, reasoning_tokens, cache_creation_input_tokens,
cache_read_input_tokens, prompt_tokens_total, completion_tokens_total.

cache_read_input_tokens and cache_creation_input_tokens now go on in the
OpenAI usage under those names; magpie's gateway (chat.go cUsage) reads
them beside prompt_tokens as it reads a relay's in front of Claude, and
judges there whether prompt_tokens counts them too. An OpenAI
prompt_tokens_details.cached_tokens, if Trae sends one, is kept as it
came, and reasoning_tokens goes as completion_tokens_details. No cache
count adds no field.

cache.test.mjs (stream and single answer with the TokenUsageEvent's
fields, OpenAI's details, none) fails 3 of 4 on 0.2.11 and passes;
bun test (113 pass) and bun scripts/check.mjs trae under a temp HOME pass.
Not tried with a real Trae account (none here): that Trae fills the
cache fields for K3 in particular is not known.
2026-10-14 17:05:06 +08:00
yetone cff78b3424 devin 0.1.16: SWE-2 is free, so a used-up day and week don't hold it
太陽と向日葵 on magpie's Discord: SWE-2 costs nothing, but with the
account's quota used up magpie said so and didn't send SWE-2 to the
account, while a test of the model worked.

Devin's GetCliModelConfigs gives each model a model_cost_tier (field 24;
the CLI labels 1-4 "Low cost", "Med cost", "High cost", "Free"). On the
owner's account on 2026-10-14, of 262 configs only swe-2-high, -medium
and -max were 4. The plugin now reads that (parseFree), lists those
models and the entries standing only for them (swe-2) with free: true,
and gives the "1 day" and "7 days" windows notModels with their ids, so
magpie's allowance no longer counts them. ACUs are unchanged. When
Devin's configs can't be read, nothing is marked free and the windows
count every model, as before.

Run: bun test in packages/devin (58 pass) with HOME and TMPDIR in a
scratchpad dir; bun scripts/check.mjs. Broke it by hand: FREE_TIER=5
fails 3 of free.test.mjs's tests; dropping notModels fails the usage
one. Not tried: an account whose quota is really used up (the owner's
had 100% of the day and week left), so that Devin itself serves SWE-2
then is the reporter's word, not checked here.
2026-10-14 17:03:50 +08:00
yetone 95f7b51737 devin 0.1.15: every account's model list is Devin's own for its token, so Gemini 4 Argon is listed on Windows and without the CLI (#115)
On Windows the devin CLI reads %APPDATA%\devin\ whatever folder it is
given (#17), so cliAnswersFor turned it away for every account before
looking at whose sign-in it reads, and an account without the CLI never
asked at all. Both kept the 2026-09-30 SNAPSHOT, which has no Gemini 4
Argon; moving a built-in Devin with it ticked then failed with "the
plugin doesn't serve Gemini 4 Argon" (NieiR).

The list now comes from GetCliModelConfigs, asked with the account's
token (the call the plugin already made for images): its configs carry
each model's label, context (18), output (model_info 13), family uid
(model_info 23) and family label (30.1). Read over Devin's real response
for the owner's account, parseConfigFamilies gives exactly the 52
families and 262 variants `devin models list --format json` prints, in
its order, less Adaptive and Fusion. When Devin can't be asked, the CLI's
list is used if the CLI names the account Devin names the token's, even
when it reads its own folder (the Windows case); else SNAPSHOT, now
refreshed from the CLI (Gemini 4 Argon and Claude Haiku 5.5 added,
Inkling and Claude Sonnet 4.5 kept for the accounts still offered them).

Run:
- TMPDIR/HOME in a scratch dir, bun test packages/devin: 54 pass, 0 fail.
  With index.mjs put back to 0.1.14, the 4 new identity tests fail
  (parseConfigFamilies missing; familiesFor without gemini-4-argon;
  "models list" never run for a same-account CLI reading its own folder;
  provider.models without gemini-4-argon).
- bun scripts/check.mjs devin passes.
- Real account (owner's Devin, sandbox HOME, no devin CLI on PATH):
  provider.models gave 85 models with gemini-4-argon (1048576/1000000)
  and claude-haiku-5-5; 0.1.14 gave the declared list only.
Not tried: the Windows box itself; the new path doesn't run the CLI.
2026-10-14 15:57:04 +08:00
yetone 5c0aebce8f zcode 0.1.18: ZCode app's sign-in reads ZCode 3.15's plan key from config.json, so a valid GLM Coding Plan no longer reads as "no plan" (yetone/magpie#2130)
What changed: ZCode 3.15 keeps no coding plan key in credentials.json any
more. The key it uses is in config.json, at provider["builtin:bigmodel-
coding-plan" / "builtin:zai-coding-plan"].options.apiKey; ZCode 3.15.3's
host reads that value as it is. ownSignIn found no key, so a signed-in
GLM Coding Plan account fell to the Start Plan and read as having no plan.

ownSignIn now falls back to config.json (configKey) when credentials.json
has no key: Z.ai's first, then BigModel. It also takes the provider ids
3.15 normalizes to (account:*-individual-coding-plan) and a value written
encrypted. A value that isn't a key, such as "{env:...}", is skipped. A key
in credentials.json and a team switch still come first. This matches
magpie's built-in (magpie 1d8e83a79, zcodeOwn/zcodeConfigKey).

What was run:
- The new own.test.mjs case uses the reporter's layout (BigModel sign-in,
  no key in credentials.json, key in config.json). It fails without the
  fallback ("j1" in place of "bm.secret").
- Every packages/zcode test file passes under a scratch HOME/TMPDIR:
  dual 25, gift 20, models 1, moved 1, own 6, signin 3, start 10, usage 15.
- bun scripts/check.mjs passes.

Not tried: a real ZCode 3.15 account.
2026-10-14 15:45:44 +08:00
yetone e7d37b0801 factory 0.1.26: Gemini 4 Argon and Gemini 3.x on Factory's Gemini route (yetone/magpie#2080), a 413 retried with older images left out and said as Factory's byte limit (yetone/magpie#2082) 2026-10-14 14:26:29 +08:00