Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions agents/MCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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:

```bash
acpx mcode exec 'summarize this repository'
```

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
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`:

```json
{
"agents": {
"mcode": {
"argv": ["/absolute/path/to/mcode", "acp"]
}
}
}
```
2 changes: 2 additions & 0 deletions agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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`
Expand Down
18 changes: 18 additions & 0 deletions docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down Expand Up @@ -178,6 +179,23 @@ 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 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

- Built-in name: `mux`
Expand Down
1 change: 1 addition & 0 deletions skills/acpx/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 2 additions & 0 deletions src/agent-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const AGENT_REGISTRY: Record<string, string> = {
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",
Expand Down Expand Up @@ -79,6 +80,7 @@ export const AGENT_ARGV_REGISTRY: Record<string, string[]> = {
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"],
Expand Down
7 changes: 7 additions & 0 deletions test/agent-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -106,6 +112,7 @@ test("listBuiltInAgents preserves the required example prefix and alphabetical t
"kilocode",
"kimi",
"kiro",
"mcode",
"mux",
"opencode",
"pool",
Expand Down
60 changes: 60 additions & 0 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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-"));
Expand Down Expand Up @@ -4710,6 +4737,39 @@ async function writeFakeGrokBuildAgent(binDir: string): Promise<void> {
);
}

async function writeFakeMCodeAgent(binDir: string): Promise<void> {
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<void> {
if (process.platform === "win32") {
await fs.writeFile(
Expand Down
Loading