Files
Purfeather 5ed1ac6d3d minimax-design 0.1.0: MiniMax Design as an agent, Windows only (Purfeather, #799)
Adds MiniMax Design (packages/minimax-design, @magpie-community/agent-minimax-design 0.1.0) as a magpie agent.

Its one switch writes a single custom-model entry, `config.customModels.user-custom-magpie`, into Design's `%APPDATA%\@hilo\desktop\hub-config.json`. The entry points at magpie's local /v1 with the gateway key and magpie's model list. Reasoning levels are filtered to the ones Design knows (low to max). Disconnecting removes the whole entry and leaves the user's other custom models alone. The agent is Windows only: its paths lean on $APPDATA and $LOCALAPPDATA, so it is never detected on macOS or Linux, and the agent's notice says so.

Also in this change:
- a README Agents row;
- a registry entry;
- COMPATIBILITY.md.

Verified by the author with real use: Windows 11, MiniMax Design 3.0.17, magpie 0.1.3238. Connect writes the entry, Design's model menu shows Magpie, and requests reach the gateway, attributed to minimax-design. Disconnect removes only the entry, and its preview lists it (magpie 0d70f335e, v0.1.3200).

Run at the reviewed head 8e09f13c on a separate macOS machine, with a throwaway HOME (Bun 1.4.2):
- bun test packages/minimax-design: 7 pass, 0 fail.
- bun scripts/check.mjs minimax-design: ok.
- Repo-wide bun test: 6791 pass, 20 skip, 1 fail. The one failure is gcp-ai's ADC consent test (plugin.test.mjs:422), red only under a concurrent full suite. It is green 6 of 6 alone, and the package isn't touched here.

Not tried: a real Design install on the reviewer's side, and macOS/Linux (unsupported).
2026-11-07 19:57:01 +08:00

62 lines
2.5 KiB
JavaScript

// MiniMax Design (design.minimax.io) as a magpie agent.
//
// MiniMax Design's custom text models live in a plain JSON file:
// Windows: %APPDATA%\@hilo\desktop\hub-config.json (electron app id @hilo)
// under config.customModels.<entry-id>, each entry shaped like:
// { protocol, providerName, baseUrl, apiKey, models: [{ id, contextWindow, maxOutputTokens, reasoningLevels }] }
// protocols Design understands: "openai-compatible" | "openai-responses" | "anthropic"
// magpie's gateway serves all three, so this plugin writes one entry pointing
// at magpie's OpenAI-compatible endpoint, and refreshes the model list
// automatically whenever magpie's models change (magpie re-calls connect).
//
// Design picks its model in its own UI, so this agent has no `model` key:
// the row is a switch, and connect is called without a model.
//
// Windows only: config and dir lean on $APPDATA and $LOCALAPPDATA, which
// don't exist on macOS or Linux. See COMPATIBILITY.md.
export const agent = {
id: "minimax-design",
name: "MiniMax Design",
icon: "https://design.minimax.io/favicon.ico",
config: "$APPDATA/@hilo/desktop/hub-config.json",
format: "json",
dir: "$LOCALAPPDATA/Programs/MiniMax Design",
notice:
"Windows only 仅限 Windows — quit MiniMax Design before connecting, restart it after(连接前退出、连接后重启)",
}
// Design's model menu knows these reasoning levels; anything else magpie
// offers (none, minimal) is dropped rather than passed through.
const DESIGN_LEVELS = ["low", "medium", "high", "xhigh", "max"]
// magpie model fields -> Design's custom-model entry fields
function toDesignModel(m) {
if (!m || !m.id) return null
const out = { id: m.id }
if (m.context) out.contextWindow = m.context
if (m.output) out.maxOutputTokens = m.output
const levels = (m.efforts || []).filter((l) => DESIGN_LEVELS.includes(l))
if (levels.length) out.reasoningLevels = levels
return out
}
// The entry goes as one key holding the whole object, so switching the agent
// off removes the entry itself — not five dotted keys whose emptied parent
// ("user-custom-magpie": {}) would stay behind in the file.
export function connect({ gateway, models }) {
const list = []
for (const m of models || []) {
const d = toDesignModel(m)
if (d) list.push(d)
}
return {
"config.customModels.user-custom-magpie": {
protocol: "openai-compatible",
providerName: "Magpie",
baseUrl: gateway.v1,
apiKey: gateway.key,
models: list,
},
}
}