llm-cli-gateway 2.12.2 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,30 @@
2
2
 
3
3
  All notable changes to the llm-cli-gateway project.
4
4
 
5
- ## [Unreleased]
5
+ ## [2.13.0] - 2026-07-01: Cursor Agent CLI provider
6
+
7
+ ### Added
8
+
9
+ - **Cursor Agent CLI (7th gateway provider).** `cursor_request` / `cursor_request_async`
10
+ drive `cursor-agent --print` headless mode with model selection, `plan`/`ask`
11
+ mode, output format, force/auto-review/sandbox/trust controls, workspace and
12
+ extra `--add-dir` roots, and session resume (`--resume`/`--continue`). Cursor
13
+ has no `promptParts` surface (plain `prompt` only, like Devin) and is not
14
+ wired for request-time MCP server injection because Cursor owns MCP config via
15
+ `cursor-agent mcp`. Covered by doctor, provider capability inventory,
16
+ provider-login guidance, upstream-contract drift detection, and CLI upgrade
17
+ support (`cursor-agent update`).
18
+ - **Cursor native ACP discovery and gated transport.** The installed Cursor Agent
19
+ CLI exposes a native `cursor-agent acp` stdio entrypoint; initialize plus
20
+ `session/new` smoke passed locally. Gateway request tools still default to the
21
+ CLI headless path. Explicit `transport:"acp"` stays config-gated and rejects
22
+ unsupported Cursor CLI-only controls instead of silently dropping them.
23
+ - **Cursor review hardening.** Cursor validation reviewers now run through
24
+ `cursor-agent --print --mode ask --sandbox enabled`; high-impact Cursor flags
25
+ (`force`, `trust`, `sandbox:"disabled"`) are gated under
26
+ `approvalStrategy:"mcp_managed"`; remote HTTP/OAuth workspace inputs must use
27
+ registered workspace aliases/roots; and docs/schema warn that gateway-created
28
+ `gw-*` ids are not resumable Cursor chat ids.
6
29
 
7
30
  ## [2.12.2] - 2026-07-01: backpressure hardening and release-gate stability
8
31
 
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
  > _"Without consultation, plans are frustrated, but with many counselors they succeed."_
10
10
  > — Proverbs 15:22 (LSB)
11
11
 
12
- A Model Context Protocol (MCP) gateway for running Claude Code, Codex, Gemini, Grok, Mistral (Vibe), and Devin CLIs from one MCP endpoint, with durable async jobs, session continuity, cache-aware prompting, observability, and personal-appliance setup tooling.
12
+ A Model Context Protocol (MCP) gateway for running Claude Code, Codex, Gemini, Grok, Mistral (Vibe), Devin, and Cursor Agent CLIs from one MCP endpoint, with durable async jobs, session continuity, cache-aware prompting, observability, and personal-appliance setup tooling.
13
13
 
14
- **Why developers try it:** one local MCP endpoint for cross-LLM validation, multi-agent coding workflows, and repeatable assistant-led setup across six provider CLIs.
14
+ **Why developers try it:** one local MCP endpoint for cross-LLM validation, multi-agent coding workflows, and repeatable assistant-led setup across registered provider CLIs.
15
15
 
16
16
  **Current signals:** CI and security workflows pass on `main`, OpenSSF Scorecard is published, OpenSSF Best Practices is passing, releases use Sigstore signing, and the package is MIT licensed.
17
17
 
@@ -38,7 +38,7 @@ Or use directly with `npx` from an MCP client:
38
38
 
39
39
  `llm-cli-gateway` is a single-user MCP gateway for cross-LLM validation and multi-agent coding workflows. It is more than a thin CLI wrapper:
40
40
 
41
- - Runs six provider CLIs through consistent sync and async MCP tools.
41
+ - Runs registered provider CLIs through consistent sync and async MCP tools.
42
42
  - Persists long-running jobs, supports restart-safe result collection, deduplication, cancellation, and sync-to-async deferral.
43
43
  - Tracks sessions, real CLI resume paths, structured response metadata, and cache telemetry.
44
44
  - Supports cache-aware `promptParts`, including explicit Claude `cache_control` when opted in.
@@ -157,7 +157,7 @@ docker compose -f docker/personal.compose.yml run --rm doctor
157
157
 
158
158
  ### Core Capabilities
159
159
 
160
- - **Multi-LLM Orchestration**: Unified interface for Claude Code, Codex, Gemini, Grok, Mistral (Vibe), and Devin CLIs
160
+ - **Multi-LLM Orchestration**: Unified interface for Claude Code, Codex, Gemini, Grok, Mistral (Vibe), Devin, and Cursor Agent CLIs
161
161
  - **Session Management**: Track and resume conversations across all CLIs with persistent storage
162
162
  - **Gateway-owned worktrees**: Run any sync or async provider request inside a managed git worktree, with per-session reuse and cleanup
163
163
  - **Token Optimization**: Automatic 44% reduction on prompts, 37% on responses (opt-in)
@@ -169,11 +169,11 @@ docker compose -f docker/personal.compose.yml run --rm doctor
169
169
  - **SQLite Flight Recorder**: Every request/response logged to `~/.llm-cli-gateway/logs.db` with correlation IDs, token usage, duration, retry counts, and circuit breaker state. Browse with [Datasette](https://datasette.io/): `datasette ~/.llm-cli-gateway/logs.db`
170
170
  - **Structured Metadata**: Tool responses include machine-readable `structuredContent` (model, cli, correlationId, sessionId, durationMs, token counts)
171
171
  - **Cache observability resources**: `cache-state://global`, `cache-state://session/{id}`, and `cache-state://prefix/{hash}` MCP resources return aggregate cache hit/miss/savings — tokens and hashes only, no prompt text. `session_get` includes a `cacheState` block when the session has prior requests.
172
- - **Provider capability inventory**: `provider_tool_capabilities` and `provider-tools://catalog` expose the gateway request fields, supported/degraded provider controls, local skill/tool discovery, and safe config-surface hints for Claude Code, Codex CLI, Gemini/Antigravity, Grok CLI/API, Mistral Vibe, and Cognition Devin. `doctor --json` includes a compact `provider_capabilities` summary for setup assistants.
172
+ - **Provider capability inventory**: `provider_tool_capabilities` and `provider-tools://catalog` expose the gateway request fields, supported/degraded provider controls, local skill/tool discovery, and safe config-surface hints for Claude Code, Codex CLI, Gemini/Antigravity, Grok CLI/API, Mistral Vibe, Cognition Devin, and Cursor Agent. `doctor --json` includes a compact `provider_capabilities` summary for setup assistants.
173
173
 
174
174
  ### Cache-aware operation
175
175
 
176
- Every `*_request` and `*_request_async` tool except `devin_request` / `devin_request_async` accepts an optional `promptParts` field that structures the prompt for better cache hit rates (the Devin headless path takes a plain `prompt` only). The gateway concatenates the parts in canonical order (`system → tools → context → task`) so that the stable prefix bytes precede the volatile task tail unchanged across calls, letting each provider's automatic prompt-caching land on the same content hash each time.
176
+ Every `*_request` and `*_request_async` tool except `devin_request` / `devin_request_async` and `cursor_request` / `cursor_request_async` accepts an optional `promptParts` field that structures the prompt for better cache hit rates (the Devin and Cursor headless paths take a plain `prompt` only). The gateway concatenates the parts in canonical order (`system → tools → context → task`) so that the stable prefix bytes precede the volatile task tail unchanged across calls, letting each provider's automatic prompt-caching land on the same content hash each time.
177
177
 
178
178
  ```json
179
179
  {
@@ -188,7 +188,7 @@ Every `*_request` and `*_request_async` tool except `devin_request` / `devin_req
188
188
 
189
189
  `prompt` and `promptParts` are mutually exclusive — pass exactly one.
190
190
 
191
- Per-CLI capability matrix (prefix discipline is automatic via `promptParts` for all providers except Devin, which has no `promptParts` surface; explicit levers are provider-specific):
191
+ Per-CLI capability matrix (prefix discipline is automatic via `promptParts` for all providers except Devin and Cursor, which have no `promptParts` surface; explicit levers are provider-specific):
192
192
 
193
193
  | CLI | Prefix discipline | Explicit lever(s) |
194
194
  | ------- | ----------------- | ----------------- |
@@ -197,6 +197,8 @@ Per-CLI capability matrix (prefix discipline is automatic via `promptParts` for
197
197
  | gemini | yes | none (implicit server-side) |
198
198
  | grok | yes | `compactionMode` / `compactionDetail` (context compaction: `summary|transcript|segments`; `segments` writes per-segment markdown) |
199
199
  | mistral | yes | none (implicit) |
200
+ | devin | no | plain `prompt` only |
201
+ | cursor | no | plain `prompt` only |
200
202
 
201
203
  **Claude example (explicit cacheControl)**
202
204
 
@@ -960,9 +962,36 @@ Run a Cognition Devin CLI request synchronously (headless print mode, `devin -p`
960
962
  - `idleTimeoutMs` (integer, optional): Kill a stuck process after output inactivity; 30,000 to 3,600,000 ms
961
963
  - `forceRefresh` (boolean, optional): Bypass dedup and force a fresh CLI run, default: false
962
964
 
963
- ##### `claude_request_async` / `codex_request_async` / `gemini_request_async` / `grok_request_async` / `mistral_request_async` / `devin_request_async`
965
+ ##### `cursor_request`
964
966
 
965
- Start a long-running Claude, Codex, Gemini, Grok, Mistral, or Devin request without waiting for completion in the same MCP call.
967
+ Run a Cursor Agent CLI request synchronously. Defaults to headless print mode (`cursor-agent --print`) and auto-defers to a pollable job past the sync deadline when async jobs are enabled. Set `transport: "acp"` to use Cursor's native `cursor-agent acp` transport when `[acp]` and `[acp.providers.cursor].runtime_enabled` are enabled; current ACP routing accepts only prompt/model/session inputs and rejects CLI-only options such as `mode`, `workspace`, `sandbox`, `force`, and `trust`.
968
+
969
+ **Parameters:**
970
+
971
+ - `prompt` (string, required): Prompt text for Cursor Agent CLI (1-100,000 chars)
972
+ - `model` (string, optional): Model name or alias (for example `gpt-5`, `sonnet-4-thinking`, or `latest`)
973
+ - `mode` (string, optional): Cursor mode, `"plan"` or `"ask"` (`--mode`)
974
+ - `outputFormat` (string, optional): `"text"` (default), `"json"`, or `"stream-json"`
975
+ - `transport` (string, optional): `"cli"` (default) or `"acp"`; ACP fails closed unless enabled in gateway config and rejects unsupported Cursor CLI-only controls instead of dropping them
976
+ - `force` (boolean, optional): Emit `--force` for non-interactive operation
977
+ - `autoReview` (boolean, optional): Emit `--auto-review`
978
+ - `sandbox` (string, optional): `"enabled"` or `"disabled"` (`--sandbox`)
979
+ - `trust` (boolean, optional): Emit `--trust` for this invocation
980
+ - `workspace` (string, optional): Cursor workspace path or name (`--workspace`); remote HTTP/OAuth callers must pass a registered workspace alias, while local stdio callers may pass paths
981
+ - `addDir` (string[], optional): Additional workspace roots (one `--add-dir` per entry); remote HTTP/OAuth callers must use registered workspace roots
982
+ - `sessionId` (string, optional): Cursor chat/session ID to resume (`--resume <id>`). The `gw-*` id minted for a brand-new gateway session is not resumable through `sessionId`; continue with `resumeLatest: true`
983
+ - `resumeLatest` (boolean, optional): Resume the most recent Cursor chat (`--continue`)
984
+ - `createNewSession` (boolean, optional): Force a new session
985
+ - `approvalStrategy` (string, optional): `"legacy"` (default) or `"mcp_managed"`; under MCP-managed approval, high-impact Cursor flags (`force`, `trust`, or `sandbox: "disabled"`) are denied unless bypass approval is explicitly allowed
986
+ - `approvalPolicy` (string, optional): `"strict"`, `"balanced"`, or `"permissive"` override for MCP-managed approval
987
+ - `optimizePrompt` / `optimizeResponse` (boolean, optional): Token-efficiency optimisation, default: false
988
+ - `correlationId` (string, optional): Request trace ID (auto-generated if omitted)
989
+ - `idleTimeoutMs` (integer, optional): Kill a stuck process after output inactivity; 30,000 to 3,600,000 ms
990
+ - `forceRefresh` (boolean, optional): Bypass dedup and force a fresh CLI run, default: false
991
+
992
+ ##### `claude_request_async` / `codex_request_async` / `gemini_request_async` / `grok_request_async` / `mistral_request_async` / `devin_request_async` / `cursor_request_async`
993
+
994
+ Start a long-running Claude, Codex, Gemini, Grok, Mistral, Devin, or Cursor request without waiting for completion in the same MCP call.
966
995
 
967
996
  Use this flow when analysis/runtime can exceed client tool-call limits:
968
997
 
@@ -1021,7 +1050,7 @@ Return the gateway's declared provider CLI contracts, optionally probing the ins
1021
1050
 
1022
1051
  **Parameters:**
1023
1052
 
1024
- - `cli` (string, optional): Filter (`claude|codex|gemini|grok|mistral|devin`)
1053
+ - `cli` (string, optional): Filter (`claude|codex|gemini|grok|mistral|devin|cursor`)
1025
1054
  - `probeInstalled` (boolean, optional, default `false`): Run local `--help` probes and compare advertised flags against the declared contract — strongly recommended after any provider CLI upgrade. The probe reports `missingFlags`, `extraFlags`, `acknowledgedExtraFlags` (known upstream-only flags filtered from `extraFlags`), `discoveredFlags`, and stale-marker `warnings`.
1026
1055
 
1027
1056
  #### Session Management Tools
@@ -1032,7 +1061,7 @@ Create a new session for a specific CLI.
1032
1061
 
1033
1062
  **Parameters:**
1034
1063
 
1035
- - `cli` (string, required): CLI to create session for ("claude", "codex", "gemini", "grok", "mistral", "devin")
1064
+ - `cli` (string, required): CLI to create session for ("claude", "codex", "gemini", "grok", "mistral", "devin", "cursor")
1036
1065
  - `description` (string, optional): Description for the session
1037
1066
  - `setAsActive` (boolean, optional): Set as active session, default: true
1038
1067
 
@@ -1052,7 +1081,7 @@ List all sessions, optionally filtered by CLI.
1052
1081
 
1053
1082
  **Parameters:**
1054
1083
 
1055
- - `cli` (string, optional): Filter by CLI ("claude", "codex", "gemini", "grok", "mistral", "devin")
1084
+ - `cli` (string, optional): Filter by CLI ("claude", "codex", "gemini", "grok", "mistral", "devin", "cursor")
1056
1085
 
1057
1086
  **Response includes:**
1058
1087
 
@@ -1101,7 +1130,7 @@ List available models for each CLI.
1101
1130
 
1102
1131
  **Parameters:**
1103
1132
 
1104
- - `cli` (string, optional): Specific provider to list models for (`"claude"`, `"codex"`, `"gemini"`, `"grok"`, `"mistral"`, `"devin"`, or an enabled API provider name). When one or more `[providers.<name>]` API providers are enabled, the unfiltered response also carries an `apiProviders` array (each entry tagged `providerKind: "api"`); see [API providers (HTTP)](#api-providers-http).
1133
+ - `cli` (string, optional): Specific provider to list models for (`"claude"`, `"codex"`, `"gemini"`, `"grok"`, `"mistral"`, `"devin"`, `"cursor"`, or an enabled API provider name). When one or more `[providers.<name>]` API providers are enabled, the unfiltered response also carries an `apiProviders` array (each entry tagged `providerKind: "api"`); see [API providers (HTTP)](#api-providers-http).
1105
1134
 
1106
1135
  **Response includes:**
1107
1136
 
@@ -1149,7 +1178,7 @@ inputs.
1149
1178
 
1150
1179
  **Parameters:**
1151
1180
 
1152
- - `cli` (string, optional): Provider filter (`"claude"`, `"codex"`, `"gemini"`, `"grok"`, `"mistral"`, `"devin"`, `"grok_api"`, or an enabled API provider name)
1181
+ - `cli` (string, optional): Provider filter (`"claude"`, `"codex"`, `"gemini"`, `"grok"`, `"mistral"`, `"devin"`, `"cursor"`, `"grok_api"`, or an enabled API provider name)
1153
1182
  - `includeSkills` (boolean, default `true`): Include bounded local skill discovery
1154
1183
  - `includeProviderTools` (boolean, default `true`): Include provider-native tools extracted from discovered skills
1155
1184
  - `includeUnsupported` (boolean, default `true`): Include explicit unsupported/degraded input records
@@ -1170,6 +1199,7 @@ Equivalent MCP resources:
1170
1199
  - `provider-tools://grok_api`
1171
1200
  - `provider-tools://mistral`
1172
1201
  - `provider-tools://devin`
1202
+ - `provider-tools://cursor`
1173
1203
  - `provider-tools://<api-provider>` for each enabled `[providers.<name>]` API provider
1174
1204
 
1175
1205
  `doctor --json` also emits a compact `provider_capabilities` block with the
@@ -1186,7 +1216,7 @@ Report installed CLI versions.
1186
1216
 
1187
1217
  **Parameters:**
1188
1218
 
1189
- - `cli` (string, optional): Specific CLI to inspect ("claude", "codex", "gemini", "grok", "mistral", "devin")
1219
+ - `cli` (string, optional): Specific CLI to inspect ("claude", "codex", "gemini", "grok", "mistral", "devin", "cursor")
1190
1220
 
1191
1221
  ##### `cli_upgrade`
1192
1222
 
@@ -1194,7 +1224,7 @@ Plan or run an upgrade for one CLI.
1194
1224
 
1195
1225
  **Parameters:**
1196
1226
 
1197
- - `cli` (string, required): CLI to upgrade ("claude", "codex", "gemini", "grok", "mistral", "devin")
1227
+ - `cli` (string, required): CLI to upgrade ("claude", "codex", "gemini", "grok", "mistral", "devin", "cursor")
1198
1228
  - `target` (string, optional): Package tag/version/target, default: `latest`
1199
1229
  - `dryRun` (boolean, optional): Return the upgrade plan without running it, default: `true`
1200
1230
  - `timeoutMs` (number, optional): Upgrade timeout when `dryRun=false`
@@ -1210,6 +1240,7 @@ Plan or run an upgrade for one CLI.
1210
1240
  - Grok explicit target: `grok update --version <target>`
1211
1241
  - Mistral (Vibe): dispatches to the detected installer (`pip`/`uv`/`brew`); errors with guidance when none is detected (Vibe ships no self-update command)
1212
1242
  - Devin latest: `devin update` (self-update; explicit version targets are unsupported)
1243
+ - Cursor latest: `cursor-agent update` (self-update; explicit version targets are unsupported)
1213
1244
 
1214
1245
  **Example dry run:**
1215
1246
 
@@ -1227,7 +1258,7 @@ In addition to the spawnable CLI tools, the gateway can route requests to first-
1227
1258
 
1228
1259
  ### Configuring a provider
1229
1260
 
1230
- API providers are declared as `[providers.<name>]` blocks in `~/.llm-cli-gateway/config.toml` (override with `LLM_GATEWAY_CONFIG`). The `<name>` becomes the provider's identity across every tool and resource and **must not** collide with a spawnable CLI name (`claude`, `codex`, `gemini`, `grok`, `mistral`, `devin`); a collision is rejected with a warning and the provider is disabled.
1261
+ API providers are declared as `[providers.<name>]` blocks in `~/.llm-cli-gateway/config.toml` (override with `LLM_GATEWAY_CONFIG`). The `<name>` becomes the provider's identity across every tool and resource and **must not** collide with a spawnable CLI name (`claude`, `codex`, `gemini`, `grok`, `mistral`, `devin`, `cursor`); a collision is rejected with a warning and the provider is disabled.
1231
1262
 
1232
1263
  ```toml
1233
1264
  # OpenRouter (OpenAI-compatible). The key is read from the named env var at
@@ -77,6 +77,19 @@ const ACP_PROVIDER_REGISTRY = Object.freeze({
77
77
  adapterCandidates: Object.freeze([]),
78
78
  caveat: "Native ACP entrypoint `devin acp` (stdio JSON-RPC). Manual initialize + session/new smoke passed with the installed CLI managing credentials (`devin auth login`; WINDSURF_API_KEY for empty-env); empty-env smoke is expected to fail. Third native runtime pilot; runtime routing stays config-gated.",
79
79
  }),
80
+ cursor: Object.freeze({
81
+ provider: "cursor",
82
+ displayName: "Cursor Agent CLI",
83
+ status: "native_smoke_passed",
84
+ supportKind: "native",
85
+ targetVersion: "cursor-agent 2026.06.29-2ad2186",
86
+ entrypoint: Object.freeze({ command: "cursor-agent", args: Object.freeze(["acp"]) }),
87
+ runtimeEnabledDefault: false,
88
+ shipRuntimePilot: true,
89
+ runtimePriority: 4,
90
+ adapterCandidates: Object.freeze([]),
91
+ caveat: "Native ACP entrypoint `cursor-agent acp` (stdio JSON-RPC) is available as a hidden advanced command. Manual initialize + session/new smoke passed locally (protocolVersion 1, session created; no agentInfo returned). Fourth native runtime pilot; runtime routing stays config-gated.",
92
+ }),
80
93
  });
81
94
  export function getAcpProviderRegistry() {
82
95
  return ACP_PROVIDER_REGISTRY;
@@ -2,7 +2,7 @@ import type { Logger } from "./logger.js";
2
2
  import type { ReviewIntegrityResult } from "./review-integrity.js";
3
3
  export type ApprovalPolicy = "strict" | "balanced" | "permissive";
4
4
  export type ApprovalStrategy = "legacy" | "mcp_managed";
5
- export type ApprovalCli = "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin";
5
+ export type ApprovalCli = "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin" | "cursor";
6
6
  export type ApprovalStatus = "approved" | "denied";
7
7
  export interface ApprovalRequest {
8
8
  cli: ApprovalCli;
@@ -7,7 +7,7 @@ import { type ApiProvider, type ApiRequest, type ApiUsage } from "./api-provider
7
7
  import { type JobLimitsConfig } from "./config.js";
8
8
  export declare function extractApiHttpStatus(error: unknown): number | null;
9
9
  export declare function extractApiErrorBody(error: unknown): string | undefined;
10
- export type LlmCli = "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin";
10
+ export type LlmCli = "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin" | "cursor";
11
11
  export type JobProvider = LlmCli | (string & {});
12
12
  export type AsyncJobStatus = "queued" | "running" | "completed" | "failed" | "canceled" | "orphaned";
13
13
  export declare function isAsyncJobInProgress(status: AsyncJobStatus): boolean;
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from "./logger.js";
2
- import type { CliType } from "./session-manager.js";
2
+ import { type CliType } from "./provider-types.js";
3
3
  import { type ProviderLoginStatus } from "./provider-status.js";
4
4
  import type { ProviderLoginGuidance } from "./provider-login-guidance.js";
5
5
  export interface CliVersionInfo {
@@ -1,5 +1,6 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { executeCli, providerCommandName } from "./executor.js";
3
+ import { CLI_TYPES } from "./provider-types.js";
3
4
  import { getProviderRuntimeStatus } from "./provider-status.js";
4
5
  const MISTRAL_VIBE_PACKAGE = "mistral-vibe";
5
6
  const LEGACY_VIBE_PACKAGE = "vibe-cli";
@@ -28,14 +29,7 @@ export function detectMistralInstallMethod(exec = (cmd, args) => {
28
29
  }
29
30
  return "unknown";
30
31
  }
31
- const VERSION_ARGS = {
32
- claude: ["--version"],
33
- codex: ["--version"],
34
- gemini: ["--version"],
35
- grok: ["--version"],
36
- mistral: ["--version"],
37
- devin: ["--version"],
38
- };
32
+ const VERSION_ARGS = Object.fromEntries(CLI_TYPES.map(provider => [provider, ["--version"]]));
39
33
  const CODEX_NPM_PACKAGE = "@openai/codex";
40
34
  export function buildCliUpgradePlan(cli, target = "latest", detectMistral = detectMistralInstallMethod) {
41
35
  const normalizedTarget = normalizeTarget(target);
@@ -108,6 +102,20 @@ export function buildCliUpgradePlan(cli, target = "latest", detectMistral = dete
108
102
  note: "Devin CLI self-updates via 'devin update' (use --force to reinstall the latest).",
109
103
  };
110
104
  }
105
+ if (cli === "cursor") {
106
+ if (normalizedTarget !== "latest") {
107
+ throw new Error("Cursor Agent CLI upgrades support only the 'latest' target via 'cursor-agent update'.");
108
+ }
109
+ return {
110
+ cli,
111
+ target: normalizedTarget,
112
+ command: providerCommandName("cursor"),
113
+ args: ["update"],
114
+ strategy: "self-update",
115
+ requiresNetwork: true,
116
+ note: "Cursor Agent CLI self-updates via 'cursor-agent update'.",
117
+ };
118
+ }
111
119
  if (cli === "gemini") {
112
120
  if (normalizedTarget !== "latest") {
113
121
  throw new Error("Antigravity CLI upgrades support only the 'latest' target via 'agy update'.");
@@ -165,7 +173,7 @@ export async function getCliVersion(cli) {
165
173
  }
166
174
  }
167
175
  export async function getCliVersions(cli) {
168
- const clis = cli ? [cli] : ["claude", "codex", "gemini", "grok", "mistral", "devin"];
176
+ const clis = cli ? [cli] : CLI_TYPES;
169
177
  return Promise.all(clis.map(item => getCliVersion(item)));
170
178
  }
171
179
  function buildMistralUpgradePlan(normalizedTarget, detectMistral) {
package/dist/config.js CHANGED
@@ -6,6 +6,7 @@ import { z } from "zod/v3";
6
6
  import { logWarn, noopLogger } from "./logger.js";
7
7
  import { hashSecret, isSecretHash } from "./oauth.js";
8
8
  import { isHttpsOrLoopbackUrl, isLoopbackUrl } from "./api-http.js";
9
+ import { CLI_TYPES } from "./provider-types.js";
9
10
  const DatabaseUrlSchema = z
10
11
  .string()
11
12
  .url()
@@ -355,14 +356,7 @@ export function minStableTokensForModel(config, modelName) {
355
356
  return table.haiku;
356
357
  return table.default;
357
358
  }
358
- const RESERVED_CLI_PROVIDER_NAMES = [
359
- "claude",
360
- "codex",
361
- "gemini",
362
- "grok",
363
- "mistral",
364
- "devin",
365
- ];
359
+ const RESERVED_CLI_PROVIDER_NAMES = CLI_TYPES;
366
360
  export const DEFAULT_XAI_API_KEY_ENV = "XAI_API_KEY";
367
361
  export const DEFAULT_XAI_BASE_URL = "https://api.x.ai/v1";
368
362
  export const DEFAULT_XAI_MODEL = "grok-build-0.1";
package/dist/doctor.d.ts CHANGED
@@ -4,7 +4,7 @@ import { type ApiProviderLoginGuidance } from "./provider-login-guidance.js";
4
4
  import type { FlightRecorderQuery } from "./flight-recorder.js";
5
5
  import { type CacheAwarenessConfig, type ProvidersConfig } from "./config.js";
6
6
  import { type ProviderCapabilityId, type ProviderKind } from "./provider-tool-capabilities.js";
7
- export type CliType = "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin";
7
+ import { type CliType } from "./session-manager.js";
8
8
  export interface CacheAwarenessReport {
9
9
  enabled_features: Array<"anthropic_cache_control" | "ttl_warnings">;
10
10
  last_24h: {
@@ -123,7 +123,7 @@ export interface DoctorReport {
123
123
  allowed_root_count: number;
124
124
  gateway_app_dir_is_workspace: boolean;
125
125
  };
126
- providers: Record<"claude" | "codex" | "gemini" | "grok" | "mistral", {
126
+ providers: Record<CliType, {
127
127
  cli_available: boolean;
128
128
  version: string | null;
129
129
  login_status: ProviderLoginStatus;
package/dist/doctor.js CHANGED
@@ -13,6 +13,7 @@ import { computeGlobalCacheStats } from "./cache-stats.js";
13
13
  import { FlightRecorder, resolveFlightRecorderDbPath } from "./flight-recorder.js";
14
14
  import { buildUpstreamContractReport } from "./upstream-contracts.js";
15
15
  import { getProviderToolCapabilities, knownProviderCapabilityIds, } from "./provider-tool-capabilities.js";
16
+ import { CLI_TYPES } from "./session-manager.js";
16
17
  export function checkVibeSessionLogging(home = homedir()) {
17
18
  const configPath = join(home, ".vibe", "config.toml");
18
19
  if (!existsSync(configPath)) {
@@ -379,13 +380,7 @@ export function createDoctorReport(envOrOptions = process.env) {
379
380
  allowed_root_count: workspaceRegistry.allowedRoots.length,
380
381
  gateway_app_dir_is_workspace: workspaceRegistry.repos.some(repo => repo.path === join(homedir(), ".llm-cli-gateway")),
381
382
  },
382
- providers: {
383
- claude: doctorProviderStatus(providerStatuses.claude),
384
- codex: doctorProviderStatus(providerStatuses.codex),
385
- gemini: doctorProviderStatus(providerStatuses.gemini),
386
- grok: doctorProviderStatus(providerStatuses.grok),
387
- mistral: doctorProviderStatus(providerStatuses.mistral),
388
- },
383
+ providers: Object.fromEntries(CLI_TYPES.map(provider => [provider, doctorProviderStatus(providerStatuses[provider])])),
389
384
  endpoint_exposure: endpointExposure,
390
385
  client_config: clientConfigStatus(),
391
386
  cache_awareness: buildCacheAwarenessReport(opts),
package/dist/executor.js CHANGED
@@ -8,6 +8,8 @@ export function providerCommandName(command) {
8
8
  return "agy";
9
9
  if (command === "mistral")
10
10
  return "vibe";
11
+ if (command === "cursor")
12
+ return "cursor-agent";
11
13
  return command;
12
14
  }
13
15
  const MAX_OUTPUT_SIZE = 50 * 1024 * 1024;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { PerformanceMetrics } from "./metrics.js";
7
7
  import { type PersistenceConfig, type CacheAwarenessConfig, type ProvidersConfig, type ApiProviderRuntime, type AcpConfig } from "./config.js";
8
8
  import { DatabaseConnection } from "./db.js";
9
9
  import { AsyncJobManager } from "./async-job-manager.js";
10
- import { ApprovalManager, ApprovalRecord } from "./approval-manager.js";
10
+ import { ApprovalManager, ApprovalPolicy, ApprovalRecord } from "./approval-manager.js";
11
11
  import { ReviewIntegrityResult } from "./review-integrity.js";
12
12
  import { ClaudeMcpConfigResult, ClaudeMcpServerName } from "./claude-mcp-config.js";
13
13
  import { type MistralAgentMode, type ClaudePermissionMode, type CodexSandboxMode, type CodexAskForApproval, type ClaudeEffortLevel } from "./request-helpers.js";
@@ -60,8 +60,8 @@ export declare const WORKTREE_SCHEMA: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
60
60
  ref?: string | undefined;
61
61
  }>]>;
62
62
  export declare const WORKSPACE_ALIAS_SCHEMA: z.ZodString;
63
- export declare const SESSION_PROVIDER_VALUES: readonly ["claude", "codex", "gemini", "grok", "mistral", "devin", "grok-api"];
64
- export declare const SESSION_PROVIDER_ENUM: z.ZodEnum<["claude", "codex", "gemini", "grok", "mistral", "devin", "grok-api"]>;
63
+ export declare const SESSION_PROVIDER_VALUES: readonly ["claude", "codex", "gemini", "grok", "mistral", "devin", "cursor", "grok-api"];
64
+ export declare const SESSION_PROVIDER_ENUM: z.ZodEnum<["claude", "codex", "gemini", "grok", "mistral", "devin", "cursor", "grok-api"]>;
65
65
  export declare function sessionProviderValuesFor(providers: ProvidersConfig): string[];
66
66
  export type SessionProvider = ProviderType;
67
67
  export interface GatewayServerDeps {
@@ -154,7 +154,7 @@ export declare function createErrorResponse(cli: string, code: number, stderr: s
154
154
  retryable?: undefined;
155
155
  };
156
156
  };
157
- export declare function extractUsageAndCost(cli: "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin", output: string, outputFormat?: string, ctx?: {
157
+ export declare function extractUsageAndCost(cli: CliType, output: string, outputFormat?: string, ctx?: {
158
158
  sessionId?: string;
159
159
  home?: string;
160
160
  }): {
@@ -348,7 +348,7 @@ export declare function buildMistralRetryPrep(params: Pick<MistralRequestParams,
348
348
  env: Record<string, string>;
349
349
  ignoredDisallowedTools: boolean;
350
350
  };
351
- export declare function buildCliResponse(cli: "claude" | "codex" | "gemini" | "grok" | "mistral" | "devin", stdout: string, optimizeResponse: boolean, corrId: string, sessionId: string | undefined, prep: CliRequestPrep, durationMs: number, resumable?: boolean, outputFormat?: string, warnings?: WarningEntry[]): ExtendedToolResponse;
351
+ export declare function buildCliResponse(cli: CliType, stdout: string, optimizeResponse: boolean, corrId: string, sessionId: string | undefined, prep: CliRequestPrep, durationMs: number, resumable?: boolean, outputFormat?: string, warnings?: WarningEntry[]): ExtendedToolResponse;
352
352
  export interface GrokApiRequestParams {
353
353
  prompt?: string;
354
354
  promptParts?: PromptParts;
@@ -522,6 +522,48 @@ export declare function prepareDevinRequest(params: {
522
522
  }, _runtime: GatewayServerRuntime): CliRequestPrep | ExtendedToolResponse;
523
523
  export declare function handleDevinRequest(deps: HandlerDeps, params: DevinRequestParams): Promise<ExtendedToolResponse>;
524
524
  export declare function handleDevinRequestAsync(deps: AsyncHandlerDeps, params: Omit<DevinRequestParams, "optimizeResponse">): Promise<ExtendedToolResponse>;
525
+ export interface CursorRequestParams {
526
+ prompt?: string;
527
+ model?: string;
528
+ mode?: "plan" | "ask";
529
+ outputFormat?: "text" | "json" | "stream-json";
530
+ transport?: "cli" | "acp";
531
+ force?: boolean;
532
+ autoReview?: boolean;
533
+ sandbox?: "enabled" | "disabled";
534
+ trust?: boolean;
535
+ workspace?: string;
536
+ addDir?: string[];
537
+ sessionId?: string;
538
+ resumeLatest?: boolean;
539
+ createNewSession?: boolean;
540
+ approvalStrategy?: "legacy" | "mcp_managed";
541
+ approvalPolicy?: ApprovalPolicy;
542
+ correlationId?: string;
543
+ optimizePrompt: boolean;
544
+ optimizeResponse?: boolean;
545
+ idleTimeoutMs?: number;
546
+ forceRefresh?: boolean;
547
+ }
548
+ export declare function prepareCursorRequest(params: {
549
+ prompt?: string;
550
+ model?: string;
551
+ mode?: CursorRequestParams["mode"];
552
+ outputFormat?: CursorRequestParams["outputFormat"];
553
+ force?: boolean;
554
+ autoReview?: boolean;
555
+ sandbox?: CursorRequestParams["sandbox"];
556
+ trust?: boolean;
557
+ workspace?: string;
558
+ addDir?: string[];
559
+ approvalStrategy?: CursorRequestParams["approvalStrategy"];
560
+ approvalPolicy?: CursorRequestParams["approvalPolicy"];
561
+ correlationId?: string;
562
+ optimizePrompt: boolean;
563
+ operation: string;
564
+ }, runtime: GatewayServerRuntime): CliRequestPrep | ExtendedToolResponse;
565
+ export declare function handleCursorRequest(deps: HandlerDeps, params: CursorRequestParams): Promise<ExtendedToolResponse>;
566
+ export declare function handleCursorRequestAsync(deps: AsyncHandlerDeps, params: Omit<CursorRequestParams, "optimizeResponse">): Promise<ExtendedToolResponse>;
525
567
  export interface MistralRequestParams {
526
568
  prompt?: string;
527
569
  promptParts?: PromptParts;