0.2.0 stopped listing a model's -fast one and takes fast as the request's
service_tier, so magpie, which offered its Fast switch (the agent picker's
lightning, a group member's 标准速度/快速) for a model with a -fast one,
offered it for none. The runtime model now says fast: true when a variant
the account is served at that context size has fast=true (Opus 5.5 @ 300k,
Composer 2.5, Grok 4.7), and nothing otherwise (a size with no fast variant,
a model with no fast parameter, an account the usable list doesn't serve the
fast variants). Requests are unchanged.
Tested: new context.test.mjs case, which fails on 0.2.1 (no model says
fast); the whole package (50 tests) and scripts/check.mjs pass. Not tried
with a real Cursor account.
Tested on the owner's real account (Token Plan Lite, no app membership): mimo-pro, mimo-flash (streamed) and mimo-auto answered 200 through the loader's fetch; usage shows Token Plan Lite with the "Token Plan" window. bun test (990 pass) and scripts/check.mjs under a temp HOME; 3 of the new tests fail on 0.1.8.
An old id names a branch of a model's variants (claude-opus-5 is the Opus 5
without thinking). When the effort asked for exists only in the other branch,
no variant matched and the request went as the default's legacySlug with the
parameters it had been given: cursor/claude-opus-5 at xhigh went as
claude-opus-5-thinking-high with thinking=false, effort=xhigh. On this
account Opus 5 without thinking stops at high, so it happens today: 40 of
5040 old id × effort × fast combinations, all claude-opus-5. 0.1.11 sent
claude-opus-5-high there.
Now, for an old id, a request no variant matches goes as the variant of
its own branch (every parameter but the effort as asked) at the nearest
effort it has (branch()): claude-opus-5 at xhigh or max is claude-opus-5-high,
-fast at xhigh is claude-opus-5-high-fast, as 0.1.11 sent them. Where the
default differs from what is asked in the effort alone, the effort still goes
as asked. A listed id is not changed.
context.test.mjs adds a picker shaped like this account's Opus 5 and checks
those cases and that every id sent agrees with its parameters (which holds
where the default's branch is complete, as in this picker; see Not covered);
it fails on 8cd5a0f's index.mjs. HOME=$(mktemp -d) bun test packages/cursor:
49 pass, 0 fail; check.mjs cursor passes. Offline against this account's
picker and usable list: the contradicting requests go from 40 to 0.
With a real Cursor account, this version installed into magpie (packed from
this code plus one temporary line logging what request() returns):
cursor/claude-opus-5 at reasoning_effort xhigh (max_tokens 16) went as
claude-opus-5-high with thinking=false, context=300k, effort=high,
fast=false, maxMode=false, and answered 200 ("ok", 14 in / 4 out, 5.2s;
magpie's usage log: effort xhigh, status 200). On 0.2.0 the contradicting
request cursor/claude-opus-5-low at xhigh also answered 200, so it failed
silently.
Not covered. branch() steps aside when what is asked differs from the
default variant in the effort alone, so that an effort goes as asked, as
for a listed model (the existing claude-opus-5-5-xhigh test expects
effort=xhigh). So when the branch that stops short is the default's own,
the request still goes as the default's slug with the effort asked: with a
default of m-high (no thinking, low to high) and a thinking branch up to
max, m at xhigh goes as m-high with effort=xhigh. Dropping that early
return fixes it (effort=high) and changes that one assertion; left for the
maintainer to decide. On this account no model's default branch is the
shorter one (of 20 models with two or more branches, only non-default
branches stop short: claude-opus-5's without thinking, and gpt-5.4's fast
one after the usable list).
* cursor 0.2.0: the list is Cursor's picker, a model once for each context size with that window (claude-opus-5-5@300k, @1m), and effort and fast are the request's, sent as the variant's parameters
The usable list (AgentService/GetUsableModels) names a model once for each effort and speed, and the window was read off the name: 1M when it said 1M, else 200K. The names say 1M of models Cursor serves at 300K outside Max Mode ("Claude Opus 5.5 1M"), and nothing of the 300K Sonnet and Haiku or the 256K Grok have, so on this account 110 of 153 names gave a wrong window: Opus too large, Sonnet, Haiku and Grok too small, and the agents compacted at the wrong point. The request carried no context parameter either, so the window Cursor ran at was its own choice, not the one magpie reported. The same id could go to a 300K and a 1M variant.
Now the list is Cursor's model picker alone (AiService/AvailableModels, asked as the CLI asks it: useModelParameters, doNotUseMarkdown), the way pi-cursor-sdk lists Cursor's catalog. A model with a context parameter is offered once for each size, as <model>@<size> named "<name> @ <size>", its window that many tokens; one without is offered once, its window Cursor's contextTokenLimit (Max Mode's for a model served only there), 200K when Cursor gives none. Effort is not a model of its own: the model's efforts (effort / reasoning_effort / reasoning; extra-high is xhigh) are its variants, the request's reasoning_effort is fitted to the nearest and sent as that parameter, and none turns a Claude's thinking off. Fast is not one either: a service_tier of priority or fast sends fast=true, anything else fast=false, so it is paid for only when asked. A request goes as the variant those parameters pick, by the variant's legacySlug (claude-opus-5-5-medium): the agent API refuses the picker's base name with 502 "AI Model Not Found: Model name is not valid". It goes in Max Mode when that variant is Max Mode's (a 1M size; Opus 300K with fast), or, with no variant for the size, when the size is over Cursor's limit outside it; the "Max Mode Required" retry stays. Hidden, Tab-only and chat-only models stay out, as in the CLI.
The ids change (cursor/claude-opus-5-5 is cursor/claude-opus-5-5@300k; the -fast, -low and -thinking models are gone), so 0.2.0: a model picked in magpie or an agent's config has to be picked again. An id the list doesn't have goes to Cursor as it is named, with the default window. poolBase and firstParty take the @size off, so usage pools as before (grok-4.7@256k Cursor Models, claude-opus-5-5@300k Other Models).
context.test.mjs (new) covers the list, the windows, the variants and the request's parameters and mode; maxmode.test.mjs (rewritten) checks what reaches a fake agent API; usage.test.mjs adds the sized ids. HOME=$(mktemp -d) bun test: 45 pass, 0 fail; check.mjs cursor passes. Tried with a real Cursor account: claude-opus-5-5@300k goes as claude-opus-5-5-medium with context=300k and answers, grok-4.6 as cursor-grok-4.6-high, and pi -p --model magpie/cursor/claude-opus-5-5@300k answers; the base name got the 502 above.
* cursor 0.2.0: an id 0.1.x listed still runs as the variant it stood for, and a variant the account hasn't got is neither offered nor asked for (review of #51)
An id the new list doesn't have went to Cursor as it was named. The ids 0.1.11 listed are families of the variants' own ids (claude-opus-5-5, claude-opus-5-5-fast, claude-haiku-5-5-thinking, cursor-grok-4.6), and they are saved in agents' configs, magpie's picks and routing groups: request(raw, "claude-opus-5-5", "high") was {id: "claude-opus-5-5", params: [], maxMode: false}, the bare name the agent API answers 502 "AI Model Not Found" for, with the effort dropped.
Now an id the list doesn't have is read as one of Cursor's own (named): a variant's legacySlug is that variant; a family of them, taken apart as 0.1.x's splitID did, is the family's variant nearest the default, fast for a -fast family, thinking as the family says, at the effort the id names when the request names none; the picker's name for a model, one of its legacySlugs or idAliases, is its default. Each is at the variant's context size, the default's when two sizes share the id. The request's reasoning_effort and service_tier count as for a listed model. The family is tried before the picker's name, so claude-haiku-5-5 stays the Claude without thinking it was in 0.1.11 where Cursor has variants named so; where it has none it is the model's default. Anything else still goes as it is named.
The usable list (AgentService/GetUsableModels) is read again, beside the picker: a variant whose legacySlug isn't in it is dropped, the model's efforts and sizes are the ones its remaining variants have, and a request no remaining variant matches goes as the nearest of them, not as the default's id with parameters the account hasn't got. A model the usable list has nothing of is the picker's alone (GLM-5.3, as 0.1.7 found) and is kept whole; a usable list Cursor can't give leaves the picker as it is.
answerOf's comment says what pick does with no service_tier (fast off). context.test.mjs checks the PICKER_SKIP names stay out (claude-4.5-haiku, claude-haiku-4-5), each id 0.1.11's offered() gives for the fixture's slugs, variant ids and a model's legacy slug, and the usable list's filter; maxmode.test.mjs checks claude-opus-5-5 reaches the fake agent API as claude-opus-5-5-medium. On b33ec2f's index.mjs the three new context tests and that maxmode test fail. HOME=$(mktemp -d) bun test: 48 pass, 0 fail; check.mjs cursor passes. Not tried with a real Cursor account, and not read against cursor-agent's source (neither is on this machine): the old-id rules follow the review's description and 0.1.11's splitID.
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>
After pi compacted a session, every turn on factory/claude-opus-5-5 was 403
"Factory: Forbidden". The reporter's replays through magpie found the
refused part: the sentence pi opens its summary message with,
"The conversation history before this point was compacted into the
following summary:" (pi-coding-agent dist/core/messages.js
COMPACTION_SUMMARY_PREFIX, the same in 1.0.4 and 1.1.0), whole; with it
removed, reworded or halved the request was answered.
A user text that is pi's whole summary message (the sentence, a blank line,
<summary>, and </summary> last) now opens "Earlier conversation context is
summarized below:", the summary itself unchanged. pi's other fixed summary
opening, BRANCH_SUMMARY_PREFIX ("The following is a summary of a branch
that this conversation came back from:"), is reworded the same way; that
Factory refuses it is not confirmed. On Messages (string content and text
blocks), chat completions and Responses user messages alike. The sentence
quoted by a user, without pi's summary around it, or in an assistant turn
goes on as it is.
pi.test.mjs: 3 new tests; the two adaptation tests fail on 0.1.20
(Expected/Received differ on the summary text), the third checks what is
left alone. bun test (114 pass) and bun scripts/check.mjs factory pass.
Not tried against Factory itself (no Factory account here).
0.2.9 (#49) looked for the CLI's cached runtime in ~/.qoder/.bin/umid-<platform>-<arch>-*/ on every platform. qodercli 1.1.66 (npm) and the worker in Qoder desktop 0.4.3 (extractBinary) make that folder only on Windows (umid-win32-<arch>-<hash>\runtime-info.exe with sgsdk.dll); on macOS and Linux they write a file, ~/.qoder/.bin/runtime-info-<platform>-<arch>-<hash>. And the Linux desktop installs to /opt/Qoder/resources/umid/runtime-info (Qoder 0.4.3's .deb and .rpm), which wasn't looked at. So a macOS user with only the CLI, and every Linux user, got HTTP 502 on the international check-in, while Qoder CN (which needs no runtime) checked in.
campaignRuntime now looks at /opt/Qoder on Linux, reads the CLI's cache as the CLI writes it (the newest matching file, a .tmp being written skipped), and follows the CLI's own folder settings (QODER_CONFIG_DIR, QODER_CLI_HOME, QODER_CONFIG_DIR_NAME). Windows and macOS desktop lookup is unchanged.
checkin.test.mjs lays out the CLI cache as qodercli writes it on win32/x64, darwin arm64/x64 and linux x64/arm64, plus /opt/Qoder and the config-folder variables: 6 of the new tests fail on 0.2.9 (the Windows case passes on both, as 0.2.9 had it right), all pass now. bun test packages/qoder (87 pass) and scripts/check.mjs qoder under a temp HOME pass. On this Mac the real lookup returns /Applications/Qoder.app/Contents/Resources/umid/runtime-info. Not run: the runtime itself against a real account, or on Linux/Windows.
SWE-2 names a call after its tool and turn ("Bash:0#a65b6a5e02194b87bbc796c4428c946d"), and the plugin passed that on as the call's id. Claude Code takes a tool_use id only of [A-Za-z0-9_-]: it dropped every such call and the turn failed with "The model's tool call could not be parsed (retry also failed)". Codex and pi take any id and were fine.
An id with any other character, or one that begins "dv_", now goes out as "dv_" and its base64url (stateless, so it holds across restarts and accounts); build() turns it back into Devin's own id on the assistant's call and on the tool result that answers it, so Devin still sees the id it gave. A safe id goes both ways as it came. magpie passes a chat tool_call id through unchanged to Anthropic's tool_use.id, Responses' call_id and Chat, so the one mapping covers all three.
tool-ids.test.mjs builds Devin's reply frame from the reporter's literal id: with the change taken out, both the whole and the streamed test fail (Received: "Bash:0#a65b6a5e02194b87bbc796c4428c946d" against /^[A-Za-z0-9_-]+$/); with it, the id out is safe and the call and its result reach Devin as "Bash:0#a65b…". HOME=$(mktemp -d) bun test packages/devin: 45 pass; the 4 CLI tests in identity.test.mjs time out at 30 s on this Mac with and without the change (a script just written under $TMPDIR doesn't start: exec of a fresh /bin/sh script hangs here), and pass in CI. bun scripts/check.mjs devin passes. Not tried against a real Devin account.
WorkBuddy AI answers 11133 "Invalid request parameters" (the model
provider rejected them) when a tool's parameters or name are of a shape
its model turns away. Tried on the owner's account through magpie:
deepseek-v4.1-flash and -sg refuse each of a pattern's \0, a root anyOf,
parameters with no type, empty parameters, a tuple's items, and a name
holding . : / a space or CJK; Kimi, GPT, Gemini and GLM refuse some;
MiniMax none. Every client protocol reached the same error, so it is the
tools, not the protocol.
fitTools now gives each the shape that passes: an object root (unions
merged as magpie's provider.ObjectRoot does), \0 as \u0000, a tuple's
items as one anyOf, and a safe name, with the model's calls named back in
JSON and streamed answers and the history's calls named as sent. A clean
chat goes as the same bytes.
Run: HOME=$(mktemp -d) bun test packages/workbuddy (54 pass), bun
scripts/check.mjs workbuddy; through a sandbox magpie gateway with this
package, deepseek-v4.1-flash, -sg, glm-5.3, gpt-5.4, gemini-3.5-flash and
kimi-k3 answer 200 to every shape above (400 before), and an Anthropic
Messages call of a tool named fs.read, streamed and not, comes back as
fs.read. wyh's own ZCode/DeepSeek Harness tool set was not seen.
buildKiro already joins consecutive assistant messages, so #1275's request
reaches Kiro with both calls in one assistantResponseMessage and both real
results after; a call that went unanswered is still answered for. The test
keeps it so. Test-only, no version bump; HOME=$(mktemp -d) bun test (30
pass, 0 fail) and bun scripts/check.mjs pass.
An agent can send one turn's tool calls in two assistant messages in a
row, answered together after. build() answered the first message's calls
at the second one: toolu_a went to Devin as "Tool use was interrupted and
did not produce a result." and its real result A! was dropped.
joinSplitCalls now joins an assistant message onto an assistant message
before it that made tool calls, as Anthropic reads consecutive assistant
messages and as magpie's built-in buildDevin does since 7067fce5. A call
of the split turn that really went unanswered is still answered for; two
text-only assistant messages stay two.
split-calls.test.mjs is #1275's request in Chat form: 3 of its 4 tests fail
on 0.1.10 and pass now. HOME=$(mktemp -d) bun test (43 pass, 0 fail) and
bun scripts/check.mjs pass. Not tried against a real Devin account.
An agent can send one turn's tool calls in two assistant messages in a
row, answered together after. conversation() answered the first
message's calls at the second one: toolu_a went to Cursor as "Tool use
was interrupted and did not produce a result." and its real result A!
was dropped. joinSplitCalls now joins an assistant message onto an
assistant message before it that made tool calls, as Anthropic reads
consecutive assistant messages and as magpie's built-in does since
7067fce5, so the calls are pending together. A call of the split turn that
really went unanswered is still answered for; two text-only assistant
messages stay two; the caller's messages are not changed.
split-calls.test.mjs is #1275's request in Chat form: 3 of its 5 tests fail
on 0.1.10 (trace user assistant(toolu_a) tool(toolu_a=interrupted)
assistant(toolu_b) tool(toolu_b=B!)) and pass now. HOME=$(mktemp -d) bun
test (43 pass, 0 fail) and bun scripts/check.mjs pass. Not tried against
a real Cursor account.
objectRoot dropped any anyOf/oneOf branch that was itself a union. Codex
desktop's automation_update (zod 4: root anyOf of view, delete, and create
and update, each a union on kind) folded to only view's mode and id, both
required, so the model was offered a tool that could only view. Found
while fixing the same fold in magpie's built-in for #1271.
A nested union branch is now folded first (up to 8 deep); a field the
root doesn't define takes every distinct schema the branches give it, as
anyOf when they differ; a field every branch requires stays required.
Verified: schema.test.mjs's new test fails on 0.1.9 (no "name" among
[id mode]) and passes now; HOME=$(mktemp -d) bun test in packages/devin:
39 pass, 0 fail.
xiaocui12: Codex on Grok failed every turn with "[invalid_client_tool_schema]
mcp__codex_app__automation_update: tool parameter root must be an object
type (root schema is an anyOf/oneOf union with a non-object branch)".
Codex desktop's codex_app automation_update has an anyOf at its
parameters' root (ChatGPT.app 26.930 builds it with zod 4's toJSONSchema),
and its create and update branches are unions themselves.
rewrite() now folds a function's parameters to an object root as magpie's
built-in provider.ObjectRoot does, nested union branches folded first so
their fields (name, prompt, rrule, kind...) are kept and only "mode" is
required. Before, the plugin sent the union as it came; magpie's grokBody
folded it for requests through magpie, but not for OpenCode's own.
Verified: the real schema (testdata, rebuilt with zod 4.1.8) sent to the
real Grok subscription raw gets 400 with the reporter's exact message;
folded it gets 200 and a correct create call
({"mode":"create","kind":"heartbeat",...,"rrule":"FREQ=MINUTELY;INTERVAL=30"}).
schema.test.mjs: 2 of its 3 tests fail on 0.1.9 and pass now.
HOME=$(mktemp -d) bun test: the rest of the package matches main (login and
refresh tests time out here on main as well; CI runs them on Linux).
Releases #49: international campaign requests carry Qoder's native device
identity (Cosy-MachineToken, Cosy-MachineType) from its own runtime-info
helper, as Qoder.app 0.4.3 does. Without it Qoder answers 200 with only
VIEW_DETAILS.
Verified with a real international account (GET only, no claim):
CLAIM_BENEFIT/CLAIMABLE/100 with the identity, VIEW_DETAILS only without.
bun test packages/qoder: 82 pass; check.mjs qoder passes.
WorkBuddy's backend counts a user send as one request by
X-Conversation-Request-ID. The China build was sent no conversation headers
at all, and the international build a new pair on every request, so one send
that takes several steps — a tool result sent back, a retry, another account
answering — was counted as a request of its own: one conversation showed up
in the usage detail as many requests.
The ids are now made as workbuddy2api's fix makes them: the turn's from the
body's last user message (its place and its signature, a tool result's part
left out), the conversation's from the session magpie or OpenCode names —
the chat.headers hook now carries it — else from the chat's first user
message; nothing is made up when neither names one. The message and request
ids stay each request's own, and both builds carry the ids now.
Co-authored-by: tearslee <16331052+tearslee@users.noreply.github.com>
@magpie-community/middleware-block-patterns is new to npm, so trusted
publishing can't create it (publish run for f0b34e2 failed: 'not on npm
yet'). Listed now, Discover offers a package that doesn't install. Its
first version is published by hand (scripts/publish.sh <otp>), then this
entry goes back. Checked: registry.json parses, bun scripts/check.mjs passes.
* jev-guard: Jev System One guardrail middleware for request inspection and rejection
* block-patterns 0.1.0: turn away requests carrying text you list, in every API magpie serves
yetone's review of the jev-guard PR (#39) showed the guard only caught a plain-string last user message: Claude Code's content blocks, Codex's Responses input_text items, Chat Completions parts, Gemini parts and the system prompt all passed it through, and the README claimed gemini was covered when no code read it. The package is renamed block-patterns, since "Jev" and "System One" are not explained anywhere and "System One" is already magpie's own routing feature, so users would read it as part of it. It is now plain substring and regular-expression matching, described as such, and the README says plainly that it is literal matching rather than a safety classifier: it does not understand a request, and a synonym or an obfuscated spelling passes it.
build() now reads every shape an agent sends text in — plain strings, text and input_text blocks, Responses input items and Gemini parts — across all four APIs, and every user turn rather than only the last, so a pattern earlier in the conversation is caught. "system" (true by default) also reads the system prompt and the Responses instructions; set it to false to leave them out. Tool calls, tool arguments, tool results and Gemini thought parts are never read. The no-op onResponse is gone rather than kept for a hook call. Its cases.json covers each shape and each exclusion, and the middleware itself is only onRequest now.
bun test packages/block-patterns (25 pass, 0 fail) and bun scripts/check.mjs pass. Not tried against a live gateway.
* block-patterns 0.1.1: read every system prompt an API actually sends, and stop one bad pattern from throwing
Four gaps in 0.1.0, all reported in the second review of #39 and confirmed against the code here before changing anything.
Anthropic keeps its system prompt out of messages: it is the top-level `system` field, a string or the block array Claude Code sends, and only the Chat branch saw it as a message — so a listed word in an Anthropic system prompt passed even with "system": true. It is now read on the same terms as a system message, and left out with "system": false.
Gemini's systemInstruction is documented as a Content, and only its string form was read; the `{ parts: [{ text }] }` object and the system_instruction spelling both passed. All three are read now, via a new systemTexts() that skips thought parts as the rest of the scan does.
The Responses branch read `system` but not `developer`, though the Chat branch read both — now consistent.
matcher() called new RegExp unguarded, so a single invalid pattern threw on every request the gateway saw, including ones that matched nothing. Each pattern is now compiled on its own first and one that fails is left out, so the others still work and nothing is thrown. The combined expression is compiled under a guard too, though an alternation of valid patterns cannot fail.
cases.json is 39 (was 25): the four shapes above with their real request bodies, the two system:false counterparts, a Gemini thought part in a system instruction, four invalid-pattern cases, and a case pinning that Chat Completions has no top-level `system` to read. Both READMEs now carry a "Word Guard vs this" section and word-guard's README points back, so the two packages' split is documented rather than a reader's guess. The system prompt's home in each of the four APIs is a table rather than prose.
Re-ran the first review's six shapes against the committed middleware: 6/6 blocked, and tool_result / tool_use input / assistant turns / Gemini thought parts / function_call_output all still pass through. Not tried against a live magpie gateway.
bun test packages/block-patterns (39 pass, 0 fail), bun test packages/word-guard (13 pass, 0 fail), bun scripts/check.mjs pass.
sun1090's account has no GLM Coding Plan, only ZCode's Start Plan, whose
buckets serve GLM-5.3 (3,000,000) and GLM-5.3-Flash (5,000,000). magpie's
usage card counted GLM-5.3, but the model list had GLM-5.3-Flash, GLM-5.2
and GLM-5-Turbo (the Start Plan's providerId in ZCode's provider config,
revisions 23 and 30, which leaves GLM-5.3 out) plus GLM-5.3-Trial and
GLM-5.3-Flash-Trial, so GLM-5.3 itself was missing.
ZCode 3.14.3 (host/index.js, resolveZaiStartPlanBalanceModelIds and the
start-plan overlay's builtinModelIds) lists a Start Plan account's models
as the balance's bucket capabilities, by their own names. A gift-only
account's requests all go to zcode.z.ai's Start Plan anyway, so the plugin
now also lists each gift model under its own name for such an account.
The -Trial entries stay, so a model a user already picked keeps working;
a coding plan account's gift is still reached only through its -Trial
entries. A gift model's context, output and efforts now also come from
the coding plan's config and the fallback table, so GLM-5.3(-Trial) on
a Start Plan account gets low/high/max rather than no efforts.
gift.test.mjs: "a gift-only account lists its gift's models by their own
names" fails on 0.1.13 (GLM-5.3 undefined); it also checks every model the
card counts is listed and that GLM-5.3 goes to zcode.z.ai. "a coding plan
account's gift stays on its trial entries alone" guards the dual route.
HOME=$(mktemp -d) bun test packages/zcode (75 pass) and
bun scripts/check.mjs zcode pass. Not tried with a real Start Plan
account.
try.sh runs magpie with env -i and a HOME pointing into the sandbox, so
the real magpie, its agents and its sign-ins are never touched. On
Windows that is no sandbox: magpie's home comes from USERPROFILE
(appdir.homeVar) and HOME is not read, so env -i leaves USERPROFILE
unset and magpie found no home at all — it stopped before doing anything
with "USERPROFILE is not set: magpie needs the home folder to find its
own files and the agents'", and scripts/try.sh was unusable on Windows.
The sandbox is given USERPROFILE="$sb" beside HOME, which is a no-op
elsewhere. A portable magpie.exe ignores both and can't be sandboxed
this way, which predates this.
The claim line was a window named after the plan and displaying
"1 to claim · claim it in the ZCode app". magpie shows a window's
display as it came — quotaCount (internal/gui/assets/app.js) returns
w.display when the window has no limit — and translates only the name
(t(w.name), on the card, the tips and the chart), so the line stayed
English on a Chinese interface (yetone/magpie#1001). The plugin cannot
know the interface's language (host.js and provider.Provider hand it no
locale) and magpie's translation is keyed by the string, so the
sentence has to be the name.
The window is now named "Gift plans to claim in the ZCode app" and its
display is "1 · ZCode Trust Build": the count and the plan's own name,
which are data and stay as they came, and one name for any number, so
no plural forms are needed. aside, the placement after every real
window, and the failure handling (nothing to claim, a failed preview or
an error card add no line) are unchanged. magpie adds the zh/ja/de
entries for that name alongside this.
usage.test.mjs: the fixtures carry the new name and display, and the
names list of "a coding account's line goes after its coding and gift
windows". Four of them fail on 0.1.12; bun test packages/zcode (73
pass) and bun scripts/check.mjs zcode pass.
#38 (deepseek-v4.1-flash on trae-cn): 64 of 3112 turns came back with
the model's text-form <tool_call> block as the answer, no call made, as
a 200 with a normal finish, so the gateway had nothing to fail over on.
ARNO (trae-cn, Discord) sent two more: a write whose JSON is whole but
has no </tool_call> (the stream ended), and a closed write block.
ARNO's two replies, as sent (content redacted to xxxx), are read as calls
by 0.2.4 too, whole or one character at a time, with the tool declared
as write or Write; prose before the block and arguments as an object
don't matter. What breaks the closed one is in its content: a written-out
analysis with a quote left unescaped ("官方"), a backslash JSON doesn't
know (\| \_ C:\Users) or a JSON sample of its own makes JSON.parse fail,
and 0.2.4 then printed the block as text. Those are the fixtures here.
TextTools now:
- reads a block as models get its JSON wrong: every quote escaped
({\"name\":…}, #38's most common shape), unknown backslash escapes
doubled, and quotes inside a string escaped unless they end it (a key's
before its colon, a value's before closing braces and the end or a
comma and the next key);
- takes an opener with attributes, <tool_call name="bash"> with
<parameter name="k">v</parameter>, and DeepSeek's {"name":"x"}> head
with parameters (magpie's paramCall, #917), its values typed by the
tool's schema;
- when a block is closed but can't be read, or is cut short at the end
(JSON not whole, a parameter not closed), returns an error instead of
the text: parts() yields it, so a stream ends with the error event and
[DONE] and no finish, and a body is a 502;
- leaves a <tool_call> in backticks or a code fence, or named in prose
with no JSON after it, as text.
Not done: #38's fourth point (text on done/response_done events): there
is no raw event showing Trae puts text there, and reading it blind could
send a whole reply twice.
textcall.test.mjs builds from ARNO's literal bytes and #38's repro cases.
Against 0.2.4's index.mjs 4 of its 6 tests fail (the two that pass are
ARNO's literal replies, which 0.2.4 already reads). HOME=$(mktemp -d)
bun test: 870 pass, 0 fail; bun scripts/check.mjs passes. Not tried with
a real Trae CN account.
A new method, Sign in with Qoder CN Enterprise (VPC), asks for the
instance (its name or <instance>.vpc.qoder.com.cn) and serves the account
from the instance's own hosts: <i>.vpc.qoder.com.cn for the sign-in page,
<i>-openapi.vpc.qoder.com.cn for poll, tokens, user info and usage, and
<i>-gateway.vpc.qoder.com.cn for models and chat, the paths unchanged, as
@qodercn-ai/qoderclicn 1.1.64 rewrites the public origins once a VPC
instance is set. The instance is kept on the account; an account with
none is served as before, and one with an instance that names none is
asked to sign in again rather than sent to the public hosts.
Not tried with a real VPC account. vpc.test.mjs builds its fixtures from
AwadYoo's redacted shapes on #312; 12 of its 13 tests fail on 0.2.7 (the
one that passes is the public sign-in staying as it was). bun test
packages/qoder: 67 pass; HOME=$(mktemp -d) bun test: 864 pass; bun
scripts/check.mjs: all pass.
* workbuddy 0.1.10: explain credits exhausted (code 14018) errors with hint and extract nested error message
When calling WorkBuddy / WorkBuddy AI models (including 0-rate / free models), accounts with no active packages or depleted credits receive 429 code 14018 ('Credits exhausted...').
- Extract nested error message from v?.error?.data?.msg and v?.data?.msg
- Match code 14018 on parsed fields (error.data.code, code, error.code) or 'code':14018 to avoid false positives on requestId/timestamps
- Append EXHAUSTED_HINT explaining that WorkBuddy requires an active credit package even for 0-rate free models
- Return standard OpenAI-shaped { error: { message, type: 'insufficient_quota', code: 14018 } }
- Add tests in refused.test.mjs covering code 14018, error.data.msg extraction, and untouched pass-through of unrelated errors with 14018 in requestId
* workbuddy 0.1.10: match code 14018 whole, so a code that only begins with it (140185) passes through instead of resting the account as out of credit
---------
Co-authored-by: yetone <yetoneful@gmail.com>
* 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
ZCode hands out one-off trust-build / gift plans that are not on the
account until the ZCode app claims them; the plugin only ever consumed
gifts already granted, so an account signed in through magpie alone sat
on the entitlement and it lapsed unclaimed (yetone/magpie#1001). The
claim itself cannot be made here: POST /billing/claim is answered 400
code 3007 "captcha verify failed" without the Aliyun captcha
attestation, and the SDK that makes it (AliyunCaptcha.js) throws unless
window and document exist, so only the app's renderer can claim one.
The author asked for the read-only half instead: ask the app's own list
(GET /api/v1/zcode-plan/billing/preview, the call the app's settings
dialog makes) while the usage card is read, and name what it lists.
The line is a window set aside, so the card shows it and routing, usage
caps and the menu bar pass it over (allowanceOf skips Aside windows;
sameAccount skips them too, so a GLM key's plan still matches the
account by its real windows). It goes last, after the coding plan's and
the gift's own buckets. A preview that fails or lists nothing adds no
line at all, a card that is an error keeps its error and asks nothing,
and an expired sign-in is no request either: the read never changes a
card or a route.
Both fixtures are real responses: an account's preview while the day's
ZCode Trust Build was unclaimed, and one after it had claimed it
(plans: []). usage.test.mjs is new (6 cases; all 72 of the package pass,
bun scripts/check.mjs zcode passes). The preview's shape is also
verified against a real account: the request goes out on the JWT with
the device id, app_version and platform the app sends.
WorkBuddy answers "Illegal API invocation from an unapproved channel" to a
few exact phrases anywhere in a chat, case-insensitively: Claude Code's
billing header and identity line, its gitStatus "Main branch (you will
usually use this for PRs)", and Codex 0.159.2's first paragraph as a whole.
The plugin rewrites each to words that say the same and pass (each tried
against both builds), drops the billing header, and leaves every other
message as it was. Tested with real accounts through Cindy's bundled Codex
0.159.2 and Claude Code 2.1.280: workbuddy/glm-5.3-flash and
workbuddy-ai/deepseek-v4.1-flash answer from both; before, Codex got the
refusal. unflag.test.mjs fails 3 of 4 without the change.
magpie's host builds a provider's models from the plugin's config first
(internal/plugin/host.js: the config's flat fields are spread into
capabilities), then lets the provider.models hook replace the list. The
hook handed back each model without capabilities, and magpie reads
capabilities.reasoning alone for a model a plugin lists, so every model
the site's fallback table doesn't have was listed as one that doesn't
reason. On Trae CN that was every model but the table's six; on Trae
Global every model but its five. A routing group with one of them in it
lost reasoning for the whole group (magpie's groups take a member that
thinks), and the agent turned thinking off for it.
modelOf now gives each model it builds capabilities: the fallback table's
own where it has an entry, else MODEL's flat fields (reasoning,
temperature, tool_call, the input modalities) with an empty variants, as
Trae's request takes no effort or thinking level. The Max twin takes them
through the same path.
packages/trae/models.test.mjs (5 tests) fails without the change:
capabilities.reasoning is undefined for deepseek-v4-flash-0731-max, for
the whole list, and for the Max twin; the fallback table's own entry and
Trae Global's models pass either way. bun test packages/trae: 79 pass.
bun scripts/check.mjs: every package ok. The whole suite has the same 40
failures before and after (Windows-only, other packages).
mintonight found the cause on #808: a JWT renewed at /cloudide/api/v3/trae/oauth/ExchangeToken carries no device, and Trae CN answers its check-in claim 9074 every time, while the client's own token is let through. Trae CN now renews as its clients do: POST /trae/api/v3/oauth/ExchangeToken with DeviceInfo (the device id, machine id and a per-account ECDSA P-256 public key, PEM) and DeviceProof (the key's ECDSA-SHA256 signature, base64, of POST, the path, ClientID, RefreshToken, Timestamp and Nonce, one to a line), as TRAE SOLO CN (en1oxy7wnw8j9n, SOLO_PC) first, then Trae CN's IDE (ono9krqynydwx5, IDE_PC). That renewal keeps the refresh token. The key pair is made at sign-in, or at the first renewal of an account signed in before, and kept with the sign-in through auth.refresh's fields; a sign-in's token is bound at once. When Trae turns the bound renewal away, the plugin renews at /cloudide/ as before. Since the refresh token can stay the same, a renewal made here is told from the sign-in by its token rather than by the refresh token. Trae Global is unchanged. device.test.mjs is new: 5 of its 6 tests fail on 0.2.2 (the Trae Global one passes on both). No Trae account to test with; mintonight is asked to verify on #808.
onEvent masked an Anthropic delta, a Responses delta and a Chat chunk, but had
no branch for Gemini's own shape (candidates[].content.parts[].text) — while
onResponse right below it did. So with replies: true, a word the user asked to
keep out of replies was masked in every API but a streamed Gemini one, where it
went to the client untouched.
A case covers it in both directions: a streamed Gemini reply in its own place
(and a part that isn't text left alone), and a whole one. It fails on 0.1.0 —
"acme Inc" reaches the client — and passes here.
The reply is what the option promises, so a filter that silently skips one of
the four APIs magpie serves is a hole rather than a missing feature.
Co-authored-by: TryWorld2026 <tryworld@users.noreply.github.com>
onRequest returned early for ctx.protocol === "gemini", on the grounds that a
Gemini request names its model in the URL and not in the body. magpie puts it
in the body before the middleware runs (gateway.go, serveAgent is called with
withFields(body, {"model": model, "stream": stream})), and reads it from there
to route, so the mapping applied to every API but Gemini: a Gemini client
asking for a mapped name got "magpie knows no model" as a 404.
onEvent and onResponse also never looked at modelVersion, where a Gemini reply
names its model (internal/gateway/member.go lists exactly that path), so the
name a Gemini client read back was the upstream's even when the mapping did
apply.
cases.json's "Gemini's body has no model to map" asserted the old assumption
with a body carrying no model — a body the gateway never sends. It is replaced
by one that carries the model the gateway fills, covering the request, the
stream and a whole reply; a second case keeps the no-model body passing as it
is. The new case fails on 0.1.0 and passes here.
Co-authored-by: TryWorld2026 <tryworld@users.noreply.github.com>