mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 23:01:08 +00:00
* Add Cursor CLI to ACP allowedAgents - acpx: add cursor to ACPX_BUILTIN_AGENT_COMMANDS (agent acp) - docs: add cursor to acp-agents harness list and allowedAgents example Fixes #28321 Made-with: Cursor * ACP Cursor: add to acp-router skill, system-prompt, and schema help - acp-router SKILL: add Cursor to description, intent, agentId mapping, harness aliases, and built-in adapter commands (agent acp) - system-prompt: add cursor to ACP harness example - schema.help: add cursor to runtime.acp.agent example Fixes #28321 Made-with: Cursor * fix(acpx): align built-in agent registry with latest acpx --------- Co-authored-by: Rob MacDonald <rob@robmacdonald.com>
102 lines
2.8 KiB
TypeScript
102 lines
2.8 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
const { spawnAndCollectMock } = vi.hoisted(() => ({
|
|
spawnAndCollectMock: vi.fn(),
|
|
}));
|
|
|
|
vi.mock("./process.js", () => ({
|
|
spawnAndCollect: spawnAndCollectMock,
|
|
}));
|
|
|
|
import { __testing, resolveAcpxAgentCommand } from "./mcp-agent-command.js";
|
|
|
|
describe("resolveAcpxAgentCommand", () => {
|
|
it.each([
|
|
["cursor", "cursor-agent acp"],
|
|
["gemini", "gemini --acp"],
|
|
["openclaw", "openclaw acp"],
|
|
["copilot", "copilot --acp --stdio"],
|
|
["pi", "npx -y pi-acp@0.0.22"],
|
|
["codex", "npx -y @zed-industries/codex-acp@0.9.5"],
|
|
["claude", "npx -y @zed-industries/claude-agent-acp@0.21.0"],
|
|
])("uses the current acpx built-in for %s by default", async (agent, expected) => {
|
|
spawnAndCollectMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({ agents: {} }),
|
|
stderr: "",
|
|
code: 0,
|
|
error: null,
|
|
});
|
|
|
|
const command = await resolveAcpxAgentCommand({
|
|
acpxCommand: "/plugin/node_modules/.bin/acpx",
|
|
cwd: "/plugin",
|
|
agent,
|
|
});
|
|
|
|
expect(command).toBe(expected);
|
|
});
|
|
|
|
it("returns null for unknown agent ids instead of falling back to raw commands", async () => {
|
|
spawnAndCollectMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({ agents: {} }),
|
|
stderr: "",
|
|
code: 0,
|
|
error: null,
|
|
});
|
|
|
|
const command = await resolveAcpxAgentCommand({
|
|
acpxCommand: "/plugin/node_modules/.bin/acpx",
|
|
cwd: "/plugin",
|
|
agent: "sh -c whoami",
|
|
});
|
|
|
|
expect(command).toBeNull();
|
|
});
|
|
|
|
it("threads stripProviderAuthEnvVars through the config show probe", async () => {
|
|
spawnAndCollectMock.mockResolvedValueOnce({
|
|
stdout: JSON.stringify({
|
|
agents: {
|
|
codex: {
|
|
command: "custom-codex",
|
|
},
|
|
},
|
|
}),
|
|
stderr: "",
|
|
code: 0,
|
|
error: null,
|
|
});
|
|
|
|
const command = await resolveAcpxAgentCommand({
|
|
acpxCommand: "/plugin/node_modules/.bin/acpx",
|
|
cwd: "/plugin",
|
|
agent: "codex",
|
|
stripProviderAuthEnvVars: true,
|
|
});
|
|
|
|
expect(command).toBe("custom-codex");
|
|
expect(spawnAndCollectMock).toHaveBeenCalledWith(
|
|
{
|
|
command: "/plugin/node_modules/.bin/acpx",
|
|
args: ["--cwd", "/plugin", "config", "show"],
|
|
cwd: "/plugin",
|
|
stripProviderAuthEnvVars: true,
|
|
},
|
|
undefined,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("buildMcpProxyAgentCommand", () => {
|
|
it("escapes Windows-style proxy paths without double-escaping backslashes", () => {
|
|
const quoted = __testing.quoteCommandPart(
|
|
"C:\\repo\\extensions\\acpx\\src\\runtime-internals\\mcp-proxy.mjs",
|
|
);
|
|
|
|
expect(quoted).toBe(
|
|
'"C:\\\\repo\\\\extensions\\\\acpx\\\\src\\\\runtime-internals\\\\mcp-proxy.mjs"',
|
|
);
|
|
expect(quoted).not.toContain("\\\\\\");
|
|
});
|
|
});
|