Files
plugins/packages
yetoneandifccod c18d87f743 agy-cli 0.1.95: agy's high-traffic ending is a 503, and 1.5.10's ban wording a 403
When Google had no capacity for the model, agy ended the reply with
"⚠ Our servers are experiencing high traffic right now, please try again
in a minute. (UNAVAILABLE (code 503): No capacity available for model …)".
The bridge passed it on as the whole reply, a 200, so nothing behind
magpie tried again. ifccod found this and patched it in their fork
(ifccod/opencode-agy-cli-auth, MIT, FORK.md "Busy ending"). Their code
is ported here: the ending is held and matched by its start, the way the
quota ending is, and it ends the turn as overloaded_error with status
503 (HTTP 503 without streaming). Retrying is allowed, and the account is
not rested.

agy 1.5.10 words a banned account's 403 without the
"PERMISSION_DENIED (code 403):" that 1.5.9 put in front. A real banned
account was probed over ACP on 11-18: the whole reply was that sentence,
end_turn, a 200. The bare sentence is now a marker, answered with the
same no-retry permission_error 403 as #1201.

Not taken from the fork: its video path. That path has agy's server-side
read_file open videos downloaded into a media folder added with
--add-dir, and it lets any gateway caller have agy read paths on the
host. It was not tried with a real account either, since the probe
account is banned.

Run (mica, HOME=$(mktemp -d), at 89df5a62+this diff):
- packages/agy-cli/test repeat-batch.mjs: 79 pass, 0 fail. usage.mjs
  (cp-hook preload): 44 pass.
- The new tests on the old index.mjs, by hand: 3 of the 4 fail (busy
  stream, busy non-stream 503, 1.5.10 ban). The quoting test passes on
  both, as it should.
- Root bun test: 9070 tests, 0 fail, 20 skip (487s).

Not tried: a real high-traffic ending; it is taken from ifccod's capture.

Co-authored-by: ifccod <102718410+ifccod@users.noreply.github.com>
2026-11-18 16:14:01 +08:00
..
middleware: param-override, model-map, system-prompt, word-guard and think-tags — gateway middleware that magpie runs on every agent's requests and replies, mostly New API's channel settings with the same JSON (the owner) — magpie can now run a plugin as gateway middleware (onRequest, onEvent, onResponse, in-process on moejs), and these are the first ones: param-override is New API's param_override (both forms, operations with gjson paths and conditions, return_error); model-map is model_mapping (chains, /regex/ keys with $1) and puts the asked-for name back into replies; system-prompt adds a prompt in each API's own place, keeping an agent's own unless override (New API's semantics), by agent or model; word-guard is the sensitive-word filter (reject or mask the user's text, optionally replies); think-tags strips a leading <think>…</think> from replies across stream chunks, or puts Chat reasoning_content into the text (thinking_to_content). Each is one file with no imports, named @magpie-community/middleware-<name>, with magpie.options as the example the app's editor starts from; registry.json lists them with "kind": "middleware" and no providers; check.mjs skips middleware-only packages. scripts/middleware.mjs calls the hooks as the gateway does (events split, [DONE] passed by) and runs each package's cases.json. Tested with a real DeepSeek account and real Claude Code through magpie's gateway: a mapped model named back in message_start, max_tokens capped, a system prompt appended for claude only, a word turned away as a 400 in Anthropic's shape, return_error as a 403 in Chat's, <think> stripped from Chat and Responses streams and an Anthropic whole reply, reasoning_content moved into the text. bun test (61 for these five) and bun scripts/check.mjs pass; packages/devin's two image tests fail on this machine only, as on main. Their first npm version has to be published by hand (trusted publishing can't create a package); until then magpie shows them as Coming soon.
2026-10-05 20:49:42 +08:00