Skip to content

feat(runner): add Cursor CLI as a new runner provider#1386

Draft
jeremyeder wants to merge 6 commits intoambient-code:mainfrom
jeremyeder:feature/cursor-cli-runner
Draft

feat(runner): add Cursor CLI as a new runner provider#1386
jeremyeder wants to merge 6 commits intoambient-code:mainfrom
jeremyeder:feature/cursor-cli-runner

Conversation

@jeremyeder
Copy link
Copy Markdown
Contributor

Summary

  • Adds Cursor CLI as a third runner provider alongside Claude Code and Gemini CLI, feature-gated behind runner.cursor-cli.enabled (workspace-scoped Unleash flag)
  • New ag_ui_cursor_cli package: NDJSON parser for the Cursor stream-json event format, AG-UI protocol adapter (CursorCLIAdapter) following the same pattern as the Gemini CLI adapter
  • New ambient_runner.bridges.cursor_cli package: CursorCLIBridge (subclasses PlatformBridge), CursorSessionWorker/CursorSessionManager (async subprocess management with per-thread locks, TTL eviction, session-ID persistence across pod restarts), auth helper, MCP config writer that merges into .cursor/mcp.json
  • Registry, feature flag, model list, Dockerfile install block, and GHA tool-version tracking all updated

Design notes

  • The Cursor CLI stream-json event format is based on documentation research; parse_event() carries a NOTE comment flagging this as unverified against a real binary
  • CURSOR_CLI_VERSION ARG in the Dockerfile is documentation-only — the upstream curl installer does not accept a version argument; the GHA sanity check explicitly excludes it with a comment
  • Session IDs are persisted to cursor_session_ids.json and restored on pod restart for conversation continuity
  • Platform secrets are stripped via _CURSOR_ENV_BLOCKLIST before spawning the agent binary

Test plan

  • Enable runner.cursor-cli.enabled flag for a workspace
  • Create a session with a cursor:* model and verify the agent binary is invoked with the expected flags
  • Verify NDJSON stream is parsed and AG-UI events are emitted correctly
  • Verify session ID is persisted and --resume is used on subsequent turns
  • Verify platform secrets are not leaked to the Cursor CLI process environment
  • Verify MCP servers are written to .cursor/mcp.json and merged with existing config
  • Disable the flag and verify cursor sessions are rejected at the bridge layer

🤖 Generated with Claude Code

Adds full support for Cursor CLI as a third runner provider alongside Claude Code and Gemini CLI. The implementation follows the established bridge/adapter pattern and is feature-gated behind `runner.cursor-cli.enabled`.

## What's included

### New packages
- `ag_ui_cursor_cli/` — NDJSON parser (`types.py`, `parse_event()`), AG-UI protocol adapter (`adapter.py`, `CursorCLIAdapter`), re-exported utils
- `ambient_runner/bridges/cursor_cli/` — `CursorCLIBridge` (PlatformBridge subclass), `CursorSessionWorker`/`CursorSessionManager` (async subprocess management with TTL eviction and session-ID persistence), auth helper, MCP config writer

### Infrastructure changes
- `agent-registry-configmap.yaml` — Cursor CLI registry entry with feature gate
- `flags.json` — `runner.cursor-cli.enabled` flag (workspace-scoped)
- `models.json` — Cursor provider defaults and four cursor model entries
- `Dockerfile` — Cursor CLI install block (pass-through version; pinning not supported by upstream installer)
- `runner-tool-versions.yml` — Cursor CLI version tracking with explanatory comments

### Design notes
- Cursor CLI `stream-json` event format is documented-but-unverified; `parse_event()` includes a NOTE comment
- `CURSOR_CLI_VERSION` ARG is documentation-only; the upstream curl installer does not accept a version argument
- Session IDs are persisted across pod restarts via `cursor_session_ids.json`
- Env var blocklist strips platform secrets before spawning the `agent` binary

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 21, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit ba2f8cd
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/69e7c57d18a32a0009f4c0f5

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 17635ffc-6e3d-40f5-8eb9-da04bf47a6bb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

Ambient Code Bot and others added 5 commits April 21, 2026 14:35
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e deltas

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant