Files
plugins/packages/zen-free/package.json
T
yetone 1f56706556 zen-free 0.1.18: the environment block names a real directory, since Zen refuses "Working directory: unknown"
shanmao_10826 on magpie's #help, 10-29: every free model (deepseek-v4.1-
flash-free and others) answers 429 "Free usage limit reached. Free
models work in OpenCode", while OpenCode itself on the same machine works.

Cause, found against opencode.ai from the Linux box (xiaomi-gpu WSL) on
2026-10-29, deepseek-v4.1-flash-free, one request each, minutes apart,
same IP, only the system prompt and stub-tool text changed:
- the plugin's own request through loader.fetch (0.1.17): 429
  FreeUsageLimitError, the reporter's message;
- "You are opencode." + <env> Working directory: /tmp/x: 200;
- the plugin's exact block "<env>\n  Working directory: unknown\n</env>"
  (alone, or after a prompt, either tool description): 429;
- the same block with /tmp/x for "unknown": 200;
- the plugin's stub description "Not available. Never call this tool."
  with a path in the block: 200.
So Zen now refuses the literal placeholder 0.1.15 to 0.1.17 added, the
plugin's fingerprint, as it refused the plugin's old User-Agent on 10-26.
Headers were diffed against OpenCode v2.2.0 (packages/core/src/session/
model-request.ts, app.ts useragent, plugin/provider/opencode.ts): the
same set the plugin sends; nothing new on the request since 2.0.25. Zen's
server code is no longer public (packages/console's handler went on
10-11), so this was found by bisecting real requests.

Fix: the block added is OpenCode 2.2.0's own (instructions/builtins.ts:
the intro line, Working directory, Workspace root folder, Is directory a
git repo, Platform; not its line about OpenCode's temp folder), with the
directory the agent's own prompt or first user message names (Codex's
<cwd>, a "Working directory:" line, Kimi's "The current working directory
is `...`"; absolute paths only), or the user's home folder when none is
named. A prompt that already has a block goes as it is, as before.

Run:
- Real, through the fixed plugin's loader.fetch from the same IP right
  after the 429s: deepseek-v4.1-flash-free with no prompt 200, with an
  agent prompt naming its directory 200, glm-5.3-flash-free 200.
- New test (the block names the stated or home directory, never a
  placeholder; Codex/Kimi/Windows/Anthropic cases): red on origin/main's
  provider.mjs (1 fail of 44 in index.test.mjs), green with it.
- HOME=$(mktemp -d) bun test in packages/zen-free: 201 pass, 0 fail.
- HOME=$(mktemp -d) bun test at the repo root: 3131 pass, 1 fail, the
  fail is layerfs "item 3: an import skips secret-shaped files", red the
  same at origin/main cc3f000, filed as #477.
- bun scripts/check.mjs: ok.
All on the Linux box (wsl-run); mote was unreachable.

Not tried: the reporter's own agent through magpie (they didn't say
which); a Responses or Anthropic free model (Zen lists none free); a
Windows or macOS host (the block's Platform and home path differ there).
2026-10-29 11:38:06 +08:00

14 lines
683 B
JSON

{
"name": "@magpie-community/opencode-zen-free-auth",
"version": "0.1.18",
"description": "OpenCode Zen free models through the public credential, with native streaming protocols",
"type": "module",
"main": "./index.mjs",
"files": ["index.mjs", "provider.mjs", "models.mjs", "stream.mjs", "tool-response.mjs", "README.md", "LICENSE"],
"keywords": ["opencode", "opencode-plugin", "zen", "free", "magpie"],
"license": "MIT",
"repository": { "type": "git", "url": "https://github.com/magpie-community/plugins", "directory": "packages/zen-free" },
"scripts": { "test": "bun test" },
"magpie": { "icon": "https://opencode.ai/favicon-v3.ico", "maxConcurrency": 2 }
}