Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: update command to launch ACP in windows (#6862)

Myles Scolnick7af4e9479e53
diff --git a/docs/guides/editor_features/agents.md b/docs/guides/editor_features/agents.md
index 2eb68e8d02..3bb4e1eb57 100644
--- a/docs/guides/editor_features/agents.md
+++ b/docs/guides/editor_features/agents.md
@@ -29,9 +29,17 @@ claude
**Connection command:**
-```bash
-npx stdio-to-ws "npx @zed-industries/claude-code-acp" --port 3017
-```
+=== "macOS/Linux"
+
+ ```bash
+ npx stdio-to-ws "npx @zed-industries/claude-code-acp" --port 3017
+ ```
+
+=== "Windows"
+
+ ```bash
+ npx stdio-to-ws "cmd /c npx @zed-industries/claude-code-acp" --port 3017
+ ```
### Gemini Agent
@@ -41,9 +49,17 @@ See login and authentication instructions in the [Gemini CLI documentation](http
**Connection command:**
-```bash
-npx stdio-to-ws "npx @google/gemini-cli --experimental-acp" --port 3019
-```
+=== "macOS/Linux"
+
+ ```bash
+ npx stdio-to-ws "npx @google/gemini-cli --experimental-acp" --port 3019
+ ```
+
+=== "Windows"
+
+ ```bash
+ npx stdio-to-ws "cmd /c npx @google/gemini-cli --experimental-acp" --port 3019
+ ```
## Connecting to an agent
diff --git a/frontend/src/components/chat/acp/__tests__/state.test.ts b/frontend/src/components/chat/acp/__tests__/state.test.ts
index 10740c62c4..1a664d447c 100644
--- a/frontend/src/components/chat/acp/__tests__/state.test.ts
+++ b/frontend/src/components/chat/acp/__tests__/state.test.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import * as shortcuts from "@/core/hotkeys/shortcuts";
import {
type AgentSession,
type AgentSessionState,
@@ -658,16 +659,32 @@ describe("state utility functions", () => {
});
describe("getAgentConnectionCommand", () => {
- it("should return correct command for claude", () => {
+ it("should return correct command for claude on non-Windows", () => {
+ vi.spyOn(shortcuts, "isPlatformWindows").mockReturnValue(false);
expect(getAgentConnectionCommand("claude")).toMatchInlineSnapshot(`
"npx stdio-to-ws "npx @zed-industries/claude-code-acp" --port 3017"
`);
});
- it("should return correct command for gemini", () => {
+ it("should return correct command for claude on Windows", () => {
+ vi.spyOn(shortcuts, "isPlatformWindows").mockReturnValue(true);
+ expect(getAgentConnectionCommand("claude")).toMatchInlineSnapshot(`
+ "npx stdio-to-ws "cmd /c npx @zed-industries/claude-code-acp" --port 3017"
+ `);
+ });
+
+ it("should return correct command for gemini on non-Windows", () => {
+ vi.spyOn(shortcuts, "isPlatformWindows").mockReturnValue(false);
expect(getAgentConnectionCommand("gemini")).toMatchInlineSnapshot(`
"npx stdio-to-ws "npx @google/gemini-cli --experimental-acp" --port 3019"
`);
});
+
+ it("should return correct command for gemini on Windows", () => {
+ vi.spyOn(shortcuts, "isPlatformWindows").mockReturnValue(true);
+ expect(getAgentConnectionCommand("gemini")).toMatchInlineSnapshot(`
+ "npx stdio-to-ws "cmd /c npx @google/gemini-cli --experimental-acp" --port 3019"
+ `);
+ });
});
});
diff --git a/frontend/src/components/chat/acp/state.ts b/frontend/src/components/chat/acp/state.ts
index 9d07a8c5c4..595e363f55 100644
--- a/frontend/src/components/chat/acp/state.ts
+++ b/frontend/src/components/chat/acp/state.ts
@@ -3,6 +3,7 @@
import { atom } from "jotai";
import { atomWithStorage } from "jotai/utils";
import { capitalize } from "lodash-es";
+import { isPlatformWindows } from "@/core/hotkeys/shortcuts";
import type { TypedString } from "@/utils/typed";
import { generateUUID } from "@/utils/uuid";
import type { ExternalAgentSessionId, SessionSupportType } from "./types";
@@ -259,5 +260,6 @@ export function getAgentSessionSupport(
export function getAgentConnectionCommand(agentId: ExternalAgentId): string {
const port = AGENT_CONFIG[agentId].port;
const command = AGENT_CONFIG[agentId].command;
- return `npx stdio-to-ws "${command}" --port ${port}`;
+ const wrappedCommand = isPlatformWindows() ? `cmd /c ${command}` : command;
+ return `npx stdio-to-ws "${wrappedCommand}" --port ${port}`;
}