@opencode/ai 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) 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/index.d.ts +38 -20
  6. package/dist/index.js +14 -2
  7. package/dist/media-client.d.ts +1 -0
  8. package/dist/media-client.js +1 -0
  9. package/dist/protocols/alibaba-chat.d.ts +39 -4
  10. package/dist/protocols/alibaba-responses.d.ts +20 -3
  11. package/dist/protocols/google-images.js +3 -1
  12. package/dist/protocols/meta-responses.d.ts +40 -6
  13. package/dist/protocols/meta-responses.js +1 -1
  14. package/dist/protocols/minimax-images.d.ts +25 -0
  15. package/dist/protocols/minimax-images.js +150 -0
  16. package/dist/protocols/open-responses.d.ts +182 -27
  17. package/dist/protocols/open-responses.js +108 -36
  18. package/dist/protocols/openai-chat.d.ts +438 -46
  19. package/dist/protocols/openai-chat.js +121 -39
  20. package/dist/protocols/openai-compatible-chat.d.ts +35 -4
  21. package/dist/protocols/openai-compatible-responses.d.ts +20 -3
  22. package/dist/protocols/openai-freeform.d.ts +47 -0
  23. package/dist/protocols/openai-freeform.js +54 -0
  24. package/dist/protocols/openai-images.d.ts +16 -1
  25. package/dist/protocols/openai-images.js +49 -17
  26. package/dist/protocols/openai-responses.d.ts +120 -18
  27. package/dist/protocols/openai-responses.js +17 -8
  28. package/dist/protocols/venice-chat.d.ts +39 -4
  29. package/dist/protocols/venice-chat.js +1 -1
  30. package/dist/protocols/xai-images.d.ts +6 -0
  31. package/dist/protocols/xai-images.js +4 -5
  32. package/dist/protocols/xai-responses.d.ts +20 -3
  33. package/dist/protocols/xai-responses.js +2 -1
  34. package/dist/protocols/zai-chat.d.ts +39 -4
  35. package/dist/provider-error.js +5 -4
  36. package/dist/provider-package.d.ts +2 -0
  37. package/dist/providers/alibaba.d.ts +58 -10
  38. package/dist/providers/amazon-bedrock-mantle.d.ts +66 -11
  39. package/dist/providers/amazon-bedrock-mantle.js +1 -1
  40. package/dist/providers/amazon-bedrock.d.ts +1 -1
  41. package/dist/providers/amazon-bedrock.js +1 -1
  42. package/dist/providers/anthropic-compatible.d.ts +1 -1
  43. package/dist/providers/anthropic.d.ts +1 -1
  44. package/dist/providers/anthropic.js +1 -1
  45. package/dist/providers/azure.d.ts +79 -15
  46. package/dist/providers/baseten.d.ts +74 -12
  47. package/dist/providers/baseten.js +1 -1
  48. package/dist/providers/cerebras.d.ts +73 -11
  49. package/dist/providers/cerebras.js +1 -1
  50. package/dist/providers/cloudflare-ai-gateway.d.ts +113 -17
  51. package/dist/providers/cloudflare-workers-ai.d.ts +73 -11
  52. package/dist/providers/cohere/chat.d.ts +1 -1
  53. package/dist/providers/cohere/chat.js +1 -1
  54. package/dist/providers/cohere.d.ts +73 -11
  55. package/dist/providers/cohere.js +1 -1
  56. package/dist/providers/deepinfra.d.ts +73 -11
  57. package/dist/providers/deepinfra.js +1 -1
  58. package/dist/providers/deepseek.d.ts +73 -11
  59. package/dist/providers/deepseek.js +1 -1
  60. package/dist/providers/digitalocean/responses.d.ts +4 -0
  61. package/dist/providers/digitalocean/responses.js +1 -0
  62. package/dist/providers/digitalocean.d.ts +320 -21
  63. package/dist/providers/digitalocean.js +18 -7
  64. package/dist/providers/fireworks.d.ts +73 -11
  65. package/dist/providers/fireworks.js +1 -1
  66. package/dist/providers/google/interactions.d.ts +1 -1
  67. package/dist/providers/google/interactions.js +1 -1
  68. package/dist/providers/google-vertex-chat.d.ts +36 -5
  69. package/dist/providers/google-vertex-chat.js +1 -1
  70. package/dist/providers/google-vertex-interactions.d.ts +1 -1
  71. package/dist/providers/google-vertex-interactions.js +1 -1
  72. package/dist/providers/google-vertex-messages.d.ts +1 -1
  73. package/dist/providers/google-vertex-messages.js +1 -1
  74. package/dist/providers/google-vertex-mistral.d.ts +1 -1
  75. package/dist/providers/google-vertex-mistral.js +1 -1
  76. package/dist/providers/google-vertex-responses.d.ts +21 -4
  77. package/dist/providers/google-vertex-responses.js +1 -1
  78. package/dist/providers/google-vertex.d.ts +2 -2
  79. package/dist/providers/google-vertex.js +1 -1
  80. package/dist/providers/google.d.ts +2 -2
  81. package/dist/providers/google.js +1 -1
  82. package/dist/providers/groq.d.ts +77 -11
  83. package/dist/providers/groq.js +1 -1
  84. package/dist/providers/index.d.ts +0 -4
  85. package/dist/providers/index.js +0 -4
  86. package/dist/providers/meta/images.d.ts +2 -0
  87. package/dist/providers/meta/images.js +1 -0
  88. package/dist/providers/meta.d.ts +61 -12
  89. package/dist/providers/meta.js +2 -1
  90. package/dist/providers/minimax/chat.d.ts +1 -1
  91. package/dist/providers/minimax/chat.js +1 -1
  92. package/dist/providers/minimax/images.d.ts +3 -0
  93. package/dist/providers/minimax/images.js +1 -0
  94. package/dist/providers/minimax/responses.d.ts +1 -1
  95. package/dist/providers/minimax/responses.js +1 -1
  96. package/dist/providers/minimax.d.ts +63 -9
  97. package/dist/providers/minimax.js +22 -9
  98. package/dist/providers/mistral.d.ts +3 -3
  99. package/dist/providers/mistral.js +1 -1
  100. package/dist/providers/moonshot/messages.d.ts +1 -1
  101. package/dist/providers/moonshot/messages.js +1 -1
  102. package/dist/providers/moonshot/responses.d.ts +1 -1
  103. package/dist/providers/moonshot/responses.js +1 -1
  104. package/dist/providers/moonshot.d.ts +56 -8
  105. package/dist/providers/moonshot.js +1 -1
  106. package/dist/providers/openai-compatible-responses.d.ts +21 -4
  107. package/dist/providers/openai-compatible.d.ts +38 -7
  108. package/dist/providers/openai-compatible.js +9 -2
  109. package/dist/providers/openai.d.ts +59 -11
  110. package/dist/providers/openai.js +4 -2
  111. package/dist/providers/opencode.d.ts +3 -3
  112. package/dist/providers/opencode.js +1 -1
  113. package/dist/providers/openrouter/responses.d.ts +4 -0
  114. package/dist/providers/openrouter/responses.js +1 -0
  115. package/dist/providers/openrouter.d.ts +356 -26
  116. package/dist/providers/openrouter.js +42 -13
  117. package/dist/providers/togetherai.d.ts +73 -11
  118. package/dist/providers/togetherai.js +1 -1
  119. package/dist/providers/typesafe-ai.d.ts +3 -3
  120. package/dist/providers/typesafe-ai.js +1 -1
  121. package/dist/providers/venice/responses.d.ts +4 -0
  122. package/dist/providers/venice/responses.js +1 -0
  123. package/dist/providers/venice.d.ts +242 -9
  124. package/dist/providers/venice.js +33 -17
  125. package/dist/providers/vercel-ai-gateway.d.ts +8 -8
  126. package/dist/providers/vercel-ai-gateway.js +12 -2
  127. package/dist/providers/xai.d.ts +39 -8
  128. package/dist/providers/xai.js +1 -1
  129. package/dist/providers/zai-coding-plan/messages.d.ts +1 -1
  130. package/dist/providers/zai-coding-plan/messages.js +1 -1
  131. package/dist/providers/zai-coding-plan/responses.d.ts +1 -1
  132. package/dist/providers/zai-coding-plan/responses.js +1 -1
  133. package/dist/providers/zai-coding-plan.d.ts +56 -8
  134. package/dist/providers/zai-coding-plan.js +1 -1
  135. package/dist/providers/zai.d.ts +37 -6
  136. package/dist/providers/zai.js +1 -1
  137. package/dist/route/auth.d.ts +1 -1
  138. package/dist/route/media-protocol.d.ts +2 -4
  139. package/dist/route/media.d.ts +1 -1
  140. package/dist/route/media.js +2 -4
  141. package/dist/schema/messages.d.ts +35 -1
  142. package/dist/schema/messages.js +20 -0
  143. package/dist/speech-client.d.ts +48 -0
  144. package/dist/testing/decision.d.ts +16 -0
  145. package/dist/testing/decision.js +20 -0
  146. package/dist/testing/image.d.ts +14 -0
  147. package/dist/testing/image.js +12 -0
  148. package/dist/testing/media.d.ts +18 -0
  149. package/dist/testing/media.js +36 -0
  150. package/dist/testing/script.d.ts +28 -0
  151. package/dist/testing/script.js +60 -0
  152. package/dist/testing/speech.d.ts +14 -0
  153. package/dist/testing/speech.js +12 -0
  154. package/dist/testing/transcription.d.ts +14 -0
  155. package/dist/testing/transcription.js +12 -0
  156. package/dist/testing/video.d.ts +14 -0
  157. package/dist/testing/video.js +12 -0
  158. package/dist/testing.d.ts +10 -21
  159. package/dist/testing.js +11 -54
  160. package/dist/tool.d.ts +12 -1
  161. package/dist/tool.js +10 -2
  162. package/dist/transcription-client.d.ts +64 -0
  163. package/dist/video-client.d.ts +41 -0
  164. package/package.json +22 -38
  165. package/dist/protocols/bfl-images.d.ts +0 -47
  166. package/dist/protocols/bfl-images.js +0 -155
  167. package/dist/protocols/fal-images.d.ts +0 -34
  168. package/dist/protocols/fal-images.js +0 -95
  169. package/dist/protocols/fal-video.d.ts +0 -29
  170. package/dist/protocols/fal-video.js +0 -73
  171. package/dist/protocols/replicate-images.d.ts +0 -28
  172. package/dist/protocols/replicate-images.js +0 -127
  173. package/dist/protocols/stability-images.d.ts +0 -44
  174. package/dist/protocols/stability-images.js +0 -131
  175. package/dist/protocols/utils/fal-queue.d.ts +0 -26
  176. package/dist/protocols/utils/fal-queue.js +0 -67
  177. package/dist/providers/black-forest-labs.d.ts +0 -21
  178. package/dist/providers/black-forest-labs.js +0 -23
  179. package/dist/providers/fal.d.ts +0 -24
  180. package/dist/providers/fal.js +0 -26
  181. package/dist/providers/replicate.d.ts +0 -21
  182. package/dist/providers/replicate.js +0 -17
  183. package/dist/providers/stability.d.ts +0 -23
  184. package/dist/providers/stability.js +0 -18
@@ -6,6 +6,7 @@ import type { Media } from "../media.js";
6
6
  import { OpenResponsesOptions } from "./utils/open-responses-options.js";
7
7
  import { Lifecycle } from "./utils/lifecycle.js";
8
8
  import { ToolStream } from "./utils/tool-stream.js";
9
+ import { OpenAIFreeform } from "./openai-freeform.js";
9
10
  export declare const PATH = "/responses";
10
11
  export declare const OpenResponsesInputText: Schema.Struct<{
11
12
  readonly type: Schema.tag<"input_text">;
@@ -169,7 +170,7 @@ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
169
170
  readonly namespace: Schema.optional<Schema.String>;
170
171
  readonly arguments: Schema.String;
171
172
  }>, Schema.Struct<{
172
- readonly type: Schema.tag<"function_call_output">;
173
+ readonly type: Schema.Literals<readonly ["function_call_output", "custom_tool_call_output"]>;
173
174
  readonly call_id: Schema.String;
174
175
  readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
175
176
  readonly type: Schema.tag<"input_text">;
@@ -188,6 +189,12 @@ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
188
189
  readonly type: Schema.tag<"input_video">;
189
190
  readonly video_url: Schema.String;
190
191
  }>]>>]>;
192
+ }>, Schema.Struct<{
193
+ readonly type: Schema.tag<"custom_tool_call">;
194
+ readonly id: Schema.optionalKey<Schema.String>;
195
+ readonly call_id: Schema.String;
196
+ readonly name: Schema.String;
197
+ readonly input: Schema.String;
191
198
  }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
192
199
  readonly type: Schema.tag<"web_search_call">;
193
200
  readonly id: Schema.String;
@@ -226,18 +233,30 @@ export declare const Tool: Schema.Struct<{
226
233
  readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
227
234
  readonly strict: Schema.optional<Schema.Boolean>;
228
235
  }>;
236
+ export declare const CustomTool: Schema.Struct<{
237
+ readonly type: Schema.tag<"custom">;
238
+ readonly name: Schema.String;
239
+ readonly description: Schema.String;
240
+ readonly format: Schema.Union<readonly [Schema.Struct<{
241
+ readonly type: Schema.tag<"text">;
242
+ }>, Schema.Struct<{
243
+ readonly type: Schema.tag<"grammar">;
244
+ readonly syntax: Schema.Literals<readonly ["lark", "regex"]>;
245
+ readonly definition: Schema.String;
246
+ }>]>;
247
+ }>;
229
248
  export declare const HostedTool: Schema.StructWithRest<Schema.Struct<{
230
249
  readonly type: Schema.String;
231
250
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
232
251
  export type HostedTool = Schema.Schema.Type<typeof HostedTool>;
233
252
  export declare const ToolChoice: Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
234
- readonly type: Schema.tag<"function">;
253
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
235
254
  readonly name: Schema.String;
236
255
  }>, Schema.Struct<{
237
256
  readonly type: Schema.tag<"allowed_tools">;
238
257
  readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
239
258
  readonly tools: Schema.$Array<Schema.Struct<{
240
- readonly type: Schema.tag<"function">;
259
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
241
260
  readonly name: Schema.String;
242
261
  }>>;
243
262
  }>]>;
@@ -308,7 +327,7 @@ export declare const coreFields: {
308
327
  readonly namespace: Schema.optional<Schema.String>;
309
328
  readonly arguments: Schema.String;
310
329
  }>, Schema.Struct<{
311
- readonly type: Schema.tag<"function_call_output">;
330
+ readonly type: Schema.Literals<readonly ["function_call_output", "custom_tool_call_output"]>;
312
331
  readonly call_id: Schema.String;
313
332
  readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
314
333
  readonly type: Schema.tag<"input_text">;
@@ -327,6 +346,12 @@ export declare const coreFields: {
327
346
  readonly type: Schema.tag<"input_video">;
328
347
  readonly video_url: Schema.String;
329
348
  }>]>>]>;
349
+ }>, Schema.Struct<{
350
+ readonly type: Schema.tag<"custom_tool_call">;
351
+ readonly id: Schema.optionalKey<Schema.String>;
352
+ readonly call_id: Schema.String;
353
+ readonly name: Schema.String;
354
+ readonly input: Schema.String;
330
355
  }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
331
356
  readonly type: Schema.tag<"web_search_call">;
332
357
  readonly id: Schema.String;
@@ -365,17 +390,28 @@ export declare const coreFields: {
365
390
  readonly description: Schema.String;
366
391
  readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
367
392
  readonly strict: Schema.optional<Schema.Boolean>;
393
+ }>, Schema.Struct<{
394
+ readonly type: Schema.tag<"custom">;
395
+ readonly name: Schema.String;
396
+ readonly description: Schema.String;
397
+ readonly format: Schema.Union<readonly [Schema.Struct<{
398
+ readonly type: Schema.tag<"text">;
399
+ }>, Schema.Struct<{
400
+ readonly type: Schema.tag<"grammar">;
401
+ readonly syntax: Schema.Literals<readonly ["lark", "regex"]>;
402
+ readonly definition: Schema.String;
403
+ }>]>;
368
404
  }>, Schema.StructWithRest<Schema.Struct<{
369
405
  readonly type: Schema.String;
370
406
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
371
407
  tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
372
- readonly type: Schema.tag<"function">;
408
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
373
409
  readonly name: Schema.String;
374
410
  }>, Schema.Struct<{
375
411
  readonly type: Schema.tag<"allowed_tools">;
376
412
  readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
377
413
  readonly tools: Schema.$Array<Schema.Struct<{
378
- readonly type: Schema.tag<"function">;
414
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
379
415
  readonly name: Schema.String;
380
416
  }>>;
381
417
  }>]>>;
@@ -472,7 +508,7 @@ export declare const OpenResponsesBody: Schema.Struct<{
472
508
  readonly namespace: Schema.optional<Schema.String>;
473
509
  readonly arguments: Schema.String;
474
510
  }>, Schema.Struct<{
475
- readonly type: Schema.tag<"function_call_output">;
511
+ readonly type: Schema.Literals<readonly ["function_call_output", "custom_tool_call_output"]>;
476
512
  readonly call_id: Schema.String;
477
513
  readonly output: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
478
514
  readonly type: Schema.tag<"input_text">;
@@ -491,6 +527,12 @@ export declare const OpenResponsesBody: Schema.Struct<{
491
527
  readonly type: Schema.tag<"input_video">;
492
528
  readonly video_url: Schema.String;
493
529
  }>]>>]>;
530
+ }>, Schema.Struct<{
531
+ readonly type: Schema.tag<"custom_tool_call">;
532
+ readonly id: Schema.optionalKey<Schema.String>;
533
+ readonly call_id: Schema.String;
534
+ readonly name: Schema.String;
535
+ readonly input: Schema.String;
494
536
  }>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
495
537
  readonly type: Schema.tag<"web_search_call">;
496
538
  readonly id: Schema.String;
@@ -529,17 +571,28 @@ export declare const OpenResponsesBody: Schema.Struct<{
529
571
  readonly description: Schema.String;
530
572
  readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
531
573
  readonly strict: Schema.optional<Schema.Boolean>;
574
+ }>, Schema.Struct<{
575
+ readonly type: Schema.tag<"custom">;
576
+ readonly name: Schema.String;
577
+ readonly description: Schema.String;
578
+ readonly format: Schema.Union<readonly [Schema.Struct<{
579
+ readonly type: Schema.tag<"text">;
580
+ }>, Schema.Struct<{
581
+ readonly type: Schema.tag<"grammar">;
582
+ readonly syntax: Schema.Literals<readonly ["lark", "regex"]>;
583
+ readonly definition: Schema.String;
584
+ }>]>;
532
585
  }>, Schema.StructWithRest<Schema.Struct<{
533
586
  readonly type: Schema.String;
534
587
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>>;
535
588
  readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
536
- readonly type: Schema.tag<"function">;
589
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
537
590
  readonly name: Schema.String;
538
591
  }>, Schema.Struct<{
539
592
  readonly type: Schema.tag<"allowed_tools">;
540
593
  readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
541
594
  readonly tools: Schema.$Array<Schema.Struct<{
542
- readonly type: Schema.tag<"function">;
595
+ readonly type: Schema.Literals<readonly ["function", "custom"]>;
543
596
  readonly name: Schema.String;
544
597
  }>>;
545
598
  }>]>>;
@@ -870,6 +923,7 @@ export interface ParserState {
870
923
  readonly name: string;
871
924
  readonly providerMetadataKey: string;
872
925
  readonly tools: ToolStream.State<string>;
926
+ readonly custom: ReadonlyMap<string, OpenAIFreeform.Custom>;
873
927
  readonly hasFunctionCall: boolean;
874
928
  readonly lifecycle: Lifecycle.State;
875
929
  readonly outputItems: Readonly<Record<number, string>>;
@@ -894,7 +948,30 @@ export declare const lowerTool: (protocolName: string, tool: ToolDefinition) =>
894
948
  };
895
949
  strict: boolean;
896
950
  }, AIError, never>;
897
- export declare const lowerTools: (tools: ReadonlyArray<ToolDefinition>, adapter: ProviderAdapter) => Effect.Effect<({
951
+ export declare const lowerCustomTool: (tool: ToolDefinition, custom: OpenAIFreeform.Custom) => {
952
+ type: "custom";
953
+ name: string;
954
+ description: string;
955
+ format: {
956
+ syntax: "lark" | "regex";
957
+ definition: string;
958
+ type: "grammar";
959
+ } | {
960
+ type: "text";
961
+ };
962
+ };
963
+ export declare const lowerTools: (tools: ReadonlyArray<ToolDefinition>, adapter: ProviderAdapter, custom: ReadonlyMap<string, OpenAIFreeform.Custom>) => Effect.Effect<({
964
+ readonly type: "custom";
965
+ readonly name: string;
966
+ readonly description: string;
967
+ readonly format: {
968
+ readonly type: "text";
969
+ } | {
970
+ readonly type: "grammar";
971
+ readonly syntax: "lark" | "regex";
972
+ readonly definition: string;
973
+ };
974
+ } | {
898
975
  readonly type: "function";
899
976
  readonly name: string;
900
977
  readonly description: string;
@@ -906,8 +983,12 @@ export declare const lowerTools: (tools: ReadonlyArray<ToolDefinition>, adapter:
906
983
  readonly [x: string]: unknown;
907
984
  readonly type: string;
908
985
  })[], AIError, never>;
909
- export declare const lowerToolChoice: (protocolName: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>) => Effect.Effect<"auto" | "none" | "required" | {
910
- type: "function";
986
+ export declare const namedTool: (name: string, custom: ReadonlyMap<string, OpenAIFreeform.Custom>) => {
987
+ type: "custom" | "function";
988
+ name: string;
989
+ };
990
+ export declare const lowerToolChoice: (protocolName: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>, custom: ReadonlyMap<string, OpenAIFreeform.Custom>) => Effect.Effect<"auto" | "none" | "required" | {
991
+ type: "custom" | "function";
911
992
  name: string;
912
993
  }, AIError, never>;
913
994
  export declare const lowerConversation: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
@@ -928,7 +1009,7 @@ export declare const lowerConversation: (request: LLMRequest<import("../schema/o
928
1009
  readonly role: "developer";
929
1010
  readonly content: string;
930
1011
  } | {
931
- readonly type: "function_call_output";
1012
+ readonly type: "custom_tool_call_output" | "function_call_output";
932
1013
  readonly call_id: string;
933
1014
  readonly output: string | readonly ({
934
1015
  readonly type: "input_text";
@@ -998,6 +1079,12 @@ export declare const lowerConversation: (request: LLMRequest<import("../schema/o
998
1079
  readonly name: string;
999
1080
  readonly namespace?: string | undefined;
1000
1081
  readonly arguments: string;
1082
+ } | {
1083
+ readonly type: "custom_tool_call";
1084
+ readonly id?: string | undefined;
1085
+ readonly call_id: string;
1086
+ readonly name: string;
1087
+ readonly input: string;
1001
1088
  } | {
1002
1089
  readonly [x: string]: unknown;
1003
1090
  readonly type: "web_search_call";
@@ -1073,11 +1160,11 @@ export declare const lowerGeneration: (request: LLMRequest, options?: OpenRespon
1073
1160
  truncation?: "auto" | "disabled" | undefined;
1074
1161
  };
1075
1162
  export declare const resolveParallelToolCalls: (request: LLMRequest, options?: OpenResponsesOptions.Resolved) => boolean | undefined;
1076
- export declare const allowedToolChoice: (request: LLMRequest, options?: OpenResponsesOptions.Resolved) => {
1163
+ export declare const allowedToolChoice: (options: OpenResponsesOptions.Resolved, custom: ReadonlyMap<string, OpenAIFreeform.Custom>) => {
1077
1164
  type: "allowed_tools";
1078
1165
  mode: "auto" | "none" | "required";
1079
1166
  tools: {
1080
- type: "function";
1167
+ type: "custom" | "function";
1081
1168
  name: string;
1082
1169
  }[];
1083
1170
  } | undefined;
@@ -1099,7 +1186,7 @@ export declare const fromRequestWithAdapter: (request: LLMRequest<import("../sch
1099
1186
  readonly role: "developer";
1100
1187
  readonly content: string;
1101
1188
  } | {
1102
- readonly type: "function_call_output";
1189
+ readonly type: "custom_tool_call_output" | "function_call_output";
1103
1190
  readonly call_id: string;
1104
1191
  readonly output: string | readonly ({
1105
1192
  readonly type: "input_text";
@@ -1169,6 +1256,12 @@ export declare const fromRequestWithAdapter: (request: LLMRequest<import("../sch
1169
1256
  readonly name: string;
1170
1257
  readonly namespace?: string | undefined;
1171
1258
  readonly arguments: string;
1259
+ } | {
1260
+ readonly type: "custom_tool_call";
1261
+ readonly id?: string | undefined;
1262
+ readonly call_id: string;
1263
+ readonly name: string;
1264
+ readonly input: string;
1172
1265
  } | {
1173
1266
  readonly [x: string]: unknown;
1174
1267
  readonly type: "web_search_call";
@@ -1241,6 +1334,17 @@ export declare const fromRequestWithAdapter: (request: LLMRequest<import("../sch
1241
1334
  parallel_tool_calls?: boolean | undefined;
1242
1335
  truncation?: "auto" | "disabled" | undefined;
1243
1336
  tools: ({
1337
+ readonly type: "custom";
1338
+ readonly name: string;
1339
+ readonly description: string;
1340
+ readonly format: {
1341
+ readonly type: "text";
1342
+ } | {
1343
+ readonly type: "grammar";
1344
+ readonly syntax: "lark" | "regex";
1345
+ readonly definition: string;
1346
+ };
1347
+ } | {
1244
1348
  readonly type: "function";
1245
1349
  readonly name: string;
1246
1350
  readonly description: string;
@@ -1253,13 +1357,13 @@ export declare const fromRequestWithAdapter: (request: LLMRequest<import("../sch
1253
1357
  readonly type: string;
1254
1358
  })[] | undefined;
1255
1359
  tool_choice: "auto" | "none" | "required" | {
1256
- type: "function";
1360
+ type: "custom" | "function";
1257
1361
  name: string;
1258
1362
  } | {
1259
1363
  type: "allowed_tools";
1260
1364
  mode: "auto" | "none" | "required";
1261
1365
  tools: {
1262
- type: "function";
1366
+ type: "custom" | "function";
1263
1367
  name: string;
1264
1368
  }[];
1265
1369
  } | undefined;
@@ -1280,7 +1384,7 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
1280
1384
  readonly role: "developer";
1281
1385
  readonly content: string;
1282
1386
  } | {
1283
- readonly type: "function_call_output";
1387
+ readonly type: "custom_tool_call_output" | "function_call_output";
1284
1388
  readonly call_id: string;
1285
1389
  readonly output: string | readonly ({
1286
1390
  readonly type: "input_text";
@@ -1350,6 +1454,12 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
1350
1454
  readonly name: string;
1351
1455
  readonly namespace?: string | undefined;
1352
1456
  readonly arguments: string;
1457
+ } | {
1458
+ readonly type: "custom_tool_call";
1459
+ readonly id?: string | undefined;
1460
+ readonly call_id: string;
1461
+ readonly name: string;
1462
+ readonly input: string;
1353
1463
  } | {
1354
1464
  readonly [x: string]: unknown;
1355
1465
  readonly type: "web_search_call";
@@ -1422,6 +1532,17 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
1422
1532
  parallel_tool_calls?: boolean | undefined;
1423
1533
  truncation?: "auto" | "disabled" | undefined;
1424
1534
  tools: ({
1535
+ readonly type: "custom";
1536
+ readonly name: string;
1537
+ readonly description: string;
1538
+ readonly format: {
1539
+ readonly type: "text";
1540
+ } | {
1541
+ readonly type: "grammar";
1542
+ readonly syntax: "lark" | "regex";
1543
+ readonly definition: string;
1544
+ };
1545
+ } | {
1425
1546
  readonly type: "function";
1426
1547
  readonly name: string;
1427
1548
  readonly description: string;
@@ -1434,13 +1555,13 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
1434
1555
  readonly type: string;
1435
1556
  })[] | undefined;
1436
1557
  tool_choice: "auto" | "none" | "required" | {
1437
- type: "function";
1558
+ type: "custom" | "function";
1438
1559
  name: string;
1439
1560
  } | {
1440
1561
  type: "allowed_tools";
1441
1562
  mode: "auto" | "none" | "required";
1442
1563
  tools: {
1443
- type: "function";
1564
+ type: "custom" | "function";
1444
1565
  name: string;
1445
1566
  }[];
1446
1567
  } | undefined;
@@ -1699,7 +1820,7 @@ export declare const protocol: Protocol<{
1699
1820
  readonly role: "developer";
1700
1821
  readonly content: string;
1701
1822
  } | {
1702
- readonly type: "function_call_output";
1823
+ readonly type: "custom_tool_call_output" | "function_call_output";
1703
1824
  readonly call_id: string;
1704
1825
  readonly output: string | readonly ({
1705
1826
  readonly type: "input_text";
@@ -1769,6 +1890,12 @@ export declare const protocol: Protocol<{
1769
1890
  readonly name: string;
1770
1891
  readonly namespace?: string | undefined;
1771
1892
  readonly arguments: string;
1893
+ } | {
1894
+ readonly type: "custom_tool_call";
1895
+ readonly id?: string | undefined;
1896
+ readonly call_id: string;
1897
+ readonly name: string;
1898
+ readonly input: string;
1772
1899
  } | {
1773
1900
  readonly [x: string]: unknown;
1774
1901
  readonly type: "web_search_call";
@@ -1813,6 +1940,17 @@ export declare const protocol: Protocol<{
1813
1940
  })[];
1814
1941
  readonly instructions?: string | undefined;
1815
1942
  readonly tools?: readonly ({
1943
+ readonly type: "custom";
1944
+ readonly name: string;
1945
+ readonly description: string;
1946
+ readonly format: {
1947
+ readonly type: "text";
1948
+ } | {
1949
+ readonly type: "grammar";
1950
+ readonly syntax: "lark" | "regex";
1951
+ readonly definition: string;
1952
+ };
1953
+ } | {
1816
1954
  readonly type: "function";
1817
1955
  readonly name: string;
1818
1956
  readonly description: string;
@@ -1825,13 +1963,13 @@ export declare const protocol: Protocol<{
1825
1963
  readonly type: string;
1826
1964
  })[] | undefined;
1827
1965
  readonly tool_choice?: "auto" | "none" | "required" | {
1828
- readonly type: "function";
1966
+ readonly type: "custom" | "function";
1829
1967
  readonly name: string;
1830
1968
  } | {
1831
1969
  readonly type: "allowed_tools";
1832
1970
  readonly mode: "auto" | "none" | "required";
1833
1971
  readonly tools: readonly {
1834
- readonly type: "function";
1972
+ readonly type: "custom" | "function";
1835
1973
  readonly name: string;
1836
1974
  }[];
1837
1975
  } | undefined;
@@ -1938,7 +2076,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
1938
2076
  readonly role: "developer";
1939
2077
  readonly content: string;
1940
2078
  } | {
1941
- readonly type: "function_call_output";
2079
+ readonly type: "custom_tool_call_output" | "function_call_output";
1942
2080
  readonly call_id: string;
1943
2081
  readonly output: string | readonly ({
1944
2082
  readonly type: "input_text";
@@ -2008,6 +2146,12 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
2008
2146
  readonly name: string;
2009
2147
  readonly namespace?: string | undefined;
2010
2148
  readonly arguments: string;
2149
+ } | {
2150
+ readonly type: "custom_tool_call";
2151
+ readonly id?: string | undefined;
2152
+ readonly call_id: string;
2153
+ readonly name: string;
2154
+ readonly input: string;
2011
2155
  } | {
2012
2156
  readonly [x: string]: unknown;
2013
2157
  readonly type: "web_search_call";
@@ -2052,6 +2196,17 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
2052
2196
  })[];
2053
2197
  readonly instructions?: string | undefined;
2054
2198
  readonly tools?: readonly ({
2199
+ readonly type: "custom";
2200
+ readonly name: string;
2201
+ readonly description: string;
2202
+ readonly format: {
2203
+ readonly type: "text";
2204
+ } | {
2205
+ readonly type: "grammar";
2206
+ readonly syntax: "lark" | "regex";
2207
+ readonly definition: string;
2208
+ };
2209
+ } | {
2055
2210
  readonly type: "function";
2056
2211
  readonly name: string;
2057
2212
  readonly description: string;
@@ -2064,13 +2219,13 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
2064
2219
  readonly type: string;
2065
2220
  })[] | undefined;
2066
2221
  readonly tool_choice?: "auto" | "none" | "required" | {
2067
- readonly type: "function";
2222
+ readonly type: "custom" | "function";
2068
2223
  readonly name: string;
2069
2224
  } | {
2070
2225
  readonly type: "allowed_tools";
2071
2226
  readonly mode: "auto" | "none" | "required";
2072
2227
  readonly tools: readonly {
2073
- readonly type: "function";
2228
+ readonly type: "custom" | "function";
2074
2229
  readonly name: string;
2075
2230
  }[];
2076
2231
  } | undefined;