@ai-sdk/harness-cursor 1.0.15 → 1.0.17

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
@@ -1,5 +1,24 @@
1
1
  # @ai-sdk/harness-cursor
2
2
 
3
+ ## 1.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - c04ded8: chore(harness): remove formerly deprecated `model` and `modelId` config on harness adapter settings
8
+ - Updated dependencies [c04ded8]
9
+ - @ai-sdk/harness-acp@1.0.42
10
+ - @ai-sdk/harness@1.0.104
11
+
12
+ ## 1.0.16
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [9e1d1b2]
17
+ - Updated dependencies [a495511]
18
+ - @ai-sdk/provider-utils@5.0.37
19
+ - @ai-sdk/harness@1.0.103
20
+ - @ai-sdk/harness-acp@1.0.41
21
+
3
22
  ## 1.0.15
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,28 +1,23 @@
1
1
  import * as _ai_sdk_harness from '@ai-sdk/harness';
2
- import { HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1 } from '@ai-sdk/harness';
2
+ import { HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1MintBridgeTokenCallback, HarnessV1 } from '@ai-sdk/harness';
3
3
  import * as _ai_sdk_provider from '@ai-sdk/provider';
4
4
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
5
5
  import { ACPAuthenticationMode } from '@ai-sdk/harness-acp';
6
6
 
7
+ type CursorAuthenticationMode = ACPAuthenticationMode;
7
8
  type CursorHarnessSettings = {
8
9
  /**
9
10
  * Declares the provider authentication configured in Cursor, or supplies an
10
11
  * isolated environment for Cursor CLI authentication. The adapter cannot
11
12
  * change provider routing and warns for explicit routing modes.
12
13
  */
13
- readonly auth?: ACPAuthenticationMode;
14
+ readonly auth?: CursorAuthenticationMode;
14
15
  /**
15
16
  * Customizes each credential value before it is forwarded into a sandbox
16
17
  * process. This does not restrict which credentials the harness adapter can
17
18
  * discover, read, or otherwise access in the host process.
18
19
  */
19
20
  readonly credentialForwarding?: HarnessV1CredentialForwarding;
20
- /**
21
- * Cursor model id selected through ACP. Unset preserves Cursor's default.
22
- *
23
- * @deprecated Use `model` on `HarnessAgent` instead.
24
- */
25
- readonly model?: string;
26
21
  /**
27
22
  * Overrides the sandbox port used by the ACP bridge.
28
23
  */
@@ -45,7 +40,7 @@ type CursorHarnessSettings = {
45
40
  * Creates the authentication token used by the sandbox bridge. Defaults to
46
41
  * a random 32-byte hexadecimal token.
47
42
  */
48
- readonly mintBridgeToken?: (sandboxId: string) => string;
43
+ readonly mintBridgeToken?: HarnessV1MintBridgeTokenCallback;
49
44
  };
50
45
  declare const CURSOR_BUILTIN_TOOLS: {
51
46
  readonly bash: {
@@ -24375,4 +24370,4 @@ declare const cursor: _ai_sdk_harness.HarnessV1<{
24375
24370
  };
24376
24371
  }>;
24377
24372
 
24378
- export { type CursorHarnessSettings, VERSION, createCursor, cursor };
24373
+ export { type CursorAuthenticationMode, type CursorHarnessSettings, VERSION, createCursor, cursor };
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { tool } from "@ai-sdk/provider-utils";
7
7
  import { z } from "zod/v4";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "1.0.15" : "0.0.0-test";
10
+ var VERSION = true ? "1.0.17" : "0.0.0-test";
11
11
 
12
12
  // src/cursor-harness.ts
13
13
  var CURSOR_CLIENT_APP = `ai-sdk/harness-cursor/${VERSION}`;
@@ -294,7 +294,6 @@ function createCursor(settings = {}) {
294
294
  return createACP({
295
295
  auth: typeof settings.auth === "string" ? void 0 : settings.auth,
296
296
  credentialForwarding: settings.credentialForwarding,
297
- modelId: settings.model,
298
297
  port: settings.port,
299
298
  portEndpoint: settings.portEndpoint,
300
299
  startupTimeoutMs: settings.startupTimeoutMs,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cursor-harness.ts","../src/version.ts","../src/index.ts"],"sourcesContent":["import {\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n type HarnessV1CredentialForwarding,\n type HarnessV1PortEndpoint,\n} from '@ai-sdk/harness';\nimport { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\n\nconst CURSOR_CLIENT_APP = `ai-sdk/harness-cursor/${VERSION}`;\n\nexport type CursorHarnessSettings = {\n /**\n * Declares the provider authentication configured in Cursor, or supplies an\n * isolated environment for Cursor CLI authentication. The adapter cannot\n * change provider routing and warns for explicit routing modes.\n */\n readonly auth?: ACPAuthenticationMode;\n /**\n * Customizes each credential value before it is forwarded into a sandbox\n * process. This does not restrict which credentials the harness adapter can\n * discover, read, or otherwise access in the host process.\n */\n readonly credentialForwarding?: HarnessV1CredentialForwarding;\n /**\n * Cursor model id selected through ACP. Unset preserves Cursor's default.\n *\n * @deprecated Use `model` on `HarnessAgent` instead.\n */\n readonly model?: string;\n /**\n * Overrides the sandbox port used by the ACP bridge.\n */\n readonly port?: number;\n /**\n * Override the host endpoint used to connect to the sandbox bridge. Required\n * together with `port` when using a basic sandbox session.\n */\n readonly portEndpoint?: HarnessV1PortEndpoint;\n /**\n * Maximum milliseconds to wait for the ACP bridge to start.\n */\n readonly startupTimeoutMs?: number;\n /**\n * MCP server definitions keyed by server name. Each definition uses the\n * underlying runtime's native MCP server configuration format.\n */\n readonly mcpServers?: Record<string, unknown>;\n /**\n * Creates the authentication token used by the sandbox bridge. Defaults to\n * a random 32-byte hexadecimal token.\n */\n readonly mintBridgeToken?: (sandboxId: string) => string;\n};\n\n/*\n * Tool variants, display titles, ACP kinds, and raw input projections were\n * captured from the official Cursor CLI 2026.08.11-e8db854 ACP implementation.\n * `mcpToolCall` is dynamic and `truncatedToolCall` is a transport sentinel, so\n * neither is exposed as a built-in.\n */\nconst CURSOR_BUILTIN_TOOLS = {\n bash: {\n ...commonTool('bash', {\n nativeName: 'shellToolCall',\n toolUseKind: 'bash',\n inputSchema: z.looseObject({ command: z.string() }),\n }),\n title: 'Terminal',\n },\n delete: {\n ...tool({\n title: 'Delete',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'deleteToolCall',\n toolUseKind: 'edit',\n },\n glob: {\n ...commonTool('glob', {\n nativeName: 'globToolCall',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({ pattern: z.string() }),\n }),\n title: 'Find',\n },\n grep: {\n ...commonTool('grep', {\n nativeName: 'grepToolCall',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n path: z.string().optional(),\n }),\n }),\n title: 'grep',\n },\n read: {\n ...tool({\n title: 'Read',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'readToolCall',\n toolUseKind: 'readonly',\n },\n updateTodos: {\n ...tool({\n title: 'Update TODOs',\n inputSchema: z.looseObject({\n _toolName: z.literal('updateTodos'),\n todos: z\n .array(\n z.looseObject({\n id: z.string(),\n content: z.string(),\n status: z.string(),\n }),\n )\n .optional(),\n }),\n }),\n nativeName: 'updateTodosToolCall',\n },\n readTodos: {\n ...tool({\n title: 'Read TODOs',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'readTodosToolCall',\n toolUseKind: 'readonly',\n },\n edit: {\n ...tool({\n title: 'Edit',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'editToolCall',\n toolUseKind: 'edit',\n },\n ls: {\n ...tool({\n title: 'List',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'lsToolCall',\n toolUseKind: 'readonly',\n },\n readLints: {\n ...tool({\n title: 'Read Lints',\n inputSchema: z.looseObject({ paths: z.array(z.string()) }),\n }),\n nativeName: 'readLintsToolCall',\n toolUseKind: 'readonly',\n },\n semanticSearch: {\n ...tool({\n title: 'Codebase Search',\n inputSchema: z.looseObject({ query: z.string() }),\n }),\n nativeName: 'semSearchToolCall',\n toolUseKind: 'readonly',\n },\n createPlan: {\n ...tool({\n title: 'Create Plan',\n inputSchema: z.looseObject({\n _toolName: z.literal('createPlan'),\n name: z.string().optional(),\n plan: z.string().optional(),\n }),\n }),\n nativeName: 'createPlanToolCall',\n },\n webSearch: {\n ...tool({\n title: 'Web Search',\n inputSchema: z.looseObject({ searchTerm: z.string() }),\n }),\n nativeName: 'webSearchToolCall',\n toolUseKind: 'readonly',\n },\n task: {\n ...tool({\n title: 'Task',\n inputSchema: z.looseObject({\n _toolName: z.literal('task'),\n prompt: z.string().optional(),\n description: z.string().optional(),\n subagentType: z.unknown().optional(),\n }),\n }),\n nativeName: 'taskToolCall',\n },\n listMcpResources: {\n ...tool({\n title: 'List MCP Resources',\n inputSchema: z.looseObject({ server: z.string().optional() }),\n }),\n nativeName: 'listMcpResourcesToolCall',\n toolUseKind: 'readonly',\n },\n readMcpResource: {\n ...tool({\n title: 'Fetch MCP Resource',\n inputSchema: z.looseObject({\n server: z.string().optional(),\n uri: z.string().optional(),\n downloadPath: z.string().optional(),\n }),\n }),\n nativeName: 'readMcpResourceToolCall',\n toolUseKind: 'readonly',\n },\n applyAgentDiff: {\n ...tool({\n title: 'Apply Agent Diff',\n inputSchema: z.looseObject({ path: z.string().optional() }),\n }),\n nativeName: 'applyAgentDiffToolCall',\n toolUseKind: 'edit',\n },\n fetch: {\n ...tool({\n title: 'Fetch',\n inputSchema: z.looseObject({ url: z.string() }),\n }),\n nativeName: 'fetchToolCall',\n toolUseKind: 'readonly',\n },\n switchMode: {\n ...tool({\n title: 'Switch Mode',\n inputSchema: z.looseObject({\n targetModeId: z.string(),\n explanation: z.string().optional(),\n }),\n }),\n nativeName: 'switchModeToolCall',\n },\n generateImage: {\n ...tool({\n title: 'Generate Image',\n inputSchema: z.looseObject({\n _toolName: z.literal('generateImage'),\n description: z.string().optional(),\n filename: z.string().optional(),\n }),\n }),\n nativeName: 'generateImageToolCall',\n },\n recordScreen: {\n ...tool({\n title: 'Record Screen',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'recordScreenToolCall',\n },\n computerUse: {\n ...tool({\n title: 'Computer Use',\n inputSchema: z.looseObject({\n action: z.string().optional(),\n coordinate: z.unknown().optional(),\n text: z.string().optional(),\n }),\n }),\n nativeName: 'computerUseToolCall',\n toolUseKind: 'bash',\n },\n writeShellStdin: {\n ...tool({\n title: 'Write to stdin',\n inputSchema: z.looseObject({\n shellId: z.number().optional(),\n chars: z.string().optional(),\n }),\n }),\n nativeName: 'writeShellStdinToolCall',\n toolUseKind: 'bash',\n },\n reflect: {\n ...tool({\n title: 'Reflect',\n inputSchema: z.looseObject({ reflection: z.string().optional() }),\n }),\n nativeName: 'reflectToolCall',\n toolUseKind: 'readonly',\n },\n setupVmEnvironment: {\n ...tool({\n title: 'Setup VM Environment',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'setupVmEnvironmentToolCall',\n toolUseKind: 'bash',\n },\n replaceEnv: {\n ...tool({\n title: 'Replace Environment',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'replaceEnvToolCall',\n toolUseKind: 'bash',\n },\n startGrindExecution: {\n ...tool({\n title: 'Start Grind Execution',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'startGrindExecutionToolCall',\n toolUseKind: 'bash',\n },\n startGrindPlanning: {\n ...tool({\n title: 'Start Grind Planning',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'startGrindPlanningToolCall',\n toolUseKind: 'readonly',\n },\n webFetch: {\n ...tool({\n title: 'Web Fetch',\n inputSchema: z.looseObject({ url: z.string() }),\n }),\n nativeName: 'webFetchToolCall',\n toolUseKind: 'readonly',\n },\n reportBugfixResults: {\n ...tool({\n title: 'Report Bugfix Results',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'reportBugfixResultsToolCall',\n },\n} as const satisfies Record<string, HarnessV1BuiltinTool<any, any>>;\n\nexport function createCursor(\n settings: CursorHarnessSettings = {},\n): HarnessV1<typeof CURSOR_BUILTIN_TOOLS> {\n const clientAppSegments = CURSOR_CLIENT_APP.split('/');\n const clientAppVersion = clientAppSegments.pop()!;\n\n if (settings.auth === 'direct' || settings.auth === 'ai-gateway') {\n warnCursorAuthenticationConfiguration({ auth: settings.auth });\n }\n\n return createACP({\n auth: typeof settings.auth === 'string' ? undefined : settings.auth,\n credentialForwarding: settings.credentialForwarding,\n modelId: settings.model,\n port: settings.port,\n portEndpoint: settings.portEndpoint,\n startupTimeoutMs: settings.startupTimeoutMs,\n mcpServers: settings.mcpServers,\n isMcpToolCall: toolCall => {\n const rawInput = toolCall.rawInput;\n return (\n isRecord(rawInput) &&\n typeof rawInput.providerIdentifier === 'string' &&\n typeof rawInput.toolName === 'string' &&\n isRecord(rawInput.args)\n );\n },\n mintBridgeToken: settings.mintBridgeToken,\n version: 'v1',\n harnessId: 'cursor',\n builtinTools: CURSOR_BUILTIN_TOOLS,\n clientApp: {\n name: clientAppSegments.join('/'),\n version: clientAppVersion,\n },\n source: {\n type: 'install-command',\n command: 'curl https://cursor.com/install -fsS | bash',\n },\n executable: 'agent',\n args: ['--disable-auto-update', 'acp'],\n modelMapping: {\n type: 'session-config-option',\n path: 'model',\n },\n clientCapabilities: {\n _meta: { parameterizedModelPicker: true },\n },\n credentialEnv: ['CURSOR_API_KEY'],\n credentialBrokering: ({ env, sandboxEnv, headers }) => {\n const transformations = [];\n if (env.CURSOR_API_KEY && sandboxEnv?.CURSOR_API_KEY) {\n transformations.push({\n match: {\n host: 'api2.cursor.sh',\n path: { exact: '/auth/exchange_user_api_key' },\n method: ['POST'],\n headers: [\n {\n key: { exact: 'Authorization' },\n value: {\n exact: `Bearer ${sandboxEnv.CURSOR_API_KEY}`,\n },\n },\n ],\n },\n transform: {\n headers: {\n Authorization: `Bearer ${env.CURSOR_API_KEY}`,\n },\n },\n });\n }\n if (headers != null) {\n transformations.push({\n match:\n settings.auth === 'ai-gateway'\n ? {\n host: 'ai-gateway.vercel.sh',\n path: { startsWith: '/cursor/v1' },\n }\n : { host: 'api2.cursor.sh' },\n transform: { headers },\n });\n }\n return transformations;\n },\n });\n}\n\nfunction warnCursorAuthenticationConfiguration({\n auth,\n}: {\n auth: Exclude<ACPAuthenticationMode, 'auto'>;\n}): void {\n const detail =\n auth === 'ai-gateway'\n ? \"Configure an AI Gateway API key as Cursor's OpenAI API key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1.\"\n : 'Configure Cursor to use its direct model-provider routing.';\n console.warn(\n `[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication.`,\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n","declare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import { createCursor } from './cursor-harness';\n\n/**\n * Default Cursor harness instance. Equivalent to `createCursor()`.\n */\nexport const cursor = createCursor();\n\nexport { createCursor } from './cursor-harness';\nexport type { CursorHarnessSettings } from './cursor-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAKK;AACP,SAAS,iBAA6C;AACtD,SAAS,YAAY;AACrB,SAAS,SAAS;;;ACRX,IAAM,UACX,OACI,WACA;;;ADQN,IAAM,oBAAoB,yBAAyB,OAAO;AAoD1D,IAAM,uBAAuB;AAAA,EAC3B,MAAM;AAAA,IACJ,GAAG,WAAW,QAAQ;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAAA,IACpD,CAAC;AAAA,IACD,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,GAAG,KAAK;AAAA,MACN,OAAO;AAAA,MACP,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,CA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B;AAAA,gBAC9B,OAAO;AAAA,kBACL,OAAO,UAAU,WAAW,cAAc;AAAA,gBAC5C;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,UACA,WAAW;AAAA,YACT,SAAS;AAAA,cACP,eAAe,UAAU,IAAI,cAAc;AAAA,YAC7C;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AACA,UAAI,WAAW,MAAM;AACnB,wBAAgB,KAAK;AAAA,UACnB,OACE,SAAS,SAAS,eACd;AAAA,YACE,MAAM;AAAA,YACN,MAAM,EAAE,YAAY,aAAa;AAAA,UACnC,IACA,EAAE,MAAM,iBAAiB;AAAA,UAC/B,WAAW,EAAE,QAAQ;AAAA,QACvB,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAEA,SAAS,sCAAsC;AAAA,EAC7C;AACF,GAES;AACP,QAAM,SACJ,SAAS,eACL,2IACA;AACN,UAAQ;AAAA,IACN,kBAAkB,KAAK,UAAU,IAAI,CAAC,qDAAqD,MAAM;AAAA,EACnG;AACF;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC3E;;;AE1bO,IAAM,SAAS,aAAa;","names":[]}
1
+ {"version":3,"sources":["../src/cursor-harness.ts","../src/version.ts","../src/index.ts"],"sourcesContent":["import {\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n type HarnessV1CredentialForwarding,\n type HarnessV1MintBridgeTokenCallback,\n type HarnessV1PortEndpoint,\n} from '@ai-sdk/harness';\nimport { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\n\nconst CURSOR_CLIENT_APP = `ai-sdk/harness-cursor/${VERSION}`;\n\nexport type CursorAuthenticationMode = ACPAuthenticationMode;\n\nexport type CursorHarnessSettings = {\n /**\n * Declares the provider authentication configured in Cursor, or supplies an\n * isolated environment for Cursor CLI authentication. The adapter cannot\n * change provider routing and warns for explicit routing modes.\n */\n readonly auth?: CursorAuthenticationMode;\n /**\n * Customizes each credential value before it is forwarded into a sandbox\n * process. This does not restrict which credentials the harness adapter can\n * discover, read, or otherwise access in the host process.\n */\n readonly credentialForwarding?: HarnessV1CredentialForwarding;\n /**\n * Overrides the sandbox port used by the ACP bridge.\n */\n readonly port?: number;\n /**\n * Override the host endpoint used to connect to the sandbox bridge. Required\n * together with `port` when using a basic sandbox session.\n */\n readonly portEndpoint?: HarnessV1PortEndpoint;\n /**\n * Maximum milliseconds to wait for the ACP bridge to start.\n */\n readonly startupTimeoutMs?: number;\n /**\n * MCP server definitions keyed by server name. Each definition uses the\n * underlying runtime's native MCP server configuration format.\n */\n readonly mcpServers?: Record<string, unknown>;\n /**\n * Creates the authentication token used by the sandbox bridge. Defaults to\n * a random 32-byte hexadecimal token.\n */\n readonly mintBridgeToken?: HarnessV1MintBridgeTokenCallback;\n};\n\n/*\n * Tool variants, display titles, ACP kinds, and raw input projections were\n * captured from the official Cursor CLI 2026.08.11-e8db854 ACP implementation.\n * `mcpToolCall` is dynamic and `truncatedToolCall` is a transport sentinel, so\n * neither is exposed as a built-in.\n */\nconst CURSOR_BUILTIN_TOOLS = {\n bash: {\n ...commonTool('bash', {\n nativeName: 'shellToolCall',\n toolUseKind: 'bash',\n inputSchema: z.looseObject({ command: z.string() }),\n }),\n title: 'Terminal',\n },\n delete: {\n ...tool({\n title: 'Delete',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'deleteToolCall',\n toolUseKind: 'edit',\n },\n glob: {\n ...commonTool('glob', {\n nativeName: 'globToolCall',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({ pattern: z.string() }),\n }),\n title: 'Find',\n },\n grep: {\n ...commonTool('grep', {\n nativeName: 'grepToolCall',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n path: z.string().optional(),\n }),\n }),\n title: 'grep',\n },\n read: {\n ...tool({\n title: 'Read',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'readToolCall',\n toolUseKind: 'readonly',\n },\n updateTodos: {\n ...tool({\n title: 'Update TODOs',\n inputSchema: z.looseObject({\n _toolName: z.literal('updateTodos'),\n todos: z\n .array(\n z.looseObject({\n id: z.string(),\n content: z.string(),\n status: z.string(),\n }),\n )\n .optional(),\n }),\n }),\n nativeName: 'updateTodosToolCall',\n },\n readTodos: {\n ...tool({\n title: 'Read TODOs',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'readTodosToolCall',\n toolUseKind: 'readonly',\n },\n edit: {\n ...tool({\n title: 'Edit',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'editToolCall',\n toolUseKind: 'edit',\n },\n ls: {\n ...tool({\n title: 'List',\n inputSchema: z.looseObject({ path: z.string() }),\n }),\n nativeName: 'lsToolCall',\n toolUseKind: 'readonly',\n },\n readLints: {\n ...tool({\n title: 'Read Lints',\n inputSchema: z.looseObject({ paths: z.array(z.string()) }),\n }),\n nativeName: 'readLintsToolCall',\n toolUseKind: 'readonly',\n },\n semanticSearch: {\n ...tool({\n title: 'Codebase Search',\n inputSchema: z.looseObject({ query: z.string() }),\n }),\n nativeName: 'semSearchToolCall',\n toolUseKind: 'readonly',\n },\n createPlan: {\n ...tool({\n title: 'Create Plan',\n inputSchema: z.looseObject({\n _toolName: z.literal('createPlan'),\n name: z.string().optional(),\n plan: z.string().optional(),\n }),\n }),\n nativeName: 'createPlanToolCall',\n },\n webSearch: {\n ...tool({\n title: 'Web Search',\n inputSchema: z.looseObject({ searchTerm: z.string() }),\n }),\n nativeName: 'webSearchToolCall',\n toolUseKind: 'readonly',\n },\n task: {\n ...tool({\n title: 'Task',\n inputSchema: z.looseObject({\n _toolName: z.literal('task'),\n prompt: z.string().optional(),\n description: z.string().optional(),\n subagentType: z.unknown().optional(),\n }),\n }),\n nativeName: 'taskToolCall',\n },\n listMcpResources: {\n ...tool({\n title: 'List MCP Resources',\n inputSchema: z.looseObject({ server: z.string().optional() }),\n }),\n nativeName: 'listMcpResourcesToolCall',\n toolUseKind: 'readonly',\n },\n readMcpResource: {\n ...tool({\n title: 'Fetch MCP Resource',\n inputSchema: z.looseObject({\n server: z.string().optional(),\n uri: z.string().optional(),\n downloadPath: z.string().optional(),\n }),\n }),\n nativeName: 'readMcpResourceToolCall',\n toolUseKind: 'readonly',\n },\n applyAgentDiff: {\n ...tool({\n title: 'Apply Agent Diff',\n inputSchema: z.looseObject({ path: z.string().optional() }),\n }),\n nativeName: 'applyAgentDiffToolCall',\n toolUseKind: 'edit',\n },\n fetch: {\n ...tool({\n title: 'Fetch',\n inputSchema: z.looseObject({ url: z.string() }),\n }),\n nativeName: 'fetchToolCall',\n toolUseKind: 'readonly',\n },\n switchMode: {\n ...tool({\n title: 'Switch Mode',\n inputSchema: z.looseObject({\n targetModeId: z.string(),\n explanation: z.string().optional(),\n }),\n }),\n nativeName: 'switchModeToolCall',\n },\n generateImage: {\n ...tool({\n title: 'Generate Image',\n inputSchema: z.looseObject({\n _toolName: z.literal('generateImage'),\n description: z.string().optional(),\n filename: z.string().optional(),\n }),\n }),\n nativeName: 'generateImageToolCall',\n },\n recordScreen: {\n ...tool({\n title: 'Record Screen',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'recordScreenToolCall',\n },\n computerUse: {\n ...tool({\n title: 'Computer Use',\n inputSchema: z.looseObject({\n action: z.string().optional(),\n coordinate: z.unknown().optional(),\n text: z.string().optional(),\n }),\n }),\n nativeName: 'computerUseToolCall',\n toolUseKind: 'bash',\n },\n writeShellStdin: {\n ...tool({\n title: 'Write to stdin',\n inputSchema: z.looseObject({\n shellId: z.number().optional(),\n chars: z.string().optional(),\n }),\n }),\n nativeName: 'writeShellStdinToolCall',\n toolUseKind: 'bash',\n },\n reflect: {\n ...tool({\n title: 'Reflect',\n inputSchema: z.looseObject({ reflection: z.string().optional() }),\n }),\n nativeName: 'reflectToolCall',\n toolUseKind: 'readonly',\n },\n setupVmEnvironment: {\n ...tool({\n title: 'Setup VM Environment',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'setupVmEnvironmentToolCall',\n toolUseKind: 'bash',\n },\n replaceEnv: {\n ...tool({\n title: 'Replace Environment',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'replaceEnvToolCall',\n toolUseKind: 'bash',\n },\n startGrindExecution: {\n ...tool({\n title: 'Start Grind Execution',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'startGrindExecutionToolCall',\n toolUseKind: 'bash',\n },\n startGrindPlanning: {\n ...tool({\n title: 'Start Grind Planning',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'startGrindPlanningToolCall',\n toolUseKind: 'readonly',\n },\n webFetch: {\n ...tool({\n title: 'Web Fetch',\n inputSchema: z.looseObject({ url: z.string() }),\n }),\n nativeName: 'webFetchToolCall',\n toolUseKind: 'readonly',\n },\n reportBugfixResults: {\n ...tool({\n title: 'Report Bugfix Results',\n inputSchema: z.looseObject({}),\n }),\n nativeName: 'reportBugfixResultsToolCall',\n },\n} as const satisfies Record<string, HarnessV1BuiltinTool<any, any>>;\n\nexport function createCursor(\n settings: CursorHarnessSettings = {},\n): HarnessV1<typeof CURSOR_BUILTIN_TOOLS> {\n const clientAppSegments = CURSOR_CLIENT_APP.split('/');\n const clientAppVersion = clientAppSegments.pop()!;\n\n if (settings.auth === 'direct' || settings.auth === 'ai-gateway') {\n warnCursorAuthenticationConfiguration({ auth: settings.auth });\n }\n\n return createACP({\n auth: typeof settings.auth === 'string' ? undefined : settings.auth,\n credentialForwarding: settings.credentialForwarding,\n port: settings.port,\n portEndpoint: settings.portEndpoint,\n startupTimeoutMs: settings.startupTimeoutMs,\n mcpServers: settings.mcpServers,\n isMcpToolCall: toolCall => {\n const rawInput = toolCall.rawInput;\n return (\n isRecord(rawInput) &&\n typeof rawInput.providerIdentifier === 'string' &&\n typeof rawInput.toolName === 'string' &&\n isRecord(rawInput.args)\n );\n },\n mintBridgeToken: settings.mintBridgeToken,\n version: 'v1',\n harnessId: 'cursor',\n builtinTools: CURSOR_BUILTIN_TOOLS,\n clientApp: {\n name: clientAppSegments.join('/'),\n version: clientAppVersion,\n },\n source: {\n type: 'install-command',\n command: 'curl https://cursor.com/install -fsS | bash',\n },\n executable: 'agent',\n args: ['--disable-auto-update', 'acp'],\n modelMapping: {\n type: 'session-config-option',\n path: 'model',\n },\n clientCapabilities: {\n _meta: { parameterizedModelPicker: true },\n },\n credentialEnv: ['CURSOR_API_KEY'],\n credentialBrokering: ({ env, sandboxEnv, headers }) => {\n const transformations = [];\n if (env.CURSOR_API_KEY && sandboxEnv?.CURSOR_API_KEY) {\n transformations.push({\n match: {\n host: 'api2.cursor.sh',\n path: { exact: '/auth/exchange_user_api_key' },\n method: ['POST'],\n headers: [\n {\n key: { exact: 'Authorization' },\n value: {\n exact: `Bearer ${sandboxEnv.CURSOR_API_KEY}`,\n },\n },\n ],\n },\n transform: {\n headers: {\n Authorization: `Bearer ${env.CURSOR_API_KEY}`,\n },\n },\n });\n }\n if (headers != null) {\n transformations.push({\n match:\n settings.auth === 'ai-gateway'\n ? {\n host: 'ai-gateway.vercel.sh',\n path: { startsWith: '/cursor/v1' },\n }\n : { host: 'api2.cursor.sh' },\n transform: { headers },\n });\n }\n return transformations;\n },\n });\n}\n\nfunction warnCursorAuthenticationConfiguration({\n auth,\n}: {\n auth: Exclude<CursorAuthenticationMode, 'auto'>;\n}): void {\n const detail =\n auth === 'ai-gateway'\n ? \"Configure an AI Gateway API key as Cursor's OpenAI API key and set Override OpenAI Base URL to https://ai-gateway.vercel.sh/cursor/v1.\"\n : 'Configure Cursor to use its direct model-provider routing.';\n console.warn(\n `[cursor] auth: ${JSON.stringify(auth)} cannot configure Cursor provider authentication. ${detail} CURSOR_API_KEY is still required for Cursor CLI authentication.`,\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n","declare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import { createCursor } from './cursor-harness';\n\n/**\n * Default Cursor harness instance. Equivalent to `createCursor()`.\n */\nexport const cursor = createCursor();\n\nexport { createCursor } from './cursor-harness';\nexport type {\n CursorAuthenticationMode,\n CursorHarnessSettings,\n} from './cursor-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAMK;AACP,SAAS,iBAA6C;AACtD,SAAS,YAAY;AACrB,SAAS,SAAS;;;ACTX,IAAM,UACX,OACI,WACA;;;ADSN,IAAM,oBAAoB,yBAAyB,OAAO;AAgD1D,IAAM,uBAAuB;AAAA,EAC3B,MAAM;AAAA,IACJ,GAAG,WAAW,QAAQ;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAAA,IACpD,CAAC;AAAA,IACD,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,GAAG,KAAK;AAAA,MACN,OAAO;AAAA,MACP,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAAA,IACjD,CAAC;AAAA,IACD,YAAY;AAAA,IACZ,aAAa;AAAA,EACf;AAAA,EACA,MAAM;AAAA,IACJ,GAAG,WAAW,QAAQ;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAAA,IACpD,CAAC;AAAA,IACD,OAAO;AAAA,EACT;AAAA,EACA,MAAM;AAAA,IACJ,GAAG,WAAW,QAAQ;AAAA,MACpB,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,aAAa,EAAE,YAAY;AAAA,QACzB,SAAS,EAAE,OAAO;AAAA,QAClB,MAAM,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,MACH;AACA,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;AAEA,SAAS,sCAAsC;AAAA,EAC7C;AACF,GAES;AACP,QAAM,SACJ,SAAS,eACL,2IACA;AACN,UAAQ;AAAA,IACN,kBAAkB,KAAK,UAAU,IAAI,CAAC,qDAAqD,MAAM;AAAA,EACnG;AACF;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC3E;;;AEtbO,IAAM,SAAS,aAAa;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/harness-cursor",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@ai-sdk/harness": "1.0.102",
30
- "@ai-sdk/harness-acp": "1.0.40",
31
- "@ai-sdk/provider-utils": "5.0.36"
29
+ "@ai-sdk/harness": "1.0.104",
30
+ "@ai-sdk/harness-acp": "1.0.42",
31
+ "@ai-sdk/provider-utils": "5.0.37"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "zod": "^3.25.76 || ^4.1.8"
@@ -3,6 +3,7 @@ import {
3
3
  type HarnessV1,
4
4
  type HarnessV1BuiltinTool,
5
5
  type HarnessV1CredentialForwarding,
6
+ type HarnessV1MintBridgeTokenCallback,
6
7
  type HarnessV1PortEndpoint,
7
8
  } from '@ai-sdk/harness';
8
9
  import { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';
@@ -12,25 +13,21 @@ import { VERSION } from './version';
12
13
 
13
14
  const CURSOR_CLIENT_APP = `ai-sdk/harness-cursor/${VERSION}`;
14
15
 
16
+ export type CursorAuthenticationMode = ACPAuthenticationMode;
17
+
15
18
  export type CursorHarnessSettings = {
16
19
  /**
17
20
  * Declares the provider authentication configured in Cursor, or supplies an
18
21
  * isolated environment for Cursor CLI authentication. The adapter cannot
19
22
  * change provider routing and warns for explicit routing modes.
20
23
  */
21
- readonly auth?: ACPAuthenticationMode;
24
+ readonly auth?: CursorAuthenticationMode;
22
25
  /**
23
26
  * Customizes each credential value before it is forwarded into a sandbox
24
27
  * process. This does not restrict which credentials the harness adapter can
25
28
  * discover, read, or otherwise access in the host process.
26
29
  */
27
30
  readonly credentialForwarding?: HarnessV1CredentialForwarding;
28
- /**
29
- * Cursor model id selected through ACP. Unset preserves Cursor's default.
30
- *
31
- * @deprecated Use `model` on `HarnessAgent` instead.
32
- */
33
- readonly model?: string;
34
31
  /**
35
32
  * Overrides the sandbox port used by the ACP bridge.
36
33
  */
@@ -53,7 +50,7 @@ export type CursorHarnessSettings = {
53
50
  * Creates the authentication token used by the sandbox bridge. Defaults to
54
51
  * a random 32-byte hexadecimal token.
55
52
  */
56
- readonly mintBridgeToken?: (sandboxId: string) => string;
53
+ readonly mintBridgeToken?: HarnessV1MintBridgeTokenCallback;
57
54
  };
58
55
 
59
56
  /*
@@ -352,7 +349,6 @@ export function createCursor(
352
349
  return createACP({
353
350
  auth: typeof settings.auth === 'string' ? undefined : settings.auth,
354
351
  credentialForwarding: settings.credentialForwarding,
355
- modelId: settings.model,
356
352
  port: settings.port,
357
353
  portEndpoint: settings.portEndpoint,
358
354
  startupTimeoutMs: settings.startupTimeoutMs,
@@ -432,7 +428,7 @@ export function createCursor(
432
428
  function warnCursorAuthenticationConfiguration({
433
429
  auth,
434
430
  }: {
435
- auth: Exclude<ACPAuthenticationMode, 'auto'>;
431
+ auth: Exclude<CursorAuthenticationMode, 'auto'>;
436
432
  }): void {
437
433
  const detail =
438
434
  auth === 'ai-gateway'
package/src/index.ts CHANGED
@@ -6,5 +6,8 @@ import { createCursor } from './cursor-harness';
6
6
  export const cursor = createCursor();
7
7
 
8
8
  export { createCursor } from './cursor-harness';
9
- export type { CursorHarnessSettings } from './cursor-harness';
9
+ export type {
10
+ CursorAuthenticationMode,
11
+ CursorHarnessSettings,
12
+ } from './cursor-harness';
10
13
  export { VERSION } from './version';