@opencode/ai 2.0.31 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/ai-client.d.ts +2 -2
  2. package/dist/experimental/evaluation-client.d.ts +1 -1
  3. package/dist/experimental/evaluation.d.ts +20 -20
  4. package/dist/experimental/realtime.d.ts +47 -0
  5. package/dist/experimental/realtime.js +99 -0
  6. package/dist/experimental/system-one.d.ts +1 -1
  7. package/dist/experimental.d.ts +2 -0
  8. package/dist/experimental.js +1 -0
  9. package/dist/image-client.d.ts +8 -8
  10. package/dist/image.d.ts +593 -437
  11. package/dist/llm.d.ts +51 -51
  12. package/dist/media-client.d.ts +1 -1
  13. package/dist/media.d.ts +4 -4
  14. package/dist/promise.d.ts +199 -198
  15. package/dist/protocols/alibaba-chat.d.ts +81 -82
  16. package/dist/protocols/alibaba-chat.js +0 -1
  17. package/dist/protocols/alibaba-messages.d.ts +99 -99
  18. package/dist/protocols/alibaba-responses.d.ts +120 -120
  19. package/dist/protocols/anthropic-messages.d.ts +187 -187
  20. package/dist/protocols/anthropic-messages.js +3 -2
  21. package/dist/protocols/assemblyai-transcription.d.ts +1 -1
  22. package/dist/protocols/bedrock-converse.d.ts +75 -79
  23. package/dist/protocols/bfl-images.d.ts +1 -1
  24. package/dist/protocols/cartesia-speech.d.ts +17 -17
  25. package/dist/protocols/cohere-chat.d.ts +26 -23
  26. package/dist/protocols/cohere-chat.js +22 -1
  27. package/dist/protocols/deepgram-speech.d.ts +17 -17
  28. package/dist/protocols/deepgram-transcription.d.ts +1 -1
  29. package/dist/protocols/elevenlabs-speech.d.ts +17 -17
  30. package/dist/protocols/elevenlabs-transcription.d.ts +1 -1
  31. package/dist/protocols/fal-images.d.ts +1 -1
  32. package/dist/protocols/fal-video.d.ts +1 -1
  33. package/dist/protocols/gemini.d.ts +55 -55
  34. package/dist/protocols/gemini.js +11 -1
  35. package/dist/protocols/google-images.d.ts +1 -1
  36. package/dist/protocols/google-interactions.d.ts +64 -62
  37. package/dist/protocols/google-interactions.js +19 -1
  38. package/dist/protocols/google-speech.d.ts +17 -17
  39. package/dist/protocols/google-transcription.d.ts +47 -47
  40. package/dist/protocols/google-video.d.ts +1 -1
  41. package/dist/protocols/meta-messages.d.ts +121 -121
  42. package/dist/protocols/meta-responses.d.ts +201 -201
  43. package/dist/protocols/mistral-chat.d.ts +45 -45
  44. package/dist/protocols/open-responses-channel.d.ts +1 -1
  45. package/dist/protocols/open-responses.d.ts +584 -450
  46. package/dist/protocols/open-responses.js +27 -35
  47. package/dist/protocols/openai-chat.d.ts +248 -248
  48. package/dist/protocols/openai-chat.js +11 -42
  49. package/dist/protocols/openai-compatible-chat.d.ts +32 -32
  50. package/dist/protocols/openai-compatible-responses.d.ts +88 -88
  51. package/dist/protocols/openai-images.d.ts +17 -17
  52. package/dist/protocols/openai-responses.d.ts +567 -567
  53. package/dist/protocols/openai-responses.js +1 -1
  54. package/dist/protocols/openai-speech.d.ts +17 -17
  55. package/dist/protocols/openai-transcription.d.ts +47 -47
  56. package/dist/protocols/replicate-images.d.ts +1 -1
  57. package/dist/protocols/runway-video.d.ts +1 -1
  58. package/dist/protocols/shared.d.ts +12 -1
  59. package/dist/protocols/shared.js +17 -1
  60. package/dist/protocols/stability-images.d.ts +2 -2
  61. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  62. package/dist/protocols/utils/bedrock-media.d.ts +4 -4
  63. package/dist/protocols/utils/openai-options.d.ts +1 -1
  64. package/dist/protocols/utils/speech-stream.d.ts +1 -1
  65. package/dist/protocols/utils/tool-schema.d.ts +10 -5
  66. package/dist/protocols/utils/tool-stream.d.ts +152 -152
  67. package/dist/protocols/venice-chat.d.ts +109 -110
  68. package/dist/protocols/venice-chat.js +0 -1
  69. package/dist/protocols/xai-images.d.ts +1 -1
  70. package/dist/protocols/xai-responses.d.ts +79 -79
  71. package/dist/protocols/xai-video.d.ts +1 -1
  72. package/dist/protocols/zai-chat.d.ts +77 -78
  73. package/dist/protocols/zai-chat.js +0 -1
  74. package/dist/protocols/zai-images.d.ts +1 -1
  75. package/dist/protocols/zai-messages.d.ts +97 -97
  76. package/dist/providers/alibaba.d.ts +222 -283
  77. package/dist/providers/amazon-bedrock-mantle.d.ts +291 -298
  78. package/dist/providers/amazon-bedrock.d.ts +22 -28
  79. package/dist/providers/anthropic-compatible.d.ts +86 -90
  80. package/dist/providers/anthropic.d.ts +86 -90
  81. package/dist/providers/assemblyai.d.ts +2 -6
  82. package/dist/providers/azure.d.ts +228 -238
  83. package/dist/providers/baseten.d.ts +66 -70
  84. package/dist/providers/black-forest-labs.d.ts +2 -6
  85. package/dist/providers/cartesia.d.ts +2 -6
  86. package/dist/providers/cerebras.d.ts +66 -70
  87. package/dist/providers/cerebras.js +0 -1
  88. package/dist/providers/cloudflare-ai-gateway.d.ts +352 -356
  89. package/dist/providers/cloudflare-workers-ai.d.ts +66 -70
  90. package/dist/providers/cohere.d.ts +122 -132
  91. package/dist/providers/cohere.js +0 -2
  92. package/dist/providers/deepgram.d.ts +2 -7
  93. package/dist/providers/deepinfra.d.ts +66 -70
  94. package/dist/providers/deepinfra.js +0 -1
  95. package/dist/providers/deepseek.d.ts +66 -70
  96. package/dist/providers/deepseek.js +1 -1
  97. package/dist/providers/digitalocean.d.ts +137 -141
  98. package/dist/providers/elevenlabs.d.ts +2 -7
  99. package/dist/providers/fal.d.ts +2 -7
  100. package/dist/providers/fireworks.d.ts +66 -70
  101. package/dist/providers/google-vertex-chat.d.ts +34 -38
  102. package/dist/providers/google-vertex-interactions.d.ts +31 -41
  103. package/dist/providers/google-vertex-messages.d.ts +81 -85
  104. package/dist/providers/google-vertex-mistral.d.ts +23 -27
  105. package/dist/providers/google-vertex-responses.d.ts +90 -94
  106. package/dist/providers/google-vertex.d.ts +26 -30
  107. package/dist/providers/google.d.ts +94 -109
  108. package/dist/providers/groq.d.ts +111 -115
  109. package/dist/providers/groq.js +0 -1
  110. package/dist/providers/meta.d.ts +309 -317
  111. package/dist/providers/meta.js +1 -1
  112. package/dist/providers/minimax.d.ts +296 -303
  113. package/dist/providers/minimax.js +1 -1
  114. package/dist/providers/mistral.d.ts +22 -26
  115. package/dist/providers/moonshot.d.ts +296 -303
  116. package/dist/providers/moonshot.js +0 -1
  117. package/dist/providers/openai-compatible-responses.d.ts +90 -94
  118. package/dist/providers/openai-compatible.d.ts +34 -38
  119. package/dist/providers/openai.d.ts +93 -108
  120. package/dist/providers/opencode.d.ts +2 -8
  121. package/dist/providers/openrouter.d.ts +137 -144
  122. package/dist/providers/replicate.d.ts +2 -6
  123. package/dist/providers/runway.d.ts +2 -6
  124. package/dist/providers/stability.d.ts +2 -7
  125. package/dist/providers/togetherai.d.ts +66 -70
  126. package/dist/providers/togetherai.js +1 -1
  127. package/dist/providers/typesafe-ai.d.ts +2 -8
  128. package/dist/providers/venice.d.ts +58 -63
  129. package/dist/providers/vercel-ai-gateway.d.ts +2 -12
  130. package/dist/providers/xai.d.ts +38 -50
  131. package/dist/providers/zai-coding-plan.d.ts +206 -213
  132. package/dist/providers/zai.d.ts +40 -46
  133. package/dist/route/client.d.ts +51 -51
  134. package/dist/route/media-protocol.d.ts +1 -1
  135. package/dist/route/transport/http.d.ts +1 -1
  136. package/dist/route/transport/websocket.d.ts +8 -8
  137. package/dist/schema/errors.d.ts +19 -19
  138. package/dist/schema/events.d.ts +3090 -3288
  139. package/dist/schema/messages.d.ts +8 -7
  140. package/dist/schema/options.d.ts +2 -1
  141. package/dist/schema/options.js +2 -1
  142. package/dist/speech-client.d.ts +8 -8
  143. package/dist/speech.d.ts +434 -398
  144. package/dist/testing.d.ts +338 -338
  145. package/dist/tool-runtime.d.ts +1 -1
  146. package/dist/transcription-client.d.ts +23 -23
  147. package/dist/transcription.d.ts +562 -646
  148. package/dist/utils/sanitize.d.ts +4 -0
  149. package/dist/utils/sanitize.js +23 -6
  150. package/dist/video-client.d.ts +8 -8
  151. package/dist/video.d.ts +416 -372
  152. package/package.json +6 -6
@@ -76,32 +76,20 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
76
76
  events?: undefined;
77
77
  } | {
78
78
  tools: Partial<Record<K, PendingTool>>;
79
- events: readonly (({
80
- readonly type: "compaction";
81
- readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
82
- readonly id?: string | undefined;
83
- readonly text?: string | null | undefined;
84
- readonly encrypted?: string | undefined;
85
- } & ({
86
- readonly encrypted: string;
87
- readonly text?: never;
88
- } | {
89
- readonly text: string | null;
90
- readonly encrypted?: never;
91
- })) | {
79
+ events: readonly ({
92
80
  readonly type: "step-start";
93
81
  readonly index: number;
94
82
  } | {
95
- readonly id: string;
96
83
  readonly type: "text-start";
84
+ readonly id: string;
97
85
  readonly providerMetadata?: {
98
86
  readonly [x: string]: {
99
87
  readonly [x: string]: unknown;
100
88
  };
101
89
  } | undefined;
102
90
  } | {
103
- readonly id: string;
104
91
  readonly type: "text-delta";
92
+ readonly id: string;
105
93
  readonly text: string;
106
94
  readonly providerMetadata?: {
107
95
  readonly [x: string]: {
@@ -109,8 +97,8 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
109
97
  };
110
98
  } | undefined;
111
99
  } | {
112
- readonly id: string;
113
100
  readonly type: "text-end";
101
+ readonly id: string;
114
102
  readonly text?: string | undefined;
115
103
  readonly providerMetadata?: {
116
104
  readonly [x: string]: {
@@ -118,16 +106,16 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
118
106
  };
119
107
  } | undefined;
120
108
  } | {
121
- readonly id: string;
122
109
  readonly type: "reasoning-start";
110
+ readonly id: string;
123
111
  readonly providerMetadata?: {
124
112
  readonly [x: string]: {
125
113
  readonly [x: string]: unknown;
126
114
  };
127
115
  } | undefined;
128
116
  } | {
129
- readonly id: string;
130
117
  readonly type: "reasoning-delta";
118
+ readonly id: string;
131
119
  readonly text: string;
132
120
  readonly providerMetadata?: {
133
121
  readonly [x: string]: {
@@ -135,8 +123,8 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
135
123
  };
136
124
  } | undefined;
137
125
  } | {
138
- readonly id: string;
139
126
  readonly type: "reasoning-end";
127
+ readonly id: string;
140
128
  readonly text?: string | undefined;
141
129
  readonly providerMetadata?: {
142
130
  readonly [x: string]: {
@@ -144,55 +132,56 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
144
132
  };
145
133
  } | undefined;
146
134
  } | {
147
- readonly id: string;
148
135
  readonly type: "tool-input-start";
136
+ readonly id: string;
149
137
  readonly name: string;
138
+ readonly namespace?: string | undefined;
139
+ readonly providerExecuted?: boolean | undefined;
150
140
  readonly providerMetadata?: {
151
141
  readonly [x: string]: {
152
142
  readonly [x: string]: unknown;
153
143
  };
154
144
  } | undefined;
155
- readonly namespace?: string | undefined;
156
- readonly providerExecuted?: boolean | undefined;
157
145
  } | {
158
- readonly id: string;
159
146
  readonly type: "tool-input-delta";
147
+ readonly id: string;
160
148
  readonly name: string;
149
+ readonly namespace?: string | undefined;
161
150
  readonly text: string;
162
151
  readonly input?: unknown;
163
- readonly namespace?: string | undefined;
164
152
  } | {
165
- readonly id: string;
166
153
  readonly type: "tool-input-end";
154
+ readonly id: string;
167
155
  readonly name: string;
156
+ readonly namespace?: string | undefined;
168
157
  readonly providerMetadata?: {
169
158
  readonly [x: string]: {
170
159
  readonly [x: string]: unknown;
171
160
  };
172
161
  } | undefined;
173
- readonly namespace?: string | undefined;
174
162
  } | {
175
- readonly id: string;
176
163
  readonly type: "tool-input-error";
164
+ readonly id: string;
177
165
  readonly name: string;
178
- readonly raw: string;
179
166
  readonly namespace?: string | undefined;
167
+ readonly raw: string;
180
168
  } | {
181
- readonly id: string;
182
169
  readonly type: "tool-call";
170
+ readonly id: string;
183
171
  readonly name: string;
172
+ readonly namespace?: string | undefined;
184
173
  readonly input: unknown;
174
+ readonly providerExecuted?: boolean | undefined;
185
175
  readonly providerMetadata?: {
186
176
  readonly [x: string]: {
187
177
  readonly [x: string]: unknown;
188
178
  };
189
179
  } | undefined;
190
- readonly namespace?: string | undefined;
191
- readonly providerExecuted?: boolean | undefined;
192
180
  } | {
193
- readonly id: string;
194
181
  readonly type: "tool-result";
182
+ readonly id: string;
195
183
  readonly name: string;
184
+ readonly namespace?: string | undefined;
196
185
  readonly result: {
197
186
  readonly type: "json";
198
187
  readonly value: unknown;
@@ -226,28 +215,19 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
226
215
  readonly name?: string | undefined;
227
216
  })[];
228
217
  } | undefined;
218
+ readonly providerExecuted?: boolean | undefined;
229
219
  readonly providerMetadata?: {
230
220
  readonly [x: string]: {
231
221
  readonly [x: string]: unknown;
232
222
  };
233
223
  } | undefined;
234
- readonly namespace?: string | undefined;
235
- readonly providerExecuted?: boolean | undefined;
236
224
  } | {
237
- readonly id: string;
238
225
  readonly type: "tool-error";
239
- readonly message: string;
226
+ readonly id: string;
240
227
  readonly name: string;
241
- readonly error?: unknown;
242
- readonly providerMetadata?: {
243
- readonly [x: string]: {
244
- readonly [x: string]: unknown;
245
- };
246
- } | undefined;
247
228
  readonly namespace?: string | undefined;
248
- } | {
249
- readonly type: "media";
250
- readonly media: import("../../media.js").Asset;
229
+ readonly message: string;
230
+ readonly error?: unknown;
251
231
  readonly providerMetadata?: {
252
232
  readonly [x: string]: {
253
233
  readonly [x: string]: unknown;
@@ -255,33 +235,41 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
255
235
  } | undefined;
256
236
  } | {
257
237
  readonly type: "step-finish";
238
+ readonly index: number;
258
239
  readonly reason: {
259
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
240
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
260
241
  readonly raw?: string | undefined;
261
242
  readonly category?: string | undefined;
262
243
  readonly explanation?: string | undefined;
263
244
  };
264
- readonly index: number;
245
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
265
246
  readonly providerMetadata?: {
266
247
  readonly [x: string]: {
267
248
  readonly [x: string]: unknown;
268
249
  };
269
250
  } | undefined;
270
- readonly usage?: import("../../schema/events.js").Usage | undefined;
271
251
  } | {
272
252
  readonly type: "finish";
273
253
  readonly reason: {
274
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
254
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
275
255
  readonly raw?: string | undefined;
276
256
  readonly category?: string | undefined;
277
257
  readonly explanation?: string | undefined;
278
258
  };
259
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
260
+ readonly providerMetadata?: {
261
+ readonly [x: string]: {
262
+ readonly [x: string]: unknown;
263
+ };
264
+ } | undefined;
265
+ } | {
266
+ readonly type: "media";
267
+ readonly media: import("../../media.js").Asset;
279
268
  readonly providerMetadata?: {
280
269
  readonly [x: string]: {
281
270
  readonly [x: string]: unknown;
282
271
  };
283
272
  } | undefined;
284
- readonly usage?: import("../../schema/events.js").Usage | undefined;
285
273
  } | {
286
274
  readonly type: "provider-error";
287
275
  readonly message: string;
@@ -291,44 +279,44 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
291
279
  readonly [x: string]: unknown;
292
280
  };
293
281
  } | undefined;
294
- })[];
295
- }, AIError, never>;
296
- /**
297
- * Finalize one pending tool call with an authoritative final input string.
298
- * OpenAI Responses can send accumulated deltas and then repeat the completed
299
- * arguments on `response.output_item.done`; the final value wins.
300
- */
301
- export declare const finishWithInput: <K extends StreamKey>(route: string, tools: State<K>, key: K, input: string) => Effect.Effect<{
302
- tools: Partial<Record<K, PendingTool>>;
303
- events?: undefined;
304
- } | {
305
- tools: Partial<Record<K, PendingTool>>;
306
- events: readonly (({
282
+ } | ({
307
283
  readonly type: "compaction";
308
284
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
309
285
  readonly id?: string | undefined;
310
- readonly text?: string | null | undefined;
311
286
  readonly encrypted?: string | undefined;
287
+ readonly text?: string | null | undefined;
312
288
  } & ({
313
289
  readonly encrypted: string;
314
290
  readonly text?: never;
315
291
  } | {
316
292
  readonly text: string | null;
317
293
  readonly encrypted?: never;
318
- })) | {
294
+ })))[];
295
+ }, AIError, never>;
296
+ /**
297
+ * Finalize one pending tool call with an authoritative final input string.
298
+ * OpenAI Responses can send accumulated deltas and then repeat the completed
299
+ * arguments on `response.output_item.done`; the final value wins.
300
+ */
301
+ export declare const finishWithInput: <K extends StreamKey>(route: string, tools: State<K>, key: K, input: string) => Effect.Effect<{
302
+ events?: undefined;
303
+ tools: Partial<Record<K, PendingTool>>;
304
+ } | {
305
+ tools: Partial<Record<K, PendingTool>>;
306
+ events: readonly ({
319
307
  readonly type: "step-start";
320
308
  readonly index: number;
321
309
  } | {
322
- readonly id: string;
323
310
  readonly type: "text-start";
311
+ readonly id: string;
324
312
  readonly providerMetadata?: {
325
313
  readonly [x: string]: {
326
314
  readonly [x: string]: unknown;
327
315
  };
328
316
  } | undefined;
329
317
  } | {
330
- readonly id: string;
331
318
  readonly type: "text-delta";
319
+ readonly id: string;
332
320
  readonly text: string;
333
321
  readonly providerMetadata?: {
334
322
  readonly [x: string]: {
@@ -336,8 +324,8 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
336
324
  };
337
325
  } | undefined;
338
326
  } | {
339
- readonly id: string;
340
327
  readonly type: "text-end";
328
+ readonly id: string;
341
329
  readonly text?: string | undefined;
342
330
  readonly providerMetadata?: {
343
331
  readonly [x: string]: {
@@ -345,16 +333,16 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
345
333
  };
346
334
  } | undefined;
347
335
  } | {
348
- readonly id: string;
349
336
  readonly type: "reasoning-start";
337
+ readonly id: string;
350
338
  readonly providerMetadata?: {
351
339
  readonly [x: string]: {
352
340
  readonly [x: string]: unknown;
353
341
  };
354
342
  } | undefined;
355
343
  } | {
356
- readonly id: string;
357
344
  readonly type: "reasoning-delta";
345
+ readonly id: string;
358
346
  readonly text: string;
359
347
  readonly providerMetadata?: {
360
348
  readonly [x: string]: {
@@ -362,8 +350,8 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
362
350
  };
363
351
  } | undefined;
364
352
  } | {
365
- readonly id: string;
366
353
  readonly type: "reasoning-end";
354
+ readonly id: string;
367
355
  readonly text?: string | undefined;
368
356
  readonly providerMetadata?: {
369
357
  readonly [x: string]: {
@@ -371,55 +359,56 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
371
359
  };
372
360
  } | undefined;
373
361
  } | {
374
- readonly id: string;
375
362
  readonly type: "tool-input-start";
363
+ readonly id: string;
376
364
  readonly name: string;
365
+ readonly namespace?: string | undefined;
366
+ readonly providerExecuted?: boolean | undefined;
377
367
  readonly providerMetadata?: {
378
368
  readonly [x: string]: {
379
369
  readonly [x: string]: unknown;
380
370
  };
381
371
  } | undefined;
382
- readonly namespace?: string | undefined;
383
- readonly providerExecuted?: boolean | undefined;
384
372
  } | {
385
- readonly id: string;
386
373
  readonly type: "tool-input-delta";
374
+ readonly id: string;
387
375
  readonly name: string;
376
+ readonly namespace?: string | undefined;
388
377
  readonly text: string;
389
378
  readonly input?: unknown;
390
- readonly namespace?: string | undefined;
391
379
  } | {
392
- readonly id: string;
393
380
  readonly type: "tool-input-end";
381
+ readonly id: string;
394
382
  readonly name: string;
383
+ readonly namespace?: string | undefined;
395
384
  readonly providerMetadata?: {
396
385
  readonly [x: string]: {
397
386
  readonly [x: string]: unknown;
398
387
  };
399
388
  } | undefined;
400
- readonly namespace?: string | undefined;
401
389
  } | {
402
- readonly id: string;
403
390
  readonly type: "tool-input-error";
391
+ readonly id: string;
404
392
  readonly name: string;
405
- readonly raw: string;
406
393
  readonly namespace?: string | undefined;
394
+ readonly raw: string;
407
395
  } | {
408
- readonly id: string;
409
396
  readonly type: "tool-call";
397
+ readonly id: string;
410
398
  readonly name: string;
399
+ readonly namespace?: string | undefined;
411
400
  readonly input: unknown;
401
+ readonly providerExecuted?: boolean | undefined;
412
402
  readonly providerMetadata?: {
413
403
  readonly [x: string]: {
414
404
  readonly [x: string]: unknown;
415
405
  };
416
406
  } | undefined;
417
- readonly namespace?: string | undefined;
418
- readonly providerExecuted?: boolean | undefined;
419
407
  } | {
420
- readonly id: string;
421
408
  readonly type: "tool-result";
409
+ readonly id: string;
422
410
  readonly name: string;
411
+ readonly namespace?: string | undefined;
423
412
  readonly result: {
424
413
  readonly type: "json";
425
414
  readonly value: unknown;
@@ -453,28 +442,19 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
453
442
  readonly name?: string | undefined;
454
443
  })[];
455
444
  } | undefined;
445
+ readonly providerExecuted?: boolean | undefined;
456
446
  readonly providerMetadata?: {
457
447
  readonly [x: string]: {
458
448
  readonly [x: string]: unknown;
459
449
  };
460
450
  } | undefined;
461
- readonly namespace?: string | undefined;
462
- readonly providerExecuted?: boolean | undefined;
463
451
  } | {
464
- readonly id: string;
465
452
  readonly type: "tool-error";
466
- readonly message: string;
453
+ readonly id: string;
467
454
  readonly name: string;
468
- readonly error?: unknown;
469
- readonly providerMetadata?: {
470
- readonly [x: string]: {
471
- readonly [x: string]: unknown;
472
- };
473
- } | undefined;
474
455
  readonly namespace?: string | undefined;
475
- } | {
476
- readonly type: "media";
477
- readonly media: import("../../media.js").Asset;
456
+ readonly message: string;
457
+ readonly error?: unknown;
478
458
  readonly providerMetadata?: {
479
459
  readonly [x: string]: {
480
460
  readonly [x: string]: unknown;
@@ -482,33 +462,41 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
482
462
  } | undefined;
483
463
  } | {
484
464
  readonly type: "step-finish";
465
+ readonly index: number;
485
466
  readonly reason: {
486
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
467
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
487
468
  readonly raw?: string | undefined;
488
469
  readonly category?: string | undefined;
489
470
  readonly explanation?: string | undefined;
490
471
  };
491
- readonly index: number;
472
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
492
473
  readonly providerMetadata?: {
493
474
  readonly [x: string]: {
494
475
  readonly [x: string]: unknown;
495
476
  };
496
477
  } | undefined;
497
- readonly usage?: import("../../schema/events.js").Usage | undefined;
498
478
  } | {
499
479
  readonly type: "finish";
500
480
  readonly reason: {
501
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
481
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
502
482
  readonly raw?: string | undefined;
503
483
  readonly category?: string | undefined;
504
484
  readonly explanation?: string | undefined;
505
485
  };
486
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
487
+ readonly providerMetadata?: {
488
+ readonly [x: string]: {
489
+ readonly [x: string]: unknown;
490
+ };
491
+ } | undefined;
492
+ } | {
493
+ readonly type: "media";
494
+ readonly media: import("../../media.js").Asset;
506
495
  readonly providerMetadata?: {
507
496
  readonly [x: string]: {
508
497
  readonly [x: string]: unknown;
509
498
  };
510
499
  } | undefined;
511
- readonly usage?: import("../../schema/events.js").Usage | undefined;
512
500
  } | {
513
501
  readonly type: "provider-error";
514
502
  readonly message: string;
@@ -518,41 +506,41 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
518
506
  readonly [x: string]: unknown;
519
507
  };
520
508
  } | undefined;
521
- })[];
522
- }, AIError, never>;
523
- /**
524
- * Finalize every pending tool call at once. OpenAI Chat has this shape: it does
525
- * not emit per-tool stop events, so all accumulated calls finish independently
526
- * when the choice receives a terminal `finish_reason`.
527
- */
528
- export declare const finishAll: <K extends StreamKey>(route: string, tools: State<K>) => Effect.Effect<{
529
- tools: Partial<Record<K, PendingTool>>;
530
- events: (({
509
+ } | ({
531
510
  readonly type: "compaction";
532
511
  readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
533
512
  readonly id?: string | undefined;
534
- readonly text?: string | null | undefined;
535
513
  readonly encrypted?: string | undefined;
514
+ readonly text?: string | null | undefined;
536
515
  } & ({
537
516
  readonly encrypted: string;
538
517
  readonly text?: never;
539
518
  } | {
540
519
  readonly text: string | null;
541
520
  readonly encrypted?: never;
542
- })) | {
521
+ })))[];
522
+ }, AIError, never>;
523
+ /**
524
+ * Finalize every pending tool call at once. OpenAI Chat has this shape: it does
525
+ * not emit per-tool stop events, so all accumulated calls finish independently
526
+ * when the choice receives a terminal `finish_reason`.
527
+ */
528
+ export declare const finishAll: <K extends StreamKey>(route: string, tools: State<K>) => Effect.Effect<{
529
+ tools: Partial<Record<K, PendingTool>>;
530
+ events: ({
543
531
  readonly type: "step-start";
544
532
  readonly index: number;
545
533
  } | {
546
- readonly id: string;
547
534
  readonly type: "text-start";
535
+ readonly id: string;
548
536
  readonly providerMetadata?: {
549
537
  readonly [x: string]: {
550
538
  readonly [x: string]: unknown;
551
539
  };
552
540
  } | undefined;
553
541
  } | {
554
- readonly id: string;
555
542
  readonly type: "text-delta";
543
+ readonly id: string;
556
544
  readonly text: string;
557
545
  readonly providerMetadata?: {
558
546
  readonly [x: string]: {
@@ -560,8 +548,8 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
560
548
  };
561
549
  } | undefined;
562
550
  } | {
563
- readonly id: string;
564
551
  readonly type: "text-end";
552
+ readonly id: string;
565
553
  readonly text?: string | undefined;
566
554
  readonly providerMetadata?: {
567
555
  readonly [x: string]: {
@@ -569,16 +557,16 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
569
557
  };
570
558
  } | undefined;
571
559
  } | {
572
- readonly id: string;
573
560
  readonly type: "reasoning-start";
561
+ readonly id: string;
574
562
  readonly providerMetadata?: {
575
563
  readonly [x: string]: {
576
564
  readonly [x: string]: unknown;
577
565
  };
578
566
  } | undefined;
579
567
  } | {
580
- readonly id: string;
581
568
  readonly type: "reasoning-delta";
569
+ readonly id: string;
582
570
  readonly text: string;
583
571
  readonly providerMetadata?: {
584
572
  readonly [x: string]: {
@@ -586,8 +574,8 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
586
574
  };
587
575
  } | undefined;
588
576
  } | {
589
- readonly id: string;
590
577
  readonly type: "reasoning-end";
578
+ readonly id: string;
591
579
  readonly text?: string | undefined;
592
580
  readonly providerMetadata?: {
593
581
  readonly [x: string]: {
@@ -595,55 +583,56 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
595
583
  };
596
584
  } | undefined;
597
585
  } | {
598
- readonly id: string;
599
586
  readonly type: "tool-input-start";
587
+ readonly id: string;
600
588
  readonly name: string;
589
+ readonly namespace?: string | undefined;
590
+ readonly providerExecuted?: boolean | undefined;
601
591
  readonly providerMetadata?: {
602
592
  readonly [x: string]: {
603
593
  readonly [x: string]: unknown;
604
594
  };
605
595
  } | undefined;
606
- readonly namespace?: string | undefined;
607
- readonly providerExecuted?: boolean | undefined;
608
596
  } | {
609
- readonly id: string;
610
597
  readonly type: "tool-input-delta";
598
+ readonly id: string;
611
599
  readonly name: string;
600
+ readonly namespace?: string | undefined;
612
601
  readonly text: string;
613
602
  readonly input?: unknown;
614
- readonly namespace?: string | undefined;
615
603
  } | {
616
- readonly id: string;
617
604
  readonly type: "tool-input-end";
605
+ readonly id: string;
618
606
  readonly name: string;
607
+ readonly namespace?: string | undefined;
619
608
  readonly providerMetadata?: {
620
609
  readonly [x: string]: {
621
610
  readonly [x: string]: unknown;
622
611
  };
623
612
  } | undefined;
624
- readonly namespace?: string | undefined;
625
613
  } | {
626
- readonly id: string;
627
614
  readonly type: "tool-input-error";
615
+ readonly id: string;
628
616
  readonly name: string;
629
- readonly raw: string;
630
617
  readonly namespace?: string | undefined;
618
+ readonly raw: string;
631
619
  } | {
632
- readonly id: string;
633
620
  readonly type: "tool-call";
621
+ readonly id: string;
634
622
  readonly name: string;
623
+ readonly namespace?: string | undefined;
635
624
  readonly input: unknown;
625
+ readonly providerExecuted?: boolean | undefined;
636
626
  readonly providerMetadata?: {
637
627
  readonly [x: string]: {
638
628
  readonly [x: string]: unknown;
639
629
  };
640
630
  } | undefined;
641
- readonly namespace?: string | undefined;
642
- readonly providerExecuted?: boolean | undefined;
643
631
  } | {
644
- readonly id: string;
645
632
  readonly type: "tool-result";
633
+ readonly id: string;
646
634
  readonly name: string;
635
+ readonly namespace?: string | undefined;
647
636
  readonly result: {
648
637
  readonly type: "json";
649
638
  readonly value: unknown;
@@ -677,28 +666,19 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
677
666
  readonly name?: string | undefined;
678
667
  })[];
679
668
  } | undefined;
669
+ readonly providerExecuted?: boolean | undefined;
680
670
  readonly providerMetadata?: {
681
671
  readonly [x: string]: {
682
672
  readonly [x: string]: unknown;
683
673
  };
684
674
  } | undefined;
685
- readonly namespace?: string | undefined;
686
- readonly providerExecuted?: boolean | undefined;
687
675
  } | {
688
- readonly id: string;
689
676
  readonly type: "tool-error";
690
- readonly message: string;
677
+ readonly id: string;
691
678
  readonly name: string;
692
- readonly error?: unknown;
693
- readonly providerMetadata?: {
694
- readonly [x: string]: {
695
- readonly [x: string]: unknown;
696
- };
697
- } | undefined;
698
679
  readonly namespace?: string | undefined;
699
- } | {
700
- readonly type: "media";
701
- readonly media: import("../../media.js").Asset;
680
+ readonly message: string;
681
+ readonly error?: unknown;
702
682
  readonly providerMetadata?: {
703
683
  readonly [x: string]: {
704
684
  readonly [x: string]: unknown;
@@ -706,33 +686,41 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
706
686
  } | undefined;
707
687
  } | {
708
688
  readonly type: "step-finish";
689
+ readonly index: number;
709
690
  readonly reason: {
710
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
691
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
711
692
  readonly raw?: string | undefined;
712
693
  readonly category?: string | undefined;
713
694
  readonly explanation?: string | undefined;
714
695
  };
715
- readonly index: number;
696
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
716
697
  readonly providerMetadata?: {
717
698
  readonly [x: string]: {
718
699
  readonly [x: string]: unknown;
719
700
  };
720
701
  } | undefined;
721
- readonly usage?: import("../../schema/events.js").Usage | undefined;
722
702
  } | {
723
703
  readonly type: "finish";
724
704
  readonly reason: {
725
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
705
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
726
706
  readonly raw?: string | undefined;
727
707
  readonly category?: string | undefined;
728
708
  readonly explanation?: string | undefined;
729
709
  };
710
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
711
+ readonly providerMetadata?: {
712
+ readonly [x: string]: {
713
+ readonly [x: string]: unknown;
714
+ };
715
+ } | undefined;
716
+ } | {
717
+ readonly type: "media";
718
+ readonly media: import("../../media.js").Asset;
730
719
  readonly providerMetadata?: {
731
720
  readonly [x: string]: {
732
721
  readonly [x: string]: unknown;
733
722
  };
734
723
  } | undefined;
735
- readonly usage?: import("../../schema/events.js").Usage | undefined;
736
724
  } | {
737
725
  readonly type: "provider-error";
738
726
  readonly message: string;
@@ -742,6 +730,18 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
742
730
  readonly [x: string]: unknown;
743
731
  };
744
732
  } | undefined;
745
- })[];
733
+ } | ({
734
+ readonly type: "compaction";
735
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
736
+ readonly id?: string | undefined;
737
+ readonly encrypted?: string | undefined;
738
+ readonly text?: string | null | undefined;
739
+ } & ({
740
+ readonly encrypted: string;
741
+ readonly text?: never;
742
+ } | {
743
+ readonly text: string | null;
744
+ readonly encrypted?: never;
745
+ })))[];
746
746
  }, AIError, never>;
747
747
  export * as ToolStream from "./tool-stream.js";