The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | |
| 4 | import { AcpRegistrySettings } from "../settings.ts"; |
| 5 | import { prefersHttpMcpTransport } from "./mcpTransport.ts"; |
| 6 | |
| 7 | const decodeSettings = Schema.decodeSync(AcpRegistrySettings); |
| 8 | |
| 9 | const local = (commandPath: string, commandArgs: string[] = []) => |
| 10 | decodeSettings({ source: "local", commandPath, commandArgs }); |
| 11 | |
| 12 | describe("prefersHttpMcpTransport", () => { |
| 13 | it("uses HTTP for the vendored Command Code launcher", () => { |
| 14 | expect( |
| 15 | prefersHttpMcpTransport( |
| 16 | local("C:\\Users\\me\\.t3\\bin\\cmdcode\\node.exe", [ |
| 17 | "C:\\Users\\me\\.t3\\bin\\cmdcode\\node_modules\\command-code\\dist\\index.mjs", |
| 18 | "acp", |
| 19 | ]), |
| 20 | ), |
| 21 | ).toBe(true); |
| 22 | expect( |
| 23 | prefersHttpMcpTransport( |
| 24 | local("C:\\tools\\node.exe", ["C:\\src\\command-code\\dist\\cli.mjs", "acp"]), |
| 25 | ), |
| 26 | ).toBe(true); |
| 27 | }); |
| 28 | |
| 29 | it("uses HTTP for the global Command Code executable", () => { |
| 30 | expect(prefersHttpMcpTransport(local("C:\\tools\\cmdc.exe", ["acp"]))).toBe(true); |
| 31 | expect(prefersHttpMcpTransport(local("/usr/local/bin/cmdc"))).toBe(true); |
| 32 | }); |
| 33 | |
| 34 | it("keeps the stdio bridge for a batch shim T3 refuses to launch", () => { |
| 35 | expect(prefersHttpMcpTransport(local("C:\\tools\\cmdc.cmd", ["acp"]))).toBe(false); |
| 36 | }); |
| 37 | |
| 38 | it("keeps the stdio bridge for other local agents", () => { |
| 39 | expect( |
| 40 | prefersHttpMcpTransport( |
| 41 | local("C:\\tools\\node.exe", ["C:\\tools\\some-other-agent\\dist\\index.mjs", "acp"]), |
| 42 | ), |
| 43 | ).toBe(false); |
| 44 | expect(prefersHttpMcpTransport(local("C:\\tools\\claude-agent-acp.exe"))).toBe(false); |
| 45 | expect(prefersHttpMcpTransport(local("C:\\tools\\command-code\\runner.mjs"))).toBe(false); |
| 46 | }); |
| 47 | |
| 48 | it("keeps the stdio bridge for registry agents", () => { |
| 49 | expect( |
| 50 | prefersHttpMcpTransport(decodeSettings({ source: "registry", agentId: "claude-acp" })), |
| 51 | ).toBe(false); |
| 52 | }); |
| 53 | }); |