cursor-opencode-provider 0.3.2 → 0.4.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/README.md +28 -4
- package/dist/image-input.d.ts +31 -0
- package/dist/image-input.js +281 -0
- package/dist/language-model.js +68 -1
- package/dist/model-config.js +10 -2
- package/dist/model-metadata.d.ts +10 -0
- package/dist/model-metadata.js +12 -0
- package/dist/models.d.ts +1 -0
- package/dist/models.js +8 -0
- package/dist/opencode2/catalog.js +8 -4
- package/dist/opencode2/types.d.ts +9 -3
- package/dist/opencode2/types.js +1 -1
- package/dist/plugin-opencode2.js +13 -5
- package/dist/pricing-data.d.ts +221 -1
- package/dist/pricing-data.js +221 -1
- package/dist/protocol/messages.js +21 -0
- package/dist/protocol/request.d.ts +2 -0
- package/dist/protocol/request.js +14 -5
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +1 -1
- package/package.json +16 -4
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* we touch is more stable than pinning a moving target.
|
|
10
10
|
*
|
|
11
11
|
* These mirror `@opencode-ai/plugin@next` `dist/promise/*.d.ts` as of
|
|
12
|
-
* `0.0.0-next-
|
|
12
|
+
* `0.0.0-next-17155`. `test/opencode2-conformance.types.ts` asserts our
|
|
13
13
|
* default export still satisfies the real 2.0 `Plugin` interface.
|
|
14
14
|
*
|
|
15
15
|
* Effect `Schema` brands (Provider.ID, Model.ID, …) are modelled as plain
|
|
@@ -228,13 +228,19 @@ export type ToolDefinition = {
|
|
|
228
228
|
export type ToolDraft = {
|
|
229
229
|
add(tool: ToolDefinition): void;
|
|
230
230
|
};
|
|
231
|
-
export type
|
|
231
|
+
export type ToolHookBaseFields = {
|
|
232
232
|
readonly tool: string;
|
|
233
233
|
readonly sessionID: string;
|
|
234
234
|
readonly agent: string;
|
|
235
235
|
readonly messageID: string;
|
|
236
|
-
readonly callID: string;
|
|
237
236
|
};
|
|
237
|
+
export type ToolHookBase = ToolHookBaseFields & ({
|
|
238
|
+
readonly id: string;
|
|
239
|
+
readonly callID?: string;
|
|
240
|
+
} | {
|
|
241
|
+
readonly id?: string;
|
|
242
|
+
readonly callID: string;
|
|
243
|
+
});
|
|
238
244
|
export type ToolHooks = {
|
|
239
245
|
readonly "execute.before": ToolHookBase & {
|
|
240
246
|
input: unknown;
|
package/dist/opencode2/types.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* we touch is more stable than pinning a moving target.
|
|
10
10
|
*
|
|
11
11
|
* These mirror `@opencode-ai/plugin@next` `dist/promise/*.d.ts` as of
|
|
12
|
-
* `0.0.0-next-
|
|
12
|
+
* `0.0.0-next-17155`. `test/opencode2-conformance.types.ts` asserts our
|
|
13
13
|
* default export still satisfies the real 2.0 `Plugin` interface.
|
|
14
14
|
*
|
|
15
15
|
* Effect `Schema` brands (Provider.ID, Model.ID, …) are modelled as plain
|
package/dist/plugin-opencode2.js
CHANGED
|
@@ -35,6 +35,12 @@ async function loadModels(cacheDir, accessToken) {
|
|
|
35
35
|
// Preserve offline / stale-cache behavior rather than emptying the picker.
|
|
36
36
|
return cached?.models ?? [];
|
|
37
37
|
}
|
|
38
|
+
function toolExecutionID(event) {
|
|
39
|
+
const id = event.id ?? event.callID;
|
|
40
|
+
if (!id)
|
|
41
|
+
throw new Error("OpenCode 2.0 tool hook did not provide an execution id");
|
|
42
|
+
return id;
|
|
43
|
+
}
|
|
38
44
|
const plugin = {
|
|
39
45
|
id: "cursor.provider",
|
|
40
46
|
setup: async (ctx) => {
|
|
@@ -142,29 +148,31 @@ const plugin = {
|
|
|
142
148
|
await track(ctx.tool.hook("execute.before", (event) => {
|
|
143
149
|
if (event.tool !== "bash")
|
|
144
150
|
return;
|
|
151
|
+
const executionID = toolExecutionID(event);
|
|
145
152
|
// No `shell.env` in 2.0 → always use the wrapper-file command form.
|
|
146
|
-
prepareCursorShellArgs(
|
|
153
|
+
prepareCursorShellArgs(executionID, event.input, {
|
|
147
154
|
preferWrapperCommand: true,
|
|
148
155
|
});
|
|
149
156
|
}));
|
|
150
157
|
await track(ctx.tool.hook("execute.after", (event) => {
|
|
151
158
|
if (event.tool !== "bash")
|
|
152
159
|
return;
|
|
160
|
+
const executionID = toolExecutionID(event);
|
|
153
161
|
try {
|
|
154
162
|
if (event.status !== "completed")
|
|
155
163
|
return;
|
|
156
164
|
const result = event.result;
|
|
157
|
-
result.title = cursorShellOriginalCommand(
|
|
158
|
-
result.output = captureCursorShellResult(
|
|
165
|
+
result.title = cursorShellOriginalCommand(executionID) ?? result.title;
|
|
166
|
+
result.output = captureCursorShellResult(executionID, result.output, result.metadata);
|
|
159
167
|
if (result.metadata && typeof result.metadata === "object") {
|
|
160
168
|
const metadata = result.metadata;
|
|
161
169
|
if (typeof metadata.output === "string") {
|
|
162
|
-
metadata.output = sanitizeRegisteredCursorShellOutput(
|
|
170
|
+
metadata.output = sanitizeRegisteredCursorShellOutput(executionID, metadata.output);
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
174
|
finally {
|
|
167
|
-
releaseCursorShellEnv(
|
|
175
|
+
releaseCursorShellEnv(executionID);
|
|
168
176
|
}
|
|
169
177
|
}));
|
|
170
178
|
// ── Compaction marker + session directory ───────────────────────────────
|
package/dist/pricing-data.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED by scripts/generate-cursor-pricing.ts — do not edit by hand.
|
|
3
|
-
*
|
|
3
|
+
* Pricing source: https://cursor.com/docs/models-and-pricing.md
|
|
4
|
+
* Context source: https://cursor.com/docs.md
|
|
4
5
|
* Regenerate: bun run generate:pricing
|
|
5
6
|
*/
|
|
6
7
|
export declare const CURSOR_PRICING_SOURCE: "https://cursor.com/docs/models-and-pricing.md";
|
|
8
|
+
export declare const CURSOR_CONTEXT_SOURCE: "https://cursor.com/docs.md";
|
|
7
9
|
export declare const CURSOR_MODEL_COSTS: {
|
|
8
10
|
readonly "claude-fable-5": {
|
|
9
11
|
readonly input: 10;
|
|
@@ -192,3 +194,221 @@ export declare const CURSOR_MODEL_COSTS: {
|
|
|
192
194
|
readonly cache_read: 0.3;
|
|
193
195
|
};
|
|
194
196
|
};
|
|
197
|
+
export declare const CURSOR_MODEL_CONTEXTS: {
|
|
198
|
+
readonly "claude-fable-5": {
|
|
199
|
+
readonly maxContext: 300000;
|
|
200
|
+
readonly maxContextForMaxMode: 1000000;
|
|
201
|
+
};
|
|
202
|
+
readonly "claude-haiku-4-5": {
|
|
203
|
+
readonly maxContext: 200000;
|
|
204
|
+
};
|
|
205
|
+
readonly "claude-opus-4-5": {
|
|
206
|
+
readonly maxContext: 200000;
|
|
207
|
+
readonly maxContextForMaxMode: 200000;
|
|
208
|
+
};
|
|
209
|
+
readonly "claude-opus-4-6": {
|
|
210
|
+
readonly maxContext: 200000;
|
|
211
|
+
readonly maxContextForMaxMode: 1000000;
|
|
212
|
+
};
|
|
213
|
+
readonly "claude-opus-4-7": {
|
|
214
|
+
readonly maxContext: 300000;
|
|
215
|
+
readonly maxContextForMaxMode: 1000000;
|
|
216
|
+
};
|
|
217
|
+
readonly "claude-opus-4-8": {
|
|
218
|
+
readonly maxContext: 300000;
|
|
219
|
+
readonly maxContextForMaxMode: 1000000;
|
|
220
|
+
};
|
|
221
|
+
readonly "claude-opus-5": {
|
|
222
|
+
readonly maxContext: 300000;
|
|
223
|
+
readonly maxContextForMaxMode: 1000000;
|
|
224
|
+
};
|
|
225
|
+
readonly "claude-sonnet-4": {
|
|
226
|
+
readonly maxContext: 200000;
|
|
227
|
+
readonly maxContextForMaxMode: 1000000;
|
|
228
|
+
};
|
|
229
|
+
readonly "claude-sonnet-4-5": {
|
|
230
|
+
readonly maxContext: 200000;
|
|
231
|
+
readonly maxContextForMaxMode: 1000000;
|
|
232
|
+
};
|
|
233
|
+
readonly "claude-sonnet-4-6": {
|
|
234
|
+
readonly maxContext: 200000;
|
|
235
|
+
readonly maxContextForMaxMode: 1000000;
|
|
236
|
+
};
|
|
237
|
+
readonly "claude-sonnet-5": {
|
|
238
|
+
readonly maxContext: 200000;
|
|
239
|
+
readonly maxContextForMaxMode: 1000000;
|
|
240
|
+
};
|
|
241
|
+
readonly "composer-2.5": {
|
|
242
|
+
readonly maxContext: 200000;
|
|
243
|
+
};
|
|
244
|
+
readonly "gemini-2.5-flash": {
|
|
245
|
+
readonly maxContext: 200000;
|
|
246
|
+
readonly maxContextForMaxMode: 1000000;
|
|
247
|
+
};
|
|
248
|
+
readonly "gemini-3-flash": {
|
|
249
|
+
readonly maxContext: 200000;
|
|
250
|
+
readonly maxContextForMaxMode: 1000000;
|
|
251
|
+
};
|
|
252
|
+
readonly "gemini-3.1-pro": {
|
|
253
|
+
readonly maxContext: 200000;
|
|
254
|
+
readonly maxContextForMaxMode: 1000000;
|
|
255
|
+
};
|
|
256
|
+
readonly "gemini-3.5-flash": {
|
|
257
|
+
readonly maxContext: 200000;
|
|
258
|
+
readonly maxContextForMaxMode: 1000000;
|
|
259
|
+
};
|
|
260
|
+
readonly "gemini-3.6-flash": {
|
|
261
|
+
readonly maxContext: 200000;
|
|
262
|
+
readonly maxContextForMaxMode: 1000000;
|
|
263
|
+
};
|
|
264
|
+
readonly "glm-5.2": {
|
|
265
|
+
readonly maxContext: 200000;
|
|
266
|
+
};
|
|
267
|
+
readonly "gpt-5-mini": {
|
|
268
|
+
readonly maxContext: 272000;
|
|
269
|
+
};
|
|
270
|
+
readonly "gpt-5.1": {
|
|
271
|
+
readonly maxContext: 272000;
|
|
272
|
+
};
|
|
273
|
+
readonly "gpt-5.2": {
|
|
274
|
+
readonly maxContext: 272000;
|
|
275
|
+
};
|
|
276
|
+
readonly "gpt-5.3-codex": {
|
|
277
|
+
readonly maxContext: 272000;
|
|
278
|
+
};
|
|
279
|
+
readonly "gpt-5.4": {
|
|
280
|
+
readonly maxContext: 272000;
|
|
281
|
+
readonly maxContextForMaxMode: 1000000;
|
|
282
|
+
};
|
|
283
|
+
readonly "gpt-5.4-mini": {
|
|
284
|
+
readonly maxContext: 272000;
|
|
285
|
+
};
|
|
286
|
+
readonly "gpt-5.4-nano": {
|
|
287
|
+
readonly maxContext: 272000;
|
|
288
|
+
};
|
|
289
|
+
readonly "gpt-5.5": {
|
|
290
|
+
readonly maxContext: 272000;
|
|
291
|
+
readonly maxContextForMaxMode: 1000000;
|
|
292
|
+
};
|
|
293
|
+
readonly "gpt-5.6-luna": {
|
|
294
|
+
readonly maxContext: 272000;
|
|
295
|
+
};
|
|
296
|
+
readonly "gpt-5.6-sol": {
|
|
297
|
+
readonly maxContext: 272000;
|
|
298
|
+
readonly maxContextForMaxMode: 1000000;
|
|
299
|
+
};
|
|
300
|
+
readonly "gpt-5.6-terra": {
|
|
301
|
+
readonly maxContext: 272000;
|
|
302
|
+
};
|
|
303
|
+
readonly "grok-4.5": {
|
|
304
|
+
readonly maxContext: 256000;
|
|
305
|
+
};
|
|
306
|
+
readonly "kimi-k2.7-code": {
|
|
307
|
+
readonly maxContext: 262000;
|
|
308
|
+
};
|
|
309
|
+
readonly "kimi-k3": {
|
|
310
|
+
readonly maxContext: 200000;
|
|
311
|
+
readonly maxContextForMaxMode: 1000000;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
export declare const CURSOR_MODEL_CAPABILITIES: {
|
|
315
|
+
readonly "claude-fable-5": {
|
|
316
|
+
readonly supportsImages: true;
|
|
317
|
+
};
|
|
318
|
+
readonly "claude-haiku-4-5": {
|
|
319
|
+
readonly supportsImages: true;
|
|
320
|
+
};
|
|
321
|
+
readonly "claude-opus-4-5": {
|
|
322
|
+
readonly supportsImages: true;
|
|
323
|
+
};
|
|
324
|
+
readonly "claude-opus-4-6": {
|
|
325
|
+
readonly supportsImages: true;
|
|
326
|
+
};
|
|
327
|
+
readonly "claude-opus-4-7": {
|
|
328
|
+
readonly supportsImages: true;
|
|
329
|
+
};
|
|
330
|
+
readonly "claude-opus-4-8": {
|
|
331
|
+
readonly supportsImages: true;
|
|
332
|
+
};
|
|
333
|
+
readonly "claude-opus-5": {
|
|
334
|
+
readonly supportsImages: true;
|
|
335
|
+
};
|
|
336
|
+
readonly "claude-sonnet-4": {
|
|
337
|
+
readonly supportsImages: true;
|
|
338
|
+
};
|
|
339
|
+
readonly "claude-sonnet-4-5": {
|
|
340
|
+
readonly supportsImages: true;
|
|
341
|
+
};
|
|
342
|
+
readonly "claude-sonnet-4-6": {
|
|
343
|
+
readonly supportsImages: true;
|
|
344
|
+
};
|
|
345
|
+
readonly "claude-sonnet-5": {
|
|
346
|
+
readonly supportsImages: true;
|
|
347
|
+
};
|
|
348
|
+
readonly "composer-2.5": {
|
|
349
|
+
readonly supportsImages: true;
|
|
350
|
+
};
|
|
351
|
+
readonly default: {
|
|
352
|
+
readonly supportsImages: false;
|
|
353
|
+
};
|
|
354
|
+
readonly "gemini-2.5-flash": {
|
|
355
|
+
readonly supportsImages: true;
|
|
356
|
+
};
|
|
357
|
+
readonly "gemini-3-flash": {
|
|
358
|
+
readonly supportsImages: true;
|
|
359
|
+
};
|
|
360
|
+
readonly "gemini-3.1-pro": {
|
|
361
|
+
readonly supportsImages: true;
|
|
362
|
+
};
|
|
363
|
+
readonly "gemini-3.5-flash": {
|
|
364
|
+
readonly supportsImages: true;
|
|
365
|
+
};
|
|
366
|
+
readonly "gemini-3.6-flash": {
|
|
367
|
+
readonly supportsImages: true;
|
|
368
|
+
};
|
|
369
|
+
readonly "glm-5.2": {
|
|
370
|
+
readonly supportsImages: false;
|
|
371
|
+
};
|
|
372
|
+
readonly "gpt-5-mini": {
|
|
373
|
+
readonly supportsImages: true;
|
|
374
|
+
};
|
|
375
|
+
readonly "gpt-5.1": {
|
|
376
|
+
readonly supportsImages: true;
|
|
377
|
+
};
|
|
378
|
+
readonly "gpt-5.2": {
|
|
379
|
+
readonly supportsImages: true;
|
|
380
|
+
};
|
|
381
|
+
readonly "gpt-5.3-codex": {
|
|
382
|
+
readonly supportsImages: true;
|
|
383
|
+
};
|
|
384
|
+
readonly "gpt-5.4": {
|
|
385
|
+
readonly supportsImages: true;
|
|
386
|
+
};
|
|
387
|
+
readonly "gpt-5.4-mini": {
|
|
388
|
+
readonly supportsImages: true;
|
|
389
|
+
};
|
|
390
|
+
readonly "gpt-5.4-nano": {
|
|
391
|
+
readonly supportsImages: true;
|
|
392
|
+
};
|
|
393
|
+
readonly "gpt-5.5": {
|
|
394
|
+
readonly supportsImages: true;
|
|
395
|
+
};
|
|
396
|
+
readonly "gpt-5.6-luna": {
|
|
397
|
+
readonly supportsImages: true;
|
|
398
|
+
};
|
|
399
|
+
readonly "gpt-5.6-sol": {
|
|
400
|
+
readonly supportsImages: true;
|
|
401
|
+
};
|
|
402
|
+
readonly "gpt-5.6-terra": {
|
|
403
|
+
readonly supportsImages: true;
|
|
404
|
+
};
|
|
405
|
+
readonly "grok-4.5": {
|
|
406
|
+
readonly supportsImages: false;
|
|
407
|
+
};
|
|
408
|
+
readonly "kimi-k2.7-code": {
|
|
409
|
+
readonly supportsImages: true;
|
|
410
|
+
};
|
|
411
|
+
readonly "kimi-k3": {
|
|
412
|
+
readonly supportsImages: true;
|
|
413
|
+
};
|
|
414
|
+
};
|
package/dist/pricing-data.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AUTO-GENERATED by scripts/generate-cursor-pricing.ts — do not edit by hand.
|
|
3
|
-
*
|
|
3
|
+
* Pricing source: https://cursor.com/docs/models-and-pricing.md
|
|
4
|
+
* Context source: https://cursor.com/docs.md
|
|
4
5
|
* Regenerate: bun run generate:pricing
|
|
5
6
|
*/
|
|
6
7
|
export const CURSOR_PRICING_SOURCE = "https://cursor.com/docs/models-and-pricing.md";
|
|
8
|
+
export const CURSOR_CONTEXT_SOURCE = "https://cursor.com/docs.md";
|
|
7
9
|
export const CURSOR_MODEL_COSTS = {
|
|
8
10
|
"claude-fable-5": {
|
|
9
11
|
"input": 10,
|
|
@@ -192,3 +194,221 @@ export const CURSOR_MODEL_COSTS = {
|
|
|
192
194
|
"cache_read": 0.3
|
|
193
195
|
}
|
|
194
196
|
};
|
|
197
|
+
export const CURSOR_MODEL_CONTEXTS = {
|
|
198
|
+
"claude-fable-5": {
|
|
199
|
+
"maxContext": 300000,
|
|
200
|
+
"maxContextForMaxMode": 1000000
|
|
201
|
+
},
|
|
202
|
+
"claude-haiku-4-5": {
|
|
203
|
+
"maxContext": 200000
|
|
204
|
+
},
|
|
205
|
+
"claude-opus-4-5": {
|
|
206
|
+
"maxContext": 200000,
|
|
207
|
+
"maxContextForMaxMode": 200000
|
|
208
|
+
},
|
|
209
|
+
"claude-opus-4-6": {
|
|
210
|
+
"maxContext": 200000,
|
|
211
|
+
"maxContextForMaxMode": 1000000
|
|
212
|
+
},
|
|
213
|
+
"claude-opus-4-7": {
|
|
214
|
+
"maxContext": 300000,
|
|
215
|
+
"maxContextForMaxMode": 1000000
|
|
216
|
+
},
|
|
217
|
+
"claude-opus-4-8": {
|
|
218
|
+
"maxContext": 300000,
|
|
219
|
+
"maxContextForMaxMode": 1000000
|
|
220
|
+
},
|
|
221
|
+
"claude-opus-5": {
|
|
222
|
+
"maxContext": 300000,
|
|
223
|
+
"maxContextForMaxMode": 1000000
|
|
224
|
+
},
|
|
225
|
+
"claude-sonnet-4": {
|
|
226
|
+
"maxContext": 200000,
|
|
227
|
+
"maxContextForMaxMode": 1000000
|
|
228
|
+
},
|
|
229
|
+
"claude-sonnet-4-5": {
|
|
230
|
+
"maxContext": 200000,
|
|
231
|
+
"maxContextForMaxMode": 1000000
|
|
232
|
+
},
|
|
233
|
+
"claude-sonnet-4-6": {
|
|
234
|
+
"maxContext": 200000,
|
|
235
|
+
"maxContextForMaxMode": 1000000
|
|
236
|
+
},
|
|
237
|
+
"claude-sonnet-5": {
|
|
238
|
+
"maxContext": 200000,
|
|
239
|
+
"maxContextForMaxMode": 1000000
|
|
240
|
+
},
|
|
241
|
+
"composer-2.5": {
|
|
242
|
+
"maxContext": 200000
|
|
243
|
+
},
|
|
244
|
+
"gemini-2.5-flash": {
|
|
245
|
+
"maxContext": 200000,
|
|
246
|
+
"maxContextForMaxMode": 1000000
|
|
247
|
+
},
|
|
248
|
+
"gemini-3-flash": {
|
|
249
|
+
"maxContext": 200000,
|
|
250
|
+
"maxContextForMaxMode": 1000000
|
|
251
|
+
},
|
|
252
|
+
"gemini-3.1-pro": {
|
|
253
|
+
"maxContext": 200000,
|
|
254
|
+
"maxContextForMaxMode": 1000000
|
|
255
|
+
},
|
|
256
|
+
"gemini-3.5-flash": {
|
|
257
|
+
"maxContext": 200000,
|
|
258
|
+
"maxContextForMaxMode": 1000000
|
|
259
|
+
},
|
|
260
|
+
"gemini-3.6-flash": {
|
|
261
|
+
"maxContext": 200000,
|
|
262
|
+
"maxContextForMaxMode": 1000000
|
|
263
|
+
},
|
|
264
|
+
"glm-5.2": {
|
|
265
|
+
"maxContext": 200000
|
|
266
|
+
},
|
|
267
|
+
"gpt-5-mini": {
|
|
268
|
+
"maxContext": 272000
|
|
269
|
+
},
|
|
270
|
+
"gpt-5.1": {
|
|
271
|
+
"maxContext": 272000
|
|
272
|
+
},
|
|
273
|
+
"gpt-5.2": {
|
|
274
|
+
"maxContext": 272000
|
|
275
|
+
},
|
|
276
|
+
"gpt-5.3-codex": {
|
|
277
|
+
"maxContext": 272000
|
|
278
|
+
},
|
|
279
|
+
"gpt-5.4": {
|
|
280
|
+
"maxContext": 272000,
|
|
281
|
+
"maxContextForMaxMode": 1000000
|
|
282
|
+
},
|
|
283
|
+
"gpt-5.4-mini": {
|
|
284
|
+
"maxContext": 272000
|
|
285
|
+
},
|
|
286
|
+
"gpt-5.4-nano": {
|
|
287
|
+
"maxContext": 272000
|
|
288
|
+
},
|
|
289
|
+
"gpt-5.5": {
|
|
290
|
+
"maxContext": 272000,
|
|
291
|
+
"maxContextForMaxMode": 1000000
|
|
292
|
+
},
|
|
293
|
+
"gpt-5.6-luna": {
|
|
294
|
+
"maxContext": 272000
|
|
295
|
+
},
|
|
296
|
+
"gpt-5.6-sol": {
|
|
297
|
+
"maxContext": 272000,
|
|
298
|
+
"maxContextForMaxMode": 1000000
|
|
299
|
+
},
|
|
300
|
+
"gpt-5.6-terra": {
|
|
301
|
+
"maxContext": 272000
|
|
302
|
+
},
|
|
303
|
+
"grok-4.5": {
|
|
304
|
+
"maxContext": 256000
|
|
305
|
+
},
|
|
306
|
+
"kimi-k2.7-code": {
|
|
307
|
+
"maxContext": 262000
|
|
308
|
+
},
|
|
309
|
+
"kimi-k3": {
|
|
310
|
+
"maxContext": 200000,
|
|
311
|
+
"maxContextForMaxMode": 1000000
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
export const CURSOR_MODEL_CAPABILITIES = {
|
|
315
|
+
"claude-fable-5": {
|
|
316
|
+
"supportsImages": true
|
|
317
|
+
},
|
|
318
|
+
"claude-haiku-4-5": {
|
|
319
|
+
"supportsImages": true
|
|
320
|
+
},
|
|
321
|
+
"claude-opus-4-5": {
|
|
322
|
+
"supportsImages": true
|
|
323
|
+
},
|
|
324
|
+
"claude-opus-4-6": {
|
|
325
|
+
"supportsImages": true
|
|
326
|
+
},
|
|
327
|
+
"claude-opus-4-7": {
|
|
328
|
+
"supportsImages": true
|
|
329
|
+
},
|
|
330
|
+
"claude-opus-4-8": {
|
|
331
|
+
"supportsImages": true
|
|
332
|
+
},
|
|
333
|
+
"claude-opus-5": {
|
|
334
|
+
"supportsImages": true
|
|
335
|
+
},
|
|
336
|
+
"claude-sonnet-4": {
|
|
337
|
+
"supportsImages": true
|
|
338
|
+
},
|
|
339
|
+
"claude-sonnet-4-5": {
|
|
340
|
+
"supportsImages": true
|
|
341
|
+
},
|
|
342
|
+
"claude-sonnet-4-6": {
|
|
343
|
+
"supportsImages": true
|
|
344
|
+
},
|
|
345
|
+
"claude-sonnet-5": {
|
|
346
|
+
"supportsImages": true
|
|
347
|
+
},
|
|
348
|
+
"composer-2.5": {
|
|
349
|
+
"supportsImages": true
|
|
350
|
+
},
|
|
351
|
+
"default": {
|
|
352
|
+
"supportsImages": false
|
|
353
|
+
},
|
|
354
|
+
"gemini-2.5-flash": {
|
|
355
|
+
"supportsImages": true
|
|
356
|
+
},
|
|
357
|
+
"gemini-3-flash": {
|
|
358
|
+
"supportsImages": true
|
|
359
|
+
},
|
|
360
|
+
"gemini-3.1-pro": {
|
|
361
|
+
"supportsImages": true
|
|
362
|
+
},
|
|
363
|
+
"gemini-3.5-flash": {
|
|
364
|
+
"supportsImages": true
|
|
365
|
+
},
|
|
366
|
+
"gemini-3.6-flash": {
|
|
367
|
+
"supportsImages": true
|
|
368
|
+
},
|
|
369
|
+
"glm-5.2": {
|
|
370
|
+
"supportsImages": false
|
|
371
|
+
},
|
|
372
|
+
"gpt-5-mini": {
|
|
373
|
+
"supportsImages": true
|
|
374
|
+
},
|
|
375
|
+
"gpt-5.1": {
|
|
376
|
+
"supportsImages": true
|
|
377
|
+
},
|
|
378
|
+
"gpt-5.2": {
|
|
379
|
+
"supportsImages": true
|
|
380
|
+
},
|
|
381
|
+
"gpt-5.3-codex": {
|
|
382
|
+
"supportsImages": true
|
|
383
|
+
},
|
|
384
|
+
"gpt-5.4": {
|
|
385
|
+
"supportsImages": true
|
|
386
|
+
},
|
|
387
|
+
"gpt-5.4-mini": {
|
|
388
|
+
"supportsImages": true
|
|
389
|
+
},
|
|
390
|
+
"gpt-5.4-nano": {
|
|
391
|
+
"supportsImages": true
|
|
392
|
+
},
|
|
393
|
+
"gpt-5.5": {
|
|
394
|
+
"supportsImages": true
|
|
395
|
+
},
|
|
396
|
+
"gpt-5.6-luna": {
|
|
397
|
+
"supportsImages": true
|
|
398
|
+
},
|
|
399
|
+
"gpt-5.6-sol": {
|
|
400
|
+
"supportsImages": true
|
|
401
|
+
},
|
|
402
|
+
"gpt-5.6-terra": {
|
|
403
|
+
"supportsImages": true
|
|
404
|
+
},
|
|
405
|
+
"grok-4.5": {
|
|
406
|
+
"supportsImages": false
|
|
407
|
+
},
|
|
408
|
+
"kimi-k2.7-code": {
|
|
409
|
+
"supportsImages": true
|
|
410
|
+
},
|
|
411
|
+
"kimi-k3": {
|
|
412
|
+
"supportsImages": true
|
|
413
|
+
}
|
|
414
|
+
};
|
|
@@ -917,9 +917,30 @@ export function createMessageTypes() {
|
|
|
917
917
|
{ id: 2, name: "max_mode", type: "bool" },
|
|
918
918
|
{ id: 3, name: "parameters", type: "ParameterValue", repeated: true },
|
|
919
919
|
]);
|
|
920
|
+
addType(root, "SelectedImageDimension", [
|
|
921
|
+
{ id: 1, name: "width", type: "int32" },
|
|
922
|
+
{ id: 2, name: "height", type: "int32" },
|
|
923
|
+
]);
|
|
924
|
+
addType(root, "SelectedImageBlobIdWithData", [
|
|
925
|
+
{ id: 1, name: "blob_id", type: "bytes" },
|
|
926
|
+
{ id: 2, name: "data", type: "bytes" },
|
|
927
|
+
]);
|
|
928
|
+
addType(root, "SelectedImage", [
|
|
929
|
+
{ id: 1, name: "blob_id", type: "bytes" },
|
|
930
|
+
{ id: 8, name: "data", type: "bytes" },
|
|
931
|
+
{ id: 9, name: "blob_id_with_data", type: "SelectedImageBlobIdWithData" },
|
|
932
|
+
{ id: 2, name: "uuid", type: "string" },
|
|
933
|
+
{ id: 3, name: "path", type: "string" },
|
|
934
|
+
{ id: 4, name: "dimension", type: "SelectedImageDimension" },
|
|
935
|
+
{ id: 7, name: "mime_type", type: "string" },
|
|
936
|
+
], [{ name: "data_or_blob_id", fields: ["blob_id", "data", "blob_id_with_data"] }]);
|
|
937
|
+
addType(root, "SelectedContext", [
|
|
938
|
+
{ id: 1, name: "selected_images", type: "SelectedImage", repeated: true },
|
|
939
|
+
]);
|
|
920
940
|
addType(root, "UserMessage", [
|
|
921
941
|
{ id: 1, name: "text", type: "string" },
|
|
922
942
|
{ id: 2, name: "message_id", type: "string" },
|
|
943
|
+
{ id: 3, name: "selected_context", type: "SelectedContext" },
|
|
923
944
|
]);
|
|
924
945
|
// RequestContext — UserMessageAction #2. Live per-turn tools go here
|
|
925
946
|
// (AgentRunRequest.mcp_tools #4 is prewarm-only / empty on real turns).
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type OpencodeToolDef } from "./tools.js";
|
|
2
|
+
import type { CursorImageInput } from "../image-input.js";
|
|
2
3
|
export type SeedHistoryMessage = {
|
|
3
4
|
role: "system" | "user" | "assistant";
|
|
4
5
|
content: string;
|
|
5
6
|
};
|
|
6
7
|
export type RunRequestInput = {
|
|
7
8
|
text: string;
|
|
9
|
+
images?: CursorImageInput[];
|
|
8
10
|
modelId: string;
|
|
9
11
|
conversationId: string;
|
|
10
12
|
systemPrompt?: string;
|
package/dist/protocol/request.js
CHANGED
|
@@ -48,12 +48,21 @@ export function buildRunRequest(input) {
|
|
|
48
48
|
const tools = input.tools ?? [];
|
|
49
49
|
const mcpTools = input.toolDescriptors ?? (tools.length > 0 ? toolsToDescriptors(tools) : []);
|
|
50
50
|
const requestContext = input.requestContext;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
message_id: msgId,
|
|
55
|
-
},
|
|
51
|
+
const userMessage = {
|
|
52
|
+
text: input.text,
|
|
53
|
+
message_id: msgId,
|
|
56
54
|
};
|
|
55
|
+
if (input.images?.length) {
|
|
56
|
+
userMessage.selected_context = {
|
|
57
|
+
selected_images: input.images.map((image) => ({
|
|
58
|
+
data: image.data,
|
|
59
|
+
uuid: crypto.randomUUID(),
|
|
60
|
+
path: image.filename,
|
|
61
|
+
mime_type: image.mimeType,
|
|
62
|
+
})),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const userMessageAction = { user_message: userMessage };
|
|
57
66
|
if (requestContext)
|
|
58
67
|
userMessageAction.request_context = requestContext;
|
|
59
68
|
const action = input.action === "resume"
|
package/dist/shared.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const AVAILABLE_MODELS_PATH = "/aiserver.v1.AiService/AvailableMo
|
|
|
10
10
|
export declare const SERVER_CONFIG_PATH = "/aiserver.v1.ServerConfigService/GetServerConfig";
|
|
11
11
|
export declare const MODEL_CACHE_FILE = "cursor-models.json";
|
|
12
12
|
/** Bumped when the on-disk model cache shape/semantics change (forces refetch). */
|
|
13
|
-
export declare const MODEL_CACHE_SCHEMA_VERSION =
|
|
13
|
+
export declare const MODEL_CACHE_SCHEMA_VERSION = 3;
|
|
14
14
|
export declare const MODEL_CACHE_TTL_MS = 86400000;
|
|
15
15
|
export declare const VERSION_CACHE_FILE = "cursor-client-version.json";
|
|
16
16
|
export declare const CONTENT_TYPE_CONNECT_PROTO = "application/connect+proto";
|
package/dist/shared.js
CHANGED
|
@@ -10,7 +10,7 @@ export const AVAILABLE_MODELS_PATH = "/aiserver.v1.AiService/AvailableModels";
|
|
|
10
10
|
export const SERVER_CONFIG_PATH = "/aiserver.v1.ServerConfigService/GetServerConfig";
|
|
11
11
|
export const MODEL_CACHE_FILE = "cursor-models.json";
|
|
12
12
|
/** Bumped when the on-disk model cache shape/semantics change (forces refetch). */
|
|
13
|
-
export const MODEL_CACHE_SCHEMA_VERSION =
|
|
13
|
+
export const MODEL_CACHE_SCHEMA_VERSION = 3;
|
|
14
14
|
export const MODEL_CACHE_TTL_MS = 86_400_000;
|
|
15
15
|
export const VERSION_CACHE_FILE = "cursor-client-version.json";
|
|
16
16
|
export const CONTENT_TYPE_CONNECT_PROTO = "application/connect+proto";
|