@opencode/ai 2.2.0 → 2.2.2

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.
Files changed (189) hide show
  1. package/README.md +66 -62
  2. package/dist/effect.d.ts +1 -1
  3. package/dist/effect.js +1 -1
  4. package/dist/image-client.d.ts +45 -0
  5. package/dist/image.d.ts +1 -0
  6. package/dist/index.d.ts +38 -20
  7. package/dist/index.js +14 -2
  8. package/dist/media-client.d.ts +1 -0
  9. package/dist/media-client.js +1 -0
  10. package/dist/protocols/alibaba-chat.d.ts +39 -4
  11. package/dist/protocols/alibaba-responses.d.ts +20 -3
  12. package/dist/protocols/google-images.js +3 -1
  13. package/dist/protocols/meta-responses.d.ts +40 -6
  14. package/dist/protocols/meta-responses.js +1 -1
  15. package/dist/protocols/minimax-images.d.ts +25 -0
  16. package/dist/protocols/minimax-images.js +150 -0
  17. package/dist/protocols/open-responses.d.ts +182 -27
  18. package/dist/protocols/open-responses.js +108 -36
  19. package/dist/protocols/openai-chat.d.ts +438 -46
  20. package/dist/protocols/openai-chat.js +121 -39
  21. package/dist/protocols/openai-compatible-chat.d.ts +35 -4
  22. package/dist/protocols/openai-compatible-responses.d.ts +20 -3
  23. package/dist/protocols/openai-freeform.d.ts +47 -0
  24. package/dist/protocols/openai-freeform.js +54 -0
  25. package/dist/protocols/openai-images.d.ts +16 -1
  26. package/dist/protocols/openai-images.js +49 -17
  27. package/dist/protocols/openai-responses.d.ts +120 -18
  28. package/dist/protocols/openai-responses.js +17 -8
  29. package/dist/protocols/venice-chat.d.ts +39 -4
  30. package/dist/protocols/venice-chat.js +1 -1
  31. package/dist/protocols/xai-images.d.ts +6 -0
  32. package/dist/protocols/xai-images.js +4 -5
  33. package/dist/protocols/xai-responses.d.ts +20 -3
  34. package/dist/protocols/xai-responses.js +2 -1
  35. package/dist/protocols/zai-chat.d.ts +39 -4
  36. package/dist/provider-error.js +5 -4
  37. package/dist/provider-package.d.ts +2 -0
  38. package/dist/providers/alibaba.d.ts +58 -10
  39. package/dist/providers/amazon-bedrock-mantle.d.ts +66 -11
  40. package/dist/providers/amazon-bedrock-mantle.js +1 -1
  41. package/dist/providers/amazon-bedrock.d.ts +1 -1
  42. package/dist/providers/amazon-bedrock.js +1 -1
  43. package/dist/providers/anthropic-compatible.d.ts +1 -1
  44. package/dist/providers/anthropic.d.ts +1 -1
  45. package/dist/providers/anthropic.js +1 -1
  46. package/dist/providers/azure.d.ts +79 -15
  47. package/dist/providers/baseten.d.ts +74 -12
  48. package/dist/providers/baseten.js +1 -1
  49. package/dist/providers/cerebras.d.ts +73 -11
  50. package/dist/providers/cerebras.js +1 -1
  51. package/dist/providers/cloudflare-ai-gateway.d.ts +113 -17
  52. package/dist/providers/cloudflare-workers-ai.d.ts +73 -11
  53. package/dist/providers/cohere/chat.d.ts +1 -1
  54. package/dist/providers/cohere/chat.js +1 -1
  55. package/dist/providers/cohere.d.ts +73 -11
  56. package/dist/providers/cohere.js +1 -1
  57. package/dist/providers/deepinfra.d.ts +73 -11
  58. package/dist/providers/deepinfra.js +1 -1
  59. package/dist/providers/deepseek.d.ts +73 -11
  60. package/dist/providers/deepseek.js +1 -1
  61. package/dist/providers/digitalocean/responses.d.ts +4 -0
  62. package/dist/providers/digitalocean/responses.js +1 -0
  63. package/dist/providers/digitalocean.d.ts +320 -21
  64. package/dist/providers/digitalocean.js +18 -7
  65. package/dist/providers/fireworks.d.ts +73 -11
  66. package/dist/providers/fireworks.js +1 -1
  67. package/dist/providers/google/interactions.d.ts +1 -1
  68. package/dist/providers/google/interactions.js +1 -1
  69. package/dist/providers/google-vertex-chat.d.ts +36 -5
  70. package/dist/providers/google-vertex-chat.js +1 -1
  71. package/dist/providers/google-vertex-interactions.d.ts +1 -1
  72. package/dist/providers/google-vertex-interactions.js +1 -1
  73. package/dist/providers/google-vertex-messages.d.ts +1 -1
  74. package/dist/providers/google-vertex-messages.js +1 -1
  75. package/dist/providers/google-vertex-mistral.d.ts +1 -1
  76. package/dist/providers/google-vertex-mistral.js +1 -1
  77. package/dist/providers/google-vertex-responses.d.ts +21 -4
  78. package/dist/providers/google-vertex-responses.js +1 -1
  79. package/dist/providers/google-vertex.d.ts +2 -2
  80. package/dist/providers/google-vertex.js +1 -1
  81. package/dist/providers/google.d.ts +2 -2
  82. package/dist/providers/google.js +1 -1
  83. package/dist/providers/groq.d.ts +77 -11
  84. package/dist/providers/groq.js +1 -1
  85. package/dist/providers/index.d.ts +0 -4
  86. package/dist/providers/index.js +0 -4
  87. package/dist/providers/meta/images.d.ts +2 -0
  88. package/dist/providers/meta/images.js +1 -0
  89. package/dist/providers/meta.d.ts +61 -12
  90. package/dist/providers/meta.js +2 -1
  91. package/dist/providers/minimax/chat.d.ts +1 -1
  92. package/dist/providers/minimax/chat.js +1 -1
  93. package/dist/providers/minimax/images.d.ts +3 -0
  94. package/dist/providers/minimax/images.js +1 -0
  95. package/dist/providers/minimax/responses.d.ts +1 -1
  96. package/dist/providers/minimax/responses.js +1 -1
  97. package/dist/providers/minimax.d.ts +63 -9
  98. package/dist/providers/minimax.js +22 -9
  99. package/dist/providers/mistral.d.ts +3 -3
  100. package/dist/providers/mistral.js +1 -1
  101. package/dist/providers/moonshot/messages.d.ts +1 -1
  102. package/dist/providers/moonshot/messages.js +1 -1
  103. package/dist/providers/moonshot/responses.d.ts +1 -1
  104. package/dist/providers/moonshot/responses.js +1 -1
  105. package/dist/providers/moonshot.d.ts +56 -8
  106. package/dist/providers/moonshot.js +1 -1
  107. package/dist/providers/openai-compatible-responses.d.ts +21 -4
  108. package/dist/providers/openai-compatible.d.ts +38 -7
  109. package/dist/providers/openai-compatible.js +9 -2
  110. package/dist/providers/openai.d.ts +59 -11
  111. package/dist/providers/openai.js +4 -2
  112. package/dist/providers/opencode.d.ts +3 -3
  113. package/dist/providers/opencode.js +1 -1
  114. package/dist/providers/openrouter/responses.d.ts +4 -0
  115. package/dist/providers/openrouter/responses.js +1 -0
  116. package/dist/providers/openrouter.d.ts +356 -26
  117. package/dist/providers/openrouter.js +42 -13
  118. package/dist/providers/togetherai.d.ts +73 -11
  119. package/dist/providers/togetherai.js +1 -1
  120. package/dist/providers/typesafe-ai.d.ts +3 -3
  121. package/dist/providers/typesafe-ai.js +1 -1
  122. package/dist/providers/venice/responses.d.ts +4 -0
  123. package/dist/providers/venice/responses.js +1 -0
  124. package/dist/providers/venice.d.ts +242 -9
  125. package/dist/providers/venice.js +33 -17
  126. package/dist/providers/vercel-ai-gateway.d.ts +8 -8
  127. package/dist/providers/vercel-ai-gateway.js +12 -2
  128. package/dist/providers/xai.d.ts +39 -8
  129. package/dist/providers/xai.js +1 -1
  130. package/dist/providers/zai-coding-plan/messages.d.ts +1 -1
  131. package/dist/providers/zai-coding-plan/messages.js +1 -1
  132. package/dist/providers/zai-coding-plan/responses.d.ts +1 -1
  133. package/dist/providers/zai-coding-plan/responses.js +1 -1
  134. package/dist/providers/zai-coding-plan.d.ts +56 -8
  135. package/dist/providers/zai-coding-plan.js +1 -1
  136. package/dist/providers/zai.d.ts +37 -6
  137. package/dist/providers/zai.js +1 -1
  138. package/dist/route/auth.d.ts +1 -1
  139. package/dist/route/media-protocol.d.ts +2 -4
  140. package/dist/route/media.d.ts +1 -1
  141. package/dist/route/media.js +2 -4
  142. package/dist/schema/events.d.ts +2 -0
  143. package/dist/schema/messages.d.ts +35 -1
  144. package/dist/schema/messages.js +20 -0
  145. package/dist/speech-client.d.ts +48 -0
  146. package/dist/speech.d.ts +1 -0
  147. package/dist/testing/decision.d.ts +16 -0
  148. package/dist/testing/decision.js +20 -0
  149. package/dist/testing/image.d.ts +14 -0
  150. package/dist/testing/image.js +12 -0
  151. package/dist/testing/media.d.ts +18 -0
  152. package/dist/testing/media.js +36 -0
  153. package/dist/testing/script.d.ts +28 -0
  154. package/dist/testing/script.js +60 -0
  155. package/dist/testing/speech.d.ts +14 -0
  156. package/dist/testing/speech.js +12 -0
  157. package/dist/testing/transcription.d.ts +14 -0
  158. package/dist/testing/transcription.js +12 -0
  159. package/dist/testing/video.d.ts +14 -0
  160. package/dist/testing/video.js +12 -0
  161. package/dist/testing.d.ts +10 -21
  162. package/dist/testing.js +11 -54
  163. package/dist/tool.d.ts +12 -1
  164. package/dist/tool.js +10 -2
  165. package/dist/transcription-client.d.ts +64 -0
  166. package/dist/transcription.d.ts +1 -0
  167. package/dist/video-client.d.ts +41 -0
  168. package/dist/video.d.ts +1 -0
  169. package/package.json +24 -40
  170. package/dist/protocols/bfl-images.d.ts +0 -47
  171. package/dist/protocols/bfl-images.js +0 -155
  172. package/dist/protocols/fal-images.d.ts +0 -34
  173. package/dist/protocols/fal-images.js +0 -95
  174. package/dist/protocols/fal-video.d.ts +0 -29
  175. package/dist/protocols/fal-video.js +0 -73
  176. package/dist/protocols/replicate-images.d.ts +0 -28
  177. package/dist/protocols/replicate-images.js +0 -127
  178. package/dist/protocols/stability-images.d.ts +0 -44
  179. package/dist/protocols/stability-images.js +0 -131
  180. package/dist/protocols/utils/fal-queue.d.ts +0 -26
  181. package/dist/protocols/utils/fal-queue.js +0 -67
  182. package/dist/providers/black-forest-labs.d.ts +0 -21
  183. package/dist/providers/black-forest-labs.js +0 -23
  184. package/dist/providers/fal.d.ts +0 -24
  185. package/dist/providers/fal.js +0 -26
  186. package/dist/providers/replicate.d.ts +0 -21
  187. package/dist/providers/replicate.js +0 -17
  188. package/dist/providers/stability.d.ts +0 -23
  189. package/dist/providers/stability.js +0 -18
@@ -7,6 +7,7 @@ import { AIError, LLMEvent, Usage, type FinishReasonDetails, type CacheHint, typ
7
7
  import { OpenResponsesOptions } from "./utils/open-responses-options.js";
8
8
  import { Lifecycle } from "./utils/lifecycle.js";
9
9
  import { ToolStream } from "./utils/tool-stream.js";
10
+ import { OpenAIFreeform } from "./openai-freeform.js";
10
11
  export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
11
12
  export declare const PATH = "/chat/completions";
12
13
  declare const OpenAIChatCacheControl: Schema.Struct<{
@@ -32,6 +33,14 @@ export declare const OpenAIChatAssistantToolCall: Schema.Struct<{
32
33
  }>;
33
34
  }>>;
34
35
  }>;
36
+ export declare const OpenAIChatAssistantCustomToolCall: Schema.Struct<{
37
+ readonly id: Schema.String;
38
+ readonly type: Schema.tag<"custom">;
39
+ readonly custom: Schema.Struct<{
40
+ readonly name: Schema.String;
41
+ readonly input: Schema.String;
42
+ }>;
43
+ }>;
35
44
  declare const ReasoningDetail: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
36
45
  readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
37
46
  readonly format: Schema.optional<Schema.String>;
@@ -125,7 +134,7 @@ export declare const OpenAIChatMessage: Schema.toTaggedUnion<"role", readonly [S
125
134
  readonly ttl: Schema.optional<Schema.String>;
126
135
  }>>;
127
136
  }>>]>>;
128
- readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
137
+ readonly tool_calls: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
129
138
  readonly id: Schema.String;
130
139
  readonly type: Schema.tag<"function">;
131
140
  readonly function: Schema.Struct<{
@@ -137,7 +146,14 @@ export declare const OpenAIChatMessage: Schema.toTaggedUnion<"role", readonly [S
137
146
  readonly thought_signature: Schema.String;
138
147
  }>;
139
148
  }>>;
140
- }>>>;
149
+ }>, Schema.Struct<{
150
+ readonly id: Schema.String;
151
+ readonly type: Schema.tag<"custom">;
152
+ readonly custom: Schema.Struct<{
153
+ readonly name: Schema.String;
154
+ readonly input: Schema.String;
155
+ }>;
156
+ }>]>>>;
141
157
  readonly reasoning_content: Schema.optional<Schema.String>;
142
158
  readonly reasoning: Schema.optional<Schema.String>;
143
159
  readonly reasoning_text: Schema.optional<Schema.String>;
@@ -219,7 +235,7 @@ export declare const bodyFields: {
219
235
  readonly ttl: Schema.optional<Schema.String>;
220
236
  }>>;
221
237
  }>>]>>;
222
- readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
238
+ readonly tool_calls: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
223
239
  readonly id: Schema.String;
224
240
  readonly type: Schema.tag<"function">;
225
241
  readonly function: Schema.Struct<{
@@ -231,7 +247,14 @@ export declare const bodyFields: {
231
247
  readonly thought_signature: Schema.String;
232
248
  }>;
233
249
  }>>;
234
- }>>>;
250
+ }>, Schema.Struct<{
251
+ readonly id: Schema.String;
252
+ readonly type: Schema.tag<"custom">;
253
+ readonly custom: Schema.Struct<{
254
+ readonly name: Schema.String;
255
+ readonly input: Schema.String;
256
+ }>;
257
+ }>]>>>;
235
258
  readonly reasoning_content: Schema.optional<Schema.String>;
236
259
  readonly reasoning: Schema.optional<Schema.String>;
237
260
  readonly reasoning_text: Schema.optional<Schema.String>;
@@ -248,7 +271,7 @@ export declare const bodyFields: {
248
271
  }>>;
249
272
  }>>]>;
250
273
  }>]>>;
251
- tools: Schema.optional<Schema.$Array<Schema.Struct<{
274
+ tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
252
275
  readonly type: Schema.tag<"function">;
253
276
  readonly function: Schema.Struct<{
254
277
  readonly name: Schema.String;
@@ -260,12 +283,36 @@ export declare const bodyFields: {
260
283
  readonly type: Schema.Literal<"ephemeral">;
261
284
  readonly ttl: Schema.optional<Schema.String>;
262
285
  }>>;
263
- }>>>;
286
+ }>, Schema.Struct<{
287
+ readonly type: Schema.tag<"custom">;
288
+ readonly custom: Schema.Struct<{
289
+ readonly name: Schema.String;
290
+ readonly description: Schema.String;
291
+ readonly format: Schema.Union<readonly [Schema.Struct<{
292
+ readonly type: Schema.tag<"text">;
293
+ }>, Schema.Struct<{
294
+ readonly type: Schema.tag<"grammar">;
295
+ readonly grammar: Schema.Struct<{
296
+ readonly syntax: Schema.Literals<readonly ["lark", "regex"]>;
297
+ readonly definition: Schema.String;
298
+ }>;
299
+ }>]>;
300
+ }>;
301
+ readonly cache_control: Schema.optional<Schema.Struct<{
302
+ readonly type: Schema.Literal<"ephemeral">;
303
+ readonly ttl: Schema.optional<Schema.String>;
304
+ }>>;
305
+ }>]>>>;
264
306
  tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
265
307
  readonly type: Schema.tag<"function">;
266
308
  readonly function: Schema.Struct<{
267
309
  readonly name: Schema.String;
268
310
  }>;
311
+ }>, Schema.Struct<{
312
+ readonly type: Schema.tag<"custom">;
313
+ readonly custom: Schema.Struct<{
314
+ readonly name: Schema.String;
315
+ }>;
269
316
  }>]>>;
270
317
  stream: Schema.Literal<true>;
271
318
  stream_options: Schema.optional<Schema.Struct<{
@@ -357,7 +404,7 @@ declare const OpenAIChatBody: Schema.Struct<{
357
404
  readonly ttl: Schema.optional<Schema.String>;
358
405
  }>>;
359
406
  }>>]>>;
360
- readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
407
+ readonly tool_calls: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
361
408
  readonly id: Schema.String;
362
409
  readonly type: Schema.tag<"function">;
363
410
  readonly function: Schema.Struct<{
@@ -369,7 +416,14 @@ declare const OpenAIChatBody: Schema.Struct<{
369
416
  readonly thought_signature: Schema.String;
370
417
  }>;
371
418
  }>>;
372
- }>>>;
419
+ }>, Schema.Struct<{
420
+ readonly id: Schema.String;
421
+ readonly type: Schema.tag<"custom">;
422
+ readonly custom: Schema.Struct<{
423
+ readonly name: Schema.String;
424
+ readonly input: Schema.String;
425
+ }>;
426
+ }>]>>>;
373
427
  readonly reasoning_content: Schema.optional<Schema.String>;
374
428
  readonly reasoning: Schema.optional<Schema.String>;
375
429
  readonly reasoning_text: Schema.optional<Schema.String>;
@@ -386,7 +440,7 @@ declare const OpenAIChatBody: Schema.Struct<{
386
440
  }>>;
387
441
  }>>]>;
388
442
  }>]>>;
389
- tools: Schema.optional<Schema.$Array<Schema.Struct<{
443
+ tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
390
444
  readonly type: Schema.tag<"function">;
391
445
  readonly function: Schema.Struct<{
392
446
  readonly name: Schema.String;
@@ -398,12 +452,36 @@ declare const OpenAIChatBody: Schema.Struct<{
398
452
  readonly type: Schema.Literal<"ephemeral">;
399
453
  readonly ttl: Schema.optional<Schema.String>;
400
454
  }>>;
401
- }>>>;
455
+ }>, Schema.Struct<{
456
+ readonly type: Schema.tag<"custom">;
457
+ readonly custom: Schema.Struct<{
458
+ readonly name: Schema.String;
459
+ readonly description: Schema.String;
460
+ readonly format: Schema.Union<readonly [Schema.Struct<{
461
+ readonly type: Schema.tag<"text">;
462
+ }>, Schema.Struct<{
463
+ readonly type: Schema.tag<"grammar">;
464
+ readonly grammar: Schema.Struct<{
465
+ readonly syntax: Schema.Literals<readonly ["lark", "regex"]>;
466
+ readonly definition: Schema.String;
467
+ }>;
468
+ }>]>;
469
+ }>;
470
+ readonly cache_control: Schema.optional<Schema.Struct<{
471
+ readonly type: Schema.Literal<"ephemeral">;
472
+ readonly ttl: Schema.optional<Schema.String>;
473
+ }>>;
474
+ }>]>>>;
402
475
  tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
403
476
  readonly type: Schema.tag<"function">;
404
477
  readonly function: Schema.Struct<{
405
478
  readonly name: Schema.String;
406
479
  }>;
480
+ }>, Schema.Struct<{
481
+ readonly type: Schema.tag<"custom">;
482
+ readonly custom: Schema.Struct<{
483
+ readonly name: Schema.String;
484
+ }>;
407
485
  }>]>>;
408
486
  stream: Schema.Literal<true>;
409
487
  stream_options: Schema.optional<Schema.Struct<{
@@ -457,6 +535,10 @@ export declare const OpenAIChatToolCallDelta: Schema.Struct<{
457
535
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
458
536
  readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
459
537
  }>>>;
538
+ readonly custom: Schema.optional<Schema.NullOr<Schema.Struct<{
539
+ readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
540
+ readonly input: Schema.optional<Schema.NullOr<Schema.String>>;
541
+ }>>>;
460
542
  readonly extra_content: Schema.optional<Schema.NullOr<Schema.Unknown>>;
461
543
  }>;
462
544
  export declare const OpenAIChatDelta: Schema.StructWithRest<Schema.Struct<{
@@ -473,6 +555,10 @@ export declare const OpenAIChatDelta: Schema.StructWithRest<Schema.Struct<{
473
555
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
474
556
  readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
475
557
  }>>>;
558
+ readonly custom: Schema.optional<Schema.NullOr<Schema.Struct<{
559
+ readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
560
+ readonly input: Schema.optional<Schema.NullOr<Schema.String>>;
561
+ }>>>;
476
562
  readonly extra_content: Schema.optional<Schema.NullOr<Schema.Unknown>>;
477
563
  }>>>>;
478
564
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
@@ -491,6 +577,10 @@ export declare const OpenAIChatChoice: Schema.StructWithRest<Schema.Struct<{
491
577
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
492
578
  readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
493
579
  }>>>;
580
+ readonly custom: Schema.optional<Schema.NullOr<Schema.Struct<{
581
+ readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
582
+ readonly input: Schema.optional<Schema.NullOr<Schema.String>>;
583
+ }>>>;
494
584
  readonly extra_content: Schema.optional<Schema.NullOr<Schema.Unknown>>;
495
585
  }>>>>;
496
586
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
@@ -531,6 +621,10 @@ export declare const OpenAIChatEvent: Schema.StructWithRest<Schema.Struct<{
531
621
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
532
622
  readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
533
623
  }>>>;
624
+ readonly custom: Schema.optional<Schema.NullOr<Schema.Struct<{
625
+ readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
626
+ readonly input: Schema.optional<Schema.NullOr<Schema.String>>;
627
+ }>>>;
534
628
  readonly extra_content: Schema.optional<Schema.NullOr<Schema.Unknown>>;
535
629
  }>>>>;
536
630
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
@@ -588,6 +682,9 @@ interface PendingToolDelta {
588
682
  export interface ParserState {
589
683
  readonly providerMetadataKey: string;
590
684
  readonly tools: ToolStream.State<number>;
685
+ readonly custom: ReadonlyMap<string, OpenAIFreeform.Custom>;
686
+ /** Stream indexes of custom tool calls, whose JSON fragment closes when the call finishes. */
687
+ readonly customCalls: ReadonlySet<number>;
591
688
  readonly pendingTools: Partial<Record<number, PendingToolDelta>>;
592
689
  readonly toolCallEvents: ReadonlyArray<LLMEvent>;
593
690
  readonly usage?: Usage;
@@ -699,7 +796,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
699
796
  readonly ttl?: string | undefined;
700
797
  } | undefined;
701
798
  }[] | null;
702
- readonly tool_calls?: readonly {
799
+ readonly tool_calls?: readonly ({
800
+ readonly id: string;
801
+ readonly type: "custom";
802
+ readonly custom: {
803
+ readonly name: string;
804
+ readonly input: string;
805
+ };
806
+ } | {
703
807
  readonly id: string;
704
808
  readonly type: "function";
705
809
  readonly function: {
@@ -711,13 +815,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
711
815
  readonly thought_signature: string;
712
816
  };
713
817
  } | undefined;
714
- }[] | undefined;
818
+ })[] | undefined;
715
819
  readonly reasoning_content?: string | undefined;
716
820
  readonly reasoning?: string | undefined;
717
821
  readonly reasoning_text?: string | undefined;
718
822
  readonly reasoning_details?: unknown;
719
823
  })[];
720
- tools: {
824
+ tools: ({
721
825
  readonly type: "function";
722
826
  readonly function: {
723
827
  readonly name: string;
@@ -731,8 +835,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
731
835
  readonly type: "ephemeral";
732
836
  readonly ttl?: string | undefined;
733
837
  } | undefined;
734
- }[] | undefined;
838
+ } | {
839
+ readonly type: "custom";
840
+ readonly custom: {
841
+ readonly name: string;
842
+ readonly description: string;
843
+ readonly format: {
844
+ readonly type: "text";
845
+ } | {
846
+ readonly type: "grammar";
847
+ readonly grammar: {
848
+ readonly syntax: "lark" | "regex";
849
+ readonly definition: string;
850
+ };
851
+ };
852
+ };
853
+ readonly cache_control?: {
854
+ readonly type: "ephemeral";
855
+ readonly ttl?: string | undefined;
856
+ } | undefined;
857
+ })[] | undefined;
735
858
  tool_choice: "auto" | "none" | "required" | {
859
+ type: "custom";
860
+ custom: {
861
+ name: string;
862
+ };
863
+ function?: undefined;
864
+ } | {
865
+ custom?: undefined;
736
866
  type: "function";
737
867
  function: {
738
868
  name: string;
@@ -838,7 +968,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
838
968
  readonly ttl?: string | undefined;
839
969
  } | undefined;
840
970
  }[] | null;
841
- readonly tool_calls?: readonly {
971
+ readonly tool_calls?: readonly ({
972
+ readonly id: string;
973
+ readonly type: "custom";
974
+ readonly custom: {
975
+ readonly name: string;
976
+ readonly input: string;
977
+ };
978
+ } | {
842
979
  readonly id: string;
843
980
  readonly type: "function";
844
981
  readonly function: {
@@ -850,13 +987,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
850
987
  readonly thought_signature: string;
851
988
  };
852
989
  } | undefined;
853
- }[] | undefined;
990
+ })[] | undefined;
854
991
  readonly reasoning_content?: string | undefined;
855
992
  readonly reasoning?: string | undefined;
856
993
  readonly reasoning_text?: string | undefined;
857
994
  readonly reasoning_details?: unknown;
858
995
  })[];
859
- tools: {
996
+ tools: ({
860
997
  readonly type: "function";
861
998
  readonly function: {
862
999
  readonly name: string;
@@ -870,8 +1007,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
870
1007
  readonly type: "ephemeral";
871
1008
  readonly ttl?: string | undefined;
872
1009
  } | undefined;
873
- }[] | undefined;
1010
+ } | {
1011
+ readonly type: "custom";
1012
+ readonly custom: {
1013
+ readonly name: string;
1014
+ readonly description: string;
1015
+ readonly format: {
1016
+ readonly type: "text";
1017
+ } | {
1018
+ readonly type: "grammar";
1019
+ readonly grammar: {
1020
+ readonly syntax: "lark" | "regex";
1021
+ readonly definition: string;
1022
+ };
1023
+ };
1024
+ };
1025
+ readonly cache_control?: {
1026
+ readonly type: "ephemeral";
1027
+ readonly ttl?: string | undefined;
1028
+ } | undefined;
1029
+ })[] | undefined;
874
1030
  tool_choice: "auto" | "none" | "required" | {
1031
+ type: "custom";
1032
+ custom: {
1033
+ name: string;
1034
+ };
1035
+ function?: undefined;
1036
+ } | {
1037
+ custom?: undefined;
875
1038
  type: "function";
876
1039
  function: {
877
1040
  name: string;
@@ -979,7 +1142,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
979
1142
  readonly ttl?: string | undefined;
980
1143
  } | undefined;
981
1144
  }[] | null;
982
- readonly tool_calls?: readonly {
1145
+ readonly tool_calls?: readonly ({
1146
+ readonly id: string;
1147
+ readonly type: "custom";
1148
+ readonly custom: {
1149
+ readonly name: string;
1150
+ readonly input: string;
1151
+ };
1152
+ } | {
983
1153
  readonly id: string;
984
1154
  readonly type: "function";
985
1155
  readonly function: {
@@ -991,13 +1161,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
991
1161
  readonly thought_signature: string;
992
1162
  };
993
1163
  } | undefined;
994
- }[] | undefined;
1164
+ })[] | undefined;
995
1165
  readonly reasoning_content?: string | undefined;
996
1166
  readonly reasoning?: string | undefined;
997
1167
  readonly reasoning_text?: string | undefined;
998
1168
  readonly reasoning_details?: unknown;
999
1169
  })[];
1000
- tools: {
1170
+ tools: ({
1001
1171
  readonly type: "function";
1002
1172
  readonly function: {
1003
1173
  readonly name: string;
@@ -1011,8 +1181,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1011
1181
  readonly type: "ephemeral";
1012
1182
  readonly ttl?: string | undefined;
1013
1183
  } | undefined;
1014
- }[] | undefined;
1184
+ } | {
1185
+ readonly type: "custom";
1186
+ readonly custom: {
1187
+ readonly name: string;
1188
+ readonly description: string;
1189
+ readonly format: {
1190
+ readonly type: "text";
1191
+ } | {
1192
+ readonly type: "grammar";
1193
+ readonly grammar: {
1194
+ readonly syntax: "lark" | "regex";
1195
+ readonly definition: string;
1196
+ };
1197
+ };
1198
+ };
1199
+ readonly cache_control?: {
1200
+ readonly type: "ephemeral";
1201
+ readonly ttl?: string | undefined;
1202
+ } | undefined;
1203
+ })[] | undefined;
1015
1204
  tool_choice: "auto" | "none" | "required" | {
1205
+ type: "custom";
1206
+ custom: {
1207
+ name: string;
1208
+ };
1209
+ function?: undefined;
1210
+ } | {
1211
+ custom?: undefined;
1016
1212
  type: "function";
1017
1213
  function: {
1018
1214
  name: string;
@@ -1118,7 +1314,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1118
1314
  readonly ttl?: string | undefined;
1119
1315
  } | undefined;
1120
1316
  }[] | null;
1121
- readonly tool_calls?: readonly {
1317
+ readonly tool_calls?: readonly ({
1318
+ readonly id: string;
1319
+ readonly type: "custom";
1320
+ readonly custom: {
1321
+ readonly name: string;
1322
+ readonly input: string;
1323
+ };
1324
+ } | {
1122
1325
  readonly id: string;
1123
1326
  readonly type: "function";
1124
1327
  readonly function: {
@@ -1130,13 +1333,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1130
1333
  readonly thought_signature: string;
1131
1334
  };
1132
1335
  } | undefined;
1133
- }[] | undefined;
1336
+ })[] | undefined;
1134
1337
  readonly reasoning_content?: string | undefined;
1135
1338
  readonly reasoning?: string | undefined;
1136
1339
  readonly reasoning_text?: string | undefined;
1137
1340
  readonly reasoning_details?: unknown;
1138
1341
  })[];
1139
- tools: {
1342
+ tools: ({
1140
1343
  readonly type: "function";
1141
1344
  readonly function: {
1142
1345
  readonly name: string;
@@ -1150,8 +1353,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1150
1353
  readonly type: "ephemeral";
1151
1354
  readonly ttl?: string | undefined;
1152
1355
  } | undefined;
1153
- }[] | undefined;
1356
+ } | {
1357
+ readonly type: "custom";
1358
+ readonly custom: {
1359
+ readonly name: string;
1360
+ readonly description: string;
1361
+ readonly format: {
1362
+ readonly type: "text";
1363
+ } | {
1364
+ readonly type: "grammar";
1365
+ readonly grammar: {
1366
+ readonly syntax: "lark" | "regex";
1367
+ readonly definition: string;
1368
+ };
1369
+ };
1370
+ };
1371
+ readonly cache_control?: {
1372
+ readonly type: "ephemeral";
1373
+ readonly ttl?: string | undefined;
1374
+ } | undefined;
1375
+ })[] | undefined;
1154
1376
  tool_choice: "auto" | "none" | "required" | {
1377
+ type: "custom";
1378
+ custom: {
1379
+ name: string;
1380
+ };
1381
+ function?: undefined;
1382
+ } | {
1383
+ custom?: undefined;
1155
1384
  type: "function";
1156
1385
  function: {
1157
1386
  name: string;
@@ -1257,7 +1486,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1257
1486
  readonly ttl?: string | undefined;
1258
1487
  } | undefined;
1259
1488
  }[] | null;
1260
- readonly tool_calls?: readonly {
1489
+ readonly tool_calls?: readonly ({
1490
+ readonly id: string;
1491
+ readonly type: "custom";
1492
+ readonly custom: {
1493
+ readonly name: string;
1494
+ readonly input: string;
1495
+ };
1496
+ } | {
1261
1497
  readonly id: string;
1262
1498
  readonly type: "function";
1263
1499
  readonly function: {
@@ -1269,13 +1505,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1269
1505
  readonly thought_signature: string;
1270
1506
  };
1271
1507
  } | undefined;
1272
- }[] | undefined;
1508
+ })[] | undefined;
1273
1509
  readonly reasoning_content?: string | undefined;
1274
1510
  readonly reasoning?: string | undefined;
1275
1511
  readonly reasoning_text?: string | undefined;
1276
1512
  readonly reasoning_details?: unknown;
1277
1513
  })[];
1278
- tools: {
1514
+ tools: ({
1279
1515
  readonly type: "function";
1280
1516
  readonly function: {
1281
1517
  readonly name: string;
@@ -1289,8 +1525,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1289
1525
  readonly type: "ephemeral";
1290
1526
  readonly ttl?: string | undefined;
1291
1527
  } | undefined;
1292
- }[] | undefined;
1528
+ } | {
1529
+ readonly type: "custom";
1530
+ readonly custom: {
1531
+ readonly name: string;
1532
+ readonly description: string;
1533
+ readonly format: {
1534
+ readonly type: "text";
1535
+ } | {
1536
+ readonly type: "grammar";
1537
+ readonly grammar: {
1538
+ readonly syntax: "lark" | "regex";
1539
+ readonly definition: string;
1540
+ };
1541
+ };
1542
+ };
1543
+ readonly cache_control?: {
1544
+ readonly type: "ephemeral";
1545
+ readonly ttl?: string | undefined;
1546
+ } | undefined;
1547
+ })[] | undefined;
1293
1548
  tool_choice: "auto" | "none" | "required" | {
1549
+ type: "custom";
1550
+ custom: {
1551
+ name: string;
1552
+ };
1553
+ function?: undefined;
1554
+ } | {
1555
+ custom?: undefined;
1294
1556
  type: "function";
1295
1557
  function: {
1296
1558
  name: string;
@@ -1398,7 +1660,14 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1398
1660
  readonly ttl?: string | undefined;
1399
1661
  } | undefined;
1400
1662
  }[] | null;
1401
- readonly tool_calls?: readonly {
1663
+ readonly tool_calls?: readonly ({
1664
+ readonly id: string;
1665
+ readonly type: "custom";
1666
+ readonly custom: {
1667
+ readonly name: string;
1668
+ readonly input: string;
1669
+ };
1670
+ } | {
1402
1671
  readonly id: string;
1403
1672
  readonly type: "function";
1404
1673
  readonly function: {
@@ -1410,13 +1679,13 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1410
1679
  readonly thought_signature: string;
1411
1680
  };
1412
1681
  } | undefined;
1413
- }[] | undefined;
1682
+ })[] | undefined;
1414
1683
  readonly reasoning_content?: string | undefined;
1415
1684
  readonly reasoning?: string | undefined;
1416
1685
  readonly reasoning_text?: string | undefined;
1417
1686
  readonly reasoning_details?: unknown;
1418
1687
  })[];
1419
- tools: {
1688
+ tools: ({
1420
1689
  readonly type: "function";
1421
1690
  readonly function: {
1422
1691
  readonly name: string;
@@ -1430,8 +1699,34 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
1430
1699
  readonly type: "ephemeral";
1431
1700
  readonly ttl?: string | undefined;
1432
1701
  } | undefined;
1433
- }[] | undefined;
1702
+ } | {
1703
+ readonly type: "custom";
1704
+ readonly custom: {
1705
+ readonly name: string;
1706
+ readonly description: string;
1707
+ readonly format: {
1708
+ readonly type: "text";
1709
+ } | {
1710
+ readonly type: "grammar";
1711
+ readonly grammar: {
1712
+ readonly syntax: "lark" | "regex";
1713
+ readonly definition: string;
1714
+ };
1715
+ };
1716
+ };
1717
+ readonly cache_control?: {
1718
+ readonly type: "ephemeral";
1719
+ readonly ttl?: string | undefined;
1720
+ } | undefined;
1721
+ })[] | undefined;
1434
1722
  tool_choice: "auto" | "none" | "required" | {
1723
+ type: "custom";
1724
+ custom: {
1725
+ name: string;
1726
+ };
1727
+ function?: undefined;
1728
+ } | {
1729
+ custom?: undefined;
1435
1730
  type: "function";
1436
1731
  function: {
1437
1732
  name: string;
@@ -1751,7 +2046,14 @@ export declare const protocol: Protocol<{
1751
2046
  readonly ttl?: string | undefined;
1752
2047
  } | undefined;
1753
2048
  }[] | null;
1754
- readonly tool_calls?: readonly {
2049
+ readonly tool_calls?: readonly ({
2050
+ readonly id: string;
2051
+ readonly type: "custom";
2052
+ readonly custom: {
2053
+ readonly name: string;
2054
+ readonly input: string;
2055
+ };
2056
+ } | {
1755
2057
  readonly id: string;
1756
2058
  readonly type: "function";
1757
2059
  readonly function: {
@@ -1763,13 +2065,13 @@ export declare const protocol: Protocol<{
1763
2065
  readonly thought_signature: string;
1764
2066
  };
1765
2067
  } | undefined;
1766
- }[] | undefined;
2068
+ })[] | undefined;
1767
2069
  readonly reasoning_content?: string | undefined;
1768
2070
  readonly reasoning?: string | undefined;
1769
2071
  readonly reasoning_text?: string | undefined;
1770
2072
  readonly reasoning_details?: unknown;
1771
2073
  })[];
1772
- readonly tools?: readonly {
2074
+ readonly tools?: readonly ({
1773
2075
  readonly type: "function";
1774
2076
  readonly function: {
1775
2077
  readonly name: string;
@@ -1783,12 +2085,36 @@ export declare const protocol: Protocol<{
1783
2085
  readonly type: "ephemeral";
1784
2086
  readonly ttl?: string | undefined;
1785
2087
  } | undefined;
1786
- }[] | undefined;
2088
+ } | {
2089
+ readonly type: "custom";
2090
+ readonly custom: {
2091
+ readonly name: string;
2092
+ readonly description: string;
2093
+ readonly format: {
2094
+ readonly type: "text";
2095
+ } | {
2096
+ readonly type: "grammar";
2097
+ readonly grammar: {
2098
+ readonly syntax: "lark" | "regex";
2099
+ readonly definition: string;
2100
+ };
2101
+ };
2102
+ };
2103
+ readonly cache_control?: {
2104
+ readonly type: "ephemeral";
2105
+ readonly ttl?: string | undefined;
2106
+ } | undefined;
2107
+ })[] | undefined;
1787
2108
  readonly tool_choice?: "auto" | "none" | "required" | {
1788
2109
  readonly type: "function";
1789
2110
  readonly function: {
1790
2111
  readonly name: string;
1791
2112
  };
2113
+ } | {
2114
+ readonly type: "custom";
2115
+ readonly custom: {
2116
+ readonly name: string;
2117
+ };
1792
2118
  } | undefined;
1793
2119
  readonly stream: true;
1794
2120
  readonly stream_options?: {
@@ -1836,6 +2162,10 @@ export declare const protocol: Protocol<{
1836
2162
  readonly name?: string | null | undefined;
1837
2163
  readonly arguments?: string | null | undefined;
1838
2164
  } | null | undefined;
2165
+ readonly custom?: {
2166
+ readonly name?: string | null | undefined;
2167
+ readonly input?: string | null | undefined;
2168
+ } | null | undefined;
1839
2169
  readonly extra_content?: unknown;
1840
2170
  }[] | null | undefined;
1841
2171
  } | null | undefined;
@@ -1967,7 +2297,14 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1967
2297
  readonly ttl?: string | undefined;
1968
2298
  } | undefined;
1969
2299
  }[] | null;
1970
- readonly tool_calls?: readonly {
2300
+ readonly tool_calls?: readonly ({
2301
+ readonly id: string;
2302
+ readonly type: "custom";
2303
+ readonly custom: {
2304
+ readonly name: string;
2305
+ readonly input: string;
2306
+ };
2307
+ } | {
1971
2308
  readonly id: string;
1972
2309
  readonly type: "function";
1973
2310
  readonly function: {
@@ -1979,13 +2316,13 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1979
2316
  readonly thought_signature: string;
1980
2317
  };
1981
2318
  } | undefined;
1982
- }[] | undefined;
2319
+ })[] | undefined;
1983
2320
  readonly reasoning_content?: string | undefined;
1984
2321
  readonly reasoning?: string | undefined;
1985
2322
  readonly reasoning_text?: string | undefined;
1986
2323
  readonly reasoning_details?: unknown;
1987
2324
  })[];
1988
- readonly tools?: readonly {
2325
+ readonly tools?: readonly ({
1989
2326
  readonly type: "function";
1990
2327
  readonly function: {
1991
2328
  readonly name: string;
@@ -1999,12 +2336,36 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1999
2336
  readonly type: "ephemeral";
2000
2337
  readonly ttl?: string | undefined;
2001
2338
  } | undefined;
2002
- }[] | undefined;
2339
+ } | {
2340
+ readonly type: "custom";
2341
+ readonly custom: {
2342
+ readonly name: string;
2343
+ readonly description: string;
2344
+ readonly format: {
2345
+ readonly type: "text";
2346
+ } | {
2347
+ readonly type: "grammar";
2348
+ readonly grammar: {
2349
+ readonly syntax: "lark" | "regex";
2350
+ readonly definition: string;
2351
+ };
2352
+ };
2353
+ };
2354
+ readonly cache_control?: {
2355
+ readonly type: "ephemeral";
2356
+ readonly ttl?: string | undefined;
2357
+ } | undefined;
2358
+ })[] | undefined;
2003
2359
  readonly tool_choice?: "auto" | "none" | "required" | {
2004
2360
  readonly type: "function";
2005
2361
  readonly function: {
2006
2362
  readonly name: string;
2007
2363
  };
2364
+ } | {
2365
+ readonly type: "custom";
2366
+ readonly custom: {
2367
+ readonly name: string;
2368
+ };
2008
2369
  } | undefined;
2009
2370
  readonly stream: true;
2010
2371
  readonly stream_options?: {
@@ -2110,7 +2471,14 @@ export declare const route: Route<{
2110
2471
  readonly ttl?: string | undefined;
2111
2472
  } | undefined;
2112
2473
  }[] | null;
2113
- readonly tool_calls?: readonly {
2474
+ readonly tool_calls?: readonly ({
2475
+ readonly id: string;
2476
+ readonly type: "custom";
2477
+ readonly custom: {
2478
+ readonly name: string;
2479
+ readonly input: string;
2480
+ };
2481
+ } | {
2114
2482
  readonly id: string;
2115
2483
  readonly type: "function";
2116
2484
  readonly function: {
@@ -2122,13 +2490,13 @@ export declare const route: Route<{
2122
2490
  readonly thought_signature: string;
2123
2491
  };
2124
2492
  } | undefined;
2125
- }[] | undefined;
2493
+ })[] | undefined;
2126
2494
  readonly reasoning_content?: string | undefined;
2127
2495
  readonly reasoning?: string | undefined;
2128
2496
  readonly reasoning_text?: string | undefined;
2129
2497
  readonly reasoning_details?: unknown;
2130
2498
  })[];
2131
- readonly tools?: readonly {
2499
+ readonly tools?: readonly ({
2132
2500
  readonly type: "function";
2133
2501
  readonly function: {
2134
2502
  readonly name: string;
@@ -2142,12 +2510,36 @@ export declare const route: Route<{
2142
2510
  readonly type: "ephemeral";
2143
2511
  readonly ttl?: string | undefined;
2144
2512
  } | undefined;
2145
- }[] | undefined;
2513
+ } | {
2514
+ readonly type: "custom";
2515
+ readonly custom: {
2516
+ readonly name: string;
2517
+ readonly description: string;
2518
+ readonly format: {
2519
+ readonly type: "text";
2520
+ } | {
2521
+ readonly type: "grammar";
2522
+ readonly grammar: {
2523
+ readonly syntax: "lark" | "regex";
2524
+ readonly definition: string;
2525
+ };
2526
+ };
2527
+ };
2528
+ readonly cache_control?: {
2529
+ readonly type: "ephemeral";
2530
+ readonly ttl?: string | undefined;
2531
+ } | undefined;
2532
+ })[] | undefined;
2146
2533
  readonly tool_choice?: "auto" | "none" | "required" | {
2147
2534
  readonly type: "function";
2148
2535
  readonly function: {
2149
2536
  readonly name: string;
2150
2537
  };
2538
+ } | {
2539
+ readonly type: "custom";
2540
+ readonly custom: {
2541
+ readonly name: string;
2542
+ };
2151
2543
  } | undefined;
2152
2544
  readonly stream: true;
2153
2545
  readonly stream_options?: {