Files
plugins/packages
KlarkxyandKlarkxy 2b87fad98d minimax 0.2.7: opt-in compactTools lists only the four dispatcher tools (#1014)
Adds the plugin option `compactTools` (default false, declared in
package.json `magpie.options`). Only an explicit `true` leaves the sixteen
named Matrix tools out of the tools plugin's advertised list; `list_tools`,
`tool_schema`, `call_tool` and `web_search` stay, built by the same code,
with descriptions and schemas unchanged. `call_tool` still checks arguments
against the live catalog. This is option A as decided on #1005; option B
(rewritten descriptions) is not in it.

Run at the reviewed head a2d18183, on mote with a temp HOME:
- bun test packages/minimax: 165 pass, 0 fail
- bun scripts/check.mjs: exit 0
- Advertised list (name, description, args) hashed with
  MiniMaxCodeToolsPlugin at origin/main dba24067 and at the head: for no
  options, {}, and {compactTools:false} both give sha256 3cacc575d5abf786…
  (32300 chars), so off is byte-identical to main; {compactTools:true}
  gives 3890 chars at the head.
- git merge-tree with origin/main dba24067: clean.

Broken by hand, each red then restored:
- off path builds the Matrix tools after the dispatchers (order change):
  "compactTools off leaves the advertised tool list byte-for-byte" and
  "discovery stays scoped to Matrix" go red.
- on path appends text to list_tools' description: both "on ... unchanged"
  tests (connector-tools and the tools plugin) go red.
- compactToolsOn(options) as Boolean(options?.compactTools): "only true for
  an explicit true" and the off byte-for-byte test go red.

Not tried: a real MiniMax account or a live agy catalog; fake fetch only.

Co-authored-by: Klarkxy <6316992+klarkxy@users.noreply.github.com>
2026-11-11 23:44:15 +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