Skip to content

Create ACP on Windows#11

Open
Azukay wants to merge 39 commits intoanyrobert:mainfrom
Azukay:feat/fix-acp-on-windows
Open

Create ACP on Windows#11
Azukay wants to merge 39 commits intoanyrobert:mainfrom
Azukay:feat/fix-acp-on-windows

Conversation

@Azukay
Copy link

@Azukay Azukay commented Mar 18, 2026

Summary

Create ACP (Agent Client Protocol) prompt delivery on Windows.

ACP transport (0cd9fa1)

  • Add acp-client.ts: spawn agent acp, JSON-RPC over stdio (initialize, authenticate, session/new, session/prompt)
  • Handle session/update streaming and session/request_permission
  • Add CURSOR_BRIDGE_USE_ACP and promptViaStdin config; wire agent-runner to use ACP when useAcp and prompt provided
  • Branch chat-completions for ACP sync and stream (raw chunks to SSE)
  • Add stdinContent support in process.ts for promptViaStdin path

Windows fixes (60a072d, 10dc59d)

  • Add acpCommand, acpArgs, acpEnv from resolveAgentCommand
  • Pass windowsVerbatimArguments to spawn when using cmd.exe fallback
  • Use child.kill('SIGKILL') on timeout (match process.ts)
  • Per-request timeout (60s) in sendRequest; reject and clear pending on timeout
  • Clear pending requests on child exit to avoid timer leaks

Skip authenticate, model, versioned layout (9d57203)

  • Skip ACP authenticate when CURSOR_API_KEY or CURSOR_BRIDGE_ACP_SKIP_AUTHENTICATE
  • Pass cmdArgs (with --model) to ACP streaming path
  • Add versioned layout detection (versions/YYYY.MM.DD-commit/) for Windows
  • Create minimal cli-config in temp workspace for chat-only mode
  • Add debug logging for unhandled session/update types

Raw debug flag (5df496b)

  • Add CURSOR_BRIDGE_ACP_RAW_DEBUG for raw JSON-RPC logging

Agent isolation (6d9b28d)

  • Isolate agent from global rules when chatOnlyWorkspace

Review findings (1c97cb0)

  • Remove CURSOR_API_KEY from argv; pass only via acpEnv (no --api-key in process args)
  • Add config test for CURSOR_BRIDGE_ACP_RAW_DEBUG=1 → acpRawDebug: true
  • Add acp-client.test.ts: skipAuthenticate, stdout from session/update, fake ACP server fixture
  • Document session/request_permission reject-once in README

anyrobert and others added 29 commits March 4, 2026 19:23
feat(logging): add verbose traffic logging via CURSOR_BRIDGE_VERBOSE
fix: pass through "auto" model identifier to Cursor API
- EnvSource, EnvOptions, LoadedEnv types
- loadEnvConfig() with aliases, defaults, path resolution
- resolveAgentCommand() for Windows cmd.exe bypass
- Supports injectable env for tests

Made-with: Cursor
- loadBridgeConfig() consumes loadEnvConfig
- CLI passes tailscale to loadBridgeConfig instead of mutating process.env
- Config tests use injected env

Made-with: Cursor
- Replace parseCliStreamLine with createStreamParser
- Track accumulated text to skip final duplicate full message
- Emit only deltas when text starts with accumulated
- Add cli-stream-parser tests

Made-with: Cursor
- process.ts uses resolveAgentCommand from env module
- Spawn Node directly when CURSOR_AGENT_NODE + CURSOR_AGENT_SCRIPT set
- Use cmd.exe /d /s /c with quoted args for .cmd files
- Add process tests

Made-with: Cursor
- CURSOR_AGENT_NODE, CURSOR_AGENT_SCRIPT for Windows
- Agent bin alias precedence
- Centralized env handling note
- Tailscale and path resolution notes

Made-with: Cursor
Made-with: Cursor
- Add CURSOR_BRIDGE_MAX_MODE to LoadedEnv and BridgeConfig
- Extend AgentCommand with agentScriptPath and configDir
- On Windows: resolve .cmd to node+index.js when present for preflight

Made-with: Cursor
Write maxMode: true to cli-config.json before spawning agent.
Config resolution: CURSOR_CONFIG_DIR, agent data/config, then platform default.

Made-with: Cursor
When maxMode is true and agentScriptPath is set, run preflight before spawn
and pass configDir as CURSOR_CONFIG_DIR so CLI reads the same config.

Made-with: Cursor
Made-with: Cursor
- Add acp-client.ts: spawn agent acp, JSON-RPC over stdio (initialize,
  authenticate, session/new, session/prompt), handle session/update
  streaming and session/request_permission.
- Add CURSOR_BRIDGE_USE_ACP and promptViaStdin config; wire agent-runner
  to use ACP when useAcp and prompt provided.
- Branch chat-completions for ACP sync and stream (raw chunks to SSE).
- Add stdinContent support in process.ts for promptViaStdin path.
- Document CURSOR_BRIDGE_USE_ACP and PROMPT_VIA_STDIN in README.
- Add process test for stdinContent.
@Azukay Azukay closed this Mar 18, 2026
@Azukay Azukay deleted the feat/fix-acp-on-windows branch March 18, 2026 10:46
@Azukay Azukay restored the feat/fix-acp-on-windows branch March 18, 2026 10:51
@Azukay Azukay changed the title Fix ACP on Windows and address review findings Create ACP on Windows Mar 18, 2026
@Azukay
Copy link
Author

Azukay commented Mar 18, 2026

It works on Windows. Needs a lot more testing.

@Azukay Azukay reopened this Mar 18, 2026
@Azukay
Copy link
Author

Azukay commented Mar 18, 2026

  • The LLM model can be specified and returns in the output but the Cursor Dashboard always (currently) shows "Auto" as the model which ran. Seems like a Cursor bug.

  • The agent can not be fully isolated from Cursor Global Rules

Azukay added 10 commits March 19, 2026 20:06
- Add acpCommand, acpArgs, acpEnv from resolveAgentCommand
- Pass windowsVerbatimArguments to spawn when using cmd.exe fallback
- Use child.kill('SIGKILL') on timeout (match process.ts)
- Add per-request timeout (60s) to sendRequest; reject and clear pending
- Add session/set_config_option for model when opts.model set
- Add acpArgsWithModel to inject --model into ACP args
- Skip ACP authenticate when CURSOR_API_KEY or CURSOR_BRIDGE_ACP_SKIP_AUTHENTICATE
- Pass cmdArgs (with --model) to ACP streaming path so configured model is used
- Add versioned layout detection (versions/YYYY.MM.DD-commit/) for Windows
- Create minimal cli-config in temp workspace for chat-only mode
- Add debug logging for unhandled session/update types
- Pass CURSOR_API_KEY in acpEnv when set
…nt tests

- Remove CURSOR_API_KEY from argv; pass only via acpEnv
- Add config test for CURSOR_BRIDGE_ACP_RAW_DEBUG=1
- Add acp-client.test.ts with skipAuthenticate and fake ACP server
…DATA isolation

- Move chat-only env overrides to getChatOnlyEnvOverrides() in workspace.ts
- On Windows: set APPDATA and LOCALAPPDATA to workspace subdirs
- On Unix: set XDG_CONFIG_HOME to workspace/.config
- Create AppData/Roaming, AppData/Local on Windows temp workspace
- Create .cursor/rules and .config dirs for isolated agent
When request model is 'auto', use config.defaultModel for response
model field instead of echoing 'auto'. Covers CURSOR_BRIDGE_DEFAULT_MODEL
set case; when unset, response remains 'auto'.

- chat-completions.ts: displayModel for streaming and non-streaming
- anthropic-messages.ts: same logic for message_start and final json
- server.test: add tests for display model and echo-auto cases
@Azukay Azukay force-pushed the feat/fix-acp-on-windows branch from d1f49dd to 1f0bfe0 Compare March 19, 2026 10:07
@anyrobert
Copy link
Owner

@Azukay this is looking good for me! let me know when you think we are good to merge it
really great work on this one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants