opencodekit 0.18.11 → 0.18.12

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/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
18
18
 
19
19
  //#endregion
20
20
  //#region package.json
21
- var version = "0.18.11";
21
+ var version = "0.18.12";
22
22
 
23
23
  //#endregion
24
24
  //#region src/utils/errors.ts
Binary file
@@ -189,7 +189,7 @@
189
189
  "claude-opus-4.5": {
190
190
  "attachment": true,
191
191
  "limit": {
192
- "context": 200000,
192
+ "context": 128000,
193
193
  "output": 64000
194
194
  },
195
195
  "options": {
@@ -214,7 +214,7 @@
214
214
  "claude-opus-4.6": {
215
215
  "attachment": true,
216
216
  "limit": {
217
- "context": 200000,
217
+ "context": 128000,
218
218
  "output": 64000
219
219
  },
220
220
  "options": {
@@ -259,7 +259,7 @@
259
259
  "claude-sonnet-4.5": {
260
260
  "attachment": true,
261
261
  "limit": {
262
- "context": 200000,
262
+ "context": 128000,
263
263
  "output": 64000
264
264
  },
265
265
  "options": {
@@ -284,7 +284,7 @@
284
284
  "claude-sonnet-4.6": {
285
285
  "attachment": true,
286
286
  "limit": {
287
- "context": 200000,
287
+ "context": 128000,
288
288
  "output": 64000
289
289
  },
290
290
  "options": {
@@ -329,7 +329,7 @@
329
329
  "gpt-5.2": {
330
330
  "attachment": true,
331
331
  "limit": {
332
- "context": 400000,
332
+ "context": 192000,
333
333
  "output": 128000
334
334
  },
335
335
  "options": {
@@ -460,6 +460,135 @@
460
460
  "textVerbosity": "medium"
461
461
  }
462
462
  }
463
+ },
464
+ "claude-sonnet-4": {
465
+ "attachment": true,
466
+ "limit": {
467
+ "context": 200000,
468
+ "output": 64000
469
+ },
470
+ "options": {
471
+ "thinking_budget": 10000
472
+ },
473
+ "reasoning": true,
474
+ "temperature": true,
475
+ "tool_call": true
476
+ },
477
+ "gemini-2.5-pro": {
478
+ "attachment": true,
479
+ "limit": {
480
+ "context": 173000,
481
+ "output": 64000
482
+ },
483
+ "reasoning": true,
484
+ "temperature": true,
485
+ "tool_call": true
486
+ },
487
+ "gemini-3-flash-preview": {
488
+ "attachment": true,
489
+ "limit": {
490
+ "context": 173000,
491
+ "output": 64000
492
+ },
493
+ "reasoning": true,
494
+ "temperature": true,
495
+ "tool_call": true
496
+ },
497
+ "gemini-3-pro-preview": {
498
+ "attachment": true,
499
+ "limit": {
500
+ "context": 173000,
501
+ "output": 64000
502
+ },
503
+ "reasoning": true,
504
+ "temperature": true,
505
+ "tool_call": true
506
+ },
507
+ "gemini-3.1-pro-preview": {
508
+ "attachment": true,
509
+ "limit": {
510
+ "context": 173000,
511
+ "output": 64000
512
+ },
513
+ "reasoning": true,
514
+ "temperature": true,
515
+ "tool_call": true
516
+ },
517
+ "gpt-5.1": {
518
+ "attachment": true,
519
+ "limit": {
520
+ "context": 192000,
521
+ "output": 128000
522
+ },
523
+ "options": {
524
+ "reasoningEffort": "medium",
525
+ "reasoningSummary": "auto"
526
+ },
527
+ "reasoning": true,
528
+ "temperature": true,
529
+ "tool_call": true
530
+ },
531
+ "gpt-5.1-codex": {
532
+ "attachment": true,
533
+ "limit": {
534
+ "context": 256000,
535
+ "output": 128000
536
+ },
537
+ "options": {
538
+ "reasoningEffort": "medium",
539
+ "reasoningSummary": "auto"
540
+ },
541
+ "reasoning": true,
542
+ "temperature": true,
543
+ "tool_call": true
544
+ },
545
+ "gpt-5.1-codex-max": {
546
+ "attachment": true,
547
+ "limit": {
548
+ "context": 256000,
549
+ "output": 128000
550
+ },
551
+ "options": {
552
+ "reasoningEffort": "medium",
553
+ "reasoningSummary": "auto"
554
+ },
555
+ "reasoning": true,
556
+ "temperature": true,
557
+ "tool_call": true
558
+ },
559
+ "gpt-5.1-codex-mini": {
560
+ "attachment": true,
561
+ "limit": {
562
+ "context": 256000,
563
+ "output": 128000
564
+ },
565
+ "options": {
566
+ "reasoningEffort": "medium",
567
+ "reasoningSummary": "auto"
568
+ },
569
+ "reasoning": true,
570
+ "temperature": true,
571
+ "tool_call": true
572
+ },
573
+ "grok-code-fast": {
574
+ "attachment": true,
575
+ "limit": {
576
+ "context": 173000,
577
+ "output": 64000
578
+ },
579
+ "reasoning": true,
580
+ "temperature": true,
581
+ "tool_call": true
582
+ },
583
+ "grok-code-fast-1": {
584
+ "attachment": true,
585
+ "limit": {
586
+ "context": 173000,
587
+ "output": 64000
588
+ },
589
+ "reasoning": true,
590
+ "temperature": true,
591
+ "tool_call": true
463
592
  }
464
593
  },
465
594
  "options": {
@@ -87,8 +87,47 @@ const RATE_LIMIT_CONFIG = {
87
87
  maxDelayMs: 30000, // Cap at 30 seconds
88
88
  };
89
89
 
90
+ // Maximum length for item IDs in the OpenAI Responses API
91
+ const MAX_RESPONSE_API_ID_LENGTH = 64;
92
+ /**
93
+ * Sanitize an ID to fit within the Responses API 64-char limit.
94
+ * GitHub Copilot returns proprietary long IDs (400+ chars) that violate
95
+ * the OpenAI spec. We hash them to a deterministic 64-char string.
96
+ * See: https://github.com/vercel/ai/issues/5171
97
+ */
98
+ function sanitizeResponseId(id: string): string {
99
+ if (!id || id.length <= MAX_RESPONSE_API_ID_LENGTH) return id;
100
+ // Use a simple hash: take first 8 chars + hash of full string for uniqueness
101
+ // Format: "h_" + first 8 chars + "_" + base36 hash (up to ~50 chars total)
102
+ let hash = 0;
103
+ for (let i = 0; i < id.length; i++) {
104
+ hash = ((hash << 5) - hash + id.charCodeAt(i)) | 0;
105
+ }
106
+ const hashStr = Math.abs(hash).toString(36);
107
+ const prefix = id.slice(0, 8);
108
+ // Ensure total length <= 64: "h_" (2) + prefix (8) + "_" (1) + hash
109
+ return `h_${prefix}_${hashStr}`.slice(0, MAX_RESPONSE_API_ID_LENGTH);
110
+ }
111
+
112
+ /**
113
+ * Sanitize all IDs in a Responses API input array.
114
+ * Recursively checks `id` and `call_id` fields on each input item.
115
+ */
116
+ function sanitizeResponseInputIds(input: any[]): any[] {
117
+ return input.map((item: any) => {
118
+ if (!item || typeof item !== "object") return item;
119
+ const sanitized = { ...item };
120
+ if (typeof sanitized.id === "string" && sanitized.id.length > MAX_RESPONSE_API_ID_LENGTH) {
121
+ sanitized.id = sanitizeResponseId(sanitized.id);
122
+ }
123
+ if (typeof sanitized.call_id === "string" && sanitized.call_id.length > MAX_RESPONSE_API_ID_LENGTH) {
124
+ sanitized.call_id = sanitizeResponseId(sanitized.call_id);
125
+ }
126
+ return sanitized;
127
+ });
128
+ }
129
+
90
130
  /**
91
- * Calculate delay with exponential backoff and jitter
92
131
  * Retries: 2s, 4s, 8s (with jitter)
93
132
  */
94
133
  function calculateRetryDelay(attempt: number): number {
@@ -291,7 +330,27 @@ export const CopilotAuthPlugin: Plugin = async ({ client: sdk }) => {
291
330
 
292
331
  // Responses API
293
332
  if (body?.input) {
294
- isAgentCall = body.input.some(
333
+ // Sanitize long IDs from Copilot backend (can be 400+ chars)
334
+ // OpenAI Responses API enforces a 64-char max on item IDs
335
+ const sanitizedInput = sanitizeResponseInputIds(body.input);
336
+ const inputWasSanitized = sanitizedInput !== body.input &&
337
+ JSON.stringify(sanitizedInput) !== JSON.stringify(body.input);
338
+
339
+ if (inputWasSanitized) {
340
+ log("info", "Sanitized long IDs in Responses API input", {
341
+ original_count: body.input.filter(
342
+ (item: any) =>
343
+ (typeof item?.id === "string" && item.id.length > MAX_RESPONSE_API_ID_LENGTH) ||
344
+ (typeof item?.call_id === "string" && item.call_id.length > MAX_RESPONSE_API_ID_LENGTH),
345
+ ).length,
346
+ });
347
+ modifiedBody = {
348
+ ...(modifiedBody || body),
349
+ input: sanitizedInput,
350
+ };
351
+ }
352
+
353
+ isAgentCall = (sanitizedInput || body.input).some(
295
354
  (item: any) =>
296
355
  item?.role === "assistant" ||
297
356
  (item?.type &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencodekit",
3
- "version": "0.18.11",
3
+ "version": "0.18.12",
4
4
  "description": "CLI tool for bootstrapping and managing OpenCodeKit projects",
5
5
  "keywords": [
6
6
  "agents",