@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
package/dist/image.d.ts CHANGED
@@ -1,110 +1,1439 @@
1
- import { Effect, Schema } from "effect";
2
- import { HttpOptions, AIError, ModelID, ProviderID, Usage } from "./schema/index.js";
3
- import { Service, type Execute as ImageExecute } from "./image-client.js";
4
- export interface ImageRoute<Options extends ImageOptions = ImageOptions> {
5
- readonly id: string;
6
- readonly generate: (request: ImageRequestFor<Options>, execute: ImageExecute) => Effect.Effect<ImageResponse, AIError>;
7
- }
1
+ import { Effect, Schema, Stream } from "effect";
2
+ import { Generation, type AwaitOptions } from "./generation.js";
3
+ import { Media } from "./media.js";
4
+ import { MediaModel } from "./media-model.js";
5
+ import { MediaRoute } from "./route/media.js";
6
+ import type { MediaProtocol } from "./route/media-protocol.js";
7
+ import { AIError, HttpOptions } from "./schema/index.js";
8
+ import { Service } from "./image-client.js";
8
9
  export type ImageOptions = Record<string, unknown>;
9
- export declare class ImageModel<Options extends ImageOptions = ImageOptions> {
10
- protected readonly _Options: (options: Options) => Options;
11
- readonly id: ModelID;
12
- readonly provider: ProviderID;
13
- readonly route: ImageRoute<Options>;
14
- readonly http?: HttpOptions;
15
- constructor(input: ImageModel.Input<Options>);
16
- static make<Options extends ImageOptions = ImageOptions>(input: ImageModel.MakeInput<Options>): ImageModel<Options>;
10
+ export type ImageRoute<Options extends ImageOptions = ImageOptions> = MediaRoute.AnyRoute<ImageRequestFor<Options>, ImageEvent, ImageResponse>;
11
+ export declare class ImageModel<Options extends ImageOptions = ImageOptions> extends MediaModel<ImageRoute<Options>, Options> {
12
+ protected readonly _ImageModel: void;
13
+ static make<Options extends ImageOptions = ImageOptions>(input: MediaModel.Input<ImageRoute<Options>>): ImageModel<Options>;
14
+ /** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
15
+ static fromRoute<Options extends ImageOptions>(route: ImageModel.InlineRouteInput<Options>, input: MediaRoute.ModelInput): ImageModel<Options>;
16
+ static fromRoute<Options extends ImageOptions, Frame, State>(route: ImageModel.StreamRouteInput<Options, Frame, State>, input: MediaRoute.ModelInput): ImageModel<Options>;
17
+ static fromRoute<Options extends ImageOptions, Token>(route: ImageModel.QueuedRouteInput<Options, Token>, input: MediaRoute.ModelInput): ImageModel<Options>;
17
18
  }
18
19
  export declare namespace ImageModel {
19
- interface Input<Options extends ImageOptions = ImageOptions> {
20
- readonly id: ModelID;
21
- readonly provider: ProviderID;
22
- readonly route: ImageRoute<Options>;
23
- readonly http?: HttpOptions;
24
- }
25
- interface MakeInput<Options extends ImageOptions = ImageOptions> extends Omit<Input<Options>, "id" | "provider"> {
26
- readonly id: string | ModelID;
27
- readonly provider: string | ProviderID;
28
- }
20
+ type InlineRouteInput<Options extends ImageOptions = ImageOptions> = MediaModel.RouteInput<ImageRequestFor<Options>, MediaProtocol.Inline<ImageRequestFor<Options>, ImageResponse>>;
21
+ type StreamRouteInput<Options extends ImageOptions = ImageOptions, Frame = unknown, State = unknown> = MediaModel.RouteInput<MediaProtocol.Addressed<ImageRequestFor<Options>>, MediaProtocol.Streamed<ImageRequestFor<Options>, ImageEvent, Frame, State>>;
22
+ type QueuedRouteInput<Options extends ImageOptions = ImageOptions, Token = unknown> = MediaModel.RouteInput<ImageRequestFor<Options>, MediaProtocol.Queued<ImageRequestFor<Options>, ImageResponse, Token>>;
23
+ type RouteInput<Options extends ImageOptions = ImageOptions, Frame = unknown, State = unknown, Token = unknown> = MediaModel.AnyRouteInput<ImageRequestFor<Options>, ImageEvent, ImageResponse, Frame, State, Token>;
29
24
  }
30
25
  export declare const ImageModelSchema: Schema.declare<ImageModel<ImageOptions>, ImageModel<ImageOptions>>;
31
- export declare const ImageInputSchema: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
32
- readonly type: Schema.Literal<"bytes">;
33
- readonly data: Schema.Uint8Array;
34
- readonly mediaType: Schema.String;
35
- }>, Schema.Struct<{
36
- readonly type: Schema.Literal<"url">;
37
- readonly url: Schema.String;
38
- }>, Schema.Struct<{
39
- readonly type: Schema.Literal<"file-id">;
40
- readonly id: Schema.String;
41
- }>, Schema.Struct<{
42
- readonly type: Schema.Literal<"file-uri">;
43
- readonly uri: Schema.String;
44
- readonly mediaType: Schema.String;
45
- }>]>;
46
- export type ImageInput = Schema.Schema.Type<typeof ImageInputSchema>;
47
- export declare const ImageInput: {
48
- readonly bytes: (data: Uint8Array, mediaType: string) => ImageInput;
49
- readonly url: (url: string) => ImageInput;
50
- readonly file: (id: string) => ImageInput;
51
- readonly fileUri: (uri: string, mediaType: string) => ImageInput;
52
- };
26
+ export type ImageSize = `${number}x${number}`;
27
+ export declare const ImageSize: Schema.declare<`${number}x${number}`, `${number}x${number}`>;
28
+ export type ImageAspectRatio = Media.AspectRatio;
29
+ export declare const ImageAspectRatio: Schema.declare<`${number}:${number}`, `${number}:${number}`>;
30
+ export type ImageFormat = "png" | "jpeg" | "webp" | (string & {});
53
31
  declare const ImageRequest_base: Schema.Class<ImageRequest, Schema.Struct<{
54
32
  readonly model: Schema.declare<ImageModel<ImageOptions>, ImageModel<ImageOptions>>;
55
33
  readonly prompt: Schema.String;
56
- readonly images: Schema.optional<Schema.$Array<Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
57
- readonly type: Schema.Literal<"bytes">;
58
- readonly data: Schema.Uint8Array;
59
- readonly mediaType: Schema.String;
60
- }>, Schema.Struct<{
61
- readonly type: Schema.Literal<"url">;
62
- readonly url: Schema.String;
63
- }>, Schema.Struct<{
64
- readonly type: Schema.Literal<"file-id">;
65
- readonly id: Schema.String;
66
- }>, Schema.Struct<{
67
- readonly type: Schema.Literal<"file-uri">;
68
- readonly uri: Schema.String;
69
- readonly mediaType: Schema.String;
70
- }>]>>>;
71
- readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
34
+ /** Edit sources or style/subject references, in order. */
35
+ readonly images: Schema.optional<Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
36
+ readonly source: Schema.Union<readonly [Schema.Struct<{
37
+ readonly type: Schema.Literal<"bytes">;
38
+ readonly data: Schema.Uint8Array;
39
+ readonly mediaType: Schema.String;
40
+ }>, Schema.Struct<{
41
+ readonly type: Schema.Literal<"base64">;
42
+ readonly data: Schema.String;
43
+ readonly mediaType: Schema.String;
44
+ }>, Schema.Struct<{
45
+ readonly type: Schema.Literal<"url">;
46
+ readonly url: Schema.String;
47
+ readonly mediaType: Schema.optional<Schema.String>;
48
+ readonly expiresAt: Schema.optional<Schema.Number>;
49
+ }>, Schema.Struct<{
50
+ readonly type: Schema.Literal<"ref">;
51
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
52
+ readonly id: Schema.String;
53
+ readonly mediaType: Schema.optional<Schema.String>;
54
+ }>]>;
55
+ readonly info: Schema.optional<Schema.Struct<{
56
+ readonly width: Schema.optional<Schema.Number>;
57
+ readonly height: Schema.optional<Schema.Number>;
58
+ readonly durationSeconds: Schema.optional<Schema.Number>;
59
+ readonly sampleRate: Schema.optional<Schema.Number>;
60
+ readonly channels: Schema.optional<Schema.Number>;
61
+ readonly encoding: Schema.optional<Schema.String>;
62
+ readonly format: Schema.optional<Schema.String>;
63
+ }>>;
64
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
65
+ }>, never, never>>>;
66
+ /** Inpainting mask; routes that cannot honor it fail with `UnsupportedOperation`. */
67
+ readonly mask: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
68
+ readonly source: Schema.Union<readonly [Schema.Struct<{
69
+ readonly type: Schema.Literal<"bytes">;
70
+ readonly data: Schema.Uint8Array;
71
+ readonly mediaType: Schema.String;
72
+ }>, Schema.Struct<{
73
+ readonly type: Schema.Literal<"base64">;
74
+ readonly data: Schema.String;
75
+ readonly mediaType: Schema.String;
76
+ }>, Schema.Struct<{
77
+ readonly type: Schema.Literal<"url">;
78
+ readonly url: Schema.String;
79
+ readonly mediaType: Schema.optional<Schema.String>;
80
+ readonly expiresAt: Schema.optional<Schema.Number>;
81
+ }>, Schema.Struct<{
82
+ readonly type: Schema.Literal<"ref">;
83
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
84
+ readonly id: Schema.String;
85
+ readonly mediaType: Schema.optional<Schema.String>;
86
+ }>]>;
87
+ readonly info: Schema.optional<Schema.Struct<{
88
+ readonly width: Schema.optional<Schema.Number>;
89
+ readonly height: Schema.optional<Schema.Number>;
90
+ readonly durationSeconds: Schema.optional<Schema.Number>;
91
+ readonly sampleRate: Schema.optional<Schema.Number>;
92
+ readonly channels: Schema.optional<Schema.Number>;
93
+ readonly encoding: Schema.optional<Schema.String>;
94
+ readonly format: Schema.optional<Schema.String>;
95
+ }>>;
96
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
97
+ }>, never, never>>;
98
+ readonly n: Schema.optional<Schema.Int>;
99
+ readonly size: Schema.optional<Schema.declare<`${number}x${number}`, `${number}x${number}`>>;
100
+ readonly aspectRatio: Schema.optional<Schema.declare<`${number}:${number}`, `${number}:${number}`>>;
101
+ readonly seed: Schema.optional<Schema.Number>;
102
+ readonly format: Schema.optional<Schema.String>;
103
+ readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
72
104
  readonly http: Schema.optional<typeof HttpOptions>;
73
105
  }>, {}>;
74
106
  export declare class ImageRequest extends ImageRequest_base {
75
107
  protected readonly _ImageRequest: void;
76
108
  }
77
- export type ImageRequestFor<Options extends ImageOptions = ImageOptions> = Omit<ImageRequest, "model" | "options"> & {
109
+ export type ImageRequestFor<Options extends ImageOptions = ImageOptions> = Omit<ImageRequest, "model" | "providerOptions"> & {
78
110
  readonly model: ImageModel<Options>;
79
- readonly options?: Options;
111
+ readonly providerOptions?: Options;
80
112
  };
81
113
  export type ImageModelOptions<Model> = Model extends ImageModel<infer Options> ? Options : never;
82
- export type ImageRequestInput<Model extends object = ImageModel> = Omit<ConstructorParameters<typeof ImageRequest>[0], "model" | "options" | "http"> & {
114
+ export type ImageRequestInput<Model extends ImageModel = ImageModel> = Omit<ConstructorParameters<typeof ImageRequest>[0], "model" | "providerOptions" | "http"> & {
83
115
  readonly model: Model;
84
- readonly options?: NoInfer<ImageModelOptions<Model>>;
116
+ readonly format?: ImageFormat;
117
+ readonly providerOptions?: NoInfer<ImageModelOptions<Model>>;
85
118
  readonly http?: HttpOptions.Input;
86
- } & (Model extends ImageModel<ImageModelOptions<Model>> ? unknown : never);
87
- declare const GeneratedImage_base: Schema.Class<GeneratedImage, Schema.Struct<{
88
- readonly mediaType: Schema.String;
89
- readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array]>;
90
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
91
- }>, {}>;
92
- export declare class GeneratedImage extends GeneratedImage_base {
93
- }
119
+ };
94
120
  declare const ImageResponse_base: Schema.Class<ImageResponse, Schema.Struct<{
95
- readonly images: Schema.$Array<typeof GeneratedImage>;
96
- readonly usage: Schema.optional<typeof Usage>;
121
+ readonly images: Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
122
+ readonly source: Schema.Union<readonly [Schema.Struct<{
123
+ readonly type: Schema.Literal<"bytes">;
124
+ readonly data: Schema.Uint8Array;
125
+ readonly mediaType: Schema.String;
126
+ }>, Schema.Struct<{
127
+ readonly type: Schema.Literal<"base64">;
128
+ readonly data: Schema.String;
129
+ readonly mediaType: Schema.String;
130
+ }>, Schema.Struct<{
131
+ readonly type: Schema.Literal<"url">;
132
+ readonly url: Schema.String;
133
+ readonly mediaType: Schema.optional<Schema.String>;
134
+ readonly expiresAt: Schema.optional<Schema.Number>;
135
+ }>, Schema.Struct<{
136
+ readonly type: Schema.Literal<"ref">;
137
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
138
+ readonly id: Schema.String;
139
+ readonly mediaType: Schema.optional<Schema.String>;
140
+ }>]>;
141
+ readonly info: Schema.optional<Schema.Struct<{
142
+ readonly width: Schema.optional<Schema.Number>;
143
+ readonly height: Schema.optional<Schema.Number>;
144
+ readonly durationSeconds: Schema.optional<Schema.Number>;
145
+ readonly sampleRate: Schema.optional<Schema.Number>;
146
+ readonly channels: Schema.optional<Schema.Number>;
147
+ readonly encoding: Schema.optional<Schema.String>;
148
+ readonly format: Schema.optional<Schema.String>;
149
+ }>>;
150
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
151
+ }>, never, never>>;
152
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
153
+ readonly type: Schema.Literal<"tokens">;
154
+ readonly input: Schema.optional<Schema.Number>;
155
+ readonly output: Schema.optional<Schema.Number>;
156
+ readonly total: Schema.optional<Schema.Number>;
157
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
158
+ }>, Schema.Struct<{
159
+ readonly type: Schema.Literal<"seconds">;
160
+ readonly seconds: Schema.Number;
161
+ }>, Schema.Struct<{
162
+ readonly type: Schema.Literal<"characters">;
163
+ readonly characters: Schema.Number;
164
+ }>, Schema.Struct<{
165
+ readonly type: Schema.Literal<"credits">;
166
+ readonly credits: Schema.Number;
167
+ }>, Schema.Struct<{
168
+ readonly type: Schema.Literal<"compute">;
169
+ readonly seconds: Schema.Number;
170
+ }>]>>;
171
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
172
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
173
+ readonly message: Schema.String;
174
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
175
+ }>>>;
97
176
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
98
177
  }>, {}>;
99
178
  export declare class ImageResponse extends ImageResponse_base {
100
- get image(): GeneratedImage;
179
+ get image(): Media.Asset;
101
180
  }
102
- export declare function request<const Model extends object>(input: ImageRequestInput<Model>): ImageRequestFor<ImageModelOptions<Model>>;
181
+ /** The `index`-th lower-fidelity preview of an image still generating; the `image` event supersedes it. */
182
+ export declare const ImagePartialEvent: Schema.Struct<{
183
+ readonly type: Schema.tag<"image-partial">;
184
+ readonly index: Schema.Number;
185
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
186
+ readonly source: Schema.Union<readonly [Schema.Struct<{
187
+ readonly type: Schema.Literal<"bytes">;
188
+ readonly data: Schema.Uint8Array;
189
+ readonly mediaType: Schema.String;
190
+ }>, Schema.Struct<{
191
+ readonly type: Schema.Literal<"base64">;
192
+ readonly data: Schema.String;
193
+ readonly mediaType: Schema.String;
194
+ }>, Schema.Struct<{
195
+ readonly type: Schema.Literal<"url">;
196
+ readonly url: Schema.String;
197
+ readonly mediaType: Schema.optional<Schema.String>;
198
+ readonly expiresAt: Schema.optional<Schema.Number>;
199
+ }>, Schema.Struct<{
200
+ readonly type: Schema.Literal<"ref">;
201
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
202
+ readonly id: Schema.String;
203
+ readonly mediaType: Schema.optional<Schema.String>;
204
+ }>]>;
205
+ readonly info: Schema.optional<Schema.Struct<{
206
+ readonly width: Schema.optional<Schema.Number>;
207
+ readonly height: Schema.optional<Schema.Number>;
208
+ readonly durationSeconds: Schema.optional<Schema.Number>;
209
+ readonly sampleRate: Schema.optional<Schema.Number>;
210
+ readonly channels: Schema.optional<Schema.Number>;
211
+ readonly encoding: Schema.optional<Schema.String>;
212
+ readonly format: Schema.optional<Schema.String>;
213
+ }>>;
214
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
215
+ }>, never, never>;
216
+ }>;
217
+ export declare const ImageOutputEvent: Schema.Struct<{
218
+ readonly type: Schema.tag<"image">;
219
+ readonly index: Schema.Number;
220
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
221
+ readonly source: Schema.Union<readonly [Schema.Struct<{
222
+ readonly type: Schema.Literal<"bytes">;
223
+ readonly data: Schema.Uint8Array;
224
+ readonly mediaType: Schema.String;
225
+ }>, Schema.Struct<{
226
+ readonly type: Schema.Literal<"base64">;
227
+ readonly data: Schema.String;
228
+ readonly mediaType: Schema.String;
229
+ }>, Schema.Struct<{
230
+ readonly type: Schema.Literal<"url">;
231
+ readonly url: Schema.String;
232
+ readonly mediaType: Schema.optional<Schema.String>;
233
+ readonly expiresAt: Schema.optional<Schema.Number>;
234
+ }>, Schema.Struct<{
235
+ readonly type: Schema.Literal<"ref">;
236
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
237
+ readonly id: Schema.String;
238
+ readonly mediaType: Schema.optional<Schema.String>;
239
+ }>]>;
240
+ readonly info: Schema.optional<Schema.Struct<{
241
+ readonly width: Schema.optional<Schema.Number>;
242
+ readonly height: Schema.optional<Schema.Number>;
243
+ readonly durationSeconds: Schema.optional<Schema.Number>;
244
+ readonly sampleRate: Schema.optional<Schema.Number>;
245
+ readonly channels: Schema.optional<Schema.Number>;
246
+ readonly encoding: Schema.optional<Schema.String>;
247
+ readonly format: Schema.optional<Schema.String>;
248
+ }>>;
249
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
250
+ }>, never, never>;
251
+ }>;
252
+ export declare const ImageFinishEvent: Schema.Struct<{
253
+ readonly type: Schema.tag<"finish">;
254
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
255
+ readonly type: Schema.Literal<"tokens">;
256
+ readonly input: Schema.optional<Schema.Number>;
257
+ readonly output: Schema.optional<Schema.Number>;
258
+ readonly total: Schema.optional<Schema.Number>;
259
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
260
+ }>, Schema.Struct<{
261
+ readonly type: Schema.Literal<"seconds">;
262
+ readonly seconds: Schema.Number;
263
+ }>, Schema.Struct<{
264
+ readonly type: Schema.Literal<"characters">;
265
+ readonly characters: Schema.Number;
266
+ }>, Schema.Struct<{
267
+ readonly type: Schema.Literal<"credits">;
268
+ readonly credits: Schema.Number;
269
+ }>, Schema.Struct<{
270
+ readonly type: Schema.Literal<"compute">;
271
+ readonly seconds: Schema.Number;
272
+ }>]>>;
273
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
274
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
275
+ readonly message: Schema.String;
276
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
277
+ }>>>;
278
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
279
+ }>;
280
+ declare const imageEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
281
+ readonly type: Schema.tag<"generation-queued">;
282
+ readonly id: Schema.String;
283
+ readonly position: Schema.optional<Schema.Number>;
284
+ }>, Schema.Struct<{
285
+ readonly type: Schema.tag<"generation-progress">;
286
+ readonly id: Schema.String;
287
+ readonly progress: Schema.optional<Schema.Number>;
288
+ }>, Schema.Struct<{
289
+ readonly type: Schema.tag<"image-partial">;
290
+ readonly index: Schema.Number;
291
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
292
+ readonly source: Schema.Union<readonly [Schema.Struct<{
293
+ readonly type: Schema.Literal<"bytes">;
294
+ readonly data: Schema.Uint8Array;
295
+ readonly mediaType: Schema.String;
296
+ }>, Schema.Struct<{
297
+ readonly type: Schema.Literal<"base64">;
298
+ readonly data: Schema.String;
299
+ readonly mediaType: Schema.String;
300
+ }>, Schema.Struct<{
301
+ readonly type: Schema.Literal<"url">;
302
+ readonly url: Schema.String;
303
+ readonly mediaType: Schema.optional<Schema.String>;
304
+ readonly expiresAt: Schema.optional<Schema.Number>;
305
+ }>, Schema.Struct<{
306
+ readonly type: Schema.Literal<"ref">;
307
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
308
+ readonly id: Schema.String;
309
+ readonly mediaType: Schema.optional<Schema.String>;
310
+ }>]>;
311
+ readonly info: Schema.optional<Schema.Struct<{
312
+ readonly width: Schema.optional<Schema.Number>;
313
+ readonly height: Schema.optional<Schema.Number>;
314
+ readonly durationSeconds: Schema.optional<Schema.Number>;
315
+ readonly sampleRate: Schema.optional<Schema.Number>;
316
+ readonly channels: Schema.optional<Schema.Number>;
317
+ readonly encoding: Schema.optional<Schema.String>;
318
+ readonly format: Schema.optional<Schema.String>;
319
+ }>>;
320
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
321
+ }>, never, never>;
322
+ }>, Schema.Struct<{
323
+ readonly type: Schema.tag<"image">;
324
+ readonly index: Schema.Number;
325
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
326
+ readonly source: Schema.Union<readonly [Schema.Struct<{
327
+ readonly type: Schema.Literal<"bytes">;
328
+ readonly data: Schema.Uint8Array;
329
+ readonly mediaType: Schema.String;
330
+ }>, Schema.Struct<{
331
+ readonly type: Schema.Literal<"base64">;
332
+ readonly data: Schema.String;
333
+ readonly mediaType: Schema.String;
334
+ }>, Schema.Struct<{
335
+ readonly type: Schema.Literal<"url">;
336
+ readonly url: Schema.String;
337
+ readonly mediaType: Schema.optional<Schema.String>;
338
+ readonly expiresAt: Schema.optional<Schema.Number>;
339
+ }>, Schema.Struct<{
340
+ readonly type: Schema.Literal<"ref">;
341
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
342
+ readonly id: Schema.String;
343
+ readonly mediaType: Schema.optional<Schema.String>;
344
+ }>]>;
345
+ readonly info: Schema.optional<Schema.Struct<{
346
+ readonly width: Schema.optional<Schema.Number>;
347
+ readonly height: Schema.optional<Schema.Number>;
348
+ readonly durationSeconds: Schema.optional<Schema.Number>;
349
+ readonly sampleRate: Schema.optional<Schema.Number>;
350
+ readonly channels: Schema.optional<Schema.Number>;
351
+ readonly encoding: Schema.optional<Schema.String>;
352
+ readonly format: Schema.optional<Schema.String>;
353
+ }>>;
354
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
355
+ }>, never, never>;
356
+ }>, Schema.Struct<{
357
+ readonly type: Schema.tag<"finish">;
358
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
359
+ readonly type: Schema.Literal<"tokens">;
360
+ readonly input: Schema.optional<Schema.Number>;
361
+ readonly output: Schema.optional<Schema.Number>;
362
+ readonly total: Schema.optional<Schema.Number>;
363
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
364
+ }>, Schema.Struct<{
365
+ readonly type: Schema.Literal<"seconds">;
366
+ readonly seconds: Schema.Number;
367
+ }>, Schema.Struct<{
368
+ readonly type: Schema.Literal<"characters">;
369
+ readonly characters: Schema.Number;
370
+ }>, Schema.Struct<{
371
+ readonly type: Schema.Literal<"credits">;
372
+ readonly credits: Schema.Number;
373
+ }>, Schema.Struct<{
374
+ readonly type: Schema.Literal<"compute">;
375
+ readonly seconds: Schema.Number;
376
+ }>]>>;
377
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
378
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
379
+ readonly message: Schema.String;
380
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
381
+ }>>>;
382
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
383
+ }>]>;
384
+ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
385
+ readonly type: Schema.tag<"generation-queued">;
386
+ readonly id: Schema.String;
387
+ readonly position: Schema.optional<Schema.Number>;
388
+ }>, Schema.Struct<{
389
+ readonly type: Schema.tag<"generation-progress">;
390
+ readonly id: Schema.String;
391
+ readonly progress: Schema.optional<Schema.Number>;
392
+ }>, Schema.Struct<{
393
+ readonly type: Schema.tag<"image-partial">;
394
+ readonly index: Schema.Number;
395
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
396
+ readonly source: Schema.Union<readonly [Schema.Struct<{
397
+ readonly type: Schema.Literal<"bytes">;
398
+ readonly data: Schema.Uint8Array;
399
+ readonly mediaType: Schema.String;
400
+ }>, Schema.Struct<{
401
+ readonly type: Schema.Literal<"base64">;
402
+ readonly data: Schema.String;
403
+ readonly mediaType: Schema.String;
404
+ }>, Schema.Struct<{
405
+ readonly type: Schema.Literal<"url">;
406
+ readonly url: Schema.String;
407
+ readonly mediaType: Schema.optional<Schema.String>;
408
+ readonly expiresAt: Schema.optional<Schema.Number>;
409
+ }>, Schema.Struct<{
410
+ readonly type: Schema.Literal<"ref">;
411
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
412
+ readonly id: Schema.String;
413
+ readonly mediaType: Schema.optional<Schema.String>;
414
+ }>]>;
415
+ readonly info: Schema.optional<Schema.Struct<{
416
+ readonly width: Schema.optional<Schema.Number>;
417
+ readonly height: Schema.optional<Schema.Number>;
418
+ readonly durationSeconds: Schema.optional<Schema.Number>;
419
+ readonly sampleRate: Schema.optional<Schema.Number>;
420
+ readonly channels: Schema.optional<Schema.Number>;
421
+ readonly encoding: Schema.optional<Schema.String>;
422
+ readonly format: Schema.optional<Schema.String>;
423
+ }>>;
424
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
425
+ }>, never, never>;
426
+ }>, Schema.Struct<{
427
+ readonly type: Schema.tag<"image">;
428
+ readonly index: Schema.Number;
429
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
430
+ readonly source: Schema.Union<readonly [Schema.Struct<{
431
+ readonly type: Schema.Literal<"bytes">;
432
+ readonly data: Schema.Uint8Array;
433
+ readonly mediaType: Schema.String;
434
+ }>, Schema.Struct<{
435
+ readonly type: Schema.Literal<"base64">;
436
+ readonly data: Schema.String;
437
+ readonly mediaType: Schema.String;
438
+ }>, Schema.Struct<{
439
+ readonly type: Schema.Literal<"url">;
440
+ readonly url: Schema.String;
441
+ readonly mediaType: Schema.optional<Schema.String>;
442
+ readonly expiresAt: Schema.optional<Schema.Number>;
443
+ }>, Schema.Struct<{
444
+ readonly type: Schema.Literal<"ref">;
445
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
446
+ readonly id: Schema.String;
447
+ readonly mediaType: Schema.optional<Schema.String>;
448
+ }>]>;
449
+ readonly info: Schema.optional<Schema.Struct<{
450
+ readonly width: Schema.optional<Schema.Number>;
451
+ readonly height: Schema.optional<Schema.Number>;
452
+ readonly durationSeconds: Schema.optional<Schema.Number>;
453
+ readonly sampleRate: Schema.optional<Schema.Number>;
454
+ readonly channels: Schema.optional<Schema.Number>;
455
+ readonly encoding: Schema.optional<Schema.String>;
456
+ readonly format: Schema.optional<Schema.String>;
457
+ }>>;
458
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
459
+ }>, never, never>;
460
+ }>, Schema.Struct<{
461
+ readonly type: Schema.tag<"finish">;
462
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
463
+ readonly type: Schema.Literal<"tokens">;
464
+ readonly input: Schema.optional<Schema.Number>;
465
+ readonly output: Schema.optional<Schema.Number>;
466
+ readonly total: Schema.optional<Schema.Number>;
467
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
468
+ }>, Schema.Struct<{
469
+ readonly type: Schema.Literal<"seconds">;
470
+ readonly seconds: Schema.Number;
471
+ }>, Schema.Struct<{
472
+ readonly type: Schema.Literal<"characters">;
473
+ readonly characters: Schema.Number;
474
+ }>, Schema.Struct<{
475
+ readonly type: Schema.Literal<"credits">;
476
+ readonly credits: Schema.Number;
477
+ }>, Schema.Struct<{
478
+ readonly type: Schema.Literal<"compute">;
479
+ readonly seconds: Schema.Number;
480
+ }>]>>;
481
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
482
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
483
+ readonly message: Schema.String;
484
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
485
+ }>>>;
486
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
487
+ }>]> & {
488
+ readonly discriminants: readonly ["generation-queued", "generation-progress", "image-partial", "image", "finish"];
489
+ readonly cases: {
490
+ "generation-queued": Schema.Struct<{
491
+ readonly type: Schema.tag<"generation-queued">;
492
+ readonly id: Schema.String;
493
+ readonly position: Schema.optional<Schema.Number>;
494
+ }>;
495
+ "generation-progress": Schema.Struct<{
496
+ readonly type: Schema.tag<"generation-progress">;
497
+ readonly id: Schema.String;
498
+ readonly progress: Schema.optional<Schema.Number>;
499
+ }>;
500
+ "image-partial": Schema.Struct<{
501
+ readonly type: Schema.tag<"image-partial">;
502
+ readonly index: Schema.Number;
503
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
504
+ readonly source: Schema.Union<readonly [Schema.Struct<{
505
+ readonly type: Schema.Literal<"bytes">;
506
+ readonly data: Schema.Uint8Array;
507
+ readonly mediaType: Schema.String;
508
+ }>, Schema.Struct<{
509
+ readonly type: Schema.Literal<"base64">;
510
+ readonly data: Schema.String;
511
+ readonly mediaType: Schema.String;
512
+ }>, Schema.Struct<{
513
+ readonly type: Schema.Literal<"url">;
514
+ readonly url: Schema.String;
515
+ readonly mediaType: Schema.optional<Schema.String>;
516
+ readonly expiresAt: Schema.optional<Schema.Number>;
517
+ }>, Schema.Struct<{
518
+ readonly type: Schema.Literal<"ref">;
519
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
520
+ readonly id: Schema.String;
521
+ readonly mediaType: Schema.optional<Schema.String>;
522
+ }>]>;
523
+ readonly info: Schema.optional<Schema.Struct<{
524
+ readonly width: Schema.optional<Schema.Number>;
525
+ readonly height: Schema.optional<Schema.Number>;
526
+ readonly durationSeconds: Schema.optional<Schema.Number>;
527
+ readonly sampleRate: Schema.optional<Schema.Number>;
528
+ readonly channels: Schema.optional<Schema.Number>;
529
+ readonly encoding: Schema.optional<Schema.String>;
530
+ readonly format: Schema.optional<Schema.String>;
531
+ }>>;
532
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
533
+ }>, never, never>;
534
+ }>;
535
+ image: Schema.Struct<{
536
+ readonly type: Schema.tag<"image">;
537
+ readonly index: Schema.Number;
538
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
539
+ readonly source: Schema.Union<readonly [Schema.Struct<{
540
+ readonly type: Schema.Literal<"bytes">;
541
+ readonly data: Schema.Uint8Array;
542
+ readonly mediaType: Schema.String;
543
+ }>, Schema.Struct<{
544
+ readonly type: Schema.Literal<"base64">;
545
+ readonly data: Schema.String;
546
+ readonly mediaType: Schema.String;
547
+ }>, Schema.Struct<{
548
+ readonly type: Schema.Literal<"url">;
549
+ readonly url: Schema.String;
550
+ readonly mediaType: Schema.optional<Schema.String>;
551
+ readonly expiresAt: Schema.optional<Schema.Number>;
552
+ }>, Schema.Struct<{
553
+ readonly type: Schema.Literal<"ref">;
554
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
555
+ readonly id: Schema.String;
556
+ readonly mediaType: Schema.optional<Schema.String>;
557
+ }>]>;
558
+ readonly info: Schema.optional<Schema.Struct<{
559
+ readonly width: Schema.optional<Schema.Number>;
560
+ readonly height: Schema.optional<Schema.Number>;
561
+ readonly durationSeconds: Schema.optional<Schema.Number>;
562
+ readonly sampleRate: Schema.optional<Schema.Number>;
563
+ readonly channels: Schema.optional<Schema.Number>;
564
+ readonly encoding: Schema.optional<Schema.String>;
565
+ readonly format: Schema.optional<Schema.String>;
566
+ }>>;
567
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
568
+ }>, never, never>;
569
+ }>;
570
+ finish: Schema.Struct<{
571
+ readonly type: Schema.tag<"finish">;
572
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
573
+ readonly type: Schema.Literal<"tokens">;
574
+ readonly input: Schema.optional<Schema.Number>;
575
+ readonly output: Schema.optional<Schema.Number>;
576
+ readonly total: Schema.optional<Schema.Number>;
577
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
578
+ }>, Schema.Struct<{
579
+ readonly type: Schema.Literal<"seconds">;
580
+ readonly seconds: Schema.Number;
581
+ }>, Schema.Struct<{
582
+ readonly type: Schema.Literal<"characters">;
583
+ readonly characters: Schema.Number;
584
+ }>, Schema.Struct<{
585
+ readonly type: Schema.Literal<"credits">;
586
+ readonly credits: Schema.Number;
587
+ }>, Schema.Struct<{
588
+ readonly type: Schema.Literal<"compute">;
589
+ readonly seconds: Schema.Number;
590
+ }>]>>;
591
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
592
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
593
+ readonly message: Schema.String;
594
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
595
+ }>>>;
596
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
597
+ }>;
598
+ };
599
+ readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
600
+ readonly id: string;
601
+ readonly type: "generation-queued";
602
+ readonly position?: number | undefined;
603
+ } | {
604
+ readonly id: string;
605
+ readonly type: "generation-progress";
606
+ readonly progress?: number | undefined;
607
+ } | {
608
+ readonly type: "image-partial";
609
+ readonly index: number;
610
+ readonly image: Media.Asset;
611
+ } | {
612
+ readonly type: "image";
613
+ readonly index: number;
614
+ readonly image: Media.Asset;
615
+ } | {
616
+ readonly type: "finish";
617
+ readonly providerMetadata?: {
618
+ readonly [x: string]: {
619
+ readonly [x: string]: unknown;
620
+ };
621
+ } | undefined;
622
+ readonly usage?: {
623
+ readonly type: "tokens";
624
+ readonly input?: number | undefined;
625
+ readonly output?: number | undefined;
626
+ readonly total?: number | undefined;
627
+ readonly details?: {
628
+ readonly [x: string]: unknown;
629
+ } | undefined;
630
+ } | {
631
+ readonly type: "seconds";
632
+ readonly seconds: number;
633
+ } | {
634
+ readonly type: "characters";
635
+ readonly characters: number;
636
+ } | {
637
+ readonly type: "credits";
638
+ readonly credits: number;
639
+ } | {
640
+ readonly type: "compute";
641
+ readonly seconds: number;
642
+ } | undefined;
643
+ readonly notices?: readonly {
644
+ readonly type: "other" | "moderated" | "filtered";
645
+ readonly message: string;
646
+ readonly providerMetadata?: {
647
+ readonly [x: string]: {
648
+ readonly [x: string]: unknown;
649
+ };
650
+ } | undefined;
651
+ }[] | undefined;
652
+ }) => value is Extract<{
653
+ readonly id: string;
654
+ readonly type: "generation-queued";
655
+ readonly position?: number | undefined;
656
+ }, {
657
+ readonly type: Keys;
658
+ }> | Extract<{
659
+ readonly id: string;
660
+ readonly type: "generation-progress";
661
+ readonly progress?: number | undefined;
662
+ }, {
663
+ readonly type: Keys;
664
+ }> | Extract<{
665
+ readonly type: "image-partial";
666
+ readonly index: number;
667
+ readonly image: Media.Asset;
668
+ }, {
669
+ readonly type: Keys;
670
+ }> | Extract<{
671
+ readonly type: "image";
672
+ readonly index: number;
673
+ readonly image: Media.Asset;
674
+ }, {
675
+ readonly type: Keys;
676
+ }> | Extract<{
677
+ readonly type: "finish";
678
+ readonly providerMetadata?: {
679
+ readonly [x: string]: {
680
+ readonly [x: string]: unknown;
681
+ };
682
+ } | undefined;
683
+ readonly usage?: {
684
+ readonly type: "tokens";
685
+ readonly input?: number | undefined;
686
+ readonly output?: number | undefined;
687
+ readonly total?: number | undefined;
688
+ readonly details?: {
689
+ readonly [x: string]: unknown;
690
+ } | undefined;
691
+ } | {
692
+ readonly type: "seconds";
693
+ readonly seconds: number;
694
+ } | {
695
+ readonly type: "characters";
696
+ readonly characters: number;
697
+ } | {
698
+ readonly type: "credits";
699
+ readonly credits: number;
700
+ } | {
701
+ readonly type: "compute";
702
+ readonly seconds: number;
703
+ } | undefined;
704
+ readonly notices?: readonly {
705
+ readonly type: "other" | "moderated" | "filtered";
706
+ readonly message: string;
707
+ readonly providerMetadata?: {
708
+ readonly [x: string]: {
709
+ readonly [x: string]: unknown;
710
+ };
711
+ } | undefined;
712
+ }[] | undefined;
713
+ }, {
714
+ readonly type: Keys;
715
+ }>;
716
+ readonly guards: {
717
+ "generation-queued": (u: unknown) => u is {
718
+ readonly id: string;
719
+ readonly type: "generation-queued";
720
+ readonly position?: number | undefined;
721
+ };
722
+ "generation-progress": (u: unknown) => u is {
723
+ readonly id: string;
724
+ readonly type: "generation-progress";
725
+ readonly progress?: number | undefined;
726
+ };
727
+ "image-partial": (u: unknown) => u is {
728
+ readonly type: "image-partial";
729
+ readonly index: number;
730
+ readonly image: Media.Asset;
731
+ };
732
+ image: (u: unknown) => u is {
733
+ readonly type: "image";
734
+ readonly index: number;
735
+ readonly image: Media.Asset;
736
+ };
737
+ finish: (u: unknown) => u is {
738
+ readonly type: "finish";
739
+ readonly providerMetadata?: {
740
+ readonly [x: string]: {
741
+ readonly [x: string]: unknown;
742
+ };
743
+ } | undefined;
744
+ readonly usage?: {
745
+ readonly type: "tokens";
746
+ readonly input?: number | undefined;
747
+ readonly output?: number | undefined;
748
+ readonly total?: number | undefined;
749
+ readonly details?: {
750
+ readonly [x: string]: unknown;
751
+ } | undefined;
752
+ } | {
753
+ readonly type: "seconds";
754
+ readonly seconds: number;
755
+ } | {
756
+ readonly type: "characters";
757
+ readonly characters: number;
758
+ } | {
759
+ readonly type: "credits";
760
+ readonly credits: number;
761
+ } | {
762
+ readonly type: "compute";
763
+ readonly seconds: number;
764
+ } | undefined;
765
+ readonly notices?: readonly {
766
+ readonly type: "other" | "moderated" | "filtered";
767
+ readonly message: string;
768
+ readonly providerMetadata?: {
769
+ readonly [x: string]: {
770
+ readonly [x: string]: unknown;
771
+ };
772
+ } | undefined;
773
+ }[] | undefined;
774
+ };
775
+ };
776
+ readonly match: {
777
+ <Cases extends {
778
+ "generation-queued": (value: {
779
+ readonly id: string;
780
+ readonly type: "generation-queued";
781
+ readonly position?: number | undefined;
782
+ }) => any;
783
+ "generation-progress": (value: {
784
+ readonly id: string;
785
+ readonly type: "generation-progress";
786
+ readonly progress?: number | undefined;
787
+ }) => any;
788
+ "image-partial": (value: {
789
+ readonly type: "image-partial";
790
+ readonly index: number;
791
+ readonly image: Media.Asset;
792
+ }) => any;
793
+ image: (value: {
794
+ readonly type: "image";
795
+ readonly index: number;
796
+ readonly image: Media.Asset;
797
+ }) => any;
798
+ finish: (value: {
799
+ readonly type: "finish";
800
+ readonly providerMetadata?: {
801
+ readonly [x: string]: {
802
+ readonly [x: string]: unknown;
803
+ };
804
+ } | undefined;
805
+ readonly usage?: {
806
+ readonly type: "tokens";
807
+ readonly input?: number | undefined;
808
+ readonly output?: number | undefined;
809
+ readonly total?: number | undefined;
810
+ readonly details?: {
811
+ readonly [x: string]: unknown;
812
+ } | undefined;
813
+ } | {
814
+ readonly type: "seconds";
815
+ readonly seconds: number;
816
+ } | {
817
+ readonly type: "characters";
818
+ readonly characters: number;
819
+ } | {
820
+ readonly type: "credits";
821
+ readonly credits: number;
822
+ } | {
823
+ readonly type: "compute";
824
+ readonly seconds: number;
825
+ } | undefined;
826
+ readonly notices?: readonly {
827
+ readonly type: "other" | "moderated" | "filtered";
828
+ readonly message: string;
829
+ readonly providerMetadata?: {
830
+ readonly [x: string]: {
831
+ readonly [x: string]: unknown;
832
+ };
833
+ } | undefined;
834
+ }[] | undefined;
835
+ }) => any;
836
+ }>(value: {
837
+ readonly id: string;
838
+ readonly type: "generation-queued";
839
+ readonly position?: number | undefined;
840
+ } | {
841
+ readonly id: string;
842
+ readonly type: "generation-progress";
843
+ readonly progress?: number | undefined;
844
+ } | {
845
+ readonly type: "image-partial";
846
+ readonly index: number;
847
+ readonly image: Media.Asset;
848
+ } | {
849
+ readonly type: "image";
850
+ readonly index: number;
851
+ readonly image: Media.Asset;
852
+ } | {
853
+ readonly type: "finish";
854
+ readonly providerMetadata?: {
855
+ readonly [x: string]: {
856
+ readonly [x: string]: unknown;
857
+ };
858
+ } | undefined;
859
+ readonly usage?: {
860
+ readonly type: "tokens";
861
+ readonly input?: number | undefined;
862
+ readonly output?: number | undefined;
863
+ readonly total?: number | undefined;
864
+ readonly details?: {
865
+ readonly [x: string]: unknown;
866
+ } | undefined;
867
+ } | {
868
+ readonly type: "seconds";
869
+ readonly seconds: number;
870
+ } | {
871
+ readonly type: "characters";
872
+ readonly characters: number;
873
+ } | {
874
+ readonly type: "credits";
875
+ readonly credits: number;
876
+ } | {
877
+ readonly type: "compute";
878
+ readonly seconds: number;
879
+ } | undefined;
880
+ readonly notices?: readonly {
881
+ readonly type: "other" | "moderated" | "filtered";
882
+ readonly message: string;
883
+ readonly providerMetadata?: {
884
+ readonly [x: string]: {
885
+ readonly [x: string]: unknown;
886
+ };
887
+ } | undefined;
888
+ }[] | undefined;
889
+ }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
890
+ <Cases extends {
891
+ "generation-queued": (value: {
892
+ readonly id: string;
893
+ readonly type: "generation-queued";
894
+ readonly position?: number | undefined;
895
+ }) => any;
896
+ "generation-progress": (value: {
897
+ readonly id: string;
898
+ readonly type: "generation-progress";
899
+ readonly progress?: number | undefined;
900
+ }) => any;
901
+ "image-partial": (value: {
902
+ readonly type: "image-partial";
903
+ readonly index: number;
904
+ readonly image: Media.Asset;
905
+ }) => any;
906
+ image: (value: {
907
+ readonly type: "image";
908
+ readonly index: number;
909
+ readonly image: Media.Asset;
910
+ }) => any;
911
+ finish: (value: {
912
+ readonly type: "finish";
913
+ readonly providerMetadata?: {
914
+ readonly [x: string]: {
915
+ readonly [x: string]: unknown;
916
+ };
917
+ } | undefined;
918
+ readonly usage?: {
919
+ readonly type: "tokens";
920
+ readonly input?: number | undefined;
921
+ readonly output?: number | undefined;
922
+ readonly total?: number | undefined;
923
+ readonly details?: {
924
+ readonly [x: string]: unknown;
925
+ } | undefined;
926
+ } | {
927
+ readonly type: "seconds";
928
+ readonly seconds: number;
929
+ } | {
930
+ readonly type: "characters";
931
+ readonly characters: number;
932
+ } | {
933
+ readonly type: "credits";
934
+ readonly credits: number;
935
+ } | {
936
+ readonly type: "compute";
937
+ readonly seconds: number;
938
+ } | undefined;
939
+ readonly notices?: readonly {
940
+ readonly type: "other" | "moderated" | "filtered";
941
+ readonly message: string;
942
+ readonly providerMetadata?: {
943
+ readonly [x: string]: {
944
+ readonly [x: string]: unknown;
945
+ };
946
+ } | undefined;
947
+ }[] | undefined;
948
+ }) => any;
949
+ }>(cases: Cases): (value: {
950
+ readonly id: string;
951
+ readonly type: "generation-queued";
952
+ readonly position?: number | undefined;
953
+ } | {
954
+ readonly id: string;
955
+ readonly type: "generation-progress";
956
+ readonly progress?: number | undefined;
957
+ } | {
958
+ readonly type: "image-partial";
959
+ readonly index: number;
960
+ readonly image: Media.Asset;
961
+ } | {
962
+ readonly type: "image";
963
+ readonly index: number;
964
+ readonly image: Media.Asset;
965
+ } | {
966
+ readonly type: "finish";
967
+ readonly providerMetadata?: {
968
+ readonly [x: string]: {
969
+ readonly [x: string]: unknown;
970
+ };
971
+ } | undefined;
972
+ readonly usage?: {
973
+ readonly type: "tokens";
974
+ readonly input?: number | undefined;
975
+ readonly output?: number | undefined;
976
+ readonly total?: number | undefined;
977
+ readonly details?: {
978
+ readonly [x: string]: unknown;
979
+ } | undefined;
980
+ } | {
981
+ readonly type: "seconds";
982
+ readonly seconds: number;
983
+ } | {
984
+ readonly type: "characters";
985
+ readonly characters: number;
986
+ } | {
987
+ readonly type: "credits";
988
+ readonly credits: number;
989
+ } | {
990
+ readonly type: "compute";
991
+ readonly seconds: number;
992
+ } | undefined;
993
+ readonly notices?: readonly {
994
+ readonly type: "other" | "moderated" | "filtered";
995
+ readonly message: string;
996
+ readonly providerMetadata?: {
997
+ readonly [x: string]: {
998
+ readonly [x: string]: unknown;
999
+ };
1000
+ } | undefined;
1001
+ }[] | undefined;
1002
+ }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
1003
+ };
1004
+ readonly matchOrElse: {
1005
+ <Cases extends {
1006
+ "generation-queued"?: ((value: {
1007
+ readonly id: string;
1008
+ readonly type: "generation-queued";
1009
+ readonly position?: number | undefined;
1010
+ }) => any) | undefined;
1011
+ "generation-progress"?: ((value: {
1012
+ readonly id: string;
1013
+ readonly type: "generation-progress";
1014
+ readonly progress?: number | undefined;
1015
+ }) => any) | undefined;
1016
+ "image-partial"?: ((value: {
1017
+ readonly type: "image-partial";
1018
+ readonly index: number;
1019
+ readonly image: Media.Asset;
1020
+ }) => any) | undefined;
1021
+ image?: ((value: {
1022
+ readonly type: "image";
1023
+ readonly index: number;
1024
+ readonly image: Media.Asset;
1025
+ }) => any) | undefined;
1026
+ finish?: ((value: {
1027
+ readonly type: "finish";
1028
+ readonly providerMetadata?: {
1029
+ readonly [x: string]: {
1030
+ readonly [x: string]: unknown;
1031
+ };
1032
+ } | undefined;
1033
+ readonly usage?: {
1034
+ readonly type: "tokens";
1035
+ readonly input?: number | undefined;
1036
+ readonly output?: number | undefined;
1037
+ readonly total?: number | undefined;
1038
+ readonly details?: {
1039
+ readonly [x: string]: unknown;
1040
+ } | undefined;
1041
+ } | {
1042
+ readonly type: "seconds";
1043
+ readonly seconds: number;
1044
+ } | {
1045
+ readonly type: "characters";
1046
+ readonly characters: number;
1047
+ } | {
1048
+ readonly type: "credits";
1049
+ readonly credits: number;
1050
+ } | {
1051
+ readonly type: "compute";
1052
+ readonly seconds: number;
1053
+ } | undefined;
1054
+ readonly notices?: readonly {
1055
+ readonly type: "other" | "moderated" | "filtered";
1056
+ readonly message: string;
1057
+ readonly providerMetadata?: {
1058
+ readonly [x: string]: {
1059
+ readonly [x: string]: unknown;
1060
+ };
1061
+ } | undefined;
1062
+ }[] | undefined;
1063
+ }) => any) | undefined;
1064
+ } & { [K in Exclude<keyof Cases, "image" | "finish" | "generation-queued" | "generation-progress" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
1065
+ readonly id: string;
1066
+ readonly type: "generation-queued";
1067
+ readonly position?: number | undefined;
1068
+ }, {
1069
+ readonly type: keyof Cases;
1070
+ }> | Exclude<{
1071
+ readonly id: string;
1072
+ readonly type: "generation-progress";
1073
+ readonly progress?: number | undefined;
1074
+ }, {
1075
+ readonly type: keyof Cases;
1076
+ }> | Exclude<{
1077
+ readonly type: "image-partial";
1078
+ readonly index: number;
1079
+ readonly image: Media.Asset;
1080
+ }, {
1081
+ readonly type: keyof Cases;
1082
+ }> | Exclude<{
1083
+ readonly type: "image";
1084
+ readonly index: number;
1085
+ readonly image: Media.Asset;
1086
+ }, {
1087
+ readonly type: keyof Cases;
1088
+ }> | Exclude<{
1089
+ readonly type: "finish";
1090
+ readonly providerMetadata?: {
1091
+ readonly [x: string]: {
1092
+ readonly [x: string]: unknown;
1093
+ };
1094
+ } | undefined;
1095
+ readonly usage?: {
1096
+ readonly type: "tokens";
1097
+ readonly input?: number | undefined;
1098
+ readonly output?: number | undefined;
1099
+ readonly total?: number | undefined;
1100
+ readonly details?: {
1101
+ readonly [x: string]: unknown;
1102
+ } | undefined;
1103
+ } | {
1104
+ readonly type: "seconds";
1105
+ readonly seconds: number;
1106
+ } | {
1107
+ readonly type: "characters";
1108
+ readonly characters: number;
1109
+ } | {
1110
+ readonly type: "credits";
1111
+ readonly credits: number;
1112
+ } | {
1113
+ readonly type: "compute";
1114
+ readonly seconds: number;
1115
+ } | undefined;
1116
+ readonly notices?: readonly {
1117
+ readonly type: "other" | "moderated" | "filtered";
1118
+ readonly message: string;
1119
+ readonly providerMetadata?: {
1120
+ readonly [x: string]: {
1121
+ readonly [x: string]: unknown;
1122
+ };
1123
+ } | undefined;
1124
+ }[] | undefined;
1125
+ }, {
1126
+ readonly type: keyof Cases;
1127
+ }>) => any>(value: {
1128
+ readonly id: string;
1129
+ readonly type: "generation-queued";
1130
+ readonly position?: number | undefined;
1131
+ } | {
1132
+ readonly id: string;
1133
+ readonly type: "generation-progress";
1134
+ readonly progress?: number | undefined;
1135
+ } | {
1136
+ readonly type: "image-partial";
1137
+ readonly index: number;
1138
+ readonly image: Media.Asset;
1139
+ } | {
1140
+ readonly type: "image";
1141
+ readonly index: number;
1142
+ readonly image: Media.Asset;
1143
+ } | {
1144
+ readonly type: "finish";
1145
+ readonly providerMetadata?: {
1146
+ readonly [x: string]: {
1147
+ readonly [x: string]: unknown;
1148
+ };
1149
+ } | undefined;
1150
+ readonly usage?: {
1151
+ readonly type: "tokens";
1152
+ readonly input?: number | undefined;
1153
+ readonly output?: number | undefined;
1154
+ readonly total?: number | undefined;
1155
+ readonly details?: {
1156
+ readonly [x: string]: unknown;
1157
+ } | undefined;
1158
+ } | {
1159
+ readonly type: "seconds";
1160
+ readonly seconds: number;
1161
+ } | {
1162
+ readonly type: "characters";
1163
+ readonly characters: number;
1164
+ } | {
1165
+ readonly type: "credits";
1166
+ readonly credits: number;
1167
+ } | {
1168
+ readonly type: "compute";
1169
+ readonly seconds: number;
1170
+ } | undefined;
1171
+ readonly notices?: readonly {
1172
+ readonly type: "other" | "moderated" | "filtered";
1173
+ readonly message: string;
1174
+ readonly providerMetadata?: {
1175
+ readonly [x: string]: {
1176
+ readonly [x: string]: unknown;
1177
+ };
1178
+ } | undefined;
1179
+ }[] | undefined;
1180
+ }, cases: Cases, orElse: OrElse): import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1181
+ <Cases extends {
1182
+ "generation-queued"?: ((value: {
1183
+ readonly id: string;
1184
+ readonly type: "generation-queued";
1185
+ readonly position?: number | undefined;
1186
+ }) => any) | undefined;
1187
+ "generation-progress"?: ((value: {
1188
+ readonly id: string;
1189
+ readonly type: "generation-progress";
1190
+ readonly progress?: number | undefined;
1191
+ }) => any) | undefined;
1192
+ "image-partial"?: ((value: {
1193
+ readonly type: "image-partial";
1194
+ readonly index: number;
1195
+ readonly image: Media.Asset;
1196
+ }) => any) | undefined;
1197
+ image?: ((value: {
1198
+ readonly type: "image";
1199
+ readonly index: number;
1200
+ readonly image: Media.Asset;
1201
+ }) => any) | undefined;
1202
+ finish?: ((value: {
1203
+ readonly type: "finish";
1204
+ readonly providerMetadata?: {
1205
+ readonly [x: string]: {
1206
+ readonly [x: string]: unknown;
1207
+ };
1208
+ } | undefined;
1209
+ readonly usage?: {
1210
+ readonly type: "tokens";
1211
+ readonly input?: number | undefined;
1212
+ readonly output?: number | undefined;
1213
+ readonly total?: number | undefined;
1214
+ readonly details?: {
1215
+ readonly [x: string]: unknown;
1216
+ } | undefined;
1217
+ } | {
1218
+ readonly type: "seconds";
1219
+ readonly seconds: number;
1220
+ } | {
1221
+ readonly type: "characters";
1222
+ readonly characters: number;
1223
+ } | {
1224
+ readonly type: "credits";
1225
+ readonly credits: number;
1226
+ } | {
1227
+ readonly type: "compute";
1228
+ readonly seconds: number;
1229
+ } | undefined;
1230
+ readonly notices?: readonly {
1231
+ readonly type: "other" | "moderated" | "filtered";
1232
+ readonly message: string;
1233
+ readonly providerMetadata?: {
1234
+ readonly [x: string]: {
1235
+ readonly [x: string]: unknown;
1236
+ };
1237
+ } | undefined;
1238
+ }[] | undefined;
1239
+ }) => any) | undefined;
1240
+ } & { [K in Exclude<keyof Cases, "image" | "finish" | "generation-queued" | "generation-progress" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
1241
+ readonly id: string;
1242
+ readonly type: "generation-queued";
1243
+ readonly position?: number | undefined;
1244
+ }, {
1245
+ readonly type: keyof Cases;
1246
+ }> | Exclude<{
1247
+ readonly id: string;
1248
+ readonly type: "generation-progress";
1249
+ readonly progress?: number | undefined;
1250
+ }, {
1251
+ readonly type: keyof Cases;
1252
+ }> | Exclude<{
1253
+ readonly type: "image-partial";
1254
+ readonly index: number;
1255
+ readonly image: Media.Asset;
1256
+ }, {
1257
+ readonly type: keyof Cases;
1258
+ }> | Exclude<{
1259
+ readonly type: "image";
1260
+ readonly index: number;
1261
+ readonly image: Media.Asset;
1262
+ }, {
1263
+ readonly type: keyof Cases;
1264
+ }> | Exclude<{
1265
+ readonly type: "finish";
1266
+ readonly providerMetadata?: {
1267
+ readonly [x: string]: {
1268
+ readonly [x: string]: unknown;
1269
+ };
1270
+ } | undefined;
1271
+ readonly usage?: {
1272
+ readonly type: "tokens";
1273
+ readonly input?: number | undefined;
1274
+ readonly output?: number | undefined;
1275
+ readonly total?: number | undefined;
1276
+ readonly details?: {
1277
+ readonly [x: string]: unknown;
1278
+ } | undefined;
1279
+ } | {
1280
+ readonly type: "seconds";
1281
+ readonly seconds: number;
1282
+ } | {
1283
+ readonly type: "characters";
1284
+ readonly characters: number;
1285
+ } | {
1286
+ readonly type: "credits";
1287
+ readonly credits: number;
1288
+ } | {
1289
+ readonly type: "compute";
1290
+ readonly seconds: number;
1291
+ } | undefined;
1292
+ readonly notices?: readonly {
1293
+ readonly type: "other" | "moderated" | "filtered";
1294
+ readonly message: string;
1295
+ readonly providerMetadata?: {
1296
+ readonly [x: string]: {
1297
+ readonly [x: string]: unknown;
1298
+ };
1299
+ } | undefined;
1300
+ }[] | undefined;
1301
+ }, {
1302
+ readonly type: keyof Cases;
1303
+ }>) => any>(cases: Cases, orElse: OrElse): (value: {
1304
+ readonly id: string;
1305
+ readonly type: "generation-queued";
1306
+ readonly position?: number | undefined;
1307
+ } | {
1308
+ readonly id: string;
1309
+ readonly type: "generation-progress";
1310
+ readonly progress?: number | undefined;
1311
+ } | {
1312
+ readonly type: "image-partial";
1313
+ readonly index: number;
1314
+ readonly image: Media.Asset;
1315
+ } | {
1316
+ readonly type: "image";
1317
+ readonly index: number;
1318
+ readonly image: Media.Asset;
1319
+ } | {
1320
+ readonly type: "finish";
1321
+ readonly providerMetadata?: {
1322
+ readonly [x: string]: {
1323
+ readonly [x: string]: unknown;
1324
+ };
1325
+ } | undefined;
1326
+ readonly usage?: {
1327
+ readonly type: "tokens";
1328
+ readonly input?: number | undefined;
1329
+ readonly output?: number | undefined;
1330
+ readonly total?: number | undefined;
1331
+ readonly details?: {
1332
+ readonly [x: string]: unknown;
1333
+ } | undefined;
1334
+ } | {
1335
+ readonly type: "seconds";
1336
+ readonly seconds: number;
1337
+ } | {
1338
+ readonly type: "characters";
1339
+ readonly characters: number;
1340
+ } | {
1341
+ readonly type: "credits";
1342
+ readonly credits: number;
1343
+ } | {
1344
+ readonly type: "compute";
1345
+ readonly seconds: number;
1346
+ } | undefined;
1347
+ readonly notices?: readonly {
1348
+ readonly type: "other" | "moderated" | "filtered";
1349
+ readonly message: string;
1350
+ readonly providerMetadata?: {
1351
+ readonly [x: string]: {
1352
+ readonly [x: string]: unknown;
1353
+ };
1354
+ } | undefined;
1355
+ }[] | undefined;
1356
+ }) => import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1357
+ };
1358
+ } & {
1359
+ is: {
1360
+ generationQueued: (u: unknown) => u is {
1361
+ readonly id: string;
1362
+ readonly type: "generation-queued";
1363
+ readonly position?: number | undefined;
1364
+ };
1365
+ generationProgress: (u: unknown) => u is {
1366
+ readonly id: string;
1367
+ readonly type: "generation-progress";
1368
+ readonly progress?: number | undefined;
1369
+ };
1370
+ imagePartial: (u: unknown) => u is {
1371
+ readonly type: "image-partial";
1372
+ readonly index: number;
1373
+ readonly image: Media.Asset;
1374
+ };
1375
+ image: (u: unknown) => u is {
1376
+ readonly type: "image";
1377
+ readonly index: number;
1378
+ readonly image: Media.Asset;
1379
+ };
1380
+ finish: (u: unknown) => u is {
1381
+ readonly type: "finish";
1382
+ readonly providerMetadata?: {
1383
+ readonly [x: string]: {
1384
+ readonly [x: string]: unknown;
1385
+ };
1386
+ } | undefined;
1387
+ readonly usage?: {
1388
+ readonly type: "tokens";
1389
+ readonly input?: number | undefined;
1390
+ readonly output?: number | undefined;
1391
+ readonly total?: number | undefined;
1392
+ readonly details?: {
1393
+ readonly [x: string]: unknown;
1394
+ } | undefined;
1395
+ } | {
1396
+ readonly type: "seconds";
1397
+ readonly seconds: number;
1398
+ } | {
1399
+ readonly type: "characters";
1400
+ readonly characters: number;
1401
+ } | {
1402
+ readonly type: "credits";
1403
+ readonly credits: number;
1404
+ } | {
1405
+ readonly type: "compute";
1406
+ readonly seconds: number;
1407
+ } | undefined;
1408
+ readonly notices?: readonly {
1409
+ readonly type: "other" | "moderated" | "filtered";
1410
+ readonly message: string;
1411
+ readonly providerMetadata?: {
1412
+ readonly [x: string]: {
1413
+ readonly [x: string]: unknown;
1414
+ };
1415
+ } | undefined;
1416
+ }[] | undefined;
1417
+ };
1418
+ };
1419
+ };
1420
+ export type ImageEvent = Schema.Schema.Type<typeof imageEventTagged>;
1421
+ export declare const responseEvents: (response: ImageResponse) => ReadonlyArray<ImageEvent>;
1422
+ export declare function request<const Model extends ImageModel>(input: ImageRequestInput<Model>): ImageRequestFor<ImageModelOptions<Model>>;
103
1423
  export declare function request(input: ImageRequest): ImageRequest;
104
- export declare function generate<const Model extends object>(input: ImageRequestInput<Model>): Effect.Effect<ImageResponse, AIError, Service>;
105
- export declare function generate(input: ImageRequest): Effect.Effect<ImageResponse, AIError, Service>;
1424
+ export declare function generate<const Model extends ImageModel>(input: ImageRequestInput<Model>, options?: AwaitOptions): Effect.Effect<ImageResponse, AIError, Service>;
1425
+ export declare function generate(input: ImageRequest, options?: AwaitOptions): Effect.Effect<ImageResponse, AIError, Service>;
1426
+ export declare function stream<const Model extends ImageModel>(input: ImageRequestInput<Model>, options?: AwaitOptions): Stream.Stream<ImageEvent, AIError, Service>;
1427
+ export declare function stream(input: ImageRequest, options?: AwaitOptions): Stream.Stream<ImageEvent, AIError, Service>;
1428
+ /** Inline and streaming routes fail with `UnsupportedOperation`. */
1429
+ export declare function start<const Model extends ImageModel>(input: ImageRequestInput<Model>): Effect.Effect<Generation<ImageResponse>, AIError, Service>;
1430
+ export declare function start(input: ImageRequest): Effect.Effect<Generation<ImageResponse>, AIError, Service>;
1431
+ export declare const resume: <Options extends ImageOptions>(model: ImageModel<Options>, token: unknown) => Effect.Effect<Generation<ImageResponse>, AIError, Service>;
106
1432
  export declare const Image: {
107
1433
  readonly request: typeof request;
108
1434
  readonly generate: typeof generate;
1435
+ readonly stream: typeof stream;
1436
+ readonly start: typeof start;
1437
+ readonly resume: <Options extends ImageOptions>(model: ImageModel<Options>, token: unknown) => Effect.Effect<Generation<ImageResponse>, AIError, Service>;
109
1438
  };
110
1439
  export {};