diff --git a/README.md b/README.md index fa8ebc9..6925bc6 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,7 @@ it off puts the config back. | [type4me](packages/type4me) | [Type4Me](https://github.com/joewongjc/type4me), macOS voice input: `~/Library/Application Support/Type4Me/magpie-agent.json`, for its LLM post-processing | | [opencodereview](packages/opencodereview) | [Open Code Review](https://github.com/alibaba/open-code-review) (`ocr`): `~/.opencodereview/config.json` as a custom Anthropic provider, so `ocr review` / `ocr scan` run on magpie's models | | [nowledge-mem-agent](packages/nowledge-mem-agent) | [Nowledge Mem / AI Now](https://mem.nowledge.co/): choose Default, AI Now and Background models through Magpie, with recovery journaling; separate from the Nowledge memory recall/capture gateway plugin | +| [minimax-design](packages/minimax-design) | [MiniMax Design](https://design.minimax.io), the local multimodal creation studio: one custom-model entry in `%APPDATA%\@hilo\desktop\hub-config.json` whose model menu follows magpie's list; Windows only | ```sh magpie plugin add @magpie-community/agent- diff --git a/packages/minimax-design/COMPATIBILITY.md b/packages/minimax-design/COMPATIBILITY.md new file mode 100644 index 0000000..1845ef7 --- /dev/null +++ b/packages/minimax-design/COMPATIBILITY.md @@ -0,0 +1,13 @@ +# Compatibility record + +**This plugin is Windows only.** Its `config` and `dir` fields lean on `%APPDATA%` and `%LOCALAPPDATA%`, environment variables that don't exist on macOS or Linux — there the paths would expand to `/@hilo/desktop/hub-config.json` and `/Programs/MiniMax Design`, where nothing is written and Design is never detected. + +## Windows — verified + +- Windows 11 (workstation), MiniMax Design 3.0.17, official magpie 0.1.20xx (Oct 2026). +- Verified with real end-to-end use: connect writes `config.customModels.user-custom-magpie` into `hub-config.json` with magpie's full model list; Design's model menu shows the Magpie entry; real inference requests flow through magpie's gateway and are attributed to `minimax-design` in Usage; existing custom-model entries are preserved. +- Magpie's own agent-plugin sandbox checks also passed: dotted nested key paths with intermediate-object creation, object values and object-array values, `$VAR` expansion (`$APPDATA`, `$LOCALAPPDATA`), preservation of unrelated keys. + +## macOS — not supported in this version + +MiniMax Design ships for macOS 13+, and its userData path there would be electron's default `~/Library/Application Support/@hilo/desktop/hub-config.json` — but that path is unconfirmed, and the agent-plugin `config` field takes a single path with `~`/`$VAR` expansion, so one package can't carry both. If you can test on macOS, open an issue or PR with the observed path and a verification note and the plugin can grow a per-platform form. diff --git a/packages/minimax-design/README.md b/packages/minimax-design/README.md new file mode 100644 index 0000000..8134737 --- /dev/null +++ b/packages/minimax-design/README.md @@ -0,0 +1,33 @@ +# @magpie-community/agent-minimax-design + +[MiniMax Design](https://design.minimax.io) (the local multimodal creation studio, electron app id `@hilo`) as a magpie agent. MiniMax Design supports custom text models over the OpenAI-compatible, OpenAI Responses and Anthropic protocols; magpie's gateway translates all three, so one switch points Design at magpie. + +```sh +magpie plugin add @magpie-community/agent-minimax-design +``` + +**Windows only.** The paths below lean on `%APPDATA%` and `%LOCALAPPDATA%`, which other systems don't set. Quit MiniMax Design first, switch the agent on in magpie's Agents page, then start Design and pick a model under the **Magpie** entry in its model menu. Disconnecting in magpie removes the entry magpie wrote — the whole entry, not just its fields — and leaves the rest of Design's configuration untouched. + +## How it works + +Design keeps its custom models in `%APPDATA%\@hilo\desktop\hub-config.json`, under `config.customModels.`: + +```json +{ + "protocol": "openai-compatible", + "providerName": "Magpie", + "baseUrl": "http://127.0.0.1:3425/v1", + "apiKey": "magpie-minimax-design", + "models": [{ "id": "...", "contextWindow": 1000000, "maxOutputTokens": 65536, "reasoningLevels": ["low", "high"] }] +} +``` + +The agent is a switch (no model picker): Design picks its model in its own UI. Connecting writes the single entry `config.customModels.user-custom-magpie` — one key holding the whole object, so disconnecting takes the entry out whole rather than leaving an emptied `{"user-custom-magpie": {}}` behind. `apiKey` is a Design-specific key, so Usage attributes requests to this agent. `models` is mapped from magpie's current model list (`id` → `id`, `context` → `contextWindow`, `output` → `maxOutputTokens`, `efforts` → `reasoningLevels`); when magpie's models change, magpie re-calls connect and the list refreshes itself. Reasoning levels are filtered to the ones Design's model menu knows (`low`, `medium`, `high`, `xhigh`, `max`); models whose efforts are all something else (e.g. `none`) get no `reasoningLevels` field. + +## Notes + +- Quit Design before switching: a running Design writes its in-memory configuration back over the file. Restart Design after a change. +- Design accepts the non-UUID entry id `user-custom-magpie` (verified on 3.0.17). +- See [COMPATIBILITY.md](COMPATIBILITY.md) for verified versions and platforms. + +How agent plugins work: [usemagpie.ai/docs/plugins#agents](https://usemagpie.ai/docs/plugins#agents). diff --git a/packages/minimax-design/minimax-design.agent.js b/packages/minimax-design/minimax-design.agent.js new file mode 100644 index 0000000..a0d8b34 --- /dev/null +++ b/packages/minimax-design/minimax-design.agent.js @@ -0,0 +1,61 @@ +// 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., 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, + }, + } +} diff --git a/packages/minimax-design/minimax-design.test.mjs b/packages/minimax-design/minimax-design.test.mjs new file mode 100644 index 0000000..d8bf379 --- /dev/null +++ b/packages/minimax-design/minimax-design.test.mjs @@ -0,0 +1,68 @@ +import { expect, test } from "bun:test" +import { agent, connect } from "./minimax-design.agent.js" + +const gateway = { url: "http://127.0.0.1:3425", v1: "http://127.0.0.1:3425/v1", key: "magpie-minimax-design" } + +test("says where Design keeps its custom models, and that it is Windows only", () => { + expect(agent).toMatchObject({ + id: "minimax-design", + config: "$APPDATA/@hilo/desktop/hub-config.json", + format: "json", + }) + expect(agent.model).toBeUndefined() + expect(agent.notice).toContain("Windows only") +}) + +test("shows Design's own icon, as the package gives it", async () => { + const pkg = await Bun.file(new URL("./package.json", import.meta.url)).json() + expect(agent.icon).toBe("https://design.minimax.io/favicon.ico") + expect(pkg.magpie.icon).toBe(agent.icon) +}) + +test("writes the entry as one key holding the whole object", () => { + const out = connect({ gateway, models: [] }) + expect(Object.keys(out)).toEqual(["config.customModels.user-custom-magpie"]) + expect(out["config.customModels.user-custom-magpie"]).toEqual({ + protocol: "openai-compatible", + providerName: "Magpie", + baseUrl: "http://127.0.0.1:3425/v1", + apiKey: "magpie-minimax-design", + models: [], + }) +}) + +test("maps magpie's model fields onto Design's", () => { + const out = connect({ + gateway, + models: [{ id: "workbuddy/deepseek-v4.1-flash", context: 1000000, output: 128000, efforts: ["low", "high", "max"] }], + }) + expect(out["config.customModels.user-custom-magpie"].models).toEqual([ + { id: "workbuddy/deepseek-v4.1-flash", contextWindow: 1000000, maxOutputTokens: 128000, reasoningLevels: ["low", "high", "max"] }, + ]) +}) + +test("drops reasoning levels Design doesn't know, and omits the field when nothing is left", () => { + const out = connect({ + gateway, + models: [ + { id: "a", efforts: ["none", "minimal", "xhigh"] }, + { id: "b", efforts: ["none"] }, + ], + }) + const models = out["config.customModels.user-custom-magpie"].models + expect(models[0]).toEqual({ id: "a", reasoningLevels: ["xhigh"] }) + expect(models[1]).toEqual({ id: "b" }) +}) + +test("drops models without an id, and null or missing model entries", () => { + const out = connect({ + gateway, + models: [null, {}, { id: "" }, { id: "kept" }, undefined], + }) + expect(out["config.customModels.user-custom-magpie"].models).toEqual([{ id: "kept" }]) +}) + +test("models: undefined gives an entry with an empty list", () => { + const out = connect({ gateway, models: undefined }) + expect(out["config.customModels.user-custom-magpie"].models).toEqual([]) +}) diff --git a/packages/minimax-design/package.json b/packages/minimax-design/package.json new file mode 100644 index 0000000..f1cd847 --- /dev/null +++ b/packages/minimax-design/package.json @@ -0,0 +1,11 @@ +{ + "name": "@magpie-community/agent-minimax-design", + "version": "0.1.0", + "description": "MiniMax Design (design.minimax.io) as a magpie agent: one switch points Design's custom text model at magpie's gateway, with magpie's model list synced automatically", + "type": "module", + "files": ["minimax-design.agent.js", "README.md", "COMPATIBILITY.md"], + "keywords": ["magpie", "magpie-agent", "minimax", "minimax-design", "llm-gateway"], + "license": "MIT", + "repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/minimax-design" }, + "magpie": { "agent": "./minimax-design.agent.js", "icon": "https://design.minimax.io/favicon.ico" } +} diff --git a/registry.json b/registry.json index 2bfc270..88f0a64 100644 --- a/registry.json +++ b/registry.json @@ -145,6 +145,7 @@ { "package": "@magpie-community/page-usage-tree", "name": "Account usage", "kind": "page", "community": true, "summary": { "en": "A provider -> account -> model usage tree with per-account calls, errors and cost. Adds the account layer that Usage Glance's usage:summary does not contain, read from Magpie's local usage API.", "zh": "按供应商 -> 账号 -> 模型展示用量,包含每个账号的调用、错误和费用;补充 Usage Glance 的 usage:summary 所没有的账号层,数据来自 Magpie 本地用量 API。" } }, {"package": "@magpie-community/agent-kimi-desktop", "name": "Kimi", "kind": "agent", "community": true, "summary": {"en": "Kimi desktop Work on Magpie's Agents page: select a model from Magpie, then disconnect to restore the original service. Not Kimi Code CLI.", "zh": "把普通 Kimi 桌面版 Work 接入 Magpie Agent 页,使用已配置的模型;断开恢复原连接。不是 Kimi Code CLI。"}}, + {"package": "@magpie-community/agent-minimax-design", "name": "MiniMax Design", "kind": "agent", "community": true, "icon": "https://design.minimax.io/favicon.ico", "summary": {"en": "MiniMax Design (the local multimodal creation studio) on magpie's Agents page: one switch points Design's custom text model at magpie's gateway, and Design's model menu follows magpie's model list automatically. Quit Design before switching; Windows only (see COMPATIBILITY.md).", "zh": "把 MiniMax Design(本地多模态创作工作室)加到 magpie 的 Agent 页:一个开关把 Design 的自定义文本模型指到 magpie 网关,Design 的模型菜单随 magpie 的模型列表自动同步。切换前先退出 Design;仅支持 Windows,详见 COMPATIBILITY.md。"}}, { "package": "@magpie-community/gateway-notify", "name": "Notify", "kind": "middleware", "community": true, "summary": { "en": "A push when an agent's turn is done or fails, after it ran long enough to be worth one: ntfy, Bark, Gotify, Server酱, Feishu, DingTalk, WeCom, Telegram or your own webhook. Agent, project, model and time only by default; the reply's text is opt-in.", "zh": "agent 一轮任务跑完或失败时推送提醒(只提醒跑够设定时长的任务):支持 ntfy、Bark、Gotify、Server酱、飞书、钉钉、企业微信、Telegram 和自定义 webhook。默认只发 agent、项目、模型和用时,回复正文需手动开启。" } }, { "package": "@magpie-community/hooks-mail-watch", "name": "Mail Watch", "kind": "middleware", "community": true,