Releases ec884d0 (#259). Only the version changes here.
Run on origin/main 915f143 plus this bump: bun scripts/check.mjs passed;
packages/zen-free bun test (temp HOME): 195 pass, 0 fail. #188's literal
repro script (node) prints call_0/call_1 for both null and "" and exits 0.
Releases 2ef6d6b (#252). Only the version changes here.
Run on 2ef6d6b plus this bump: bun scripts/check.mjs passed;
node --test packages/zen-free/ all pass. The PR's head was run in full
before the merge (HOME=$(mktemp -d) bun test: 1853 pass, 0 fail).
#209: since 0.1.3 (#76) a call whose name the agent has no spelling of
(DSH with pwsh declared: psh, pash, ppwsh, pshh, bash, shell_command) was
left out with a text note, and a reply of only such calls was rewritten
to a plain stop. DSH read that as a finished answer: 16 of xiotbox's 19
cases ended an autonomous turn, and the model never saw an error it
could correct.
Now nameGuard answers the model's own name when no declared tool folds
to it, so every protocol (Chat JSON/SSE, Responses, Messages) hands the
call on with its id, arguments and tool-call finish, as every other
provider in magpie does. The agent answers an unknown name itself (DSH's
ToolRuntime, Claude Code's "No such tool available", Codex's
"unsupported call", OpenCode's invalid tool) and the model corrects it.
Case and separator folding (todowrite -> todo_write, bash -> Bash) is
unchanged, and an ambiguous fold is still never guessed: it goes on as
called. Only a call with no name is still left out with the note. Any
correction budget is the agent's, as with any provider; the plugin keeps
no per-turn state.
Tests: the #76/#209 names (bedit, bcp, ash, mcp__netcatcatty__unused,
psh, pash, ppwsh, pshh, shell_command) alone and beside a declared call,
JSON and streamed, in all three protocols: the call arrives with its id,
no note, no error, a tool-call finish; a Responses or Messages stream
comes through frame for frame. index.test's plugin-level case (loader
fetch against a local fake Zen) now expects an undeclared `edit` handed
on as a tool call. The leave-out machinery tests use a nameless call.
Run:
- packages/zen-free `bun test`: 174 pass, 0 fail. With nameGuard put
back to `|| null`: 28 fail.
- `node --test` (Node 25.8.2 and 22.22.0): 171 pass, 3 fail, the
"sends OpenCode's own headers" tests, red the same on origin/main
0b58032: Node's fetch adds accept-language and sec-fetch-mode. magpie
and OpenCode run the plugin in Bun. Filed as #212.
- Whole repo, TMPDIR and HOME in a scratch dir, `bun test`: 1771 pass,
0 fail. `bun scripts/check.mjs zen-free`: ok.
- Not tried live against Zen or with DSH: the fix is in what the plugin
hands on, shown against a fake upstream.
A user typed keys made under several OpenCode accounts into Zen Free's key
field and expected several accounts. The method's authorize() always
returns key "public", and magpie's host stores result.key over the typed
key (host.js save), so every such sign-in is the same shared credential
and the typed key is dropped. The label and README now say so and point
own keys to magpie's built-in OpenCode Zen provider (several keys,
rotation and failover).
Run: bun test in packages/zen-free, 174 pass 0 fail. Read host.js
apiKey/save on magpie 63be47717 to confirm the stored key is "public".
Not tried: a sign-in through magpie's GUI with the new label.
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.
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.
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.
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.
Zen's chat endpoints now answer the free tier's requests 403 FreeTierError
("can only be used from within OpenCode") unless x-opencode-session looks
like an id OpenCode made. 0.1.4 sent a sha256 cut to the ses_ shape; Zen
decodes the id as OpenCode's identifier.ts lays it out (12 hex of
~(Date.now()*0x1000 + counter), then 14 base62) and turns away one whose
counter is not small.
Bisected against the real upstream by replaying 0.1.4's captured request:
- 0.1.4's ses_e9283da055b15JwOAra76bwUx4: 403. The same request with the
session of a real OpenCode 1.19.0 run: 200. The real UA alone, or a real
msg_ request id alone: still 403.
- Any timestamp passes (epoch 0, a year back, an hour ahead); the low 3 hex
ffe/ffd/ff0 (counter 1/2/15) pass, f00/c00/800/001 get 403; 25 or 27
characters after ses_ get 403.
Now:
- sessionID makes a real descending id with the current time and counter,
kept per conversation (sha256 of the signal, at most 1000 kept) so a
conversation's turns share one session. An id the caller sent through
that OpenCode could have made is passed on unchanged.
- x-opencode-request is an ascending msg_ id, x-opencode-session-id is
sent too, and the User-Agent is OpenCode 1.19.0's
(opencode/1.19.0 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.14), as
captured from the real client.
Run: bun test in packages/zen-free, 166 pass. With 0.1.4's hash put back,
the new session tests and the streaming header test go red (3 fail).
tools-smoke.mjs against the real opencode.ai: big-pickle,
mimo-v2.6-flash-free and muse-spark-1.3-contributor-free each 200 with a
Bash call, streamed and not; 0.1.4's provider.mjs in the same run: 403
FreeTierError.
Not done here: magpie maps this 403 to permission_error, which reads as a
sign-in problem; that is magpie's gateway, not this package.
Zen now and then closes a space-bunny-free Chat Completions stream after
some frames, with no finish_reason, usage or [DONE] (~0.1% of turns in
the reporter's logs). The tool guard turned that into an error frame at
the end of the 200 stream, so the agent threw away the reasoning and text
it already had, and magpie can't ask a Zen Chat reply to go on.
Now, for a client that streams, a Chat reply cut short that has said
something (text or reasoning) and has no tool call pending ends as an
ordinary answer: each open choice gets the note "(The reply was cut
short: Zen closed the stream before it finished. Ask again to go on.)"
and finish_reason "stop", then [DONE]. A reply whose every choice had
finished only gets its [DONE]. It still fails when a tool call is
pending (its arguments may be half written), when nothing was said
(an empty reply), and when the reply is collapsed for a client that
doesn't stream (nothing reached the client yet, so magpie can ask
again). Anthropic Messages and Responses streams cut short still fail:
magpie's gateway tells such a reply from a whole one itself (#370) and,
for an Anthropic upstream reached through translation, goes on with it
(continuation.go); a made-up message_stop or response.completed here
would stop that. The error that remains names the reply's id, the
events and bytes received, and an unfinished tool call, as the reporter
asked. The README also says the free tier needs tools, which is why the
five core tools are sent.
Run: packages/zen-free `bun test` and `node --test` (161 pass). The new
tests use the reporter's three frames byte for byte, at chunk sizes 7, 31
and 4096; all 6 go red on the old tool-response.mjs/provider.mjs.
Broken by hand: dropping the pending-call check turns the "still fails"
test red; ending cut short for non-streaming clients too turns the loader
test and the "still fails" test red. Whole repo `bun test` with a temp
HOME and TMPDIR: 1109 pass. `bun scripts/check.mjs`: all ✓. Through the
plugin's loader against a node fake upstream on 127.0.0.1:3720 that sends
role, reasoning and two text frames 50 ms apart and FINs: streamed → 200
with the text, the note, stop and [DONE]; not streamed → 502 "Upstream SSE
ended without a completion marker (reply x2, 4 events, 659 bytes
received)". Not run: real Zen (the cut can't be provoked) or magpie's
plugin host.
#76: Zen's free models sometimes call a tool by a name the agent never
declared (tkhs101's table: bedit, bcp, ash, mcp__netcatcatty__unused,
beside declared edit, bash, mcp__netcatty-external__list_hosts). The
guard answered each with "Upstream called a tool not declared by the
client", which failed the whole turn. The rows without a name are from
before 0.1.1 (published 10-10 11:51 UTC), which added the name.
Now such a call (or one with no name) is left out of the reply instead:
- chat: dropped from tool_calls/function_call; the reply's content says
"(The model called a tool this agent doesn't have: "bedit". The call
was left out.)"; kept calls are renumbered from 0; finish_reason
becomes "stop" when no call is left, including a repeated finish.
- responses: the function_call item becomes a message item with the
note (added, text deltas, done, and in response.completed); its
argument events are not passed on.
- anthropic: the tool_use block becomes a text block with the note; its
input deltas are not passed on; stop_reason tool_use becomes end_turn
when no call is left.
A call of an unsupported type (custom tools, non-object input) still
fails as before.
Run:
- bun test packages/zen-free: 155 pass, 0 fail; node --test
packages/zen-free/*.test.mjs: 155/155; bun scripts/check.mjs zen-free.
- The new tests on the old tool-response.mjs: 35 fail.
- Breaking the finish rewrite by hand: 5 fail.
- Chat stream fixtures use the shape a live step-5-preview-free stream
sent (name whole in the first delta, arguments in pieces, two
tool_calls finishes). Zen sends names whole, so the names in #76 are
the model's own; a real misnamed call was not reproduced live.
Jeremy.Zhou asked that dropped free models leave the list by themselves
and new ones join it. The list was already read from Zen's /models each
time the host lists models (magpie's start, refresh, and now its hourly
relist), with the last list kept when Zen's can't be read. Two request-time
gaps remained:
- A model not in the list (Zen dropped it) threw, which the host reports as
a transport failure, so magpie rested the whole account. It is now a 404
not_found_error, "Model X is not available as an OpenCode Zen free model
now. Free models: ...", which magpie reads as that model alone refused.
- After the first list, a model not in it never asked Zen again, so one
made free since stayed refused until a relist. Now it asks again, at
most once a minute, so a hand-typed id doesn't list on every request.
A model on the wrong protocol still throws as before. README's Models
section says how the list stays current.
Run: bun test in packages/zen-free (32 pass; 3 of the new tests fail on
0.1.1's provider.mjs), bun scripts/check.mjs (ok). Real use against Zen
with the public key: glm-5-free gets the local 404 listing Zen's 11 free
models, big-pickle answers 200.
Zen's models open multi-step work with OpenCode's own todowrite, while
DeepSeek Harness declares todo_write. The guard folded names only for the
five core tools the plugin injects, so with an agent that declares all
five nothing was injected, nothing folded, and the whole turn died with
"Upstream called a tool not declared by the client" - without saying
which tool.
Now any call is given the agent's tool whose name differs only in case,
or else only in case and separators (todowrite -> todo_write, webfetch ->
web_fetch, BASH -> bash), when exactly one declared tool folds to it; a
name two declared tools fold to is still refused rather than guessed.
A refused call's error ends with the tool's name.
Run: bun test and node --test in packages/zen-free (141 pass; under a
load average of ~140 bun's 32 MiB buffer tests sometimes hit their 5s
timeout, the same on the old code, one run fully green); the new #76
tests fail on the old tool-response.mjs (6 red). bun scripts/check.mjs
zen-free. Live against Zen (step-5-preview-free, chat, stream): calls
pass with the folded names; the model didn't emit todowrite in 6 tries,
so the mapping itself is shown by the tests.
* 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