@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
@@ -58,8 +58,20 @@ export declare const routes: Route<{
58
58
  readonly file_data: string;
59
59
  };
60
60
  })[];
61
+ } | {
62
+ readonly role: "tool";
63
+ readonly tool_call_id: string;
64
+ readonly content: string | readonly {
65
+ readonly type: "text";
66
+ readonly text: string;
67
+ readonly cache_control?: {
68
+ readonly type: "ephemeral";
69
+ readonly ttl?: string | undefined;
70
+ } | undefined;
71
+ }[];
61
72
  } | {
62
73
  readonly [x: string]: unknown;
74
+ readonly role: "assistant";
63
75
  readonly content: string | readonly {
64
76
  readonly type: "text";
65
77
  readonly text: string;
@@ -68,103 +80,85 @@ export declare const routes: Route<{
68
80
  readonly ttl?: string | undefined;
69
81
  } | undefined;
70
82
  }[] | null;
71
- readonly role: "assistant";
72
- readonly reasoning?: string | undefined;
73
- readonly reasoning_content?: string | undefined;
74
- readonly reasoning_text?: string | undefined;
75
83
  readonly tool_calls?: readonly {
84
+ readonly id: string;
85
+ readonly type: "function";
76
86
  readonly function: {
77
87
  readonly name: string;
78
88
  readonly arguments: string;
79
89
  };
80
- readonly id: string;
81
- readonly type: "function";
82
90
  readonly extra_content?: {
83
91
  readonly google: {
84
92
  readonly thought_signature: string;
85
93
  };
86
94
  } | undefined;
87
95
  }[] | undefined;
96
+ readonly reasoning_content?: string | undefined;
97
+ readonly reasoning?: string | undefined;
98
+ readonly reasoning_text?: string | undefined;
88
99
  readonly reasoning_details?: unknown;
89
- } | {
90
- readonly role: "tool";
91
- readonly tool_call_id: string;
92
- readonly content: string | readonly {
93
- readonly type: "text";
94
- readonly text: string;
95
- readonly cache_control?: {
96
- readonly type: "ephemeral";
97
- readonly ttl?: string | undefined;
98
- } | undefined;
99
- }[];
100
100
  })[];
101
- readonly stream: true;
102
- readonly max_completion_tokens?: number | undefined;
103
- readonly max_tokens?: number | undefined;
104
- readonly temperature?: number | undefined;
105
101
  readonly tools?: readonly {
102
+ readonly type: "function";
106
103
  readonly function: {
107
- readonly description: string;
108
104
  readonly name: string;
105
+ readonly description: string;
109
106
  readonly parameters: {
110
107
  readonly [x: string]: unknown;
111
108
  };
112
109
  readonly strict?: boolean | undefined;
113
110
  };
114
- readonly type: "function";
115
111
  readonly cache_control?: {
116
112
  readonly type: "ephemeral";
117
113
  readonly ttl?: string | undefined;
118
114
  } | undefined;
119
115
  }[] | undefined;
120
- readonly stop?: readonly string[] | undefined;
121
- readonly seed?: number | undefined;
122
- readonly thinking?: {
123
- readonly type?: string | undefined;
124
- readonly clear_thinking?: boolean | undefined;
125
- } | undefined;
126
- readonly user_id?: string | undefined;
127
- readonly tool_choice?: "required" | "auto" | "none" | {
116
+ readonly tool_choice?: "auto" | "none" | "required" | {
128
117
  readonly type: "function";
129
118
  readonly function: {
130
119
  readonly name: string;
131
120
  };
132
121
  } | undefined;
133
- readonly top_p?: number | undefined;
134
- readonly frequency_penalty?: number | undefined;
135
- readonly presence_penalty?: number | undefined;
136
- readonly store?: boolean | undefined;
137
- readonly prompt_cache_key?: string | undefined;
138
- readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
122
+ readonly stream: true;
139
123
  readonly stream_options?: {
140
124
  readonly include_usage: boolean;
141
125
  } | undefined;
126
+ readonly store?: boolean | undefined;
127
+ readonly prompt_cache_key?: string | undefined;
128
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
142
129
  readonly tool_stream?: boolean | undefined;
130
+ readonly max_completion_tokens?: number | undefined;
131
+ readonly max_tokens?: number | undefined;
132
+ readonly temperature?: number | undefined;
133
+ readonly top_p?: number | undefined;
134
+ readonly frequency_penalty?: number | undefined;
135
+ readonly presence_penalty?: number | undefined;
136
+ readonly seed?: number | undefined;
137
+ readonly stop?: readonly string[] | undefined;
138
+ readonly thinking?: {
139
+ readonly type?: string | undefined;
140
+ readonly clear_thinking?: boolean | undefined;
141
+ } | undefined;
142
+ readonly do_sample?: boolean | undefined;
143
143
  readonly response_format?: {
144
144
  readonly type: string;
145
145
  } | undefined;
146
146
  readonly request_id?: string | undefined;
147
- readonly do_sample?: boolean | undefined;
147
+ readonly user_id?: string | undefined;
148
148
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
149
149
  export declare const configure: (input?: Config) => {
150
150
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
151
151
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
152
152
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
153
153
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("./zai.js").ZAIImageOptions>;
154
- configure: (input?: Config) => /*elided*/ any;
154
+ configure: typeof configure;
155
155
  };
156
156
  export declare const provider: {
157
157
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
158
158
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
159
159
  chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
160
160
  image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("./zai.js").ZAIImageOptions>;
161
- configure: (input?: Config) => {
162
- id: string & import("effect/Brand").Brand<"AI.ProviderID">;
163
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
164
- chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
165
- image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("./zai.js").ZAIImageOptions>;
166
- configure: /*elided*/ any;
167
- };
161
+ configure: typeof configure;
168
162
  };
169
163
  export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("./zai.js").ZAIImageOptions>;
170
164
  export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<ZAIChat.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
@@ -214,32 +214,20 @@ export declare function stream(request: LLMRequest, options?: StreamOptions): St
214
214
  export declare function generate(request: LLMRequest, options?: StreamOptions): Effect.Effect<LLMResponse, AIError, Service>;
215
215
  export declare function compact(request: CheckpointRequest, options: TriggerCompactOptions): Effect.Effect<CompactionCheckpointResponse, AIError, Service>;
216
216
  export declare function compact(request: CompactionRequest, options?: EndpointCompactOptions): Effect.Effect<CompactionResponse, AIError, Service>;
217
- export declare const streamRequest: (request: LLMRequest, options?: StreamOptions) => Stream.Stream<({
218
- readonly type: "compaction";
219
- readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
220
- readonly id?: string | undefined;
221
- readonly text?: string | null | undefined;
222
- readonly encrypted?: string | undefined;
223
- } & ({
224
- readonly encrypted: string;
225
- readonly text?: never;
226
- } | {
227
- readonly text: string | null;
228
- readonly encrypted?: never;
229
- })) | {
217
+ export declare const streamRequest: (request: LLMRequest, options?: StreamOptions) => Stream.Stream<{
230
218
  readonly type: "step-start";
231
219
  readonly index: number;
232
220
  } | {
233
- readonly id: string;
234
221
  readonly type: "text-start";
222
+ readonly id: string;
235
223
  readonly providerMetadata?: {
236
224
  readonly [x: string]: {
237
225
  readonly [x: string]: unknown;
238
226
  };
239
227
  } | undefined;
240
228
  } | {
241
- readonly id: string;
242
229
  readonly type: "text-delta";
230
+ readonly id: string;
243
231
  readonly text: string;
244
232
  readonly providerMetadata?: {
245
233
  readonly [x: string]: {
@@ -247,8 +235,8 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
247
235
  };
248
236
  } | undefined;
249
237
  } | {
250
- readonly id: string;
251
238
  readonly type: "text-end";
239
+ readonly id: string;
252
240
  readonly text?: string | undefined;
253
241
  readonly providerMetadata?: {
254
242
  readonly [x: string]: {
@@ -256,16 +244,16 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
256
244
  };
257
245
  } | undefined;
258
246
  } | {
259
- readonly id: string;
260
247
  readonly type: "reasoning-start";
248
+ readonly id: string;
261
249
  readonly providerMetadata?: {
262
250
  readonly [x: string]: {
263
251
  readonly [x: string]: unknown;
264
252
  };
265
253
  } | undefined;
266
254
  } | {
267
- readonly id: string;
268
255
  readonly type: "reasoning-delta";
256
+ readonly id: string;
269
257
  readonly text: string;
270
258
  readonly providerMetadata?: {
271
259
  readonly [x: string]: {
@@ -273,8 +261,8 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
273
261
  };
274
262
  } | undefined;
275
263
  } | {
276
- readonly id: string;
277
264
  readonly type: "reasoning-end";
265
+ readonly id: string;
278
266
  readonly text?: string | undefined;
279
267
  readonly providerMetadata?: {
280
268
  readonly [x: string]: {
@@ -282,55 +270,56 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
282
270
  };
283
271
  } | undefined;
284
272
  } | {
285
- readonly id: string;
286
273
  readonly type: "tool-input-start";
274
+ readonly id: string;
287
275
  readonly name: string;
276
+ readonly namespace?: string | undefined;
277
+ readonly providerExecuted?: boolean | undefined;
288
278
  readonly providerMetadata?: {
289
279
  readonly [x: string]: {
290
280
  readonly [x: string]: unknown;
291
281
  };
292
282
  } | undefined;
293
- readonly namespace?: string | undefined;
294
- readonly providerExecuted?: boolean | undefined;
295
283
  } | {
296
- readonly id: string;
297
284
  readonly type: "tool-input-delta";
285
+ readonly id: string;
298
286
  readonly name: string;
287
+ readonly namespace?: string | undefined;
299
288
  readonly text: string;
300
289
  readonly input?: unknown;
301
- readonly namespace?: string | undefined;
302
290
  } | {
303
- readonly id: string;
304
291
  readonly type: "tool-input-end";
292
+ readonly id: string;
305
293
  readonly name: string;
294
+ readonly namespace?: string | undefined;
306
295
  readonly providerMetadata?: {
307
296
  readonly [x: string]: {
308
297
  readonly [x: string]: unknown;
309
298
  };
310
299
  } | undefined;
311
- readonly namespace?: string | undefined;
312
300
  } | {
313
- readonly id: string;
314
301
  readonly type: "tool-input-error";
302
+ readonly id: string;
315
303
  readonly name: string;
316
- readonly raw: string;
317
304
  readonly namespace?: string | undefined;
305
+ readonly raw: string;
318
306
  } | {
319
- readonly id: string;
320
307
  readonly type: "tool-call";
308
+ readonly id: string;
321
309
  readonly name: string;
310
+ readonly namespace?: string | undefined;
322
311
  readonly input: unknown;
312
+ readonly providerExecuted?: boolean | undefined;
323
313
  readonly providerMetadata?: {
324
314
  readonly [x: string]: {
325
315
  readonly [x: string]: unknown;
326
316
  };
327
317
  } | undefined;
328
- readonly namespace?: string | undefined;
329
- readonly providerExecuted?: boolean | undefined;
330
318
  } | {
331
- readonly id: string;
332
319
  readonly type: "tool-result";
320
+ readonly id: string;
333
321
  readonly name: string;
322
+ readonly namespace?: string | undefined;
334
323
  readonly result: {
335
324
  readonly type: "json";
336
325
  readonly value: unknown;
@@ -364,28 +353,19 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
364
353
  readonly name?: string | undefined;
365
354
  })[];
366
355
  } | undefined;
356
+ readonly providerExecuted?: boolean | undefined;
367
357
  readonly providerMetadata?: {
368
358
  readonly [x: string]: {
369
359
  readonly [x: string]: unknown;
370
360
  };
371
361
  } | undefined;
372
- readonly namespace?: string | undefined;
373
- readonly providerExecuted?: boolean | undefined;
374
362
  } | {
375
- readonly id: string;
376
363
  readonly type: "tool-error";
377
- readonly message: string;
364
+ readonly id: string;
378
365
  readonly name: string;
379
- readonly error?: unknown;
380
- readonly providerMetadata?: {
381
- readonly [x: string]: {
382
- readonly [x: string]: unknown;
383
- };
384
- } | undefined;
385
366
  readonly namespace?: string | undefined;
386
- } | {
387
- readonly type: "media";
388
- readonly media: import("../media.js").Asset;
367
+ readonly message: string;
368
+ readonly error?: unknown;
389
369
  readonly providerMetadata?: {
390
370
  readonly [x: string]: {
391
371
  readonly [x: string]: unknown;
@@ -393,33 +373,41 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
393
373
  } | undefined;
394
374
  } | {
395
375
  readonly type: "step-finish";
376
+ readonly index: number;
396
377
  readonly reason: {
397
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
378
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
398
379
  readonly raw?: string | undefined;
399
380
  readonly category?: string | undefined;
400
381
  readonly explanation?: string | undefined;
401
382
  };
402
- readonly index: number;
383
+ readonly usage?: import("../schema/events.js").Usage | undefined;
403
384
  readonly providerMetadata?: {
404
385
  readonly [x: string]: {
405
386
  readonly [x: string]: unknown;
406
387
  };
407
388
  } | undefined;
408
- readonly usage?: import("../schema/events.js").Usage | undefined;
409
389
  } | {
410
390
  readonly type: "finish";
411
391
  readonly reason: {
412
- readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
392
+ readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
413
393
  readonly raw?: string | undefined;
414
394
  readonly category?: string | undefined;
415
395
  readonly explanation?: string | undefined;
416
396
  };
397
+ readonly usage?: import("../schema/events.js").Usage | undefined;
398
+ readonly providerMetadata?: {
399
+ readonly [x: string]: {
400
+ readonly [x: string]: unknown;
401
+ };
402
+ } | undefined;
403
+ } | {
404
+ readonly type: "media";
405
+ readonly media: import("../media.js").Asset;
417
406
  readonly providerMetadata?: {
418
407
  readonly [x: string]: {
419
408
  readonly [x: string]: unknown;
420
409
  };
421
410
  } | undefined;
422
- readonly usage?: import("../schema/events.js").Usage | undefined;
423
411
  } | {
424
412
  readonly type: "provider-error";
425
413
  readonly message: string;
@@ -429,7 +417,19 @@ export declare const streamRequest: (request: LLMRequest, options?: StreamOption
429
417
  readonly [x: string]: unknown;
430
418
  };
431
419
  } | undefined;
432
- }, AIError, LLMClientService>;
420
+ } | ({
421
+ readonly type: "compaction";
422
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
423
+ readonly id?: string | undefined;
424
+ readonly encrypted?: string | undefined;
425
+ readonly text?: string | null | undefined;
426
+ } & ({
427
+ readonly encrypted: string;
428
+ readonly text?: never;
429
+ } | {
430
+ readonly text: string | null;
431
+ readonly encrypted?: never;
432
+ })), AIError, LLMClientService>;
433
433
  export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
434
434
  export declare const Route: {
435
435
  readonly make: typeof make;
@@ -154,13 +154,13 @@ export declare const identity: (input: {
154
154
  contentPolicy: (message: string) => AIError;
155
155
  }, AIError, never>;
156
156
  decodeJson: <A>(schema: Schema.Codec<A, unknown>) => (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<{
157
- value: A;
158
157
  body: string;
159
158
  http: HttpContext;
160
159
  invalid: (message: string, cause?: unknown) => AIError;
161
160
  ended: (status: Exclude<Status, "queued" | "running" | "completed">, message: string, failure?: Failure) => AIError;
162
161
  pending: (id: string) => AIError;
163
162
  contentPolicy: (message: string) => AIError;
163
+ value: A;
164
164
  }, AIError, never>;
165
165
  /** Decode a submission response into the token and first snapshot. */
166
166
  decodeStarted: <A, Token>(schema: Schema.Codec<A, unknown>, started: (value: A) => Started<Token>) => (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<Started<Token>, AIError, never>;
@@ -17,7 +17,7 @@ export interface HttpPrepared<Frame> {
17
17
  }
18
18
  export declare const jsonRequestParts: <Body>(input: JsonRequestInput<Body>) => Effect.Effect<{
19
19
  url: string;
20
- jsonBody: Record<string, unknown> | Body;
20
+ jsonBody: Body | Record<string, unknown>;
21
21
  bodyText: string;
22
22
  headers: Headers.Headers;
23
23
  }, AIError, never>;
@@ -39,18 +39,18 @@ export interface JsonTransport<Body, Message> extends Transport<Body, JsonPrepar
39
39
  export declare const json: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
40
40
  export declare const jsonTransport: {
41
41
  readonly id: "websocket-json";
42
- readonly with: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
42
+ readonly with: typeof json;
43
43
  };
44
44
  export declare const WebSocketTransport: {
45
- readonly json: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
45
+ readonly json: typeof json;
46
46
  readonly jsonTransport: {
47
47
  readonly id: "websocket-json";
48
- readonly with: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
48
+ readonly with: typeof json;
49
49
  };
50
50
  readonly direct: Effect.Effect<WebSocketChannelExecutor, never, Socket.WebSocketConstructor>;
51
- readonly makeDirect: (connector: WebSocketConnector) => WebSocketChannelExecutor;
52
- readonly open: (input: WebSocketRequest) => Effect.Effect<WebSocketConnection, AIError, Socket.WebSocketConstructor>;
53
- readonly fromWebSocket: (ws: Socket.WebSocketLike, input: WebSocketRequest) => Effect.Effect<WebSocketConnection, AIError>;
54
- readonly messageText: (message: string | Uint8Array, decoder: TextDecoder) => string;
55
- readonly toWebSocketUrl: (value: string) => Effect.Effect<string, AIError, never>;
51
+ readonly makeDirect: typeof makeDirect;
52
+ readonly open: typeof open;
53
+ readonly fromWebSocket: typeof fromWebSocket;
54
+ readonly messageText: typeof messageText;
55
+ readonly toWebSocketUrl: typeof toWebSocketUrl;
56
56
  };
@@ -18,23 +18,23 @@ declare const HttpRateLimitDetails_base: Schema.Class<HttpRateLimitDetails, Sche
18
18
  export declare class HttpRateLimitDetails extends HttpRateLimitDetails_base {
19
19
  }
20
20
  declare const InvalidRequestError_base: Schema.Class<InvalidRequestError, Schema.TaggedStruct<"InvalidRequest", {
21
- readonly parameter: Schema.optional<Schema.String>;
22
- readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
23
21
  readonly message: Schema.String;
24
22
  readonly body: Schema.optional<Schema.String>;
25
23
  readonly http: Schema.optional<typeof HttpContext>;
26
24
  readonly cause: Schema.optional<Schema.Defect>;
25
+ readonly parameter: Schema.optional<Schema.String>;
26
+ readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
27
27
  }>, import("effect/Cause").YieldableError>;
28
28
  export declare class InvalidRequestError extends InvalidRequestError_base {
29
29
  }
30
30
  declare const UnsupportedOperationError_base: Schema.Class<UnsupportedOperationError, Schema.TaggedStruct<"UnsupportedOperation", {
31
- readonly operation: Schema.String;
32
- readonly provider: Schema.optional<Schema.brand<Schema.String, "AI.ProviderID">>;
33
- readonly route: Schema.optional<Schema.String>;
34
31
  readonly message: Schema.String;
35
32
  readonly body: Schema.optional<Schema.String>;
36
33
  readonly http: Schema.optional<typeof HttpContext>;
37
34
  readonly cause: Schema.optional<Schema.Defect>;
35
+ readonly operation: Schema.String;
36
+ readonly provider: Schema.optional<Schema.brand<Schema.String, "AI.ProviderID">>;
37
+ readonly route: Schema.optional<Schema.String>;
38
38
  }>, import("effect/Cause").YieldableError>;
39
39
  /**
40
40
  * A caller-requested operation the selected route does not implement, such as
@@ -57,13 +57,13 @@ declare const ProviderConfigurationError_base: Schema.Class<ProviderConfiguratio
57
57
  export declare class ProviderConfigurationError extends ProviderConfigurationError_base {
58
58
  }
59
59
  declare const NoRouteError_base: Schema.Class<NoRouteError, Schema.TaggedStruct<"NoRoute", {
60
- readonly route: Schema.String;
61
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
62
- readonly model: Schema.brand<Schema.String, "AI.ModelID">;
63
60
  readonly message: Schema.String;
64
61
  readonly body: Schema.optional<Schema.String>;
65
62
  readonly http: Schema.optional<typeof HttpContext>;
66
63
  readonly cause: Schema.optional<Schema.Defect>;
64
+ readonly route: Schema.String;
65
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
66
+ readonly model: Schema.brand<Schema.String, "AI.ModelID">;
67
67
  }>, import("effect/Cause").YieldableError>;
68
68
  export declare class NoRouteError extends NoRouteError_base {
69
69
  }
@@ -76,12 +76,12 @@ declare const AuthenticationError_base: Schema.Class<AuthenticationError, Schema
76
76
  export declare class AuthenticationError extends AuthenticationError_base {
77
77
  }
78
78
  declare const RateLimitError_base: Schema.Class<RateLimitError, Schema.TaggedStruct<"RateLimit", {
79
- readonly retryAfterMs: Schema.optional<Schema.Number>;
80
- readonly rateLimit: Schema.optional<typeof HttpRateLimitDetails>;
81
79
  readonly message: Schema.String;
82
80
  readonly body: Schema.optional<Schema.String>;
83
81
  readonly http: Schema.optional<typeof HttpContext>;
84
82
  readonly cause: Schema.optional<Schema.Defect>;
83
+ readonly retryAfterMs: Schema.optional<Schema.Number>;
84
+ readonly rateLimit: Schema.optional<typeof HttpRateLimitDetails>;
85
85
  }>, import("effect/Cause").YieldableError>;
86
86
  export declare class RateLimitError extends RateLimitError_base {
87
87
  }
@@ -102,11 +102,11 @@ declare const ContentPolicyError_base: Schema.Class<ContentPolicyError, Schema.T
102
102
  export declare class ContentPolicyError extends ContentPolicyError_base {
103
103
  }
104
104
  declare const ProviderInternalError_base: Schema.Class<ProviderInternalError, Schema.TaggedStruct<"ProviderInternal", {
105
- readonly retryAfterMs: Schema.optional<Schema.Number>;
106
105
  readonly message: Schema.String;
107
106
  readonly body: Schema.optional<Schema.String>;
108
107
  readonly http: Schema.optional<typeof HttpContext>;
109
108
  readonly cause: Schema.optional<Schema.Defect>;
109
+ readonly retryAfterMs: Schema.optional<Schema.Number>;
110
110
  }>, import("effect/Cause").YieldableError>;
111
111
  export declare class ProviderInternalError extends ProviderInternalError_base {
112
112
  }
@@ -115,6 +115,10 @@ export type TransportType = typeof TransportType.Type;
115
115
  export declare const TransportOperation: Schema.Literals<readonly ["request", "read", "write"]>;
116
116
  export type TransportOperation = typeof TransportOperation.Type;
117
117
  declare const TransportError_base: Schema.Class<TransportError, Schema.TaggedStruct<"Transport", {
118
+ readonly message: Schema.String;
119
+ readonly body: Schema.optional<Schema.String>;
120
+ readonly http: Schema.optional<typeof HttpContext>;
121
+ readonly cause: Schema.optional<Schema.Defect>;
118
122
  readonly transport: Schema.Literals<readonly ["http", "websocket"]>;
119
123
  readonly operation: Schema.Literals<readonly ["request", "read", "write"]>;
120
124
  readonly code: Schema.optional<Schema.String>;
@@ -122,20 +126,16 @@ declare const TransportError_base: Schema.Class<TransportError, Schema.TaggedStr
122
126
  readonly phase: Schema.optional<Schema.Literals<readonly ["prepare", "queue", "connect", "send", "receive", "decode", "complete", "fallback", "close"]>>;
123
127
  readonly delivery: Schema.optional<Schema.Literals<readonly ["not-sent", "rejected", "ambiguous", "accepted"]>>;
124
128
  readonly recovery: Schema.optional<Schema.Literals<readonly ["retry-connect", "retry-full", "rotate-and-retry-full", "fallback-http", "fail"]>>;
125
- readonly message: Schema.String;
126
- readonly body: Schema.optional<Schema.String>;
127
- readonly http: Schema.optional<typeof HttpContext>;
128
- readonly cause: Schema.optional<Schema.Defect>;
129
129
  }>, import("effect/Cause").YieldableError>;
130
130
  export declare class TransportError extends TransportError_base {
131
131
  }
132
132
  declare const InvalidProviderOutputError_base: Schema.Class<InvalidProviderOutputError, Schema.TaggedStruct<"InvalidProviderOutput", {
133
- readonly classification: Schema.optional<Schema.Literals<readonly ["incomplete-stream"]>>;
134
- readonly route: Schema.optional<Schema.String>;
135
133
  readonly message: Schema.String;
136
134
  readonly body: Schema.optional<Schema.String>;
137
135
  readonly http: Schema.optional<typeof HttpContext>;
138
136
  readonly cause: Schema.optional<Schema.Defect>;
137
+ readonly classification: Schema.optional<Schema.Literals<readonly ["incomplete-stream"]>>;
138
+ readonly route: Schema.optional<Schema.String>;
139
139
  }>, import("effect/Cause").YieldableError>;
140
140
  export declare class InvalidProviderOutputError extends InvalidProviderOutputError_base {
141
141
  }
@@ -148,11 +148,11 @@ declare const UnknownProviderError_base: Schema.Class<UnknownProviderError, Sche
148
148
  export declare class UnknownProviderError extends UnknownProviderError_base {
149
149
  }
150
150
  declare const TimeoutError_base: Schema.Class<TimeoutError, Schema.TaggedStruct<"Timeout", {
151
- readonly timeoutMs: Schema.optional<Schema.Number>;
152
151
  readonly message: Schema.String;
153
152
  readonly body: Schema.optional<Schema.String>;
154
153
  readonly http: Schema.optional<typeof HttpContext>;
155
154
  readonly cause: Schema.optional<Schema.Defect>;
155
+ readonly timeoutMs: Schema.optional<Schema.Number>;
156
156
  }>, import("effect/Cause").YieldableError>;
157
157
  /** A caller-supplied deadline elapsed, such as `Generation.await` polling past its `Poll.timeout`. */
158
158
  export declare class TimeoutError extends TimeoutError_base {
@@ -163,7 +163,7 @@ declare const AIError_base: Schema.Class<AIError, Schema.TaggedStruct<"AI.Error"
163
163
  readonly reason: Schema.toTaggedUnion<"_tag", readonly [typeof InvalidRequestError, typeof UnsupportedOperationError, typeof NoRouteError, typeof AuthenticationError, typeof RateLimitError, typeof QuotaExceededError, typeof ContentPolicyError, typeof ProviderInternalError, typeof TransportError, typeof InvalidProviderOutputError, typeof UnknownProviderError, typeof TimeoutError]>;
164
164
  }>, import("effect/Cause").YieldableError>;
165
165
  export declare class AIError extends AIError_base {
166
- readonly cause: InvalidRequestError | UnsupportedOperationError | NoRouteError | AuthenticationError | RateLimitError | QuotaExceededError | ContentPolicyError | ProviderInternalError | TransportError | InvalidProviderOutputError | UnknownProviderError | TimeoutError;
166
+ readonly cause: AuthenticationError | ContentPolicyError | InvalidProviderOutputError | InvalidRequestError | NoRouteError | ProviderInternalError | QuotaExceededError | RateLimitError | TimeoutError | TransportError | UnknownProviderError | UnsupportedOperationError;
167
167
  get message(): string;
168
168
  }
169
169
  /**