llm-cli-gateway 2.12.2 → 2.13.1

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.
@@ -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";
@@ -38,11 +38,11 @@ type ExtendedToolResponse = {
38
38
  reviewIntegrity?: ReviewIntegrityResult;
39
39
  warnings?: WarningEntry[];
40
40
  };
41
- declare const logger: {
42
- info: (message: string, ...args: any[]) => void;
43
- warn: (message: string, ...args: any[]) => void;
44
- error: (message: string, ...args: any[]) => void;
45
- debug: (message: string, ...args: any[]) => void;
41
+ export declare const logger: {
42
+ info: (message: string, ...args: unknown[]) => void;
43
+ warn: (message: string, ...args: unknown[]) => void;
44
+ error: (message: string, ...args: unknown[]) => void;
45
+ debug: (message: string, ...args: unknown[]) => void;
46
46
  };
47
47
  type GatewayLogger = typeof logger;
48
48
  export declare function buildServerInstructions(asyncJobsEnabled: boolean, grokApiToolsEnabled?: boolean): string;
@@ -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;