Files
plugins/packages
yetone 0a9415f4ef kimi-work 0.1.7: models come from Work's own menu (DescribeKimiWorkConfig) as well as /models, so K3.1 Pro on the 99 plan is listed
泠夜Soul (Discord #help, 10-24) is on Kimi's 99 membership and the official
Kimi Work desktop has "Kimi K3.1 Pro" picked in its composer, but magpie's
Kimi Work list (0.1.6) leaves it out.

Cause, read from Kimi desktop 3.2.20's main bundle (decoded): the desktop
does not build its Work model menu from agent-gw's /models. It calls the
Connect RPC kimi.gateway.config.v1.ConfigService/DescribeKimiWorkConfig on
https://www.kimi.com/apiv2 with the web sign-in, takes models plus
moreModels, and hands each entry's requestParams.modelId to its agent
(conversations.updateKimiModelList), which sends it to agent-gw as the
model. The plugin listed /models only, so a tier model the menu has and
/models doesn't was never offered. That /models leaves K3.1 Pro out is
inferred from the report (0.1.6 already lists /models in full), not seen
on an account.

What changed:
- provider.models asks both lists at once. Menu entries come first, under
  display.displayName, with id requestParams.modelId; reasoning levels are
  requestParams.reasoningEffortOptions, else daimonModelConfig's
  supportEfforts ("off" is REASONING_EFFORT_NONE there, sent as none);
  image input from its "image_in" capability. Context is capped at the
  standard 262,144 as before: XL is an X-Kimi-Context-Length header the
  desktop sends only when the user picks extended, and this doesn't send it.
- An id both list keeps /models' row under the menu's name. Either list
  failing leaves the other; both failing, or the menu empty with /models
  failing, throws, so magpie keeps the last good list.
- The reply is read in camelCase and in the proto's snake_case names.

The fixture (tests/fixtures/work-config.shape.json) is the reply's shape
from the proto descriptor and the desktop's mapping code. No reply was
captured from an account; k3d1-pro in it is a placeholder id, and the
fixture says so.

Run: bun test packages/kimi-work (46 pass, 0 fail); with the menu call
turned off by hand in index.mjs the two new list tests go red (44 pass,
2 fail); bun scripts/check.mjs kimi-work ok; git diff --check clean.
Not tried: a real Work account (none on this machine or the Windows box),
so neither the menu's reply nor a chat request with K3.1 Pro's id through
agent-gw has been seen. The model-speed header (X-Kimi-Model-Speed) is not
sent either.
2026-10-24 17:28:52 +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