Files
plugins/packages
yetone c20fa331a0 trae 0.2.23: a model whose entry names max (or medium) offers it and sends it (#434)
huajii (#434): Trae's app offers DeepSeek V4.1 Flash at max, the plugin
does not.

Cause: LEVELS knew only light/high/extra_high, so levelsOf dropped any
other option an entry's reasoning_effort_config names, and effortOf never
sent it. Trae's client names five levels (its bundle's
reasoning_effort.{low,medium,high,extra_high,max}, handed out per model by
remote config, per dsh-connect-trae #60's read of the client bundle). An
entry naming max beside the three lost it.

Fix: LEVELS spells medium and max as themselves. They are offered only
for a model whose entry names them, and a model that names none still
sends nothing for them.

Run:
- packages/trae: bun test 215 pass, 0 fail. The two new tests in
  reasoning.test.mjs (levels/variants/chatBody with max and medium; max
  reaching llm_utils_chat through the loader's fetch) were red on the old
  LEVELS line (2 fail, max undefined), green with it.
- HOME=$(mktemp -d) bun test at the repo root: 2902 pass, 3 skip, 0 fail;
  bun scripts/check.mjs: ok.

Not tried: a real Trae account. The wire name "max" in options comes from
the client's i18n keys, not a captured list; on 10-25 a live CN list named
only light/high/extra_high (dsh-connect-trae #60, plugins #300). If Trae's
"max" in the app is the Max mode instead, the plugin's
deepseek-v4.1-flash-max model is that and is unchanged here.
2026-10-28 00:46:08 +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
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