From 79b5bf40f9065ee82bab0c2dc0515e861e06397d Mon Sep 17 00:00:00 2001 From: hetaoBackend Date: Sun, 16 Aug 2026 21:14:50 +0800 Subject: [PATCH 1/3] feat: add MCode as built-in ACP agent --- CHANGELOG.md | 2 ++ agents/MCode.md | 46 ++++++++++++++++++++++++++++ agents/README.md | 2 ++ docs/agents.md | 17 +++++++++++ skills/acpx/SKILL.md | 1 + src/agent-registry.ts | 2 ++ test/agent-registry.test.ts | 7 +++++ test/integration.test.ts | 60 +++++++++++++++++++++++++++++++++++++ 8 files changed, 137 insertions(+) create mode 100644 agents/MCode.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb57063..803e1bef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Repo: https://github.com/openclaw/acpx ### Changes +- Agents/built-ins: add MiniMax Code via its native `mcode acp` stdio server. (#502) Thanks @hetaoBackend. + - Docs/readme: rewrite the project front door to the house standard and route detailed CLI guidance to the existing documentation. - Runtime/embedding: expose the existing per-tool permission policy through diff --git a/agents/MCode.md b/agents/MCode.md new file mode 100644 index 00000000..61a03e74 --- /dev/null +++ b/agents/MCode.md @@ -0,0 +1,46 @@ +# MCode + +- Built-in name: `mcode` +- Default command: `mcode acp` +- Upstream: [MiniMax Code](https://www.npmjs.com/package/@minimax-ai/code) + +`acpx mcode` launches MiniMax Code's native ACP v1 stdio server. Install and +authenticate the CLI first: + +```bash +npm install -g @minimax-ai/code +mcode login +``` + +Then run a one-shot prompt or create an in-process session: + +```bash +acpx mcode exec 'summarize this repository' +acpx mcode sessions new +acpx mcode 'review the current branch' +``` + +MCode emits normal ACP agent messages, tool-call updates, and permission requests. +Choose the acpx permission policy that matches the task, for example +`--approve-reads` (the default), `--approve-all`, or `--deny-all`. + +## Session lifecycle + +MCode currently implements `session/new` and `session/prompt`, but does not advertise +`session/load`. A live acpx process can keep using its in-process session; after the +MCode process exits, start a new session rather than expecting a saved provider session +to resume. `acpx mcode exec …` avoids persisted-session expectations and is the most +predictable choice for automation. + +If `mcode` is installed outside `PATH`, override the built-in argv in +`~/.acpx/config.json`: + +```json +{ + "agents": { + "mcode": { + "argv": ["/absolute/path/to/mcode", "acp"] + } + } +} +``` diff --git a/agents/README.md b/agents/README.md index 520676a1..3151ad02 100644 --- a/agents/README.md +++ b/agents/README.md @@ -16,6 +16,7 @@ Built-in agents: - `kilocode -> npx -y @kilocode/cli acp` - `kimi -> kimi acp` - `kiro -> kiro-cli-chat acp` +- `mcode -> mcode acp` - `mux -> mux acp` via an ACPX-owned npm range - `opencode -> npx -y opencode-ai acp` - `pool -> pool acp` @@ -38,6 +39,7 @@ Harness-specific docs in this directory: - [Kilocode](Kilocode.md): built-in `kilocode -> npx -y @kilocode/cli acp` - [Kimi](Kimi.md): built-in `kimi -> kimi acp` - [Kiro](Kiro.md): built-in `kiro -> kiro-cli-chat acp` +- [MCode](MCode.md): built-in `mcode -> mcode acp` - [Mux](Mux.md): built-in `mux -> mux acp` via an ACPX-owned npm range - [OpenCode](OpenCode.md): built-in `opencode -> npx -y opencode-ai acp` - [Pool](Pool.md): built-in `pool -> pool acp` diff --git a/docs/agents.md b/docs/agents.md index b03c8573..af98a24f 100644 --- a/docs/agents.md +++ b/docs/agents.md @@ -25,6 +25,7 @@ The default agent for top-level commands like `acpx exec …` and `acpx prompt | `kilocode` | `npx -y @kilocode/cli acp` | [Kilocode](https://kilocode.ai) | | `kimi` | `kimi acp` | [Kimi CLI](https://github.com/MoonshotAI/kimi-cli) | | `kiro` | `kiro-cli-chat acp` | [Kiro CLI](https://kiro.dev) | +| `mcode` | `mcode acp` | [MiniMax Code](https://www.npmjs.com/package/@minimax-ai/code) | | `mux` | `mux acp` via an ACPX-owned npm range | [Mux](https://mux.coder.com) | | `opencode` | `npx -y opencode-ai acp` | [OpenCode](https://opencode.ai) | | `pool` | `pool acp` | [Poolside](https://poolside.ai) | @@ -178,6 +179,22 @@ Configure model/provider settings through fast-agent environment variables, fast - Default command: `kiro-cli-chat acp` - Upstream: [kiro.dev](https://kiro.dev) +### MCode + +- Built-in name: `mcode` +- Default command: `mcode acp` +- Upstream: [MiniMax Code](https://www.npmjs.com/package/@minimax-ai/code) + +Install MiniMax Code with `npm install -g @minimax-ai/code`, then authenticate with +`mcode login` before launching it through acpx. The native `mcode acp` command runs an +ACP v1 server over stdio; permission requests are handled by acpx's normal permission +policy. + +MCode currently supports new in-process ACP sessions but does not advertise +`session/load`. Prefer `acpx mcode exec …` for one-shot work; after the agent process +exits, start a new persistent session instead of expecting a saved provider session to +resume. + ### Mux - Built-in name: `mux` diff --git a/skills/acpx/SKILL.md b/skills/acpx/SKILL.md index 70ff8781..c45977bb 100644 --- a/skills/acpx/SKILL.md +++ b/skills/acpx/SKILL.md @@ -95,6 +95,7 @@ Friendly agent names resolve to commands: - `kilocode` -> `npx -y @kilocode/cli acp` - `kimi` -> `kimi acp` - `kiro` -> `kiro-cli-chat acp` +- `mcode` -> `mcode acp` - `mux` -> `mux acp` via an ACPX-owned npm range - `opencode` -> `npx -y opencode-ai acp` - `pool` -> `pool acp` diff --git a/src/agent-registry.ts b/src/agent-registry.ts index 6fc0337d..92b0b18b 100644 --- a/src/agent-registry.ts +++ b/src/agent-registry.ts @@ -51,6 +51,7 @@ export const AGENT_REGISTRY: Record = { kilocode: "npx -y @kilocode/cli acp", kimi: "kimi acp", kiro: "kiro-cli-chat acp", + mcode: "mcode acp", mux: `npx -y mux@${ACP_ADAPTER_PACKAGE_RANGES.mux} acp`, opencode: "npx -y opencode-ai acp", pool: "pool acp", @@ -79,6 +80,7 @@ export const AGENT_ARGV_REGISTRY: Record = { kilocode: ["npx", "-y", "@kilocode/cli", "acp"], kimi: ["kimi", "acp"], kiro: ["kiro-cli-chat", "acp"], + mcode: ["mcode", "acp"], mux: ["npx", "-y", `mux@${ACP_ADAPTER_PACKAGE_RANGES.mux}`, "acp"], opencode: ["npx", "-y", "opencode-ai", "acp"], pool: ["pool", "acp"], diff --git a/test/agent-registry.test.ts b/test/agent-registry.test.ts index d4531400..eaad1177 100644 --- a/test/agent-registry.test.ts +++ b/test/agent-registry.test.ts @@ -59,6 +59,12 @@ test("kiro built-in uses kiro-cli-chat directly", () => { assert.equal(resolveAgentCommand("kiro"), "kiro-cli-chat acp"); }); +test("mcode built-in launches the native MCode ACP server", () => { + assert.equal(AGENT_REGISTRY.mcode, "mcode acp"); + assert.deepEqual(AGENT_ARGV_REGISTRY.mcode, ["mcode", "acp"]); + assert.equal(resolveAgentCommand("mcode"), "mcode acp"); +}); + test("fast-agent built-in runs the ACP entrypoint through uvx", () => { assert.equal(AGENT_REGISTRY["fast-agent"], "uvx fast-agent-mcp acp"); assert.equal(resolveAgentCommand("fast-agent"), "uvx fast-agent-mcp acp"); @@ -106,6 +112,7 @@ test("listBuiltInAgents preserves the required example prefix and alphabetical t "kilocode", "kimi", "kiro", + "mcode", "mux", "opencode", "pool", diff --git a/test/integration.test.ts b/test/integration.test.ts index 275e3870..60dd71ae 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -935,6 +935,33 @@ test("integration: built-in grok-build agent resolves to grok agent stdio", asyn }); }); +test("integration: built-in mcode agent resolves to mcode acp", async () => { + await withTempHome(async (homeDir) => { + const cwd = await fs.mkdtemp(path.join(os.tmpdir(), "acpx-integration-cwd-")); + const fakeBinDir = await fs.mkdtemp(path.join(os.tmpdir(), "acpx-fake-mcode-")); + + try { + await writeFakeMCodeAgent(fakeBinDir); + + const result = await runCli( + ["--approve-all", "--cwd", cwd, "--format", "quiet", "mcode", "exec", "echo hello"], + homeDir, + { + env: { + PATH: `${fakeBinDir}${path.delimiter}${process.env.PATH ?? ""}`, + }, + }, + ); + + assert.equal(result.code, 0, result.stderr); + assert.match(result.stdout, /hello/); + } finally { + await fs.rm(fakeBinDir, { recursive: true, force: true }); + await fs.rm(cwd, { recursive: true, force: true }); + } + }); +}); + test("integration: built-in pool agent resolves to pool acp", async () => { await withTempHome(async (homeDir) => { const cwd = await fs.mkdtemp(path.join(os.tmpdir(), "acpx-integration-cwd-")); @@ -4710,6 +4737,39 @@ async function writeFakeGrokBuildAgent(binDir: string): Promise { ); } +async function writeFakeMCodeAgent(binDir: string): Promise { + if (process.platform === "win32") { + await fs.writeFile( + path.join(binDir, "mcode.cmd"), + [ + "@echo off", + "setlocal", + 'if not "%~1"=="acp" exit /b 2', + `"${process.execPath}" "${MOCK_AGENT_PATH}" %2 %3 %4 %5 %6 %7 %8 %9`, + "", + ].join("\r\n"), + { encoding: "utf8" }, + ); + return; + } + + await fs.writeFile( + path.join(binDir, "mcode"), + [ + "#!/bin/sh", + 'if [ "$1" = "acp" ]; then', + " shift", + "else", + ' echo "unexpected mcode command: $*" 1>&2', + " exit 2", + "fi", + `exec "${process.execPath}" "${MOCK_AGENT_PATH}" "$@"`, + "", + ].join("\n"), + { encoding: "utf8", mode: 0o755 }, + ); +} + async function writeFakePoolAgent(binDir: string): Promise { if (process.platform === "win32") { await fs.writeFile( From ddafca469486361c7f4dfd58734a91759ce71691 Mon Sep 17 00:00:00 2001 From: hetaoBackend Date: Sun, 16 Aug 2026 22:25:03 +0800 Subject: [PATCH 2/3] chore: leave changelog updates to release process --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 803e1bef..3fb57063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,6 @@ Repo: https://github.com/openclaw/acpx ### Changes -- Agents/built-ins: add MiniMax Code via its native `mcode acp` stdio server. (#502) Thanks @hetaoBackend. - - Docs/readme: rewrite the project front door to the house standard and route detailed CLI guidance to the existing documentation. - Runtime/embedding: expose the existing per-tool permission policy through From 5b40647f7cf48e7f747191afeacc9110ef5c3c36 Mon Sep 17 00:00:00 2001 From: hetaoBackend Date: Sun, 16 Aug 2026 22:31:25 +0800 Subject: [PATCH 3/3] docs: clarify MCode session lifecycle --- agents/MCode.md | 12 +++++------- docs/agents.md | 9 +++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/agents/MCode.md b/agents/MCode.md index 61a03e74..c9ae844a 100644 --- a/agents/MCode.md +++ b/agents/MCode.md @@ -12,12 +12,10 @@ npm install -g @minimax-ai/code mcode login ``` -Then run a one-shot prompt or create an in-process session: +Then run a one-shot prompt: ```bash acpx mcode exec 'summarize this repository' -acpx mcode sessions new -acpx mcode 'review the current branch' ``` MCode emits normal ACP agent messages, tool-call updates, and permission requests. @@ -27,10 +25,10 @@ Choose the acpx permission policy that matches the task, for example ## Session lifecycle MCode currently implements `session/new` and `session/prompt`, but does not advertise -`session/load`. A live acpx process can keep using its in-process session; after the -MCode process exits, start a new session rather than expecting a saved provider session -to resume. `acpx mcode exec …` avoids persisted-session expectations and is the most -predictable choice for automation. +provider-session reload. `acpx mcode sessions new` closes the ACP client after saving +the local record, so a later CLI prompt starts with fresh MCode context instead of +continuing that provider conversation. Do not treat sequential CLI invocations as a +multi-turn session. Use `acpx mcode exec …` for predictable automation. If `mcode` is installed outside `PATH`, override the built-in argv in `~/.acpx/config.json`: diff --git a/docs/agents.md b/docs/agents.md index af98a24f..ea404ae6 100644 --- a/docs/agents.md +++ b/docs/agents.md @@ -190,10 +190,11 @@ Install MiniMax Code with `npm install -g @minimax-ai/code`, then authenticate w ACP v1 server over stdio; permission requests are handled by acpx's normal permission policy. -MCode currently supports new in-process ACP sessions but does not advertise -`session/load`. Prefer `acpx mcode exec …` for one-shot work; after the agent process -exits, start a new persistent session instead of expecting a saved provider session to -resume. +MCode currently does not advertise provider-session reload. Although +`acpx mcode sessions new` can create a local record, it closes the ACP client before a +later CLI invocation; that later prompt starts with fresh MCode context. Prefer +`acpx mcode exec …` and do not rely on sequential CLI invocations for a persistent +conversation. ### Mux