@opencode-ai/ai 0.0.0-beta-17595 → 0.0.0-beta-17727

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 (74) hide show
  1. package/README.md +17 -6
  2. package/dist/cache-policy.js +3 -5
  3. package/dist/protocols/anthropic-messages.d.ts +26 -28
  4. package/dist/protocols/anthropic-messages.js +21 -9
  5. package/dist/protocols/gemini.d.ts +5 -9
  6. package/dist/protocols/gemini.js +5 -4
  7. package/dist/protocols/open-responses.d.ts +200 -38
  8. package/dist/protocols/open-responses.js +115 -42
  9. package/dist/protocols/openai-chat.d.ts +17 -15
  10. package/dist/protocols/openai-chat.js +8 -2
  11. package/dist/protocols/openai-compatible-chat.d.ts +3 -3
  12. package/dist/protocols/openai-compatible-responses.d.ts +31 -5
  13. package/dist/protocols/openai-responses.d.ts +171 -33
  14. package/dist/protocols/openai-responses.js +4 -2
  15. package/dist/protocols/shared.d.ts +8 -14
  16. package/dist/protocols/shared.js +8 -14
  17. package/dist/protocols/utils/bedrock-cache.js +3 -4
  18. package/dist/protocols/utils/cache.js +3 -6
  19. package/dist/protocols/utils/open-responses-options.d.ts +49 -14
  20. package/dist/protocols/utils/open-responses-options.js +40 -22
  21. package/dist/protocols/utils/openai-options.d.ts +7 -5
  22. package/dist/protocols/utils/openai-options.js +3 -3
  23. package/dist/provider-package.d.ts +0 -5
  24. package/dist/providers/amazon-bedrock-mantle.d.ts +47 -19
  25. package/dist/providers/amazon-bedrock-mantle.js +0 -1
  26. package/dist/providers/amazon-bedrock.d.ts +3 -9
  27. package/dist/providers/amazon-bedrock.js +0 -1
  28. package/dist/providers/anthropic-compatible.d.ts +11 -11
  29. package/dist/providers/anthropic-compatible.js +0 -1
  30. package/dist/providers/anthropic.d.ts +12 -12
  31. package/dist/providers/anthropic.js +0 -1
  32. package/dist/providers/azure.d.ts +44 -16
  33. package/dist/providers/azure.js +0 -1
  34. package/dist/providers/cloudflare.d.ts +11 -11
  35. package/dist/providers/google-vertex-chat.d.ts +5 -5
  36. package/dist/providers/google-vertex-chat.js +0 -1
  37. package/dist/providers/google-vertex-messages.d.ts +11 -11
  38. package/dist/providers/google-vertex-messages.js +0 -1
  39. package/dist/providers/google-vertex-responses.d.ts +33 -7
  40. package/dist/providers/google-vertex-responses.js +1 -2
  41. package/dist/providers/google-vertex.d.ts +5 -7
  42. package/dist/providers/google-vertex.js +1 -2
  43. package/dist/providers/google.d.ts +4 -4
  44. package/dist/providers/google.js +0 -1
  45. package/dist/providers/open-responses-options.d.ts +3 -13
  46. package/dist/providers/openai-compatible-responses.d.ts +33 -7
  47. package/dist/providers/openai-compatible-responses.js +0 -1
  48. package/dist/providers/openai-compatible.d.ts +13 -12
  49. package/dist/providers/openai-compatible.js +1 -1
  50. package/dist/providers/openai-options.d.ts +2 -4
  51. package/dist/providers/openai-options.js +3 -3
  52. package/dist/providers/openai.d.ts +48 -20
  53. package/dist/providers/openai.js +0 -1
  54. package/dist/providers/openrouter.d.ts +16 -17
  55. package/dist/providers/openrouter.js +1 -2
  56. package/dist/providers/xai.d.ts +50 -24
  57. package/dist/providers/xai.js +1 -2
  58. package/dist/route/client.d.ts +2 -6
  59. package/dist/route/client.js +1 -2
  60. package/dist/route/framing.d.ts +2 -2
  61. package/dist/route/protocol.d.ts +1 -2
  62. package/dist/route/protocol.js +1 -2
  63. package/dist/schema/errors.js +2 -1
  64. package/dist/schema/events.d.ts +5 -3
  65. package/dist/schema/events.js +5 -2
  66. package/dist/schema/ids.d.ts +0 -13
  67. package/dist/schema/ids.js +0 -9
  68. package/dist/schema/messages.d.ts +7 -7
  69. package/dist/schema/messages.js +5 -2
  70. package/dist/schema/options.d.ts +6 -22
  71. package/dist/schema/options.js +6 -30
  72. package/dist/testing.d.ts +2 -1
  73. package/dist/testing.js +7 -2
  74. package/package.json +5 -5
@@ -8,6 +8,8 @@ export declare const PATH = "/responses";
8
8
  declare const OpenAIResponsesBody: Schema.Struct<{
9
9
  readonly stream: Schema.Literal<true>;
10
10
  readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
11
+ readonly type: Schema.tag<"message">;
12
+ readonly id: Schema.optionalKey<Schema.String>;
11
13
  readonly role: Schema.tag<"assistant">;
12
14
  readonly content: Schema.$Array<Schema.Struct<{
13
15
  readonly type: Schema.tag<"output_text">;
@@ -17,6 +19,9 @@ declare const OpenAIResponsesBody: Schema.Struct<{
17
19
  }>, Schema.Union<readonly [Schema.Struct<{
18
20
  readonly role: Schema.tag<"system">;
19
21
  readonly content: Schema.String;
22
+ }>, Schema.Struct<{
23
+ readonly role: Schema.tag<"developer">;
24
+ readonly content: Schema.String;
20
25
  }>, Schema.Struct<{
21
26
  readonly role: Schema.tag<"user">;
22
27
  readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
@@ -32,6 +37,8 @@ declare const OpenAIResponsesBody: Schema.Struct<{
32
37
  readonly mime_type: Schema.optional<Schema.String>;
33
38
  }>]>]>>;
34
39
  }>, Schema.Struct<{
40
+ readonly type: Schema.tag<"message">;
41
+ readonly id: Schema.optionalKey<Schema.String>;
35
42
  readonly role: Schema.tag<"assistant">;
36
43
  readonly content: Schema.$Array<Schema.Struct<{
37
44
  readonly type: Schema.tag<"output_text">;
@@ -51,6 +58,7 @@ declare const OpenAIResponsesBody: Schema.Struct<{
51
58
  readonly id: Schema.String;
52
59
  }>, Schema.Struct<{
53
60
  readonly type: Schema.tag<"function_call">;
61
+ readonly id: Schema.optionalKey<Schema.String>;
54
62
  readonly call_id: Schema.String;
55
63
  readonly name: Schema.String;
56
64
  readonly arguments: Schema.String;
@@ -90,25 +98,43 @@ declare const OpenAIResponsesBody: Schema.Struct<{
90
98
  readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
91
99
  readonly type: Schema.tag<"function">;
92
100
  readonly name: Schema.String;
101
+ }>, Schema.Struct<{
102
+ readonly type: Schema.tag<"allowed_tools">;
103
+ readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
104
+ readonly tools: Schema.$Array<Schema.Struct<{
105
+ readonly type: Schema.tag<"function">;
106
+ readonly name: Schema.String;
107
+ }>>;
93
108
  }>]>, Schema.Struct<{
94
109
  readonly type: Schema.tag<"image_generation">;
95
110
  }>]>>;
96
111
  readonly model: Schema.String;
97
112
  readonly instructions: Schema.optional<Schema.String>;
98
113
  readonly store: Schema.optional<Schema.Boolean>;
114
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
115
+ readonly safety_identifier: Schema.optional<Schema.String>;
116
+ readonly stream_options: Schema.optional<Schema.Struct<{
117
+ readonly include_obfuscation: Schema.optional<Schema.Boolean>;
118
+ }>>;
119
+ readonly top_logprobs: Schema.optional<Schema.Int>;
120
+ readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
99
121
  readonly service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
100
122
  readonly prompt_cache_key: Schema.optional<Schema.String>;
101
- readonly include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
123
+ readonly include: Schema.optional<Schema.$Array<Schema.declare<import("./utils/open-responses-options.js").ResponseIncludable, import("./utils/open-responses-options.js").ResponseIncludable>>>;
102
124
  readonly reasoning: Schema.optional<Schema.Struct<{
103
- readonly effort: Schema.optional<Schema.String>;
125
+ readonly effort: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").ReasoningEffort, import("./utils/open-responses-options.js").ReasoningEffort>>;
104
126
  readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
105
127
  }>>;
106
128
  readonly text: Schema.optional<Schema.Struct<{
107
- readonly verbosity: Schema.optional<Schema.Literals<readonly ["low", "medium", "high"]>>;
129
+ readonly verbosity: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").TextVerbosity, import("./utils/open-responses-options.js").TextVerbosity>>;
108
130
  }>>;
109
131
  readonly max_output_tokens: Schema.optional<Schema.Number>;
132
+ readonly max_tool_calls: Schema.optional<Schema.Int>;
133
+ readonly parallel_tool_calls: Schema.optional<Schema.Boolean>;
110
134
  readonly temperature: Schema.optional<Schema.Number>;
111
135
  readonly top_p: Schema.optional<Schema.Number>;
136
+ readonly presence_penalty: Schema.optional<Schema.Number>;
137
+ readonly frequency_penalty: Schema.optional<Schema.Number>;
112
138
  }>;
113
139
  export type OpenAIResponsesBody = Schema.Schema.Type<typeof OpenAIResponsesBody>;
114
140
  export declare const protocol: Protocol<{
@@ -126,6 +152,9 @@ export declare const protocol: Protocol<{
126
152
  } | {
127
153
  readonly role: "system";
128
154
  readonly content: string;
155
+ } | {
156
+ readonly role: "developer";
157
+ readonly content: string;
129
158
  } | {
130
159
  readonly role: "user";
131
160
  readonly content: readonly ({
@@ -141,17 +170,20 @@ export declare const protocol: Protocol<{
141
170
  readonly text: string;
142
171
  })[];
143
172
  } | {
173
+ readonly type: "message";
144
174
  readonly content: readonly {
145
175
  readonly type: "output_text";
146
176
  readonly text: string;
147
177
  }[];
148
178
  readonly role: "assistant";
179
+ readonly id?: string | undefined;
149
180
  readonly phase?: "commentary" | "final_answer" | undefined;
150
181
  } | {
151
182
  readonly type: "function_call";
152
- readonly call_id: string;
153
183
  readonly name: string;
154
184
  readonly arguments: string;
185
+ readonly call_id: string;
186
+ readonly id?: string | undefined;
155
187
  } | {
156
188
  readonly type: "function_call_output";
157
189
  readonly call_id: string;
@@ -168,19 +200,24 @@ export declare const protocol: Protocol<{
168
200
  readonly text: string;
169
201
  })[];
170
202
  } | {
203
+ readonly type: "message";
171
204
  readonly content: readonly {
172
205
  readonly type: "output_text";
173
206
  readonly text: string;
174
207
  }[];
175
208
  readonly role: "assistant";
209
+ readonly id?: string | undefined;
176
210
  readonly phase?: "commentary" | "final_answer" | null | undefined;
177
211
  })[];
178
212
  readonly model: string;
179
213
  readonly stream: true;
214
+ readonly metadata?: {
215
+ readonly [x: string]: string;
216
+ } | undefined;
180
217
  readonly instructions?: string | undefined;
181
218
  readonly reasoning?: {
182
219
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
183
- readonly effort?: string | undefined;
220
+ readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
184
221
  } | undefined;
185
222
  readonly tools?: readonly ({
186
223
  readonly type: "function";
@@ -195,42 +232,59 @@ export declare const protocol: Protocol<{
195
232
  readonly size?: string | undefined;
196
233
  readonly action?: "generate" | "auto" | "edit" | undefined;
197
234
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
198
- readonly quality?: "low" | "medium" | "high" | "auto" | undefined;
235
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
199
236
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
200
237
  readonly output_compression?: number | undefined;
201
238
  readonly input_fidelity?: "low" | "high" | undefined;
202
239
  readonly partial_images?: number | undefined;
203
240
  })[] | undefined;
204
241
  readonly text?: {
205
- readonly verbosity?: "low" | "medium" | "high" | undefined;
242
+ readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
206
243
  } | undefined;
207
244
  readonly temperature?: number | undefined;
208
- readonly tool_choice?: "required" | "none" | "auto" | {
245
+ readonly tool_choice?: "required" | "auto" | "none" | {
209
246
  readonly type: "function";
210
247
  readonly name: string;
248
+ } | {
249
+ readonly type: "allowed_tools";
250
+ readonly mode: "required" | "auto" | "none";
251
+ readonly tools: readonly {
252
+ readonly type: "function";
253
+ readonly name: string;
254
+ }[];
211
255
  } | {
212
256
  readonly type: "image_generation";
213
257
  } | undefined;
214
258
  readonly top_p?: number | undefined;
215
- readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
216
259
  readonly store?: boolean | undefined;
260
+ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
261
+ readonly truncation?: "auto" | "disabled" | undefined;
262
+ readonly stream_options?: {
263
+ readonly include_obfuscation?: boolean | undefined;
264
+ } | undefined;
217
265
  readonly prompt_cache_key?: string | undefined;
266
+ readonly frequency_penalty?: number | undefined;
267
+ readonly presence_penalty?: number | undefined;
268
+ readonly safety_identifier?: string | undefined;
269
+ readonly top_logprobs?: number | undefined;
218
270
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
219
271
  readonly max_output_tokens?: number | undefined;
272
+ readonly max_tool_calls?: number | undefined;
273
+ readonly parallel_tool_calls?: boolean | undefined;
220
274
  }, string, {
221
275
  readonly [x: string]: unknown;
222
276
  readonly type: string;
277
+ readonly status?: unknown;
278
+ readonly code?: string | null | undefined;
279
+ readonly message?: string | undefined;
280
+ readonly headers?: unknown;
281
+ readonly text?: string | undefined;
223
282
  readonly error?: {
224
283
  readonly type?: string | null | undefined;
225
284
  readonly code?: string | null | undefined;
226
285
  readonly message?: string | null | undefined;
227
286
  readonly param?: string | null | undefined;
228
287
  } | null | undefined;
229
- readonly status?: unknown;
230
- readonly code?: string | null | undefined;
231
- readonly message?: string | undefined;
232
- readonly headers?: unknown;
233
- readonly text?: string | undefined;
234
288
  readonly item?: {
235
289
  readonly [x: string]: unknown;
236
290
  readonly type: string;
@@ -243,13 +297,13 @@ export declare const protocol: Protocol<{
243
297
  readonly delta?: string | undefined;
244
298
  readonly response?: {
245
299
  readonly [x: string]: unknown;
300
+ readonly id?: string | undefined;
246
301
  readonly error?: {
247
302
  readonly type?: string | null | undefined;
248
303
  readonly code?: string | null | undefined;
249
304
  readonly message?: string | null | undefined;
250
305
  readonly param?: string | null | undefined;
251
306
  } | null | undefined;
252
- readonly id?: string | undefined;
253
307
  readonly usage?: {
254
308
  readonly input_tokens?: number | undefined;
255
309
  readonly output_tokens?: number | undefined;
@@ -287,6 +341,9 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
287
341
  } | {
288
342
  readonly role: "system";
289
343
  readonly content: string;
344
+ } | {
345
+ readonly role: "developer";
346
+ readonly content: string;
290
347
  } | {
291
348
  readonly role: "user";
292
349
  readonly content: readonly ({
@@ -302,17 +359,20 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
302
359
  readonly text: string;
303
360
  })[];
304
361
  } | {
362
+ readonly type: "message";
305
363
  readonly content: readonly {
306
364
  readonly type: "output_text";
307
365
  readonly text: string;
308
366
  }[];
309
367
  readonly role: "assistant";
368
+ readonly id?: string | undefined;
310
369
  readonly phase?: "commentary" | "final_answer" | undefined;
311
370
  } | {
312
371
  readonly type: "function_call";
313
- readonly call_id: string;
314
372
  readonly name: string;
315
373
  readonly arguments: string;
374
+ readonly call_id: string;
375
+ readonly id?: string | undefined;
316
376
  } | {
317
377
  readonly type: "function_call_output";
318
378
  readonly call_id: string;
@@ -329,19 +389,24 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
329
389
  readonly text: string;
330
390
  })[];
331
391
  } | {
392
+ readonly type: "message";
332
393
  readonly content: readonly {
333
394
  readonly type: "output_text";
334
395
  readonly text: string;
335
396
  }[];
336
397
  readonly role: "assistant";
398
+ readonly id?: string | undefined;
337
399
  readonly phase?: "commentary" | "final_answer" | null | undefined;
338
400
  })[];
339
401
  readonly model: string;
340
402
  readonly stream: true;
403
+ readonly metadata?: {
404
+ readonly [x: string]: string;
405
+ } | undefined;
341
406
  readonly instructions?: string | undefined;
342
407
  readonly reasoning?: {
343
408
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
344
- readonly effort?: string | undefined;
409
+ readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
345
410
  } | undefined;
346
411
  readonly tools?: readonly ({
347
412
  readonly type: "function";
@@ -356,28 +421,45 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
356
421
  readonly size?: string | undefined;
357
422
  readonly action?: "generate" | "auto" | "edit" | undefined;
358
423
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
359
- readonly quality?: "low" | "medium" | "high" | "auto" | undefined;
424
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
360
425
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
361
426
  readonly output_compression?: number | undefined;
362
427
  readonly input_fidelity?: "low" | "high" | undefined;
363
428
  readonly partial_images?: number | undefined;
364
429
  })[] | undefined;
365
430
  readonly text?: {
366
- readonly verbosity?: "low" | "medium" | "high" | undefined;
431
+ readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
367
432
  } | undefined;
368
433
  readonly temperature?: number | undefined;
369
- readonly tool_choice?: "required" | "none" | "auto" | {
434
+ readonly tool_choice?: "required" | "auto" | "none" | {
370
435
  readonly type: "function";
371
436
  readonly name: string;
437
+ } | {
438
+ readonly type: "allowed_tools";
439
+ readonly mode: "required" | "auto" | "none";
440
+ readonly tools: readonly {
441
+ readonly type: "function";
442
+ readonly name: string;
443
+ }[];
372
444
  } | {
373
445
  readonly type: "image_generation";
374
446
  } | undefined;
375
447
  readonly top_p?: number | undefined;
376
- readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
377
448
  readonly store?: boolean | undefined;
449
+ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
450
+ readonly truncation?: "auto" | "disabled" | undefined;
451
+ readonly stream_options?: {
452
+ readonly include_obfuscation?: boolean | undefined;
453
+ } | undefined;
378
454
  readonly prompt_cache_key?: string | undefined;
455
+ readonly frequency_penalty?: number | undefined;
456
+ readonly presence_penalty?: number | undefined;
457
+ readonly safety_identifier?: string | undefined;
458
+ readonly top_logprobs?: number | undefined;
379
459
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
380
460
  readonly max_output_tokens?: number | undefined;
461
+ readonly max_tool_calls?: number | undefined;
462
+ readonly parallel_tool_calls?: boolean | undefined;
381
463
  }, string>;
382
464
  export declare const transport: import("../route/transport/index.js").Transport<{
383
465
  readonly input: readonly ({
@@ -394,6 +476,9 @@ export declare const transport: import("../route/transport/index.js").Transport<
394
476
  } | {
395
477
  readonly role: "system";
396
478
  readonly content: string;
479
+ } | {
480
+ readonly role: "developer";
481
+ readonly content: string;
397
482
  } | {
398
483
  readonly role: "user";
399
484
  readonly content: readonly ({
@@ -409,17 +494,20 @@ export declare const transport: import("../route/transport/index.js").Transport<
409
494
  readonly text: string;
410
495
  })[];
411
496
  } | {
497
+ readonly type: "message";
412
498
  readonly content: readonly {
413
499
  readonly type: "output_text";
414
500
  readonly text: string;
415
501
  }[];
416
502
  readonly role: "assistant";
503
+ readonly id?: string | undefined;
417
504
  readonly phase?: "commentary" | "final_answer" | undefined;
418
505
  } | {
419
506
  readonly type: "function_call";
420
- readonly call_id: string;
421
507
  readonly name: string;
422
508
  readonly arguments: string;
509
+ readonly call_id: string;
510
+ readonly id?: string | undefined;
423
511
  } | {
424
512
  readonly type: "function_call_output";
425
513
  readonly call_id: string;
@@ -436,19 +524,24 @@ export declare const transport: import("../route/transport/index.js").Transport<
436
524
  readonly text: string;
437
525
  })[];
438
526
  } | {
527
+ readonly type: "message";
439
528
  readonly content: readonly {
440
529
  readonly type: "output_text";
441
530
  readonly text: string;
442
531
  }[];
443
532
  readonly role: "assistant";
533
+ readonly id?: string | undefined;
444
534
  readonly phase?: "commentary" | "final_answer" | null | undefined;
445
535
  })[];
446
536
  readonly model: string;
447
537
  readonly stream: true;
538
+ readonly metadata?: {
539
+ readonly [x: string]: string;
540
+ } | undefined;
448
541
  readonly instructions?: string | undefined;
449
542
  readonly reasoning?: {
450
543
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
451
- readonly effort?: string | undefined;
544
+ readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
452
545
  } | undefined;
453
546
  readonly tools?: readonly ({
454
547
  readonly type: "function";
@@ -463,28 +556,45 @@ export declare const transport: import("../route/transport/index.js").Transport<
463
556
  readonly size?: string | undefined;
464
557
  readonly action?: "generate" | "auto" | "edit" | undefined;
465
558
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
466
- readonly quality?: "low" | "medium" | "high" | "auto" | undefined;
559
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
467
560
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
468
561
  readonly output_compression?: number | undefined;
469
562
  readonly input_fidelity?: "low" | "high" | undefined;
470
563
  readonly partial_images?: number | undefined;
471
564
  })[] | undefined;
472
565
  readonly text?: {
473
- readonly verbosity?: "low" | "medium" | "high" | undefined;
566
+ readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
474
567
  } | undefined;
475
568
  readonly temperature?: number | undefined;
476
- readonly tool_choice?: "required" | "none" | "auto" | {
569
+ readonly tool_choice?: "required" | "auto" | "none" | {
477
570
  readonly type: "function";
478
571
  readonly name: string;
572
+ } | {
573
+ readonly type: "allowed_tools";
574
+ readonly mode: "required" | "auto" | "none";
575
+ readonly tools: readonly {
576
+ readonly type: "function";
577
+ readonly name: string;
578
+ }[];
479
579
  } | {
480
580
  readonly type: "image_generation";
481
581
  } | undefined;
482
582
  readonly top_p?: number | undefined;
483
- readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
484
583
  readonly store?: boolean | undefined;
584
+ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
585
+ readonly truncation?: "auto" | "disabled" | undefined;
586
+ readonly stream_options?: {
587
+ readonly include_obfuscation?: boolean | undefined;
588
+ } | undefined;
485
589
  readonly prompt_cache_key?: string | undefined;
590
+ readonly frequency_penalty?: number | undefined;
591
+ readonly presence_penalty?: number | undefined;
592
+ readonly safety_identifier?: string | undefined;
593
+ readonly top_logprobs?: number | undefined;
486
594
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
487
595
  readonly max_output_tokens?: number | undefined;
596
+ readonly max_tool_calls?: number | undefined;
597
+ readonly parallel_tool_calls?: boolean | undefined;
488
598
  }, import("./open-responses-channel.js").Prepared, string>;
489
599
  export declare const route: Route<{
490
600
  readonly input: readonly ({
@@ -501,6 +611,9 @@ export declare const route: Route<{
501
611
  } | {
502
612
  readonly role: "system";
503
613
  readonly content: string;
614
+ } | {
615
+ readonly role: "developer";
616
+ readonly content: string;
504
617
  } | {
505
618
  readonly role: "user";
506
619
  readonly content: readonly ({
@@ -516,17 +629,20 @@ export declare const route: Route<{
516
629
  readonly text: string;
517
630
  })[];
518
631
  } | {
632
+ readonly type: "message";
519
633
  readonly content: readonly {
520
634
  readonly type: "output_text";
521
635
  readonly text: string;
522
636
  }[];
523
637
  readonly role: "assistant";
638
+ readonly id?: string | undefined;
524
639
  readonly phase?: "commentary" | "final_answer" | undefined;
525
640
  } | {
526
641
  readonly type: "function_call";
527
- readonly call_id: string;
528
642
  readonly name: string;
529
643
  readonly arguments: string;
644
+ readonly call_id: string;
645
+ readonly id?: string | undefined;
530
646
  } | {
531
647
  readonly type: "function_call_output";
532
648
  readonly call_id: string;
@@ -543,19 +659,24 @@ export declare const route: Route<{
543
659
  readonly text: string;
544
660
  })[];
545
661
  } | {
662
+ readonly type: "message";
546
663
  readonly content: readonly {
547
664
  readonly type: "output_text";
548
665
  readonly text: string;
549
666
  }[];
550
667
  readonly role: "assistant";
668
+ readonly id?: string | undefined;
551
669
  readonly phase?: "commentary" | "final_answer" | null | undefined;
552
670
  })[];
553
671
  readonly model: string;
554
672
  readonly stream: true;
673
+ readonly metadata?: {
674
+ readonly [x: string]: string;
675
+ } | undefined;
555
676
  readonly instructions?: string | undefined;
556
677
  readonly reasoning?: {
557
678
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
558
- readonly effort?: string | undefined;
679
+ readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
559
680
  } | undefined;
560
681
  readonly tools?: readonly ({
561
682
  readonly type: "function";
@@ -570,27 +691,44 @@ export declare const route: Route<{
570
691
  readonly size?: string | undefined;
571
692
  readonly action?: "generate" | "auto" | "edit" | undefined;
572
693
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
573
- readonly quality?: "low" | "medium" | "high" | "auto" | undefined;
694
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
574
695
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
575
696
  readonly output_compression?: number | undefined;
576
697
  readonly input_fidelity?: "low" | "high" | undefined;
577
698
  readonly partial_images?: number | undefined;
578
699
  })[] | undefined;
579
700
  readonly text?: {
580
- readonly verbosity?: "low" | "medium" | "high" | undefined;
701
+ readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
581
702
  } | undefined;
582
703
  readonly temperature?: number | undefined;
583
- readonly tool_choice?: "required" | "none" | "auto" | {
704
+ readonly tool_choice?: "required" | "auto" | "none" | {
584
705
  readonly type: "function";
585
706
  readonly name: string;
707
+ } | {
708
+ readonly type: "allowed_tools";
709
+ readonly mode: "required" | "auto" | "none";
710
+ readonly tools: readonly {
711
+ readonly type: "function";
712
+ readonly name: string;
713
+ }[];
586
714
  } | {
587
715
  readonly type: "image_generation";
588
716
  } | undefined;
589
717
  readonly top_p?: number | undefined;
590
- readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
591
718
  readonly store?: boolean | undefined;
719
+ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
720
+ readonly truncation?: "auto" | "disabled" | undefined;
721
+ readonly stream_options?: {
722
+ readonly include_obfuscation?: boolean | undefined;
723
+ } | undefined;
592
724
  readonly prompt_cache_key?: string | undefined;
725
+ readonly frequency_penalty?: number | undefined;
726
+ readonly presence_penalty?: number | undefined;
727
+ readonly safety_identifier?: string | undefined;
728
+ readonly top_logprobs?: number | undefined;
593
729
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
594
730
  readonly max_output_tokens?: number | undefined;
731
+ readonly max_tool_calls?: number | undefined;
732
+ readonly parallel_tool_calls?: boolean | undefined;
595
733
  }, import("./open-responses-channel.js").Prepared>;
596
734
  export * as OpenAIResponses from "./openai-responses.js";
@@ -37,6 +37,8 @@ const OpenAIResponsesToolChoice = Schema.Union([
37
37
  ]);
38
38
  const OpenAIResponsesInputItem = Schema.Union([
39
39
  Schema.Struct({
40
+ type: Schema.tag("message"),
41
+ id: Schema.optionalKey(Schema.String),
40
42
  role: Schema.tag("assistant"),
41
43
  content: Schema.Array(Schema.Struct({ type: Schema.tag("output_text"), text: Schema.String })),
42
44
  phase: Schema.optionalKey(Schema.NullOr(OpenResponses.MessagePhase)),
@@ -101,7 +103,7 @@ const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request)
101
103
  tools: request.tools.length === 0
102
104
  ? undefined
103
105
  : yield* Effect.forEach(request.tools, (tool) => lowerTool(tool, ToolSchemaProjection.modelCompatibility(tool.inputSchema, toolSchemaCompatibility))),
104
- tool_choice: request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined,
106
+ tool_choice: body.tool_choice ?? (request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined),
105
107
  };
106
108
  });
107
109
  const HOSTED_TOOLS = {
@@ -203,6 +205,6 @@ export const route = Route.make({
203
205
  endpoint,
204
206
  auth,
205
207
  transport,
206
- defaults: { providerOptions: { openai: { store: false } } },
208
+ defaults: { providerOptions: { store: false } },
207
209
  });
208
210
  export * as OpenAIResponses from "./openai-responses.js";
@@ -26,12 +26,10 @@ export interface ToolAccumulator {
26
26
  * when at least one is defined. Returns `undefined` when neither input nor
27
27
  * output is known so routes don't publish a misleading `0`.
28
28
  *
29
- * Under the additive `AI.Usage` contract, `inputTokens` and `outputTokens`
30
- * are the non-cached input and visible output only. The provider-supplied
31
- * `total` is the source of truth when present; the computed fallback
32
- * under-counts cache and reasoning by design and exists mainly so
33
- * Anthropic-style providers (which don't surface a total) still get a
34
- * sensible aggregate on the input + output axes.
29
+ * Under the inclusive `AI.Usage` contract, `inputTokens` includes cached input
30
+ * and `outputTokens` includes reasoning. Protocol mappers normalize those
31
+ * inclusive values before calling this helper. The provider-supplied total is
32
+ * the source of truth when present; otherwise their sum is the canonical total.
35
33
  */
36
34
  export declare const totalTokens: (inputTokens: number | undefined, outputTokens: number | undefined, total: number | undefined) => number | undefined;
37
35
  /**
@@ -43,7 +41,7 @@ export declare const totalTokens: (inputTokens: number | undefined, outputTokens
43
41
  *
44
42
  * If `total` is `undefined`, returns `undefined` (we don't fabricate
45
43
  * counts). If `subtrahend` is `undefined`, returns `total` unchanged. The
46
- * provider-native breakdown stays available on `Usage.native` for debugging.
44
+ * provider-native breakdown stays available on `Usage.providerMetadata` for debugging.
47
45
  */
48
46
  export declare const subtractTokens: (total: number | undefined, subtrahend: number | undefined) => number | undefined;
49
47
  /**
@@ -117,19 +115,15 @@ export declare const toolResultText: (part: ToolResultPart) => string;
117
115
  export declare const errorText: (error: unknown) => string;
118
116
  /**
119
117
  * `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
120
- * decoder, and drops empty / `[DONE]` keep-alive events so the downstream
121
- * `decodeChunk` sees one JSON string per element. The SSE channel emits a
118
+ * decoder, and drops empty / `[DONE]` keep-alive events so the protocol event
119
+ * schema sees one JSON string per element. The SSE channel emits a
122
120
  * `Retry` control event on its error channel; we drop it here (we don't
123
121
  * implement client-driven retries). Decoder failures become provider output
124
122
  * errors so the public error channel stays `AIError`.
125
123
  */
126
124
  export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>) => Stream.Stream<string, AIError>;
127
125
  /**
128
- * Canonical invalid-request constructor. Lift one-line `const invalid =
129
- * (message) => invalidRequest(message)` aliases out of every
130
- * route so the error constructor lives in one place. If we ever extend
131
- * `InvalidRequestReason` with route context or trace metadata, the change
132
- * lands here.
126
+ * Canonical invalid-request constructor shared by protocol lowering.
133
127
  */
134
128
  export declare const invalidRequest: (message: string) => AIError;
135
129
  export declare const matchToolChoice: <Auto, None, Required, Tool>(route: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>, cases: {