@opencode/ai 2.0.14 → 2.0.16

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 (208) hide show
  1. package/README.md +399 -56
  2. package/dist/experimental/evaluation-client.d.ts +1 -1
  3. package/dist/experimental/evaluation-client.js +39 -3
  4. package/dist/experimental/evaluation.d.ts +4 -4
  5. package/dist/experimental/evaluation.js +2 -2
  6. package/dist/experimental/system-one.d.ts +3 -3
  7. package/dist/experimental/system-one.js +40 -51
  8. package/dist/generation.d.ts +83 -0
  9. package/dist/generation.js +113 -0
  10. package/dist/image-client.d.ts +16 -7
  11. package/dist/image-client.js +29 -13
  12. package/dist/image.d.ts +1410 -81
  13. package/dist/image.js +97 -67
  14. package/dist/index.d.ts +17 -2
  15. package/dist/index.js +12 -1
  16. package/dist/llm.d.ts +9 -1
  17. package/dist/media-model.d.ts +44 -0
  18. package/dist/media-model.js +49 -0
  19. package/dist/media.d.ts +213 -0
  20. package/dist/media.js +227 -0
  21. package/dist/promise.d.ts +974 -0
  22. package/dist/promise.js +81 -0
  23. package/dist/protocols/alibaba-chat.d.ts +12 -0
  24. package/dist/protocols/alibaba-responses.d.ts +2 -2
  25. package/dist/protocols/anthropic-messages.js +8 -19
  26. package/dist/protocols/assemblyai-transcription.d.ts +40 -0
  27. package/dist/protocols/assemblyai-transcription.js +138 -0
  28. package/dist/protocols/bedrock-converse.d.ts +4 -4
  29. package/dist/protocols/bedrock-converse.js +6 -17
  30. package/dist/protocols/bfl-images.d.ts +32 -0
  31. package/dist/protocols/bfl-images.js +153 -0
  32. package/dist/protocols/cartesia-speech.d.ts +127 -0
  33. package/dist/protocols/cartesia-speech.js +126 -0
  34. package/dist/protocols/deepgram-speech.d.ts +119 -0
  35. package/dist/protocols/deepgram-speech.js +92 -0
  36. package/dist/protocols/deepgram-transcription.d.ts +25 -0
  37. package/dist/protocols/deepgram-transcription.js +129 -0
  38. package/dist/protocols/elevenlabs-speech.d.ts +122 -0
  39. package/dist/protocols/elevenlabs-speech.js +115 -0
  40. package/dist/protocols/fal-images.d.ts +24 -0
  41. package/dist/protocols/fal-images.js +114 -0
  42. package/dist/protocols/fal-video.d.ts +29 -0
  43. package/dist/protocols/fal-video.js +88 -0
  44. package/dist/protocols/gemini.d.ts +30 -9
  45. package/dist/protocols/gemini.js +45 -35
  46. package/dist/protocols/google-images.d.ts +9 -21
  47. package/dist/protocols/google-images.js +158 -133
  48. package/dist/protocols/google-speech.d.ts +130 -0
  49. package/dist/protocols/google-speech.js +84 -0
  50. package/dist/protocols/google-transcription.d.ts +173 -0
  51. package/dist/protocols/google-transcription.js +138 -0
  52. package/dist/protocols/google-video.d.ts +26 -0
  53. package/dist/protocols/google-video.js +158 -0
  54. package/dist/protocols/meta-images.d.ts +7 -12
  55. package/dist/protocols/meta-images.js +85 -66
  56. package/dist/protocols/meta-responses.d.ts +4 -4
  57. package/dist/protocols/meta-responses.js +1 -1
  58. package/dist/protocols/mistral-chat.js +7 -6
  59. package/dist/protocols/open-responses.d.ts +17 -9
  60. package/dist/protocols/open-responses.js +24 -14
  61. package/dist/protocols/openai-chat.d.ts +118 -1
  62. package/dist/protocols/openai-chat.js +125 -44
  63. package/dist/protocols/openai-compatible-chat.d.ts +12 -0
  64. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  65. package/dist/protocols/openai-images.d.ts +128 -18
  66. package/dist/protocols/openai-images.js +177 -154
  67. package/dist/protocols/openai-responses.d.ts +15 -15
  68. package/dist/protocols/openai-responses.js +5 -6
  69. package/dist/protocols/openai-speech.d.ts +116 -0
  70. package/dist/protocols/openai-speech.js +98 -0
  71. package/dist/protocols/openai-transcription.d.ts +207 -0
  72. package/dist/protocols/openai-transcription.js +190 -0
  73. package/dist/protocols/replicate-images.d.ts +28 -0
  74. package/dist/protocols/replicate-images.js +133 -0
  75. package/dist/protocols/runway-video.d.ts +38 -0
  76. package/dist/protocols/runway-video.js +146 -0
  77. package/dist/protocols/shared.d.ts +27 -17
  78. package/dist/protocols/shared.js +52 -35
  79. package/dist/protocols/stability-images.d.ts +38 -0
  80. package/dist/protocols/stability-images.js +148 -0
  81. package/dist/protocols/utils/bedrock-media.d.ts +2 -3
  82. package/dist/protocols/utils/bedrock-media.js +4 -4
  83. package/dist/protocols/utils/fal-queue.d.ts +28 -0
  84. package/dist/protocols/utils/fal-queue.js +69 -0
  85. package/dist/protocols/utils/gemini-generate-content.d.ts +65 -0
  86. package/dist/protocols/utils/gemini-generate-content.js +65 -0
  87. package/dist/protocols/utils/gemini-json-schema.d.ts +3 -0
  88. package/dist/protocols/utils/gemini-json-schema.js +76 -0
  89. package/dist/protocols/utils/media-input.d.ts +18 -0
  90. package/dist/protocols/utils/media-input.js +35 -0
  91. package/dist/protocols/utils/responses-compaction.js +6 -5
  92. package/dist/protocols/utils/speech-stream.d.ts +49 -0
  93. package/dist/protocols/utils/speech-stream.js +67 -0
  94. package/dist/protocols/utils/tool-schema.d.ts +2 -2
  95. package/dist/protocols/utils/tool-schema.js +40 -17
  96. package/dist/protocols/utils/tool-stream.d.ts +27 -3
  97. package/dist/protocols/xai-images.d.ts +9 -15
  98. package/dist/protocols/xai-images.js +75 -84
  99. package/dist/protocols/xai-responses.d.ts +2 -2
  100. package/dist/protocols/xai-video.d.ts +34 -0
  101. package/dist/protocols/xai-video.js +147 -0
  102. package/dist/protocols/zai-chat.d.ts +13 -1
  103. package/dist/protocols/zai-images.d.ts +9 -13
  104. package/dist/protocols/zai-images.js +59 -57
  105. package/dist/provider-error.js +3 -0
  106. package/dist/providers/alibaba.d.ts +14 -2
  107. package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
  108. package/dist/providers/amazon-bedrock.d.ts +2 -2
  109. package/dist/providers/assemblyai.d.ts +25 -0
  110. package/dist/providers/assemblyai.js +29 -0
  111. package/dist/providers/azure.d.ts +18 -6
  112. package/dist/providers/baseten.d.ts +24 -0
  113. package/dist/providers/black-forest-labs.d.ts +25 -0
  114. package/dist/providers/black-forest-labs.js +28 -0
  115. package/dist/providers/cartesia.d.ts +24 -0
  116. package/dist/providers/cartesia.js +22 -0
  117. package/dist/providers/cerebras.d.ts +24 -0
  118. package/dist/providers/cerebras.js +6 -1
  119. package/dist/providers/cloudflare-ai-gateway.d.ts +30 -6
  120. package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
  121. package/dist/providers/deepgram.d.ts +29 -0
  122. package/dist/providers/deepgram.js +31 -0
  123. package/dist/providers/deepinfra.d.ts +24 -0
  124. package/dist/providers/deepinfra.js +6 -1
  125. package/dist/providers/deepseek.d.ts +24 -0
  126. package/dist/providers/elevenlabs.d.ts +24 -0
  127. package/dist/providers/elevenlabs.js +28 -0
  128. package/dist/providers/fal.d.ts +29 -0
  129. package/dist/providers/fal.js +33 -0
  130. package/dist/providers/fireworks.d.ts +24 -0
  131. package/dist/providers/google-vertex-chat.d.ts +12 -0
  132. package/dist/providers/google-vertex-responses.d.ts +2 -2
  133. package/dist/providers/google-vertex.d.ts +10 -3
  134. package/dist/providers/google.d.ts +25 -3
  135. package/dist/providers/google.js +11 -2
  136. package/dist/providers/groq.d.ts +24 -0
  137. package/dist/providers/index.d.ts +10 -0
  138. package/dist/providers/index.js +10 -0
  139. package/dist/providers/meta.d.ts +14 -2
  140. package/dist/providers/minimax.d.ts +14 -2
  141. package/dist/providers/moonshot.d.ts +14 -2
  142. package/dist/providers/moonshot.js +3 -3
  143. package/dist/providers/openai-compatible-responses.d.ts +2 -2
  144. package/dist/providers/openai-compatible.d.ts +12 -0
  145. package/dist/providers/openai.d.ts +25 -3
  146. package/dist/providers/openai.js +10 -1
  147. package/dist/providers/openrouter.d.ts +67 -0
  148. package/dist/providers/openrouter.js +13 -1
  149. package/dist/providers/replicate.d.ts +25 -0
  150. package/dist/providers/replicate.js +22 -0
  151. package/dist/providers/runway.d.ts +24 -0
  152. package/dist/providers/runway.js +22 -0
  153. package/dist/providers/stability.d.ts +28 -0
  154. package/dist/providers/stability.js +23 -0
  155. package/dist/providers/togetherai.d.ts +24 -0
  156. package/dist/providers/vercel-ai-gateway.d.ts +41 -0
  157. package/dist/providers/vercel-ai-gateway.js +85 -0
  158. package/dist/providers/xai.d.ts +17 -0
  159. package/dist/providers/xai.js +5 -2
  160. package/dist/providers/zai-coding-plan.d.ts +15 -3
  161. package/dist/providers/zai.d.ts +13 -1
  162. package/dist/route/auth.d.ts +4 -1
  163. package/dist/route/auth.js +6 -0
  164. package/dist/route/client.d.ts +9 -1
  165. package/dist/route/endpoint.d.ts +10 -10
  166. package/dist/route/executor-service.d.ts +12 -0
  167. package/dist/route/executor-service.js +3 -0
  168. package/dist/route/executor.d.ts +4 -9
  169. package/dist/route/executor.js +3 -3
  170. package/dist/route/framing.d.ts +5 -1
  171. package/dist/route/framing.js +9 -0
  172. package/dist/route/index.d.ts +2 -0
  173. package/dist/route/index.js +2 -0
  174. package/dist/route/media-protocol.d.ts +158 -0
  175. package/dist/route/media-protocol.js +96 -0
  176. package/dist/route/media.d.ts +97 -0
  177. package/dist/route/media.js +236 -0
  178. package/dist/schema/errors.d.ts +13 -3
  179. package/dist/schema/errors.js +7 -0
  180. package/dist/schema/events.d.ts +557 -40
  181. package/dist/schema/events.js +35 -2
  182. package/dist/schema/messages.d.ts +95 -8
  183. package/dist/schema/messages.js +8 -6
  184. package/dist/schema/options.d.ts +6 -3
  185. package/dist/schema/options.js +6 -2
  186. package/dist/speech-client.d.ts +21 -0
  187. package/dist/speech-client.js +25 -0
  188. package/dist/speech.d.ts +1150 -0
  189. package/dist/speech.js +119 -0
  190. package/dist/testing.d.ts +72 -8
  191. package/dist/transcription-client.d.ts +28 -0
  192. package/dist/transcription-client.js +44 -0
  193. package/dist/transcription.d.ts +1504 -0
  194. package/dist/transcription.js +133 -0
  195. package/dist/utils/bytes.d.ts +1 -0
  196. package/dist/utils/bytes.js +10 -0
  197. package/dist/utils/media-type.d.ts +7 -0
  198. package/dist/utils/media-type.js +70 -0
  199. package/dist/utils/sanitize.js +3 -1
  200. package/dist/video-client.d.ts +28 -0
  201. package/dist/video-client.js +40 -0
  202. package/dist/video.d.ts +1359 -0
  203. package/dist/video.js +119 -0
  204. package/package.json +7 -3
  205. package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -2
  206. package/dist/protocols/utils/gemini-tool-schema.js +0 -103
  207. package/dist/protocols/utils/image-input.d.ts +0 -21
  208. package/dist/protocols/utils/image-input.js +0 -20
@@ -0,0 +1,974 @@
1
+ import { Effect, Layer } from "effect";
2
+ import type { AwaitOptions, Snapshot } from "./generation.js";
3
+ import { ImageModel, ImageRequest, type ImageOptions, type ImageRequestInput } from "./image.js";
4
+ import { ImageClient } from "./image-client.js";
5
+ import { LLMClient } from "./route/client.js";
6
+ import { RequestExecutor } from "./route/executor.js";
7
+ import { LanguageModel, LLMRequest } from "./schema/index.js";
8
+ import type { RequestInput } from "./llm.js";
9
+ import { SpeechModel, SpeechRequest, type SpeechRequestInput } from "./speech.js";
10
+ import { SpeechClient } from "./speech-client.js";
11
+ import { TranscriptionModel, TranscriptionRequest, type TranscriptionOptions, type TranscriptionRequestInput } from "./transcription.js";
12
+ import { TranscriptionClient } from "./transcription-client.js";
13
+ import { VideoModel, VideoRequest, type VideoOptions, type VideoRequestInput } from "./video.js";
14
+ import { VideoClient } from "./video-client.js";
15
+ /**
16
+ * Promise-first entrypoint for scripts and non-Effect callers. One `ManagedRuntime` hosts the LLM, image, video, speech,
17
+ * and transcription clients over a request executor; every method runs the corresponding Effect API and rethrows
18
+ * `AIError` unchanged.
19
+ */
20
+ export interface Options {
21
+ /** Executor layer; defaults to `RequestExecutor.fetchLayer`. Inject a recorder or middleware here. */
22
+ readonly layer?: Layer.Layer<RequestExecutor.Service>;
23
+ }
24
+ export interface RunOptions {
25
+ readonly signal?: AbortSignal;
26
+ }
27
+ export type Services = Layer.Success<typeof LLMClient.layer> | Layer.Success<typeof ImageClient.layer> | Layer.Success<typeof VideoClient.layer> | Layer.Success<typeof SpeechClient.layer> | Layer.Success<typeof TranscriptionClient.layer> | RequestExecutor.Service;
28
+ /** Promise view of a `Generation`: its snapshot plus `await`, `refresh`, and `cancel` returning promises. */
29
+ export type GenerationHandle<Response> = Snapshot & {
30
+ /** Serializable JSON; pass it back to `resume` from another process. */
31
+ readonly token: unknown;
32
+ readonly await: (options?: AwaitOptions & RunOptions) => Promise<Response>;
33
+ readonly refresh: (options?: RunOptions) => Promise<GenerationHandle<Response>>;
34
+ readonly cancel: (options?: RunOptions) => Promise<void>;
35
+ };
36
+ export declare const make: (options?: Options) => {
37
+ run: <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) => Promise<A>;
38
+ llm: {
39
+ request: <const SelectedLanguageModel extends LanguageModel>(input: RequestInput<SelectedLanguageModel>) => LLMRequest<SelectedLanguageModel>;
40
+ generate: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: RunOptions) => Promise<import("./index.js").LLMResponse>;
41
+ stream: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: RunOptions) => AsyncIterable<({
42
+ readonly type: "compaction";
43
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
44
+ readonly id?: string | undefined;
45
+ readonly text?: string | null | undefined;
46
+ readonly encrypted?: string | undefined;
47
+ } & ({
48
+ readonly encrypted: string;
49
+ readonly text?: never;
50
+ } | {
51
+ readonly text: string | null;
52
+ readonly encrypted?: never;
53
+ })) | {
54
+ readonly type: "step-start";
55
+ readonly index: number;
56
+ } | {
57
+ readonly id: string;
58
+ readonly type: "text-start";
59
+ readonly providerMetadata?: {
60
+ readonly [x: string]: {
61
+ readonly [x: string]: unknown;
62
+ };
63
+ } | undefined;
64
+ } | {
65
+ readonly id: string;
66
+ readonly type: "text-delta";
67
+ readonly text: string;
68
+ readonly providerMetadata?: {
69
+ readonly [x: string]: {
70
+ readonly [x: string]: unknown;
71
+ };
72
+ } | undefined;
73
+ } | {
74
+ readonly id: string;
75
+ readonly type: "text-end";
76
+ readonly text?: string | undefined;
77
+ readonly providerMetadata?: {
78
+ readonly [x: string]: {
79
+ readonly [x: string]: unknown;
80
+ };
81
+ } | undefined;
82
+ } | {
83
+ readonly id: string;
84
+ readonly type: "reasoning-start";
85
+ readonly providerMetadata?: {
86
+ readonly [x: string]: {
87
+ readonly [x: string]: unknown;
88
+ };
89
+ } | undefined;
90
+ } | {
91
+ readonly id: string;
92
+ readonly type: "reasoning-delta";
93
+ readonly text: string;
94
+ readonly providerMetadata?: {
95
+ readonly [x: string]: {
96
+ readonly [x: string]: unknown;
97
+ };
98
+ } | undefined;
99
+ } | {
100
+ readonly id: string;
101
+ readonly type: "reasoning-end";
102
+ readonly text?: string | undefined;
103
+ readonly providerMetadata?: {
104
+ readonly [x: string]: {
105
+ readonly [x: string]: unknown;
106
+ };
107
+ } | undefined;
108
+ } | {
109
+ readonly id: string;
110
+ readonly type: "tool-input-start";
111
+ readonly name: string;
112
+ readonly providerMetadata?: {
113
+ readonly [x: string]: {
114
+ readonly [x: string]: unknown;
115
+ };
116
+ } | undefined;
117
+ readonly namespace?: string | undefined;
118
+ readonly providerExecuted?: boolean | undefined;
119
+ } | {
120
+ readonly id: string;
121
+ readonly type: "tool-input-delta";
122
+ readonly name: string;
123
+ readonly text: string;
124
+ readonly input?: unknown;
125
+ readonly namespace?: string | undefined;
126
+ } | {
127
+ readonly id: string;
128
+ readonly type: "tool-input-end";
129
+ readonly name: string;
130
+ readonly providerMetadata?: {
131
+ readonly [x: string]: {
132
+ readonly [x: string]: unknown;
133
+ };
134
+ } | undefined;
135
+ readonly namespace?: string | undefined;
136
+ } | {
137
+ readonly id: string;
138
+ readonly type: "tool-input-error";
139
+ readonly name: string;
140
+ readonly raw: string;
141
+ readonly namespace?: string | undefined;
142
+ } | {
143
+ readonly id: string;
144
+ readonly type: "tool-call";
145
+ readonly name: string;
146
+ readonly input: unknown;
147
+ readonly providerMetadata?: {
148
+ readonly [x: string]: {
149
+ readonly [x: string]: unknown;
150
+ };
151
+ } | undefined;
152
+ readonly namespace?: string | undefined;
153
+ readonly providerExecuted?: boolean | undefined;
154
+ } | {
155
+ readonly id: string;
156
+ readonly type: "tool-result";
157
+ readonly name: string;
158
+ readonly result: {
159
+ readonly type: "json";
160
+ readonly value: unknown;
161
+ } | {
162
+ readonly type: "text";
163
+ readonly value: unknown;
164
+ } | {
165
+ readonly type: "error";
166
+ readonly value: unknown;
167
+ } | {
168
+ readonly type: "content";
169
+ readonly value: readonly ({
170
+ readonly type: "text";
171
+ readonly text: string;
172
+ } | {
173
+ readonly type: "file";
174
+ readonly uri: string;
175
+ readonly mime: string;
176
+ readonly name?: string | undefined;
177
+ })[];
178
+ };
179
+ readonly output?: {
180
+ readonly structured: unknown;
181
+ readonly content: readonly ({
182
+ readonly type: "text";
183
+ readonly text: string;
184
+ } | {
185
+ readonly type: "file";
186
+ readonly uri: string;
187
+ readonly mime: string;
188
+ readonly name?: string | undefined;
189
+ })[];
190
+ } | undefined;
191
+ readonly providerMetadata?: {
192
+ readonly [x: string]: {
193
+ readonly [x: string]: unknown;
194
+ };
195
+ } | undefined;
196
+ readonly namespace?: string | undefined;
197
+ readonly providerExecuted?: boolean | undefined;
198
+ } | {
199
+ readonly id: string;
200
+ readonly type: "tool-error";
201
+ readonly name: string;
202
+ readonly message: string;
203
+ readonly error?: unknown;
204
+ readonly providerMetadata?: {
205
+ readonly [x: string]: {
206
+ readonly [x: string]: unknown;
207
+ };
208
+ } | undefined;
209
+ readonly namespace?: string | undefined;
210
+ } | {
211
+ readonly type: "media";
212
+ readonly media: import("./media.js").Asset;
213
+ readonly providerMetadata?: {
214
+ readonly [x: string]: {
215
+ readonly [x: string]: unknown;
216
+ };
217
+ } | undefined;
218
+ } | {
219
+ readonly type: "step-finish";
220
+ readonly reason: {
221
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
222
+ readonly raw?: string | undefined;
223
+ };
224
+ readonly index: number;
225
+ readonly providerMetadata?: {
226
+ readonly [x: string]: {
227
+ readonly [x: string]: unknown;
228
+ };
229
+ } | undefined;
230
+ readonly usage?: import("./index.js").Usage | undefined;
231
+ } | {
232
+ readonly type: "finish";
233
+ readonly reason: {
234
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
235
+ readonly raw?: string | undefined;
236
+ };
237
+ readonly providerMetadata?: {
238
+ readonly [x: string]: {
239
+ readonly [x: string]: unknown;
240
+ };
241
+ } | undefined;
242
+ readonly usage?: import("./index.js").Usage | undefined;
243
+ } | {
244
+ readonly type: "provider-error";
245
+ readonly message: string;
246
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
247
+ readonly providerMetadata?: {
248
+ readonly [x: string]: {
249
+ readonly [x: string]: unknown;
250
+ };
251
+ } | undefined;
252
+ }>;
253
+ };
254
+ image: {
255
+ request: typeof import("./image.js").request;
256
+ generate: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => Promise<import("./image.js").ImageResponse>;
257
+ stream: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
258
+ readonly id: string;
259
+ readonly type: "generation-queued";
260
+ readonly position?: number | undefined;
261
+ } | {
262
+ readonly id: string;
263
+ readonly type: "generation-progress";
264
+ readonly progress?: number | undefined;
265
+ } | {
266
+ readonly type: "image-partial";
267
+ readonly index: number;
268
+ readonly image: import("./media.js").Asset;
269
+ } | {
270
+ readonly type: "image";
271
+ readonly index: number;
272
+ readonly image: import("./media.js").Asset;
273
+ } | {
274
+ readonly type: "finish";
275
+ readonly providerMetadata?: {
276
+ readonly [x: string]: {
277
+ readonly [x: string]: unknown;
278
+ };
279
+ } | undefined;
280
+ readonly usage?: {
281
+ readonly type: "tokens";
282
+ readonly input?: number | undefined;
283
+ readonly output?: number | undefined;
284
+ readonly total?: number | undefined;
285
+ readonly details?: {
286
+ readonly [x: string]: unknown;
287
+ } | undefined;
288
+ } | {
289
+ readonly type: "seconds";
290
+ readonly seconds: number;
291
+ } | {
292
+ readonly type: "characters";
293
+ readonly characters: number;
294
+ } | {
295
+ readonly type: "credits";
296
+ readonly credits: number;
297
+ } | {
298
+ readonly type: "compute";
299
+ readonly seconds: number;
300
+ } | undefined;
301
+ readonly notices?: readonly {
302
+ readonly type: "other" | "moderated" | "filtered";
303
+ readonly message: string;
304
+ readonly providerMetadata?: {
305
+ readonly [x: string]: {
306
+ readonly [x: string]: unknown;
307
+ };
308
+ } | undefined;
309
+ }[] | undefined;
310
+ }>;
311
+ start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
312
+ resume: <Options extends ImageOptions>(model: ImageModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
313
+ };
314
+ video: {
315
+ request: typeof import("./video.js").request;
316
+ start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
317
+ generate: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => Promise<import("./video.js").VideoResponse>;
318
+ resume: <Options extends VideoOptions>(model: VideoModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
319
+ stream: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
320
+ readonly id: string;
321
+ readonly type: "generation-queued";
322
+ readonly position?: number | undefined;
323
+ } | {
324
+ readonly id: string;
325
+ readonly type: "generation-progress";
326
+ readonly progress?: number | undefined;
327
+ } | {
328
+ readonly type: "video";
329
+ readonly index: number;
330
+ readonly video: import("./media.js").Asset;
331
+ } | {
332
+ readonly type: "finish";
333
+ readonly providerMetadata?: {
334
+ readonly [x: string]: {
335
+ readonly [x: string]: unknown;
336
+ };
337
+ } | undefined;
338
+ readonly usage?: {
339
+ readonly type: "tokens";
340
+ readonly input?: number | undefined;
341
+ readonly output?: number | undefined;
342
+ readonly total?: number | undefined;
343
+ readonly details?: {
344
+ readonly [x: string]: unknown;
345
+ } | undefined;
346
+ } | {
347
+ readonly type: "seconds";
348
+ readonly seconds: number;
349
+ } | {
350
+ readonly type: "characters";
351
+ readonly characters: number;
352
+ } | {
353
+ readonly type: "credits";
354
+ readonly credits: number;
355
+ } | {
356
+ readonly type: "compute";
357
+ readonly seconds: number;
358
+ } | undefined;
359
+ readonly notices?: readonly {
360
+ readonly type: "other" | "moderated" | "filtered";
361
+ readonly message: string;
362
+ readonly providerMetadata?: {
363
+ readonly [x: string]: {
364
+ readonly [x: string]: unknown;
365
+ };
366
+ } | undefined;
367
+ }[] | undefined;
368
+ }>;
369
+ };
370
+ speech: {
371
+ request: typeof import("./speech.js").request;
372
+ generate: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => Promise<import("./speech.js").SpeechResponse>;
373
+ stream: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => AsyncIterable<{
374
+ readonly type: "audio-delta";
375
+ readonly chunk: Uint8Array<ArrayBufferLike>;
376
+ } | {
377
+ readonly type: "timestamps";
378
+ readonly items: readonly {
379
+ readonly text: string;
380
+ readonly startSeconds: number;
381
+ readonly endSeconds: number;
382
+ }[];
383
+ } | {
384
+ readonly type: "finish";
385
+ readonly audio: import("./media.js").Asset;
386
+ readonly providerMetadata?: {
387
+ readonly [x: string]: {
388
+ readonly [x: string]: unknown;
389
+ };
390
+ } | undefined;
391
+ readonly usage?: {
392
+ readonly type: "tokens";
393
+ readonly input?: number | undefined;
394
+ readonly output?: number | undefined;
395
+ readonly total?: number | undefined;
396
+ readonly details?: {
397
+ readonly [x: string]: unknown;
398
+ } | undefined;
399
+ } | {
400
+ readonly type: "seconds";
401
+ readonly seconds: number;
402
+ } | {
403
+ readonly type: "characters";
404
+ readonly characters: number;
405
+ } | {
406
+ readonly type: "credits";
407
+ readonly credits: number;
408
+ } | {
409
+ readonly type: "compute";
410
+ readonly seconds: number;
411
+ } | undefined;
412
+ readonly notices?: readonly {
413
+ readonly type: "other" | "moderated" | "filtered";
414
+ readonly message: string;
415
+ readonly providerMetadata?: {
416
+ readonly [x: string]: {
417
+ readonly [x: string]: unknown;
418
+ };
419
+ } | undefined;
420
+ }[] | undefined;
421
+ }>;
422
+ };
423
+ transcription: {
424
+ request: typeof import("./transcription.js").request;
425
+ generate: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => Promise<import("./transcription.js").TranscriptionResponse>;
426
+ stream: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
427
+ readonly id: string;
428
+ readonly type: "generation-queued";
429
+ readonly position?: number | undefined;
430
+ } | {
431
+ readonly id: string;
432
+ readonly type: "generation-progress";
433
+ readonly progress?: number | undefined;
434
+ } | {
435
+ readonly type: "text-delta";
436
+ readonly delta: string;
437
+ } | {
438
+ readonly type: "segment";
439
+ readonly segment: {
440
+ readonly text: string;
441
+ readonly startSeconds: number;
442
+ readonly endSeconds: number;
443
+ readonly speaker?: string | undefined;
444
+ };
445
+ } | {
446
+ readonly type: "finish";
447
+ readonly text: string;
448
+ readonly durationSeconds?: number | undefined;
449
+ readonly providerMetadata?: {
450
+ readonly [x: string]: {
451
+ readonly [x: string]: unknown;
452
+ };
453
+ } | undefined;
454
+ readonly usage?: {
455
+ readonly type: "tokens";
456
+ readonly input?: number | undefined;
457
+ readonly output?: number | undefined;
458
+ readonly total?: number | undefined;
459
+ readonly details?: {
460
+ readonly [x: string]: unknown;
461
+ } | undefined;
462
+ } | {
463
+ readonly type: "seconds";
464
+ readonly seconds: number;
465
+ } | {
466
+ readonly type: "characters";
467
+ readonly characters: number;
468
+ } | {
469
+ readonly type: "credits";
470
+ readonly credits: number;
471
+ } | {
472
+ readonly type: "compute";
473
+ readonly seconds: number;
474
+ } | undefined;
475
+ readonly notices?: readonly {
476
+ readonly type: "other" | "moderated" | "filtered";
477
+ readonly message: string;
478
+ readonly providerMetadata?: {
479
+ readonly [x: string]: {
480
+ readonly [x: string]: unknown;
481
+ };
482
+ } | undefined;
483
+ }[] | undefined;
484
+ readonly language?: string | undefined;
485
+ readonly segments?: readonly {
486
+ readonly text: string;
487
+ readonly startSeconds: number;
488
+ readonly endSeconds: number;
489
+ readonly speaker?: string | undefined;
490
+ }[] | undefined;
491
+ readonly words?: readonly {
492
+ readonly text: string;
493
+ readonly startSeconds: number;
494
+ readonly endSeconds: number;
495
+ readonly speaker?: string | undefined;
496
+ readonly confidence?: number | undefined;
497
+ }[] | undefined;
498
+ }>;
499
+ start: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
500
+ resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
501
+ };
502
+ dispose: () => Promise<void>;
503
+ };
504
+ export type Client = ReturnType<typeof make>;
505
+ /** Default client over `RequestExecutor.fetchLayer` for scripts; the runtime builds its layer on first use. */
506
+ export declare const ai: {
507
+ run: <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) => Promise<A>;
508
+ llm: {
509
+ request: <const SelectedLanguageModel extends LanguageModel>(input: RequestInput<SelectedLanguageModel>) => LLMRequest<SelectedLanguageModel>;
510
+ generate: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: RunOptions) => Promise<import("./index.js").LLMResponse>;
511
+ stream: <const Model extends LanguageModel>(input: RequestInput<Model> | LLMRequest, options?: RunOptions) => AsyncIterable<({
512
+ readonly type: "compaction";
513
+ readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
514
+ readonly id?: string | undefined;
515
+ readonly text?: string | null | undefined;
516
+ readonly encrypted?: string | undefined;
517
+ } & ({
518
+ readonly encrypted: string;
519
+ readonly text?: never;
520
+ } | {
521
+ readonly text: string | null;
522
+ readonly encrypted?: never;
523
+ })) | {
524
+ readonly type: "step-start";
525
+ readonly index: number;
526
+ } | {
527
+ readonly id: string;
528
+ readonly type: "text-start";
529
+ readonly providerMetadata?: {
530
+ readonly [x: string]: {
531
+ readonly [x: string]: unknown;
532
+ };
533
+ } | undefined;
534
+ } | {
535
+ readonly id: string;
536
+ readonly type: "text-delta";
537
+ readonly text: string;
538
+ readonly providerMetadata?: {
539
+ readonly [x: string]: {
540
+ readonly [x: string]: unknown;
541
+ };
542
+ } | undefined;
543
+ } | {
544
+ readonly id: string;
545
+ readonly type: "text-end";
546
+ readonly text?: string | undefined;
547
+ readonly providerMetadata?: {
548
+ readonly [x: string]: {
549
+ readonly [x: string]: unknown;
550
+ };
551
+ } | undefined;
552
+ } | {
553
+ readonly id: string;
554
+ readonly type: "reasoning-start";
555
+ readonly providerMetadata?: {
556
+ readonly [x: string]: {
557
+ readonly [x: string]: unknown;
558
+ };
559
+ } | undefined;
560
+ } | {
561
+ readonly id: string;
562
+ readonly type: "reasoning-delta";
563
+ readonly text: string;
564
+ readonly providerMetadata?: {
565
+ readonly [x: string]: {
566
+ readonly [x: string]: unknown;
567
+ };
568
+ } | undefined;
569
+ } | {
570
+ readonly id: string;
571
+ readonly type: "reasoning-end";
572
+ readonly text?: string | undefined;
573
+ readonly providerMetadata?: {
574
+ readonly [x: string]: {
575
+ readonly [x: string]: unknown;
576
+ };
577
+ } | undefined;
578
+ } | {
579
+ readonly id: string;
580
+ readonly type: "tool-input-start";
581
+ readonly name: string;
582
+ readonly providerMetadata?: {
583
+ readonly [x: string]: {
584
+ readonly [x: string]: unknown;
585
+ };
586
+ } | undefined;
587
+ readonly namespace?: string | undefined;
588
+ readonly providerExecuted?: boolean | undefined;
589
+ } | {
590
+ readonly id: string;
591
+ readonly type: "tool-input-delta";
592
+ readonly name: string;
593
+ readonly text: string;
594
+ readonly input?: unknown;
595
+ readonly namespace?: string | undefined;
596
+ } | {
597
+ readonly id: string;
598
+ readonly type: "tool-input-end";
599
+ readonly name: string;
600
+ readonly providerMetadata?: {
601
+ readonly [x: string]: {
602
+ readonly [x: string]: unknown;
603
+ };
604
+ } | undefined;
605
+ readonly namespace?: string | undefined;
606
+ } | {
607
+ readonly id: string;
608
+ readonly type: "tool-input-error";
609
+ readonly name: string;
610
+ readonly raw: string;
611
+ readonly namespace?: string | undefined;
612
+ } | {
613
+ readonly id: string;
614
+ readonly type: "tool-call";
615
+ readonly name: string;
616
+ readonly input: unknown;
617
+ readonly providerMetadata?: {
618
+ readonly [x: string]: {
619
+ readonly [x: string]: unknown;
620
+ };
621
+ } | undefined;
622
+ readonly namespace?: string | undefined;
623
+ readonly providerExecuted?: boolean | undefined;
624
+ } | {
625
+ readonly id: string;
626
+ readonly type: "tool-result";
627
+ readonly name: string;
628
+ readonly result: {
629
+ readonly type: "json";
630
+ readonly value: unknown;
631
+ } | {
632
+ readonly type: "text";
633
+ readonly value: unknown;
634
+ } | {
635
+ readonly type: "error";
636
+ readonly value: unknown;
637
+ } | {
638
+ readonly type: "content";
639
+ readonly value: readonly ({
640
+ readonly type: "text";
641
+ readonly text: string;
642
+ } | {
643
+ readonly type: "file";
644
+ readonly uri: string;
645
+ readonly mime: string;
646
+ readonly name?: string | undefined;
647
+ })[];
648
+ };
649
+ readonly output?: {
650
+ readonly structured: unknown;
651
+ readonly content: readonly ({
652
+ readonly type: "text";
653
+ readonly text: string;
654
+ } | {
655
+ readonly type: "file";
656
+ readonly uri: string;
657
+ readonly mime: string;
658
+ readonly name?: string | undefined;
659
+ })[];
660
+ } | undefined;
661
+ readonly providerMetadata?: {
662
+ readonly [x: string]: {
663
+ readonly [x: string]: unknown;
664
+ };
665
+ } | undefined;
666
+ readonly namespace?: string | undefined;
667
+ readonly providerExecuted?: boolean | undefined;
668
+ } | {
669
+ readonly id: string;
670
+ readonly type: "tool-error";
671
+ readonly name: string;
672
+ readonly message: string;
673
+ readonly error?: unknown;
674
+ readonly providerMetadata?: {
675
+ readonly [x: string]: {
676
+ readonly [x: string]: unknown;
677
+ };
678
+ } | undefined;
679
+ readonly namespace?: string | undefined;
680
+ } | {
681
+ readonly type: "media";
682
+ readonly media: import("./media.js").Asset;
683
+ readonly providerMetadata?: {
684
+ readonly [x: string]: {
685
+ readonly [x: string]: unknown;
686
+ };
687
+ } | undefined;
688
+ } | {
689
+ readonly type: "step-finish";
690
+ readonly reason: {
691
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
692
+ readonly raw?: string | undefined;
693
+ };
694
+ readonly index: number;
695
+ readonly providerMetadata?: {
696
+ readonly [x: string]: {
697
+ readonly [x: string]: unknown;
698
+ };
699
+ } | undefined;
700
+ readonly usage?: import("./index.js").Usage | undefined;
701
+ } | {
702
+ readonly type: "finish";
703
+ readonly reason: {
704
+ readonly normalized: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
705
+ readonly raw?: string | undefined;
706
+ };
707
+ readonly providerMetadata?: {
708
+ readonly [x: string]: {
709
+ readonly [x: string]: unknown;
710
+ };
711
+ } | undefined;
712
+ readonly usage?: import("./index.js").Usage | undefined;
713
+ } | {
714
+ readonly type: "provider-error";
715
+ readonly message: string;
716
+ readonly classification?: "context-overflow" | "payload-too-large" | undefined;
717
+ readonly providerMetadata?: {
718
+ readonly [x: string]: {
719
+ readonly [x: string]: unknown;
720
+ };
721
+ } | undefined;
722
+ }>;
723
+ };
724
+ image: {
725
+ request: typeof import("./image.js").request;
726
+ generate: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => Promise<import("./image.js").ImageResponse>;
727
+ stream: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
728
+ readonly id: string;
729
+ readonly type: "generation-queued";
730
+ readonly position?: number | undefined;
731
+ } | {
732
+ readonly id: string;
733
+ readonly type: "generation-progress";
734
+ readonly progress?: number | undefined;
735
+ } | {
736
+ readonly type: "image-partial";
737
+ readonly index: number;
738
+ readonly image: import("./media.js").Asset;
739
+ } | {
740
+ readonly type: "image";
741
+ readonly index: number;
742
+ readonly image: import("./media.js").Asset;
743
+ } | {
744
+ readonly type: "finish";
745
+ readonly providerMetadata?: {
746
+ readonly [x: string]: {
747
+ readonly [x: string]: unknown;
748
+ };
749
+ } | undefined;
750
+ readonly usage?: {
751
+ readonly type: "tokens";
752
+ readonly input?: number | undefined;
753
+ readonly output?: number | undefined;
754
+ readonly total?: number | undefined;
755
+ readonly details?: {
756
+ readonly [x: string]: unknown;
757
+ } | undefined;
758
+ } | {
759
+ readonly type: "seconds";
760
+ readonly seconds: number;
761
+ } | {
762
+ readonly type: "characters";
763
+ readonly characters: number;
764
+ } | {
765
+ readonly type: "credits";
766
+ readonly credits: number;
767
+ } | {
768
+ readonly type: "compute";
769
+ readonly seconds: number;
770
+ } | undefined;
771
+ readonly notices?: readonly {
772
+ readonly type: "other" | "moderated" | "filtered";
773
+ readonly message: string;
774
+ readonly providerMetadata?: {
775
+ readonly [x: string]: {
776
+ readonly [x: string]: unknown;
777
+ };
778
+ } | undefined;
779
+ }[] | undefined;
780
+ }>;
781
+ start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
782
+ resume: <Options extends ImageOptions>(model: ImageModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./image.js").ImageResponse>>;
783
+ };
784
+ video: {
785
+ request: typeof import("./video.js").request;
786
+ start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
787
+ generate: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => Promise<import("./video.js").VideoResponse>;
788
+ resume: <Options extends VideoOptions>(model: VideoModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./video.js").VideoResponse>>;
789
+ stream: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
790
+ readonly id: string;
791
+ readonly type: "generation-queued";
792
+ readonly position?: number | undefined;
793
+ } | {
794
+ readonly id: string;
795
+ readonly type: "generation-progress";
796
+ readonly progress?: number | undefined;
797
+ } | {
798
+ readonly type: "video";
799
+ readonly index: number;
800
+ readonly video: import("./media.js").Asset;
801
+ } | {
802
+ readonly type: "finish";
803
+ readonly providerMetadata?: {
804
+ readonly [x: string]: {
805
+ readonly [x: string]: unknown;
806
+ };
807
+ } | undefined;
808
+ readonly usage?: {
809
+ readonly type: "tokens";
810
+ readonly input?: number | undefined;
811
+ readonly output?: number | undefined;
812
+ readonly total?: number | undefined;
813
+ readonly details?: {
814
+ readonly [x: string]: unknown;
815
+ } | undefined;
816
+ } | {
817
+ readonly type: "seconds";
818
+ readonly seconds: number;
819
+ } | {
820
+ readonly type: "characters";
821
+ readonly characters: number;
822
+ } | {
823
+ readonly type: "credits";
824
+ readonly credits: number;
825
+ } | {
826
+ readonly type: "compute";
827
+ readonly seconds: number;
828
+ } | undefined;
829
+ readonly notices?: readonly {
830
+ readonly type: "other" | "moderated" | "filtered";
831
+ readonly message: string;
832
+ readonly providerMetadata?: {
833
+ readonly [x: string]: {
834
+ readonly [x: string]: unknown;
835
+ };
836
+ } | undefined;
837
+ }[] | undefined;
838
+ }>;
839
+ };
840
+ speech: {
841
+ request: typeof import("./speech.js").request;
842
+ generate: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => Promise<import("./speech.js").SpeechResponse>;
843
+ stream: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => AsyncIterable<{
844
+ readonly type: "audio-delta";
845
+ readonly chunk: Uint8Array<ArrayBufferLike>;
846
+ } | {
847
+ readonly type: "timestamps";
848
+ readonly items: readonly {
849
+ readonly text: string;
850
+ readonly startSeconds: number;
851
+ readonly endSeconds: number;
852
+ }[];
853
+ } | {
854
+ readonly type: "finish";
855
+ readonly audio: import("./media.js").Asset;
856
+ readonly providerMetadata?: {
857
+ readonly [x: string]: {
858
+ readonly [x: string]: unknown;
859
+ };
860
+ } | undefined;
861
+ readonly usage?: {
862
+ readonly type: "tokens";
863
+ readonly input?: number | undefined;
864
+ readonly output?: number | undefined;
865
+ readonly total?: number | undefined;
866
+ readonly details?: {
867
+ readonly [x: string]: unknown;
868
+ } | undefined;
869
+ } | {
870
+ readonly type: "seconds";
871
+ readonly seconds: number;
872
+ } | {
873
+ readonly type: "characters";
874
+ readonly characters: number;
875
+ } | {
876
+ readonly type: "credits";
877
+ readonly credits: number;
878
+ } | {
879
+ readonly type: "compute";
880
+ readonly seconds: number;
881
+ } | undefined;
882
+ readonly notices?: readonly {
883
+ readonly type: "other" | "moderated" | "filtered";
884
+ readonly message: string;
885
+ readonly providerMetadata?: {
886
+ readonly [x: string]: {
887
+ readonly [x: string]: unknown;
888
+ };
889
+ } | undefined;
890
+ }[] | undefined;
891
+ }>;
892
+ };
893
+ transcription: {
894
+ request: typeof import("./transcription.js").request;
895
+ generate: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => Promise<import("./transcription.js").TranscriptionResponse>;
896
+ stream: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
897
+ readonly id: string;
898
+ readonly type: "generation-queued";
899
+ readonly position?: number | undefined;
900
+ } | {
901
+ readonly id: string;
902
+ readonly type: "generation-progress";
903
+ readonly progress?: number | undefined;
904
+ } | {
905
+ readonly type: "text-delta";
906
+ readonly delta: string;
907
+ } | {
908
+ readonly type: "segment";
909
+ readonly segment: {
910
+ readonly text: string;
911
+ readonly startSeconds: number;
912
+ readonly endSeconds: number;
913
+ readonly speaker?: string | undefined;
914
+ };
915
+ } | {
916
+ readonly type: "finish";
917
+ readonly text: string;
918
+ readonly durationSeconds?: number | undefined;
919
+ readonly providerMetadata?: {
920
+ readonly [x: string]: {
921
+ readonly [x: string]: unknown;
922
+ };
923
+ } | undefined;
924
+ readonly usage?: {
925
+ readonly type: "tokens";
926
+ readonly input?: number | undefined;
927
+ readonly output?: number | undefined;
928
+ readonly total?: number | undefined;
929
+ readonly details?: {
930
+ readonly [x: string]: unknown;
931
+ } | undefined;
932
+ } | {
933
+ readonly type: "seconds";
934
+ readonly seconds: number;
935
+ } | {
936
+ readonly type: "characters";
937
+ readonly characters: number;
938
+ } | {
939
+ readonly type: "credits";
940
+ readonly credits: number;
941
+ } | {
942
+ readonly type: "compute";
943
+ readonly seconds: number;
944
+ } | undefined;
945
+ readonly notices?: readonly {
946
+ readonly type: "other" | "moderated" | "filtered";
947
+ readonly message: string;
948
+ readonly providerMetadata?: {
949
+ readonly [x: string]: {
950
+ readonly [x: string]: unknown;
951
+ };
952
+ } | undefined;
953
+ }[] | undefined;
954
+ readonly language?: string | undefined;
955
+ readonly segments?: readonly {
956
+ readonly text: string;
957
+ readonly startSeconds: number;
958
+ readonly endSeconds: number;
959
+ readonly speaker?: string | undefined;
960
+ }[] | undefined;
961
+ readonly words?: readonly {
962
+ readonly text: string;
963
+ readonly startSeconds: number;
964
+ readonly endSeconds: number;
965
+ readonly speaker?: string | undefined;
966
+ readonly confidence?: number | undefined;
967
+ }[] | undefined;
968
+ }>;
969
+ start: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
970
+ resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
971
+ };
972
+ dispose: () => Promise<void>;
973
+ };
974
+ export * as AI from "./promise.js";