@opencode/ai 2.2.7 → 2.3.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 (90) hide show
  1. package/README.md +114 -96
  2. package/dist/effect.d.ts +8 -7
  3. package/dist/effect.js +2 -1
  4. package/dist/experimental.d.ts +0 -4
  5. package/dist/experimental.js +0 -3
  6. package/dist/image-client.d.ts +1 -1
  7. package/dist/image-client.js +2 -6
  8. package/dist/index.d.ts +11 -48
  9. package/dist/index.js +30 -13
  10. package/dist/media-model.d.ts +2 -0
  11. package/dist/media-model.js +3 -1
  12. package/dist/media.d.ts +9 -3
  13. package/dist/media.js +27 -7
  14. package/dist/protocols/google-decisions.d.ts +13 -0
  15. package/dist/protocols/google-decisions.js +133 -0
  16. package/dist/protocols/google-interactions-video.d.ts +43 -0
  17. package/dist/protocols/google-interactions-video.js +186 -0
  18. package/dist/protocols/google-interactions.d.ts +14 -1
  19. package/dist/protocols/google-interactions.js +1 -1
  20. package/dist/protocols/index.d.ts +1 -0
  21. package/dist/protocols/index.js +1 -0
  22. package/dist/protocols/minimax-video.d.ts +54 -0
  23. package/dist/protocols/minimax-video.js +292 -0
  24. package/dist/protocols/openrouter-video.d.ts +41 -0
  25. package/dist/protocols/openrouter-video.js +138 -0
  26. package/dist/protocols/seedance-video.d.ts +50 -0
  27. package/dist/protocols/seedance-video.js +216 -0
  28. package/dist/protocols/system-one.d.ts +45 -1
  29. package/dist/protocols/system-one.js +42 -7
  30. package/dist/protocols/utils/responses-compaction.js +1 -1
  31. package/dist/protocols/xai-video.d.ts +8 -2
  32. package/dist/protocols/xai-video.js +20 -15
  33. package/dist/provider-error.js +7 -1
  34. package/dist/providers/byteplus/videos.d.ts +2 -0
  35. package/dist/providers/byteplus/videos.js +1 -0
  36. package/dist/providers/byteplus.d.ts +26 -0
  37. package/dist/providers/byteplus.js +21 -0
  38. package/dist/providers/google/decisions.d.ts +2 -0
  39. package/dist/providers/google/decisions.js +1 -0
  40. package/dist/providers/google/videos.d.ts +2 -0
  41. package/dist/providers/google/videos.js +1 -0
  42. package/dist/providers/google.d.ts +11 -4
  43. package/dist/providers/google.js +13 -3
  44. package/dist/providers/index.d.ts +2 -1
  45. package/dist/providers/index.js +2 -1
  46. package/dist/providers/minimax/videos.d.ts +3 -0
  47. package/dist/providers/minimax/videos.js +1 -0
  48. package/dist/providers/minimax.d.ts +6 -1
  49. package/dist/providers/minimax.js +10 -1
  50. package/dist/providers/openai-compatible/decisions.d.ts +2 -0
  51. package/dist/providers/openai-compatible/decisions.js +1 -0
  52. package/dist/providers/openai-compatible.d.ts +2 -0
  53. package/dist/providers/openai-compatible.js +14 -0
  54. package/dist/providers/openrouter/videos.d.ts +2 -0
  55. package/dist/providers/openrouter/videos.js +1 -0
  56. package/dist/providers/openrouter.d.ts +5 -0
  57. package/dist/providers/openrouter.js +8 -0
  58. package/dist/providers/volcengine/videos.d.ts +2 -0
  59. package/dist/providers/volcengine/videos.js +1 -0
  60. package/dist/providers/volcengine.d.ts +26 -0
  61. package/dist/providers/volcengine.js +21 -0
  62. package/dist/public.d.ts +2 -0
  63. package/dist/public.js +1 -0
  64. package/dist/route/executor-service.d.ts +6 -0
  65. package/dist/route/executor-service.js +7 -0
  66. package/dist/route/executor.d.ts +7 -1
  67. package/dist/route/executor.js +7 -2
  68. package/dist/route/media-protocol.d.ts +12 -11
  69. package/dist/route/media.d.ts +2 -0
  70. package/dist/route/media.js +31 -22
  71. package/dist/route/transport/http.js +1 -1
  72. package/dist/schema/messages.d.ts +1 -1
  73. package/dist/schema/messages.js +1 -5
  74. package/dist/schema/options.d.ts +8 -0
  75. package/dist/schema/options.js +1 -0
  76. package/dist/speech-client.d.ts +1 -1
  77. package/dist/speech-client.js +4 -4
  78. package/dist/transcription-client.d.ts +1 -1
  79. package/dist/transcription-client.js +1 -2
  80. package/dist/video-client.d.ts +16 -84
  81. package/dist/video-client.js +28 -13
  82. package/dist/video.d.ts +56 -1072
  83. package/dist/video.js +28 -65
  84. package/package.json +55 -7
  85. package/dist/protocols/google-video.d.ts +0 -26
  86. package/dist/protocols/google-video.js +0 -146
  87. package/dist/protocols/runway-video.d.ts +0 -38
  88. package/dist/protocols/runway-video.js +0 -141
  89. package/dist/providers/runway.d.ts +0 -20
  90. package/dist/providers/runway.js +0 -17
package/dist/video.d.ts CHANGED
@@ -1,17 +1,15 @@
1
- import { Effect, Schema, Stream } from "effect";
2
- import { Generation, type AwaitOptions } from "./generation.js";
1
+ import { Effect, Schema } from "effect";
2
+ import type { Status } from "./generation.js";
3
3
  import { Media } from "./media.js";
4
4
  import { MediaModel } from "./media-model.js";
5
5
  import { MediaRoute } from "./route/media.js";
6
6
  import { AIError, type OpenString, type BaseRequest } from "./schema/index.js";
7
7
  import { Service } from "./video-client.js";
8
8
  export type VideoOptions = MediaModel.Options;
9
- export type VideoRoute = MediaRoute.AnyRoute<VideoRequest, VideoEvent, VideoResponse>;
9
+ /** Video generation is always a queued job: submit, then read its status and result by token. */
10
+ export type VideoRoute = MediaRoute.QueuedRoute<VideoRequest, VideoResponse>;
10
11
  export declare class VideoModel<Options extends VideoOptions = VideoOptions> extends MediaModel<VideoRoute, Options> {
11
12
  protected readonly _VideoModel: void;
12
- /** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
13
- static fromRoute<Options extends VideoOptions>(route: MediaModel.InlineRouteInput<VideoRequest<VideoModel<Options>>, VideoResponse>, input: MediaRoute.ModelInput): VideoModel<Options>;
14
- static fromRoute<Options extends VideoOptions, Frame, State>(route: MediaModel.StreamRouteInput<VideoRequest<VideoModel<Options>>, VideoEvent, Frame, State>, input: MediaRoute.ModelInput): VideoModel<Options>;
15
13
  static fromRoute<Options extends VideoOptions, Token>(route: MediaModel.QueuedRouteInput<VideoRequest<VideoModel<Options>>, VideoResponse, Token>, input: MediaRoute.ModelInput): VideoModel<Options>;
16
14
  }
17
15
  export declare const VideoModelSchema: Schema.declare<VideoModel<{
@@ -19,12 +17,23 @@ export declare const VideoModelSchema: Schema.declare<VideoModel<{
19
17
  }>, VideoModel<{
20
18
  readonly [x: string]: unknown;
21
19
  }>>;
22
- export type VideoAspectRatio = Media.AspectRatio;
23
- export declare const VideoAspectRatio: Schema.declare<`${number}:${number}`, `${number}:${number}`>;
20
+ /** A `width:height` ratio, or `auto` to follow the input image. */
21
+ export type VideoAspectRatio = Media.AspectRatio | "auto";
22
+ export declare const VideoAspectRatio: Schema.Union<readonly [Schema.declare<`${number}:${number}`, `${number}:${number}`>, Schema.Literal<"auto">]>;
23
+ /** Common output resolutions; protocols convert them to their provider's spelling and pass other values through. */
24
24
  export type VideoResolution = OpenString<"480p" | "720p" | "1080p" | "4k">;
25
- /** Pinned frames. Routes that accept only a first frame fail typed when `last` is present. */
26
- export declare const VideoFrames: Schema.Struct<{
27
- readonly first: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
25
+ /** Output length as an Effect duration string in seconds, such as `"8 seconds"`. */
26
+ export type VideoDuration = `${number} second` | `${number} seconds`;
27
+ export declare const VideoDuration: Schema.declare<VideoDuration, VideoDuration>;
28
+ declare const VideoRequestSchema: Schema.Struct<{
29
+ readonly model: Schema.declare<VideoModel<{
30
+ readonly [x: string]: unknown;
31
+ }>, VideoModel<{
32
+ readonly [x: string]: unknown;
33
+ }>>;
34
+ readonly prompt: Schema.String;
35
+ /** Image the video starts on exactly. */
36
+ readonly start: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
28
37
  readonly source: Schema.Union<readonly [Schema.Struct<{
29
38
  readonly type: Schema.Literal<"bytes">;
30
39
  readonly data: Schema.Uint8Array;
@@ -55,7 +64,8 @@ export declare const VideoFrames: Schema.Struct<{
55
64
  }>>;
56
65
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
57
66
  }>, never, never>>;
58
- readonly last: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
67
+ /** Image the video ends on exactly. */
68
+ readonly end: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
59
69
  readonly source: Schema.Union<readonly [Schema.Struct<{
60
70
  readonly type: Schema.Literal<"bytes">;
61
71
  readonly data: Schema.Uint8Array;
@@ -86,80 +96,7 @@ export declare const VideoFrames: Schema.Struct<{
86
96
  }>>;
87
97
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
88
98
  }>, never, never>>;
89
- }>;
90
- export type VideoFrames = Schema.Schema.Type<typeof VideoFrames>;
91
- declare const VideoRequestSchema: Schema.Struct<{
92
- readonly model: Schema.declare<VideoModel<{
93
- readonly [x: string]: unknown;
94
- }>, VideoModel<{
95
- readonly [x: string]: unknown;
96
- }>>;
97
- readonly prompt: Schema.String;
98
- readonly frames: Schema.optional<Schema.Struct<{
99
- readonly first: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
100
- readonly source: Schema.Union<readonly [Schema.Struct<{
101
- readonly type: Schema.Literal<"bytes">;
102
- readonly data: Schema.Uint8Array;
103
- readonly mediaType: Schema.String;
104
- }>, Schema.Struct<{
105
- readonly type: Schema.Literal<"base64">;
106
- readonly data: Schema.String;
107
- readonly mediaType: Schema.String;
108
- }>, Schema.Struct<{
109
- readonly type: Schema.Literal<"url">;
110
- readonly url: Schema.String;
111
- readonly mediaType: Schema.optional<Schema.String>;
112
- readonly expiresAt: Schema.optional<Schema.Number>;
113
- }>, Schema.Struct<{
114
- readonly type: Schema.Literal<"ref">;
115
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
116
- readonly id: Schema.String;
117
- readonly mediaType: Schema.optional<Schema.String>;
118
- }>]>;
119
- readonly info: Schema.optional<Schema.Struct<{
120
- readonly width: Schema.optional<Schema.Number>;
121
- readonly height: Schema.optional<Schema.Number>;
122
- readonly durationSeconds: Schema.optional<Schema.Number>;
123
- readonly sampleRate: Schema.optional<Schema.Number>;
124
- readonly channels: Schema.optional<Schema.Number>;
125
- readonly encoding: Schema.optional<Schema.String>;
126
- readonly format: Schema.optional<Schema.String>;
127
- }>>;
128
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
129
- }>, never, never>>;
130
- readonly last: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
131
- readonly source: Schema.Union<readonly [Schema.Struct<{
132
- readonly type: Schema.Literal<"bytes">;
133
- readonly data: Schema.Uint8Array;
134
- readonly mediaType: Schema.String;
135
- }>, Schema.Struct<{
136
- readonly type: Schema.Literal<"base64">;
137
- readonly data: Schema.String;
138
- readonly mediaType: Schema.String;
139
- }>, Schema.Struct<{
140
- readonly type: Schema.Literal<"url">;
141
- readonly url: Schema.String;
142
- readonly mediaType: Schema.optional<Schema.String>;
143
- readonly expiresAt: Schema.optional<Schema.Number>;
144
- }>, Schema.Struct<{
145
- readonly type: Schema.Literal<"ref">;
146
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
147
- readonly id: Schema.String;
148
- readonly mediaType: Schema.optional<Schema.String>;
149
- }>]>;
150
- readonly info: Schema.optional<Schema.Struct<{
151
- readonly width: Schema.optional<Schema.Number>;
152
- readonly height: Schema.optional<Schema.Number>;
153
- readonly durationSeconds: Schema.optional<Schema.Number>;
154
- readonly sampleRate: Schema.optional<Schema.Number>;
155
- readonly channels: Schema.optional<Schema.Number>;
156
- readonly encoding: Schema.optional<Schema.String>;
157
- readonly format: Schema.optional<Schema.String>;
158
- }>>;
159
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
160
- }>, never, never>>;
161
- }>>;
162
- /** Style or subject references that guide the output without pinning a frame. */
99
+ /** Images, videos or audio that guide the subject or style without pinning a frame. */
163
100
  readonly references: Schema.optional<Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
164
101
  readonly source: Schema.Union<readonly [Schema.Struct<{
165
102
  readonly type: Schema.Literal<"bytes">;
@@ -191,57 +128,37 @@ declare const VideoRequestSchema: Schema.Struct<{
191
128
  }>>;
192
129
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
193
130
  }>, never, never>>>;
194
- /** Source video for edit or extension routes. */
195
- readonly video: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
196
- readonly source: Schema.Union<readonly [Schema.Struct<{
197
- readonly type: Schema.Literal<"bytes">;
198
- readonly data: Schema.Uint8Array;
199
- readonly mediaType: Schema.String;
200
- }>, Schema.Struct<{
201
- readonly type: Schema.Literal<"base64">;
202
- readonly data: Schema.String;
203
- readonly mediaType: Schema.String;
204
- }>, Schema.Struct<{
205
- readonly type: Schema.Literal<"url">;
206
- readonly url: Schema.String;
207
- readonly mediaType: Schema.optional<Schema.String>;
208
- readonly expiresAt: Schema.optional<Schema.Number>;
209
- }>, Schema.Struct<{
210
- readonly type: Schema.Literal<"ref">;
211
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
212
- readonly id: Schema.String;
213
- readonly mediaType: Schema.optional<Schema.String>;
214
- }>]>;
215
- readonly info: Schema.optional<Schema.Struct<{
216
- readonly width: Schema.optional<Schema.Number>;
217
- readonly height: Schema.optional<Schema.Number>;
218
- readonly durationSeconds: Schema.optional<Schema.Number>;
219
- readonly sampleRate: Schema.optional<Schema.Number>;
220
- readonly channels: Schema.optional<Schema.Number>;
221
- readonly encoding: Schema.optional<Schema.String>;
222
- readonly format: Schema.optional<Schema.String>;
223
- }>>;
224
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
225
- }>, never, never>>;
226
- readonly durationSeconds: Schema.optional<Schema.Number>;
227
- readonly aspect: Schema.optional<Schema.declare<`${number}:${number}`, `${number}:${number}`>>;
131
+ readonly duration: Schema.optional<Schema.declare<VideoDuration, VideoDuration>>;
132
+ readonly aspect: Schema.optional<Schema.Union<readonly [Schema.declare<`${number}:${number}`, `${number}:${number}`>, Schema.Literal<"auto">]>>;
228
133
  readonly resolution: Schema.optional<Schema.String>;
229
- /** Whether to generate an audio track; routes whose audio is always on fail typed on `false`. */
230
- readonly audio: Schema.optional<Schema.Boolean>;
231
- readonly n: Schema.optional<Schema.Int>;
232
- readonly seed: Schema.optional<Schema.Number>;
233
- readonly negativePrompt: Schema.optional<Schema.String>;
134
+ /** Whether the video has a generated soundtrack; unset leaves the model's default. */
135
+ readonly sound: Schema.optional<Schema.Boolean>;
234
136
  readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
235
137
  }>;
236
- /** A normalized video request, the plain object `Video.request(...)` returns. */
138
+ /** A normalized video request, the plain object `ai.video.request(...)` returns. */
237
139
  export type VideoRequest<Model extends VideoModel = VideoModel> = Omit<typeof VideoRequestSchema.Type, "model" | "providerOptions" | "resolution"> & BaseRequest<Model, VideoModelOptions<Model>> & {
238
140
  readonly resolution?: VideoResolution;
239
141
  };
240
142
  export type VideoModelOptions<Model> = Model extends VideoModel<infer Options> ? Options : never;
241
- /** Input accepted by `Video.request` and the calls; a `VideoRequest` is also a valid input. */
242
- export type VideoRequestInput<Model extends VideoModel = VideoModel> = Omit<VideoRequest<Model>, "providerOptions"> & {
143
+ /** Input accepted by `ai.video.request` and `ai.video.start`; a `VideoRequest` is also a valid input. */
144
+ export type VideoRequestInput<Model extends VideoModel = VideoModel> = Omit<VideoRequest<Model>, "start" | "end" | "references" | "providerOptions"> & {
145
+ readonly start?: Media.Input;
146
+ readonly end?: Media.Input;
147
+ readonly references?: ReadonlyArray<Media.Input>;
243
148
  readonly providerOptions?: NoInfer<VideoModelOptions<Model>>;
244
149
  };
150
+ /** Seconds in a request's `duration`, for protocols that send a number. */
151
+ export declare const seconds: (duration: VideoDuration) => number;
152
+ /** A submitted generation. Store `token` (plain JSON) with the model to read the job later, from any process. */
153
+ export interface VideoJob {
154
+ readonly id: string;
155
+ readonly token: unknown;
156
+ }
157
+ export interface VideoStatus {
158
+ readonly status: Status;
159
+ /** 0..1, only when the provider reports progress. */
160
+ readonly progress?: number;
161
+ }
245
162
  declare const VideoResponse_base: Schema.Class<VideoResponse, Schema.Struct<{
246
163
  readonly videos: Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
247
164
  readonly source: Schema.Union<readonly [Schema.Struct<{
@@ -298,954 +215,21 @@ declare const VideoResponse_base: Schema.Class<VideoResponse, Schema.Struct<{
298
215
  export declare class VideoResponse extends VideoResponse_base {
299
216
  get video(): Media.Asset;
300
217
  }
301
- export declare const VideoOutputEvent: Schema.Struct<{
302
- readonly type: Schema.tag<"video">;
303
- readonly index: Schema.Number;
304
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
305
- readonly source: Schema.Union<readonly [Schema.Struct<{
306
- readonly type: Schema.Literal<"bytes">;
307
- readonly data: Schema.Uint8Array;
308
- readonly mediaType: Schema.String;
309
- }>, Schema.Struct<{
310
- readonly type: Schema.Literal<"base64">;
311
- readonly data: Schema.String;
312
- readonly mediaType: Schema.String;
313
- }>, Schema.Struct<{
314
- readonly type: Schema.Literal<"url">;
315
- readonly url: Schema.String;
316
- readonly mediaType: Schema.optional<Schema.String>;
317
- readonly expiresAt: Schema.optional<Schema.Number>;
318
- }>, Schema.Struct<{
319
- readonly type: Schema.Literal<"ref">;
320
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
321
- readonly id: Schema.String;
322
- readonly mediaType: Schema.optional<Schema.String>;
323
- }>]>;
324
- readonly info: Schema.optional<Schema.Struct<{
325
- readonly width: Schema.optional<Schema.Number>;
326
- readonly height: Schema.optional<Schema.Number>;
327
- readonly durationSeconds: Schema.optional<Schema.Number>;
328
- readonly sampleRate: Schema.optional<Schema.Number>;
329
- readonly channels: Schema.optional<Schema.Number>;
330
- readonly encoding: Schema.optional<Schema.String>;
331
- readonly format: Schema.optional<Schema.String>;
332
- }>>;
333
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
334
- }>, never, never>;
335
- }>;
336
- export declare const VideoFinishEvent: Schema.Struct<{
337
- readonly type: Schema.tag<"finish">;
338
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
339
- readonly type: Schema.Literal<"tokens">;
340
- readonly input: Schema.optional<Schema.Number>;
341
- readonly output: Schema.optional<Schema.Number>;
342
- readonly total: Schema.optional<Schema.Number>;
343
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
344
- }>, Schema.Struct<{
345
- readonly type: Schema.Literal<"seconds">;
346
- readonly seconds: Schema.Number;
347
- }>, Schema.Struct<{
348
- readonly type: Schema.Literal<"characters">;
349
- readonly characters: Schema.Number;
350
- }>, Schema.Struct<{
351
- readonly type: Schema.Literal<"credits">;
352
- readonly credits: Schema.Number;
353
- }>, Schema.Struct<{
354
- readonly type: Schema.Literal<"compute">;
355
- readonly seconds: Schema.Number;
356
- }>]>>;
357
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
358
- }>;
359
- declare const videoEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
360
- readonly type: Schema.tag<"generation-queued">;
361
- readonly id: Schema.String;
362
- readonly position: Schema.optional<Schema.Number>;
363
- }>, Schema.Struct<{
364
- readonly type: Schema.tag<"generation-progress">;
365
- readonly id: Schema.String;
366
- readonly progress: Schema.optional<Schema.Number>;
367
- }>, Schema.Struct<{
368
- readonly type: Schema.tag<"video">;
369
- readonly index: Schema.Number;
370
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
371
- readonly source: Schema.Union<readonly [Schema.Struct<{
372
- readonly type: Schema.Literal<"bytes">;
373
- readonly data: Schema.Uint8Array;
374
- readonly mediaType: Schema.String;
375
- }>, Schema.Struct<{
376
- readonly type: Schema.Literal<"base64">;
377
- readonly data: Schema.String;
378
- readonly mediaType: Schema.String;
379
- }>, Schema.Struct<{
380
- readonly type: Schema.Literal<"url">;
381
- readonly url: Schema.String;
382
- readonly mediaType: Schema.optional<Schema.String>;
383
- readonly expiresAt: Schema.optional<Schema.Number>;
384
- }>, Schema.Struct<{
385
- readonly type: Schema.Literal<"ref">;
386
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
387
- readonly id: Schema.String;
388
- readonly mediaType: Schema.optional<Schema.String>;
389
- }>]>;
390
- readonly info: Schema.optional<Schema.Struct<{
391
- readonly width: Schema.optional<Schema.Number>;
392
- readonly height: Schema.optional<Schema.Number>;
393
- readonly durationSeconds: Schema.optional<Schema.Number>;
394
- readonly sampleRate: Schema.optional<Schema.Number>;
395
- readonly channels: Schema.optional<Schema.Number>;
396
- readonly encoding: Schema.optional<Schema.String>;
397
- readonly format: Schema.optional<Schema.String>;
398
- }>>;
399
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
400
- }>, never, never>;
401
- }>, Schema.Struct<{
402
- readonly type: Schema.tag<"finish">;
403
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
404
- readonly type: Schema.Literal<"tokens">;
405
- readonly input: Schema.optional<Schema.Number>;
406
- readonly output: Schema.optional<Schema.Number>;
407
- readonly total: Schema.optional<Schema.Number>;
408
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
409
- }>, Schema.Struct<{
410
- readonly type: Schema.Literal<"seconds">;
411
- readonly seconds: Schema.Number;
412
- }>, Schema.Struct<{
413
- readonly type: Schema.Literal<"characters">;
414
- readonly characters: Schema.Number;
415
- }>, Schema.Struct<{
416
- readonly type: Schema.Literal<"credits">;
417
- readonly credits: Schema.Number;
418
- }>, Schema.Struct<{
419
- readonly type: Schema.Literal<"compute">;
420
- readonly seconds: Schema.Number;
421
- }>]>>;
422
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
423
- }>]>;
424
- export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
425
- readonly type: Schema.tag<"generation-queued">;
426
- readonly id: Schema.String;
427
- readonly position: Schema.optional<Schema.Number>;
428
- }>, Schema.Struct<{
429
- readonly type: Schema.tag<"generation-progress">;
430
- readonly id: Schema.String;
431
- readonly progress: Schema.optional<Schema.Number>;
432
- }>, Schema.Struct<{
433
- readonly type: Schema.tag<"video">;
434
- readonly index: Schema.Number;
435
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
436
- readonly source: Schema.Union<readonly [Schema.Struct<{
437
- readonly type: Schema.Literal<"bytes">;
438
- readonly data: Schema.Uint8Array;
439
- readonly mediaType: Schema.String;
440
- }>, Schema.Struct<{
441
- readonly type: Schema.Literal<"base64">;
442
- readonly data: Schema.String;
443
- readonly mediaType: Schema.String;
444
- }>, Schema.Struct<{
445
- readonly type: Schema.Literal<"url">;
446
- readonly url: Schema.String;
447
- readonly mediaType: Schema.optional<Schema.String>;
448
- readonly expiresAt: Schema.optional<Schema.Number>;
449
- }>, Schema.Struct<{
450
- readonly type: Schema.Literal<"ref">;
451
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
452
- readonly id: Schema.String;
453
- readonly mediaType: Schema.optional<Schema.String>;
454
- }>]>;
455
- readonly info: Schema.optional<Schema.Struct<{
456
- readonly width: Schema.optional<Schema.Number>;
457
- readonly height: Schema.optional<Schema.Number>;
458
- readonly durationSeconds: Schema.optional<Schema.Number>;
459
- readonly sampleRate: Schema.optional<Schema.Number>;
460
- readonly channels: Schema.optional<Schema.Number>;
461
- readonly encoding: Schema.optional<Schema.String>;
462
- readonly format: Schema.optional<Schema.String>;
463
- }>>;
464
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
465
- }>, never, never>;
466
- }>, Schema.Struct<{
467
- readonly type: Schema.tag<"finish">;
468
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
469
- readonly type: Schema.Literal<"tokens">;
470
- readonly input: Schema.optional<Schema.Number>;
471
- readonly output: Schema.optional<Schema.Number>;
472
- readonly total: Schema.optional<Schema.Number>;
473
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
474
- }>, Schema.Struct<{
475
- readonly type: Schema.Literal<"seconds">;
476
- readonly seconds: Schema.Number;
477
- }>, Schema.Struct<{
478
- readonly type: Schema.Literal<"characters">;
479
- readonly characters: Schema.Number;
480
- }>, Schema.Struct<{
481
- readonly type: Schema.Literal<"credits">;
482
- readonly credits: Schema.Number;
483
- }>, Schema.Struct<{
484
- readonly type: Schema.Literal<"compute">;
485
- readonly seconds: Schema.Number;
486
- }>]>>;
487
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
488
- }>]> & {
489
- readonly tag: "type";
490
- readonly discriminants: readonly ["generation-queued", "generation-progress", "video", "finish"];
491
- readonly cases: {
492
- finish: Schema.Struct<{
493
- readonly type: Schema.tag<"finish">;
494
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
495
- readonly type: Schema.Literal<"tokens">;
496
- readonly input: Schema.optional<Schema.Number>;
497
- readonly output: Schema.optional<Schema.Number>;
498
- readonly total: Schema.optional<Schema.Number>;
499
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
500
- }>, Schema.Struct<{
501
- readonly type: Schema.Literal<"seconds">;
502
- readonly seconds: Schema.Number;
503
- }>, Schema.Struct<{
504
- readonly type: Schema.Literal<"characters">;
505
- readonly characters: Schema.Number;
506
- }>, Schema.Struct<{
507
- readonly type: Schema.Literal<"credits">;
508
- readonly credits: Schema.Number;
509
- }>, Schema.Struct<{
510
- readonly type: Schema.Literal<"compute">;
511
- readonly seconds: Schema.Number;
512
- }>]>>;
513
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
514
- }>;
515
- "generation-progress": Schema.Struct<{
516
- readonly type: Schema.tag<"generation-progress">;
517
- readonly id: Schema.String;
518
- readonly progress: Schema.optional<Schema.Number>;
519
- }>;
520
- "generation-queued": Schema.Struct<{
521
- readonly type: Schema.tag<"generation-queued">;
522
- readonly id: Schema.String;
523
- readonly position: Schema.optional<Schema.Number>;
524
- }>;
525
- video: Schema.Struct<{
526
- readonly type: Schema.tag<"video">;
527
- readonly index: Schema.Number;
528
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
529
- readonly source: Schema.Union<readonly [Schema.Struct<{
530
- readonly type: Schema.Literal<"bytes">;
531
- readonly data: Schema.Uint8Array;
532
- readonly mediaType: Schema.String;
533
- }>, Schema.Struct<{
534
- readonly type: Schema.Literal<"base64">;
535
- readonly data: Schema.String;
536
- readonly mediaType: Schema.String;
537
- }>, Schema.Struct<{
538
- readonly type: Schema.Literal<"url">;
539
- readonly url: Schema.String;
540
- readonly mediaType: Schema.optional<Schema.String>;
541
- readonly expiresAt: Schema.optional<Schema.Number>;
542
- }>, Schema.Struct<{
543
- readonly type: Schema.Literal<"ref">;
544
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
545
- readonly id: Schema.String;
546
- readonly mediaType: Schema.optional<Schema.String>;
547
- }>]>;
548
- readonly info: Schema.optional<Schema.Struct<{
549
- readonly width: Schema.optional<Schema.Number>;
550
- readonly height: Schema.optional<Schema.Number>;
551
- readonly durationSeconds: Schema.optional<Schema.Number>;
552
- readonly sampleRate: Schema.optional<Schema.Number>;
553
- readonly channels: Schema.optional<Schema.Number>;
554
- readonly encoding: Schema.optional<Schema.String>;
555
- readonly format: Schema.optional<Schema.String>;
556
- }>>;
557
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
558
- }>, never, never>;
559
- }>;
560
- };
561
- readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
562
- readonly type: "video";
563
- readonly index: number;
564
- readonly video: Media.Asset;
565
- } | {
566
- readonly type: "generation-queued";
567
- readonly id: string;
568
- readonly position?: number | undefined;
569
- } | {
570
- readonly type: "generation-progress";
571
- readonly id: string;
572
- readonly progress?: number | undefined;
573
- } | {
574
- readonly type: "finish";
575
- readonly usage?: {
576
- readonly type: "seconds";
577
- readonly seconds: number;
578
- } | {
579
- readonly type: "characters";
580
- readonly characters: number;
581
- } | {
582
- readonly type: "credits";
583
- readonly credits: number;
584
- } | {
585
- readonly type: "compute";
586
- readonly seconds: number;
587
- } | {
588
- readonly type: "tokens";
589
- readonly input?: number | undefined;
590
- readonly output?: number | undefined;
591
- readonly total?: number | undefined;
592
- readonly details?: {
593
- readonly [x: string]: unknown;
594
- } | undefined;
595
- } | undefined;
596
- readonly providerMetadata?: {
597
- readonly [x: string]: {
598
- readonly [x: string]: unknown;
599
- };
600
- } | undefined;
601
- }) => value is Extract<{
602
- readonly type: "video";
603
- readonly index: number;
604
- readonly video: Media.Asset;
605
- }, {
606
- readonly type: Keys;
607
- }> | Extract<{
608
- readonly type: "generation-queued";
609
- readonly id: string;
610
- readonly position?: number | undefined;
611
- }, {
612
- readonly type: Keys;
613
- }> | Extract<{
614
- readonly type: "generation-progress";
615
- readonly id: string;
616
- readonly progress?: number | undefined;
617
- }, {
618
- readonly type: Keys;
619
- }> | Extract<{
620
- readonly type: "finish";
621
- readonly usage?: {
622
- readonly type: "seconds";
623
- readonly seconds: number;
624
- } | {
625
- readonly type: "characters";
626
- readonly characters: number;
627
- } | {
628
- readonly type: "credits";
629
- readonly credits: number;
630
- } | {
631
- readonly type: "compute";
632
- readonly seconds: number;
633
- } | {
634
- readonly type: "tokens";
635
- readonly input?: number | undefined;
636
- readonly output?: number | undefined;
637
- readonly total?: number | undefined;
638
- readonly details?: {
639
- readonly [x: string]: unknown;
640
- } | undefined;
641
- } | undefined;
642
- readonly providerMetadata?: {
643
- readonly [x: string]: {
644
- readonly [x: string]: unknown;
645
- };
646
- } | undefined;
647
- }, {
648
- readonly type: Keys;
649
- }>;
650
- readonly guards: {
651
- finish: (u: unknown) => u is {
652
- readonly type: "finish";
653
- readonly usage?: {
654
- readonly type: "seconds";
655
- readonly seconds: number;
656
- } | {
657
- readonly type: "characters";
658
- readonly characters: number;
659
- } | {
660
- readonly type: "credits";
661
- readonly credits: number;
662
- } | {
663
- readonly type: "compute";
664
- readonly seconds: number;
665
- } | {
666
- readonly type: "tokens";
667
- readonly input?: number | undefined;
668
- readonly output?: number | undefined;
669
- readonly total?: number | undefined;
670
- readonly details?: {
671
- readonly [x: string]: unknown;
672
- } | undefined;
673
- } | undefined;
674
- readonly providerMetadata?: {
675
- readonly [x: string]: {
676
- readonly [x: string]: unknown;
677
- };
678
- } | undefined;
679
- };
680
- "generation-progress": (u: unknown) => u is {
681
- readonly type: "generation-progress";
682
- readonly id: string;
683
- readonly progress?: number | undefined;
684
- };
685
- "generation-queued": (u: unknown) => u is {
686
- readonly type: "generation-queued";
687
- readonly id: string;
688
- readonly position?: number | undefined;
689
- };
690
- video: (u: unknown) => u is {
691
- readonly type: "video";
692
- readonly index: number;
693
- readonly video: Media.Asset;
694
- };
695
- };
696
- readonly match: {
697
- <Handlers extends { [K in "finish" | "generation-progress" | "generation-queued" | "video"]: (value: {
698
- readonly finish: Schema.Struct<{
699
- readonly type: Schema.tag<"finish">;
700
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
701
- readonly type: Schema.Literal<"tokens">;
702
- readonly input: Schema.optional<Schema.Number>;
703
- readonly output: Schema.optional<Schema.Number>;
704
- readonly total: Schema.optional<Schema.Number>;
705
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
706
- }>, Schema.Struct<{
707
- readonly type: Schema.Literal<"seconds">;
708
- readonly seconds: Schema.Number;
709
- }>, Schema.Struct<{
710
- readonly type: Schema.Literal<"characters">;
711
- readonly characters: Schema.Number;
712
- }>, Schema.Struct<{
713
- readonly type: Schema.Literal<"credits">;
714
- readonly credits: Schema.Number;
715
- }>, Schema.Struct<{
716
- readonly type: Schema.Literal<"compute">;
717
- readonly seconds: Schema.Number;
718
- }>]>>;
719
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
720
- }>;
721
- readonly "generation-progress": Schema.Struct<{
722
- readonly type: Schema.tag<"generation-progress">;
723
- readonly id: Schema.String;
724
- readonly progress: Schema.optional<Schema.Number>;
725
- }>;
726
- readonly "generation-queued": Schema.Struct<{
727
- readonly type: Schema.tag<"generation-queued">;
728
- readonly id: Schema.String;
729
- readonly position: Schema.optional<Schema.Number>;
730
- }>;
731
- readonly video: Schema.Struct<{
732
- readonly type: Schema.tag<"video">;
733
- readonly index: Schema.Number;
734
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
735
- readonly source: Schema.Union<readonly [Schema.Struct<{
736
- readonly type: Schema.Literal<"bytes">;
737
- readonly data: Schema.Uint8Array;
738
- readonly mediaType: Schema.String;
739
- }>, Schema.Struct<{
740
- readonly type: Schema.Literal<"base64">;
741
- readonly data: Schema.String;
742
- readonly mediaType: Schema.String;
743
- }>, Schema.Struct<{
744
- readonly type: Schema.Literal<"url">;
745
- readonly url: Schema.String;
746
- readonly mediaType: Schema.optional<Schema.String>;
747
- readonly expiresAt: Schema.optional<Schema.Number>;
748
- }>, Schema.Struct<{
749
- readonly type: Schema.Literal<"ref">;
750
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
751
- readonly id: Schema.String;
752
- readonly mediaType: Schema.optional<Schema.String>;
753
- }>]>;
754
- readonly info: Schema.optional<Schema.Struct<{
755
- readonly width: Schema.optional<Schema.Number>;
756
- readonly height: Schema.optional<Schema.Number>;
757
- readonly durationSeconds: Schema.optional<Schema.Number>;
758
- readonly sampleRate: Schema.optional<Schema.Number>;
759
- readonly channels: Schema.optional<Schema.Number>;
760
- readonly encoding: Schema.optional<Schema.String>;
761
- readonly format: Schema.optional<Schema.String>;
762
- }>>;
763
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
764
- }>, never, never>;
765
- }>;
766
- }[K]["Type"]) => any; }>(value: {
767
- readonly type: "video";
768
- readonly index: number;
769
- readonly video: Media.Asset;
770
- } | {
771
- readonly type: "generation-queued";
772
- readonly id: string;
773
- readonly position?: number | undefined;
774
- } | {
775
- readonly type: "generation-progress";
776
- readonly id: string;
777
- readonly progress?: number | undefined;
778
- } | {
779
- readonly type: "finish";
780
- readonly usage?: {
781
- readonly type: "seconds";
782
- readonly seconds: number;
783
- } | {
784
- readonly type: "characters";
785
- readonly characters: number;
786
- } | {
787
- readonly type: "credits";
788
- readonly credits: number;
789
- } | {
790
- readonly type: "compute";
791
- readonly seconds: number;
792
- } | {
793
- readonly type: "tokens";
794
- readonly input?: number | undefined;
795
- readonly output?: number | undefined;
796
- readonly total?: number | undefined;
797
- readonly details?: {
798
- readonly [x: string]: unknown;
799
- } | undefined;
800
- } | undefined;
801
- readonly providerMetadata?: {
802
- readonly [x: string]: {
803
- readonly [x: string]: unknown;
804
- };
805
- } | undefined;
806
- }, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["finish" | "generation-progress" | "generation-queued" | "video"]>>;
807
- <Handlers extends { [K in "finish" | "generation-progress" | "generation-queued" | "video"]: (value: {
808
- readonly finish: Schema.Struct<{
809
- readonly type: Schema.tag<"finish">;
810
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
811
- readonly type: Schema.Literal<"tokens">;
812
- readonly input: Schema.optional<Schema.Number>;
813
- readonly output: Schema.optional<Schema.Number>;
814
- readonly total: Schema.optional<Schema.Number>;
815
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
816
- }>, Schema.Struct<{
817
- readonly type: Schema.Literal<"seconds">;
818
- readonly seconds: Schema.Number;
819
- }>, Schema.Struct<{
820
- readonly type: Schema.Literal<"characters">;
821
- readonly characters: Schema.Number;
822
- }>, Schema.Struct<{
823
- readonly type: Schema.Literal<"credits">;
824
- readonly credits: Schema.Number;
825
- }>, Schema.Struct<{
826
- readonly type: Schema.Literal<"compute">;
827
- readonly seconds: Schema.Number;
828
- }>]>>;
829
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
830
- }>;
831
- readonly "generation-progress": Schema.Struct<{
832
- readonly type: Schema.tag<"generation-progress">;
833
- readonly id: Schema.String;
834
- readonly progress: Schema.optional<Schema.Number>;
835
- }>;
836
- readonly "generation-queued": Schema.Struct<{
837
- readonly type: Schema.tag<"generation-queued">;
838
- readonly id: Schema.String;
839
- readonly position: Schema.optional<Schema.Number>;
840
- }>;
841
- readonly video: Schema.Struct<{
842
- readonly type: Schema.tag<"video">;
843
- readonly index: Schema.Number;
844
- readonly video: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
845
- readonly source: Schema.Union<readonly [Schema.Struct<{
846
- readonly type: Schema.Literal<"bytes">;
847
- readonly data: Schema.Uint8Array;
848
- readonly mediaType: Schema.String;
849
- }>, Schema.Struct<{
850
- readonly type: Schema.Literal<"base64">;
851
- readonly data: Schema.String;
852
- readonly mediaType: Schema.String;
853
- }>, Schema.Struct<{
854
- readonly type: Schema.Literal<"url">;
855
- readonly url: Schema.String;
856
- readonly mediaType: Schema.optional<Schema.String>;
857
- readonly expiresAt: Schema.optional<Schema.Number>;
858
- }>, Schema.Struct<{
859
- readonly type: Schema.Literal<"ref">;
860
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
861
- readonly id: Schema.String;
862
- readonly mediaType: Schema.optional<Schema.String>;
863
- }>]>;
864
- readonly info: Schema.optional<Schema.Struct<{
865
- readonly width: Schema.optional<Schema.Number>;
866
- readonly height: Schema.optional<Schema.Number>;
867
- readonly durationSeconds: Schema.optional<Schema.Number>;
868
- readonly sampleRate: Schema.optional<Schema.Number>;
869
- readonly channels: Schema.optional<Schema.Number>;
870
- readonly encoding: Schema.optional<Schema.String>;
871
- readonly format: Schema.optional<Schema.String>;
872
- }>>;
873
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
874
- }>, never, never>;
875
- }>;
876
- }[K]["Type"]) => any; }>(cases: Handlers): (value: {
877
- readonly type: "video";
878
- readonly index: number;
879
- readonly video: Media.Asset;
880
- } | {
881
- readonly type: "generation-queued";
882
- readonly id: string;
883
- readonly position?: number | undefined;
884
- } | {
885
- readonly type: "generation-progress";
886
- readonly id: string;
887
- readonly progress?: number | undefined;
888
- } | {
889
- readonly type: "finish";
890
- readonly usage?: {
891
- readonly type: "seconds";
892
- readonly seconds: number;
893
- } | {
894
- readonly type: "characters";
895
- readonly characters: number;
896
- } | {
897
- readonly type: "credits";
898
- readonly credits: number;
899
- } | {
900
- readonly type: "compute";
901
- readonly seconds: number;
902
- } | {
903
- readonly type: "tokens";
904
- readonly input?: number | undefined;
905
- readonly output?: number | undefined;
906
- readonly total?: number | undefined;
907
- readonly details?: {
908
- readonly [x: string]: unknown;
909
- } | undefined;
910
- } | undefined;
911
- readonly providerMetadata?: {
912
- readonly [x: string]: {
913
- readonly [x: string]: unknown;
914
- };
915
- } | undefined;
916
- }) => import("effect/Unify").Unify<ReturnType<Handlers["finish" | "generation-progress" | "generation-queued" | "video"]>>;
917
- };
918
- readonly matchOrElse: {
919
- <Handlers, OrElse>(value: {
920
- readonly type: "video";
921
- readonly index: number;
922
- readonly video: Media.Asset;
923
- } | {
924
- readonly type: "generation-queued";
925
- readonly id: string;
926
- readonly position?: number | undefined;
927
- } | {
928
- readonly type: "generation-progress";
929
- readonly id: string;
930
- readonly progress?: number | undefined;
931
- } | {
932
- readonly type: "finish";
933
- readonly usage?: {
934
- readonly type: "seconds";
935
- readonly seconds: number;
936
- } | {
937
- readonly type: "characters";
938
- readonly characters: number;
939
- } | {
940
- readonly type: "credits";
941
- readonly credits: number;
942
- } | {
943
- readonly type: "compute";
944
- readonly seconds: number;
945
- } | {
946
- readonly type: "tokens";
947
- readonly input?: number | undefined;
948
- readonly output?: number | undefined;
949
- readonly total?: number | undefined;
950
- readonly details?: {
951
- readonly [x: string]: unknown;
952
- } | undefined;
953
- } | undefined;
954
- readonly providerMetadata?: {
955
- readonly [x: string]: {
956
- readonly [x: string]: unknown;
957
- };
958
- } | undefined;
959
- }, cases: Handlers & {
960
- readonly finish?: ((value: {
961
- readonly type: "finish";
962
- readonly usage?: {
963
- readonly type: "seconds";
964
- readonly seconds: number;
965
- } | {
966
- readonly type: "characters";
967
- readonly characters: number;
968
- } | {
969
- readonly type: "credits";
970
- readonly credits: number;
971
- } | {
972
- readonly type: "compute";
973
- readonly seconds: number;
974
- } | {
975
- readonly type: "tokens";
976
- readonly input?: number | undefined;
977
- readonly output?: number | undefined;
978
- readonly total?: number | undefined;
979
- readonly details?: {
980
- readonly [x: string]: unknown;
981
- } | undefined;
982
- } | undefined;
983
- readonly providerMetadata?: {
984
- readonly [x: string]: {
985
- readonly [x: string]: unknown;
986
- };
987
- } | undefined;
988
- }) => any) | undefined;
989
- readonly "generation-progress"?: ((value: {
990
- readonly type: "generation-progress";
991
- readonly id: string;
992
- readonly progress?: number | undefined;
993
- }) => any) | undefined;
994
- readonly "generation-queued"?: ((value: {
995
- readonly type: "generation-queued";
996
- readonly id: string;
997
- readonly position?: number | undefined;
998
- }) => any) | undefined;
999
- readonly video?: ((value: {
1000
- readonly type: "video";
1001
- readonly index: number;
1002
- readonly video: Media.Asset;
1003
- }) => any) | undefined;
1004
- } & (Exclude<keyof Handlers, "finish" | "generation-progress" | "generation-queued" | "video"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
1005
- readonly type: "video";
1006
- readonly index: number;
1007
- readonly video: Media.Asset;
1008
- }, {
1009
- readonly type: keyof Handlers;
1010
- }> | Exclude<{
1011
- readonly type: "generation-queued";
1012
- readonly id: string;
1013
- readonly position?: number | undefined;
1014
- }, {
1015
- readonly type: keyof Handlers;
1016
- }> | Exclude<{
1017
- readonly type: "generation-progress";
1018
- readonly id: string;
1019
- readonly progress?: number | undefined;
1020
- }, {
1021
- readonly type: keyof Handlers;
1022
- }> | Exclude<{
1023
- readonly type: "finish";
1024
- readonly usage?: {
1025
- readonly type: "seconds";
1026
- readonly seconds: number;
1027
- } | {
1028
- readonly type: "characters";
1029
- readonly characters: number;
1030
- } | {
1031
- readonly type: "credits";
1032
- readonly credits: number;
1033
- } | {
1034
- readonly type: "compute";
1035
- readonly seconds: number;
1036
- } | {
1037
- readonly type: "tokens";
1038
- readonly input?: number | undefined;
1039
- readonly output?: number | undefined;
1040
- readonly total?: number | undefined;
1041
- readonly details?: {
1042
- readonly [x: string]: unknown;
1043
- } | undefined;
1044
- } | undefined;
1045
- readonly providerMetadata?: {
1046
- readonly [x: string]: {
1047
- readonly [x: string]: unknown;
1048
- };
1049
- } | undefined;
1050
- }, {
1051
- readonly type: keyof Handlers;
1052
- }>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
1053
- <Handlers, OrElse>(cases: Handlers & {
1054
- readonly finish?: ((value: {
1055
- readonly type: "finish";
1056
- readonly usage?: {
1057
- readonly type: "seconds";
1058
- readonly seconds: number;
1059
- } | {
1060
- readonly type: "characters";
1061
- readonly characters: number;
1062
- } | {
1063
- readonly type: "credits";
1064
- readonly credits: number;
1065
- } | {
1066
- readonly type: "compute";
1067
- readonly seconds: number;
1068
- } | {
1069
- readonly type: "tokens";
1070
- readonly input?: number | undefined;
1071
- readonly output?: number | undefined;
1072
- readonly total?: number | undefined;
1073
- readonly details?: {
1074
- readonly [x: string]: unknown;
1075
- } | undefined;
1076
- } | undefined;
1077
- readonly providerMetadata?: {
1078
- readonly [x: string]: {
1079
- readonly [x: string]: unknown;
1080
- };
1081
- } | undefined;
1082
- }) => any) | undefined;
1083
- readonly "generation-progress"?: ((value: {
1084
- readonly type: "generation-progress";
1085
- readonly id: string;
1086
- readonly progress?: number | undefined;
1087
- }) => any) | undefined;
1088
- readonly "generation-queued"?: ((value: {
1089
- readonly type: "generation-queued";
1090
- readonly id: string;
1091
- readonly position?: number | undefined;
1092
- }) => any) | undefined;
1093
- readonly video?: ((value: {
1094
- readonly type: "video";
1095
- readonly index: number;
1096
- readonly video: Media.Asset;
1097
- }) => any) | undefined;
1098
- } & (Exclude<keyof Handlers, "finish" | "generation-progress" | "generation-queued" | "video"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
1099
- readonly type: "video";
1100
- readonly index: number;
1101
- readonly video: Media.Asset;
1102
- }, {
1103
- readonly type: keyof Handlers;
1104
- }> | Exclude<{
1105
- readonly type: "generation-queued";
1106
- readonly id: string;
1107
- readonly position?: number | undefined;
1108
- }, {
1109
- readonly type: keyof Handlers;
1110
- }> | Exclude<{
1111
- readonly type: "generation-progress";
1112
- readonly id: string;
1113
- readonly progress?: number | undefined;
1114
- }, {
1115
- readonly type: keyof Handlers;
1116
- }> | Exclude<{
1117
- readonly type: "finish";
1118
- readonly usage?: {
1119
- readonly type: "seconds";
1120
- readonly seconds: number;
1121
- } | {
1122
- readonly type: "characters";
1123
- readonly characters: number;
1124
- } | {
1125
- readonly type: "credits";
1126
- readonly credits: number;
1127
- } | {
1128
- readonly type: "compute";
1129
- readonly seconds: number;
1130
- } | {
1131
- readonly type: "tokens";
1132
- readonly input?: number | undefined;
1133
- readonly output?: number | undefined;
1134
- readonly total?: number | undefined;
1135
- readonly details?: {
1136
- readonly [x: string]: unknown;
1137
- } | undefined;
1138
- } | undefined;
1139
- readonly providerMetadata?: {
1140
- readonly [x: string]: {
1141
- readonly [x: string]: unknown;
1142
- };
1143
- } | undefined;
1144
- }, {
1145
- readonly type: keyof Handlers;
1146
- }>) => any)): (value: {
1147
- readonly type: "video";
1148
- readonly index: number;
1149
- readonly video: Media.Asset;
1150
- } | {
1151
- readonly type: "generation-queued";
1152
- readonly id: string;
1153
- readonly position?: number | undefined;
1154
- } | {
1155
- readonly type: "generation-progress";
1156
- readonly id: string;
1157
- readonly progress?: number | undefined;
1158
- } | {
1159
- readonly type: "finish";
1160
- readonly usage?: {
1161
- readonly type: "seconds";
1162
- readonly seconds: number;
1163
- } | {
1164
- readonly type: "characters";
1165
- readonly characters: number;
1166
- } | {
1167
- readonly type: "credits";
1168
- readonly credits: number;
1169
- } | {
1170
- readonly type: "compute";
1171
- readonly seconds: number;
1172
- } | {
1173
- readonly type: "tokens";
1174
- readonly input?: number | undefined;
1175
- readonly output?: number | undefined;
1176
- readonly total?: number | undefined;
1177
- readonly details?: {
1178
- readonly [x: string]: unknown;
1179
- } | undefined;
1180
- } | undefined;
1181
- readonly providerMetadata?: {
1182
- readonly [x: string]: {
1183
- readonly [x: string]: unknown;
1184
- };
1185
- } | undefined;
1186
- }) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
1187
- };
1188
- } & {
1189
- is: {
1190
- generationQueued: (u: unknown) => u is {
1191
- readonly type: "generation-queued";
1192
- readonly id: string;
1193
- readonly position?: number | undefined;
1194
- };
1195
- generationProgress: (u: unknown) => u is {
1196
- readonly type: "generation-progress";
1197
- readonly id: string;
1198
- readonly progress?: number | undefined;
1199
- };
1200
- video: (u: unknown) => u is {
1201
- readonly type: "video";
1202
- readonly index: number;
1203
- readonly video: Media.Asset;
1204
- };
1205
- finish: (u: unknown) => u is {
1206
- readonly type: "finish";
1207
- readonly usage?: {
1208
- readonly type: "seconds";
1209
- readonly seconds: number;
1210
- } | {
1211
- readonly type: "characters";
1212
- readonly characters: number;
1213
- } | {
1214
- readonly type: "credits";
1215
- readonly credits: number;
1216
- } | {
1217
- readonly type: "compute";
1218
- readonly seconds: number;
1219
- } | {
1220
- readonly type: "tokens";
1221
- readonly input?: number | undefined;
1222
- readonly output?: number | undefined;
1223
- readonly total?: number | undefined;
1224
- readonly details?: {
1225
- readonly [x: string]: unknown;
1226
- } | undefined;
1227
- } | undefined;
1228
- readonly providerMetadata?: {
1229
- readonly [x: string]: {
1230
- readonly [x: string]: unknown;
1231
- };
1232
- } | undefined;
1233
- };
1234
- };
1235
- };
1236
- export type VideoEvent = Schema.Schema.Type<typeof videoEventTagged>;
1237
218
  /** Normalize video request input into a plain `VideoRequest`. */
1238
219
  export declare const request: <const Model extends VideoModel>(input: VideoRequestInput<Model>) => VideoRequest<Model>;
1239
- export declare function start<const Model extends VideoModel>(input: VideoRequestInput<Model>): Effect.Effect<Generation<VideoResponse>, AIError, Service>;
1240
- export declare function generate<const Model extends VideoModel>(input: VideoRequestInput<Model>, options?: AwaitOptions): Effect.Effect<VideoResponse, AIError, Service>;
1241
- /** Rebuild a generation handle from a persisted `Generation.token`, refreshing its status once. */
1242
- export declare const resume: (model: VideoModel, token: unknown) => Effect.Effect<Generation<VideoResponse>, AIError, Service>;
1243
- export declare function stream<const Model extends VideoModel>(input: VideoRequestInput<Model>, options?: AwaitOptions): Stream.Stream<VideoEvent, AIError, Service>;
220
+ /** Submit a generation and return at once; nothing polls. */
221
+ export declare function start<const Model extends VideoModel>(input: VideoRequestInput<Model>): Effect.Effect<VideoJob, AIError, Service>;
222
+ /** One status read for a stored token. */
223
+ export declare const status: (model: VideoModel, token: unknown) => Effect.Effect<VideoStatus, AIError, Service>;
224
+ /** The finished videos; fails while the job is still running, or with the provider's reason when it failed. */
225
+ export declare const result: (model: VideoModel, token: unknown) => Effect.Effect<VideoResponse, AIError, Service>;
226
+ /** Ask the provider to stop the job; fails with `UnsupportedOperation` when the provider has no cancel call. */
227
+ export declare const cancel: (model: VideoModel, token: unknown) => Effect.Effect<void, AIError, Service>;
1244
228
  export declare const Video: {
1245
229
  readonly request: typeof request;
1246
230
  readonly start: typeof start;
1247
- readonly generate: typeof generate;
1248
- readonly resume: typeof resume;
1249
- readonly stream: typeof stream;
231
+ readonly status: typeof status;
232
+ readonly result: typeof result;
233
+ readonly cancel: typeof cancel;
1250
234
  };
1251
235
  export {};