@opencode/ai 2.0.14 → 2.0.15
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.
- package/README.md +115 -56
- package/dist/experimental/evaluation-client.d.ts +1 -1
- package/dist/experimental/evaluation-client.js +39 -3
- package/dist/experimental/evaluation.d.ts +4 -4
- package/dist/experimental/evaluation.js +2 -2
- package/dist/experimental/system-one.d.ts +3 -3
- package/dist/experimental/system-one.js +40 -51
- package/dist/generation.d.ts +69 -0
- package/dist/generation.js +84 -0
- package/dist/image-client.d.ts +6 -4
- package/dist/image-client.js +11 -11
- package/dist/image.d.ts +1040 -62
- package/dist/image.js +80 -52
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -1
- package/dist/llm.d.ts +9 -1
- package/dist/media.d.ts +212 -0
- package/dist/media.js +228 -0
- package/dist/promise.d.ts +554 -0
- package/dist/promise.js +44 -0
- package/dist/protocols/anthropic-messages.js +7 -17
- package/dist/protocols/bedrock-converse.d.ts +4 -4
- package/dist/protocols/bedrock-converse.js +1 -6
- package/dist/protocols/gemini.d.ts +21 -0
- package/dist/protocols/gemini.js +42 -6
- package/dist/protocols/google-images.d.ts +9 -21
- package/dist/protocols/google-images.js +169 -132
- package/dist/protocols/meta-images.d.ts +7 -12
- package/dist/protocols/meta-images.js +92 -66
- package/dist/protocols/mistral-chat.js +7 -6
- package/dist/protocols/open-responses.d.ts +11 -3
- package/dist/protocols/open-responses.js +23 -12
- package/dist/protocols/openai-chat.d.ts +34 -1
- package/dist/protocols/openai-chat.js +100 -31
- package/dist/protocols/openai-images.d.ts +9 -20
- package/dist/protocols/openai-images.js +112 -142
- package/dist/protocols/shared.d.ts +17 -17
- package/dist/protocols/shared.js +32 -35
- package/dist/protocols/utils/bedrock-media.d.ts +2 -3
- package/dist/protocols/utils/bedrock-media.js +4 -4
- package/dist/protocols/utils/media-input.d.ts +10 -0
- package/dist/protocols/utils/media-input.js +17 -0
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/tool-stream.d.ts +27 -3
- package/dist/protocols/xai-images.d.ts +9 -15
- package/dist/protocols/xai-images.js +85 -83
- package/dist/protocols/zai-images.d.ts +9 -13
- package/dist/protocols/zai-images.js +59 -57
- package/dist/providers/amazon-bedrock.d.ts +2 -2
- package/dist/providers/cerebras.js +6 -1
- package/dist/providers/deepinfra.js +6 -1
- package/dist/providers/google-vertex.d.ts +7 -0
- package/dist/providers/google.d.ts +7 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/dist/providers/openrouter.d.ts +19 -0
- package/dist/providers/openrouter.js +13 -1
- package/dist/providers/vercel-ai-gateway.d.ts +41 -0
- package/dist/providers/vercel-ai-gateway.js +85 -0
- package/dist/route/client.d.ts +9 -1
- package/dist/route/endpoint.d.ts +10 -10
- package/dist/route/executor-service.d.ts +12 -0
- package/dist/route/executor-service.js +3 -0
- package/dist/route/executor.d.ts +4 -9
- package/dist/route/executor.js +3 -3
- package/dist/route/index.d.ts +2 -0
- package/dist/route/index.js +2 -0
- package/dist/route/media-protocol.d.ts +45 -0
- package/dist/route/media-protocol.js +40 -0
- package/dist/route/media.d.ts +46 -0
- package/dist/route/media.js +64 -0
- package/dist/schema/errors.d.ts +13 -3
- package/dist/schema/errors.js +7 -0
- package/dist/schema/events.d.ts +563 -40
- package/dist/schema/events.js +35 -2
- package/dist/schema/messages.d.ts +98 -8
- package/dist/schema/messages.js +8 -6
- package/dist/schema/options.d.ts +2 -0
- package/dist/schema/options.js +3 -0
- package/dist/testing.d.ts +72 -8
- package/dist/utils/media-type.d.ts +6 -0
- package/dist/utils/media-type.js +49 -0
- package/dist/utils/sanitize.js +3 -1
- package/package.json +7 -3
- package/dist/protocols/utils/image-input.d.ts +0 -21
- package/dist/protocols/utils/image-input.js +0 -20
package/dist/image.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Effect, Schema } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
import { Media } from "./media.js";
|
|
3
|
+
import { Endpoint } from "./route/endpoint.js";
|
|
4
|
+
import { MediaRoute } from "./route/media.js";
|
|
5
|
+
import type { MediaProtocol } from "./route/media-protocol.js";
|
|
6
|
+
import { AIError, HttpOptions, ModelID, ProviderID } from "./schema/index.js";
|
|
7
|
+
import { Service } from "./image-client.js";
|
|
8
8
|
export type ImageOptions = Record<string, unknown>;
|
|
9
|
+
export type ImageRoute<Options extends ImageOptions = ImageOptions> = MediaRoute.Route<ImageRequestFor<Options>, ImageResponse>;
|
|
9
10
|
export declare class ImageModel<Options extends ImageOptions = ImageOptions> {
|
|
10
11
|
protected readonly _Options: (options: Options) => Options;
|
|
11
12
|
readonly id: ModelID;
|
|
@@ -14,6 +15,8 @@ export declare class ImageModel<Options extends ImageOptions = ImageOptions> {
|
|
|
14
15
|
readonly http?: HttpOptions;
|
|
15
16
|
constructor(input: ImageModel.Input<Options>);
|
|
16
17
|
static make<Options extends ImageOptions = ImageOptions>(input: ImageModel.MakeInput<Options>): ImageModel<Options>;
|
|
18
|
+
/** Compose an inline image protocol with its canonical path into a model for one deployment. */
|
|
19
|
+
static fromRoute<Options extends ImageOptions = ImageOptions>(route: ImageModel.RouteInput<Options>, input: MediaRoute.ModelInput): ImageModel<Options>;
|
|
17
20
|
}
|
|
18
21
|
export declare namespace ImageModel {
|
|
19
22
|
interface Input<Options extends ImageOptions = ImageOptions> {
|
|
@@ -26,85 +29,1060 @@ export declare namespace ImageModel {
|
|
|
26
29
|
readonly id: string | ModelID;
|
|
27
30
|
readonly provider: string | ProviderID;
|
|
28
31
|
}
|
|
32
|
+
interface RouteInput<Options extends ImageOptions = ImageOptions> {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly provider: string | ProviderID;
|
|
35
|
+
readonly protocol: MediaProtocol.Inline<ImageRequestFor<Options>, ImageResponse>;
|
|
36
|
+
readonly path: Endpoint.EndpointPart<MediaProtocol.Body, ImageRequestFor<Options>>;
|
|
37
|
+
/** Canonical base URL; `ModelInput.baseURL` overrides it per deployment. */
|
|
38
|
+
readonly baseURL?: string;
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
41
|
export declare const ImageModelSchema: Schema.declare<ImageModel<ImageOptions>, ImageModel<ImageOptions>>;
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
};
|
|
42
|
+
export type ImageSize = `${number}x${number}`;
|
|
43
|
+
export declare const ImageSize: Schema.declare<`${number}x${number}`, `${number}x${number}`>;
|
|
44
|
+
export type ImageAspectRatio = `${number}:${number}`;
|
|
45
|
+
export declare const ImageAspectRatio: Schema.declare<`${number}:${number}`, `${number}:${number}`>;
|
|
46
|
+
export type ImageFormat = "png" | "jpeg" | "webp" | (string & {});
|
|
53
47
|
declare const ImageRequest_base: Schema.Class<ImageRequest, Schema.Struct<{
|
|
54
48
|
readonly model: Schema.declare<ImageModel<ImageOptions>, ImageModel<ImageOptions>>;
|
|
55
49
|
readonly prompt: Schema.String;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
readonly
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
/** Edit sources or style/subject references, in order. */
|
|
51
|
+
readonly images: Schema.optional<Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
52
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
53
|
+
readonly type: Schema.Literal<"bytes">;
|
|
54
|
+
readonly data: Schema.Uint8Array;
|
|
55
|
+
readonly mediaType: Schema.String;
|
|
56
|
+
}>, Schema.Struct<{
|
|
57
|
+
readonly type: Schema.Literal<"base64">;
|
|
58
|
+
readonly data: Schema.String;
|
|
59
|
+
readonly mediaType: Schema.String;
|
|
60
|
+
}>, Schema.Struct<{
|
|
61
|
+
readonly type: Schema.Literal<"url">;
|
|
62
|
+
readonly url: Schema.String;
|
|
63
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
64
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
65
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly type: Schema.Literal<"ref">;
|
|
68
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
69
|
+
readonly id: Schema.String;
|
|
70
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
71
|
+
}>]>;
|
|
72
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
73
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
74
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
75
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
76
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
77
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
78
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
79
|
+
readonly format: Schema.optional<Schema.String>;
|
|
80
|
+
}>>;
|
|
81
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
82
|
+
}>, never, never>>>;
|
|
83
|
+
/** Inpainting mask; routes that cannot honor it fail with `UnsupportedOperation`. */
|
|
84
|
+
readonly mask: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
85
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"bytes">;
|
|
87
|
+
readonly data: Schema.Uint8Array;
|
|
88
|
+
readonly mediaType: Schema.String;
|
|
89
|
+
}>, Schema.Struct<{
|
|
90
|
+
readonly type: Schema.Literal<"base64">;
|
|
91
|
+
readonly data: Schema.String;
|
|
92
|
+
readonly mediaType: Schema.String;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly type: Schema.Literal<"url">;
|
|
95
|
+
readonly url: Schema.String;
|
|
96
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
97
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
98
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly type: Schema.Literal<"ref">;
|
|
101
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
102
|
+
readonly id: Schema.String;
|
|
103
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
104
|
+
}>]>;
|
|
105
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
106
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
107
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
108
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
109
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
110
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
111
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
112
|
+
readonly format: Schema.optional<Schema.String>;
|
|
113
|
+
}>>;
|
|
114
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
115
|
+
}>, never, never>>;
|
|
116
|
+
readonly n: Schema.optional<Schema.Int>;
|
|
117
|
+
readonly size: Schema.optional<Schema.declare<`${number}x${number}`, `${number}x${number}`>>;
|
|
118
|
+
readonly aspectRatio: Schema.optional<Schema.declare<`${number}:${number}`, `${number}:${number}`>>;
|
|
119
|
+
readonly seed: Schema.optional<Schema.Number>;
|
|
120
|
+
readonly format: Schema.optional<Schema.String>;
|
|
121
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
72
122
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
73
123
|
}>, {}>;
|
|
74
124
|
export declare class ImageRequest extends ImageRequest_base {
|
|
75
125
|
protected readonly _ImageRequest: void;
|
|
76
126
|
}
|
|
77
|
-
export type ImageRequestFor<Options extends ImageOptions = ImageOptions> = Omit<ImageRequest, "model" | "
|
|
127
|
+
export type ImageRequestFor<Options extends ImageOptions = ImageOptions> = Omit<ImageRequest, "model" | "providerOptions"> & {
|
|
78
128
|
readonly model: ImageModel<Options>;
|
|
79
|
-
readonly
|
|
129
|
+
readonly providerOptions?: Options;
|
|
80
130
|
};
|
|
81
131
|
export type ImageModelOptions<Model> = Model extends ImageModel<infer Options> ? Options : never;
|
|
82
|
-
export type ImageRequestInput<Model extends
|
|
132
|
+
export type ImageRequestInput<Model extends ImageModel = ImageModel> = Omit<ConstructorParameters<typeof ImageRequest>[0], "model" | "providerOptions" | "http"> & {
|
|
83
133
|
readonly model: Model;
|
|
84
|
-
readonly
|
|
134
|
+
readonly format?: ImageFormat;
|
|
135
|
+
readonly providerOptions?: NoInfer<ImageModelOptions<Model>>;
|
|
85
136
|
readonly http?: HttpOptions.Input;
|
|
86
|
-
}
|
|
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
|
-
}
|
|
137
|
+
};
|
|
94
138
|
declare const ImageResponse_base: Schema.Class<ImageResponse, Schema.Struct<{
|
|
95
|
-
readonly images: Schema.$Array<
|
|
96
|
-
|
|
139
|
+
readonly images: Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
140
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
141
|
+
readonly type: Schema.Literal<"bytes">;
|
|
142
|
+
readonly data: Schema.Uint8Array;
|
|
143
|
+
readonly mediaType: Schema.String;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly type: Schema.Literal<"base64">;
|
|
146
|
+
readonly data: Schema.String;
|
|
147
|
+
readonly mediaType: Schema.String;
|
|
148
|
+
}>, Schema.Struct<{
|
|
149
|
+
readonly type: Schema.Literal<"url">;
|
|
150
|
+
readonly url: Schema.String;
|
|
151
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
152
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
153
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
154
|
+
}>, Schema.Struct<{
|
|
155
|
+
readonly type: Schema.Literal<"ref">;
|
|
156
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
157
|
+
readonly id: Schema.String;
|
|
158
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
159
|
+
}>]>;
|
|
160
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
161
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
162
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
163
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
164
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
165
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
166
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
167
|
+
readonly format: Schema.optional<Schema.String>;
|
|
168
|
+
}>>;
|
|
169
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
170
|
+
}>, never, never>>;
|
|
171
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
172
|
+
readonly type: Schema.Literal<"tokens">;
|
|
173
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
174
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
175
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
176
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
177
|
+
}>, Schema.Struct<{
|
|
178
|
+
readonly type: Schema.Literal<"seconds">;
|
|
179
|
+
readonly seconds: Schema.Number;
|
|
180
|
+
}>, Schema.Struct<{
|
|
181
|
+
readonly type: Schema.Literal<"characters">;
|
|
182
|
+
readonly characters: Schema.Number;
|
|
183
|
+
}>, Schema.Struct<{
|
|
184
|
+
readonly type: Schema.Literal<"credits">;
|
|
185
|
+
readonly credits: Schema.Number;
|
|
186
|
+
}>, Schema.Struct<{
|
|
187
|
+
readonly type: Schema.Literal<"compute">;
|
|
188
|
+
readonly seconds: Schema.Number;
|
|
189
|
+
}>]>>;
|
|
190
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
191
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
192
|
+
readonly message: Schema.String;
|
|
193
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
194
|
+
}>>>;
|
|
97
195
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
98
196
|
}>, {}>;
|
|
99
197
|
export declare class ImageResponse extends ImageResponse_base {
|
|
100
|
-
get image():
|
|
198
|
+
get image(): Media.Asset;
|
|
101
199
|
}
|
|
102
|
-
export declare
|
|
200
|
+
export declare const ImageOutputEvent: Schema.Struct<{
|
|
201
|
+
readonly type: Schema.tag<"image">;
|
|
202
|
+
readonly index: Schema.Number;
|
|
203
|
+
readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
204
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
205
|
+
readonly type: Schema.Literal<"bytes">;
|
|
206
|
+
readonly data: Schema.Uint8Array;
|
|
207
|
+
readonly mediaType: Schema.String;
|
|
208
|
+
}>, Schema.Struct<{
|
|
209
|
+
readonly type: Schema.Literal<"base64">;
|
|
210
|
+
readonly data: Schema.String;
|
|
211
|
+
readonly mediaType: Schema.String;
|
|
212
|
+
}>, Schema.Struct<{
|
|
213
|
+
readonly type: Schema.Literal<"url">;
|
|
214
|
+
readonly url: Schema.String;
|
|
215
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
216
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
217
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
218
|
+
}>, Schema.Struct<{
|
|
219
|
+
readonly type: Schema.Literal<"ref">;
|
|
220
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
221
|
+
readonly id: Schema.String;
|
|
222
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
223
|
+
}>]>;
|
|
224
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
225
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
226
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
227
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
228
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
229
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
230
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
231
|
+
readonly format: Schema.optional<Schema.String>;
|
|
232
|
+
}>>;
|
|
233
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
234
|
+
}>, never, never>;
|
|
235
|
+
}>;
|
|
236
|
+
export declare const ImageFinishEvent: Schema.Struct<{
|
|
237
|
+
readonly type: Schema.tag<"finish">;
|
|
238
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
239
|
+
readonly type: Schema.Literal<"tokens">;
|
|
240
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
241
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
242
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
243
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
244
|
+
}>, Schema.Struct<{
|
|
245
|
+
readonly type: Schema.Literal<"seconds">;
|
|
246
|
+
readonly seconds: Schema.Number;
|
|
247
|
+
}>, Schema.Struct<{
|
|
248
|
+
readonly type: Schema.Literal<"characters">;
|
|
249
|
+
readonly characters: Schema.Number;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly type: Schema.Literal<"credits">;
|
|
252
|
+
readonly credits: Schema.Number;
|
|
253
|
+
}>, Schema.Struct<{
|
|
254
|
+
readonly type: Schema.Literal<"compute">;
|
|
255
|
+
readonly seconds: Schema.Number;
|
|
256
|
+
}>]>>;
|
|
257
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
258
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
259
|
+
readonly message: Schema.String;
|
|
260
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
261
|
+
}>>>;
|
|
262
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
263
|
+
}>;
|
|
264
|
+
declare const imageEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
265
|
+
readonly type: Schema.tag<"image">;
|
|
266
|
+
readonly index: Schema.Number;
|
|
267
|
+
readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
268
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
269
|
+
readonly type: Schema.Literal<"bytes">;
|
|
270
|
+
readonly data: Schema.Uint8Array;
|
|
271
|
+
readonly mediaType: Schema.String;
|
|
272
|
+
}>, Schema.Struct<{
|
|
273
|
+
readonly type: Schema.Literal<"base64">;
|
|
274
|
+
readonly data: Schema.String;
|
|
275
|
+
readonly mediaType: Schema.String;
|
|
276
|
+
}>, Schema.Struct<{
|
|
277
|
+
readonly type: Schema.Literal<"url">;
|
|
278
|
+
readonly url: Schema.String;
|
|
279
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
280
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
281
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
282
|
+
}>, Schema.Struct<{
|
|
283
|
+
readonly type: Schema.Literal<"ref">;
|
|
284
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
285
|
+
readonly id: Schema.String;
|
|
286
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
287
|
+
}>]>;
|
|
288
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
289
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
290
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
291
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
292
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
293
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
294
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
295
|
+
readonly format: Schema.optional<Schema.String>;
|
|
296
|
+
}>>;
|
|
297
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
298
|
+
}>, never, never>;
|
|
299
|
+
}>, Schema.Struct<{
|
|
300
|
+
readonly type: Schema.tag<"finish">;
|
|
301
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
302
|
+
readonly type: Schema.Literal<"tokens">;
|
|
303
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
304
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
305
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
306
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
307
|
+
}>, Schema.Struct<{
|
|
308
|
+
readonly type: Schema.Literal<"seconds">;
|
|
309
|
+
readonly seconds: Schema.Number;
|
|
310
|
+
}>, Schema.Struct<{
|
|
311
|
+
readonly type: Schema.Literal<"characters">;
|
|
312
|
+
readonly characters: Schema.Number;
|
|
313
|
+
}>, Schema.Struct<{
|
|
314
|
+
readonly type: Schema.Literal<"credits">;
|
|
315
|
+
readonly credits: Schema.Number;
|
|
316
|
+
}>, Schema.Struct<{
|
|
317
|
+
readonly type: Schema.Literal<"compute">;
|
|
318
|
+
readonly seconds: Schema.Number;
|
|
319
|
+
}>]>>;
|
|
320
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
321
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
322
|
+
readonly message: Schema.String;
|
|
323
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
324
|
+
}>>>;
|
|
325
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
326
|
+
}>]>;
|
|
327
|
+
export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
|
|
328
|
+
readonly type: Schema.tag<"image">;
|
|
329
|
+
readonly index: Schema.Number;
|
|
330
|
+
readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
331
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
332
|
+
readonly type: Schema.Literal<"bytes">;
|
|
333
|
+
readonly data: Schema.Uint8Array;
|
|
334
|
+
readonly mediaType: Schema.String;
|
|
335
|
+
}>, Schema.Struct<{
|
|
336
|
+
readonly type: Schema.Literal<"base64">;
|
|
337
|
+
readonly data: Schema.String;
|
|
338
|
+
readonly mediaType: Schema.String;
|
|
339
|
+
}>, Schema.Struct<{
|
|
340
|
+
readonly type: Schema.Literal<"url">;
|
|
341
|
+
readonly url: Schema.String;
|
|
342
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
343
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
344
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
345
|
+
}>, Schema.Struct<{
|
|
346
|
+
readonly type: Schema.Literal<"ref">;
|
|
347
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
348
|
+
readonly id: Schema.String;
|
|
349
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
350
|
+
}>]>;
|
|
351
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
352
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
353
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
354
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
355
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
356
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
357
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
358
|
+
readonly format: Schema.optional<Schema.String>;
|
|
359
|
+
}>>;
|
|
360
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
361
|
+
}>, never, never>;
|
|
362
|
+
}>, Schema.Struct<{
|
|
363
|
+
readonly type: Schema.tag<"finish">;
|
|
364
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
365
|
+
readonly type: Schema.Literal<"tokens">;
|
|
366
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
367
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
368
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
369
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
370
|
+
}>, Schema.Struct<{
|
|
371
|
+
readonly type: Schema.Literal<"seconds">;
|
|
372
|
+
readonly seconds: Schema.Number;
|
|
373
|
+
}>, Schema.Struct<{
|
|
374
|
+
readonly type: Schema.Literal<"characters">;
|
|
375
|
+
readonly characters: Schema.Number;
|
|
376
|
+
}>, Schema.Struct<{
|
|
377
|
+
readonly type: Schema.Literal<"credits">;
|
|
378
|
+
readonly credits: Schema.Number;
|
|
379
|
+
}>, Schema.Struct<{
|
|
380
|
+
readonly type: Schema.Literal<"compute">;
|
|
381
|
+
readonly seconds: Schema.Number;
|
|
382
|
+
}>]>>;
|
|
383
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
384
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
385
|
+
readonly message: Schema.String;
|
|
386
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
387
|
+
}>>>;
|
|
388
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
389
|
+
}>]> & {
|
|
390
|
+
readonly discriminants: readonly ["image", "finish"];
|
|
391
|
+
readonly cases: {
|
|
392
|
+
image: Schema.Struct<{
|
|
393
|
+
readonly type: Schema.tag<"image">;
|
|
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
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
410
|
+
}>, Schema.Struct<{
|
|
411
|
+
readonly type: Schema.Literal<"ref">;
|
|
412
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
413
|
+
readonly id: Schema.String;
|
|
414
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
415
|
+
}>]>;
|
|
416
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
417
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
418
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
419
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
420
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
421
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
422
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
423
|
+
readonly format: Schema.optional<Schema.String>;
|
|
424
|
+
}>>;
|
|
425
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
426
|
+
}>, never, never>;
|
|
427
|
+
}>;
|
|
428
|
+
finish: Schema.Struct<{
|
|
429
|
+
readonly type: Schema.tag<"finish">;
|
|
430
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
431
|
+
readonly type: Schema.Literal<"tokens">;
|
|
432
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
433
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
434
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
435
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
436
|
+
}>, Schema.Struct<{
|
|
437
|
+
readonly type: Schema.Literal<"seconds">;
|
|
438
|
+
readonly seconds: Schema.Number;
|
|
439
|
+
}>, Schema.Struct<{
|
|
440
|
+
readonly type: Schema.Literal<"characters">;
|
|
441
|
+
readonly characters: Schema.Number;
|
|
442
|
+
}>, Schema.Struct<{
|
|
443
|
+
readonly type: Schema.Literal<"credits">;
|
|
444
|
+
readonly credits: Schema.Number;
|
|
445
|
+
}>, Schema.Struct<{
|
|
446
|
+
readonly type: Schema.Literal<"compute">;
|
|
447
|
+
readonly seconds: Schema.Number;
|
|
448
|
+
}>]>>;
|
|
449
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
450
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
451
|
+
readonly message: Schema.String;
|
|
452
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
453
|
+
}>>>;
|
|
454
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
455
|
+
}>;
|
|
456
|
+
};
|
|
457
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
458
|
+
readonly type: "image";
|
|
459
|
+
readonly index: number;
|
|
460
|
+
readonly image: Media.Asset;
|
|
461
|
+
} | {
|
|
462
|
+
readonly type: "finish";
|
|
463
|
+
readonly providerMetadata?: {
|
|
464
|
+
readonly [x: string]: {
|
|
465
|
+
readonly [x: string]: unknown;
|
|
466
|
+
};
|
|
467
|
+
} | undefined;
|
|
468
|
+
readonly usage?: {
|
|
469
|
+
readonly type: "tokens";
|
|
470
|
+
readonly input?: number | undefined;
|
|
471
|
+
readonly output?: number | undefined;
|
|
472
|
+
readonly total?: number | undefined;
|
|
473
|
+
readonly details?: {
|
|
474
|
+
readonly [x: string]: unknown;
|
|
475
|
+
} | undefined;
|
|
476
|
+
} | {
|
|
477
|
+
readonly type: "seconds";
|
|
478
|
+
readonly seconds: number;
|
|
479
|
+
} | {
|
|
480
|
+
readonly type: "characters";
|
|
481
|
+
readonly characters: number;
|
|
482
|
+
} | {
|
|
483
|
+
readonly type: "credits";
|
|
484
|
+
readonly credits: number;
|
|
485
|
+
} | {
|
|
486
|
+
readonly type: "compute";
|
|
487
|
+
readonly seconds: number;
|
|
488
|
+
} | undefined;
|
|
489
|
+
readonly notices?: readonly {
|
|
490
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
491
|
+
readonly message: string;
|
|
492
|
+
readonly providerMetadata?: {
|
|
493
|
+
readonly [x: string]: {
|
|
494
|
+
readonly [x: string]: unknown;
|
|
495
|
+
};
|
|
496
|
+
} | undefined;
|
|
497
|
+
}[] | undefined;
|
|
498
|
+
}) => value is Extract<{
|
|
499
|
+
readonly type: "image";
|
|
500
|
+
readonly index: number;
|
|
501
|
+
readonly image: Media.Asset;
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: Keys;
|
|
504
|
+
}> | Extract<{
|
|
505
|
+
readonly type: "finish";
|
|
506
|
+
readonly providerMetadata?: {
|
|
507
|
+
readonly [x: string]: {
|
|
508
|
+
readonly [x: string]: unknown;
|
|
509
|
+
};
|
|
510
|
+
} | undefined;
|
|
511
|
+
readonly usage?: {
|
|
512
|
+
readonly type: "tokens";
|
|
513
|
+
readonly input?: number | undefined;
|
|
514
|
+
readonly output?: number | undefined;
|
|
515
|
+
readonly total?: number | undefined;
|
|
516
|
+
readonly details?: {
|
|
517
|
+
readonly [x: string]: unknown;
|
|
518
|
+
} | undefined;
|
|
519
|
+
} | {
|
|
520
|
+
readonly type: "seconds";
|
|
521
|
+
readonly seconds: number;
|
|
522
|
+
} | {
|
|
523
|
+
readonly type: "characters";
|
|
524
|
+
readonly characters: number;
|
|
525
|
+
} | {
|
|
526
|
+
readonly type: "credits";
|
|
527
|
+
readonly credits: number;
|
|
528
|
+
} | {
|
|
529
|
+
readonly type: "compute";
|
|
530
|
+
readonly seconds: number;
|
|
531
|
+
} | undefined;
|
|
532
|
+
readonly notices?: readonly {
|
|
533
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
534
|
+
readonly message: string;
|
|
535
|
+
readonly providerMetadata?: {
|
|
536
|
+
readonly [x: string]: {
|
|
537
|
+
readonly [x: string]: unknown;
|
|
538
|
+
};
|
|
539
|
+
} | undefined;
|
|
540
|
+
}[] | undefined;
|
|
541
|
+
}, {
|
|
542
|
+
readonly type: Keys;
|
|
543
|
+
}>;
|
|
544
|
+
readonly guards: {
|
|
545
|
+
image: (u: unknown) => u is {
|
|
546
|
+
readonly type: "image";
|
|
547
|
+
readonly index: number;
|
|
548
|
+
readonly image: Media.Asset;
|
|
549
|
+
};
|
|
550
|
+
finish: (u: unknown) => u is {
|
|
551
|
+
readonly type: "finish";
|
|
552
|
+
readonly providerMetadata?: {
|
|
553
|
+
readonly [x: string]: {
|
|
554
|
+
readonly [x: string]: unknown;
|
|
555
|
+
};
|
|
556
|
+
} | undefined;
|
|
557
|
+
readonly usage?: {
|
|
558
|
+
readonly type: "tokens";
|
|
559
|
+
readonly input?: number | undefined;
|
|
560
|
+
readonly output?: number | undefined;
|
|
561
|
+
readonly total?: number | undefined;
|
|
562
|
+
readonly details?: {
|
|
563
|
+
readonly [x: string]: unknown;
|
|
564
|
+
} | undefined;
|
|
565
|
+
} | {
|
|
566
|
+
readonly type: "seconds";
|
|
567
|
+
readonly seconds: number;
|
|
568
|
+
} | {
|
|
569
|
+
readonly type: "characters";
|
|
570
|
+
readonly characters: number;
|
|
571
|
+
} | {
|
|
572
|
+
readonly type: "credits";
|
|
573
|
+
readonly credits: number;
|
|
574
|
+
} | {
|
|
575
|
+
readonly type: "compute";
|
|
576
|
+
readonly seconds: number;
|
|
577
|
+
} | undefined;
|
|
578
|
+
readonly notices?: readonly {
|
|
579
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
580
|
+
readonly message: string;
|
|
581
|
+
readonly providerMetadata?: {
|
|
582
|
+
readonly [x: string]: {
|
|
583
|
+
readonly [x: string]: unknown;
|
|
584
|
+
};
|
|
585
|
+
} | undefined;
|
|
586
|
+
}[] | undefined;
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
readonly match: {
|
|
590
|
+
<Cases extends {
|
|
591
|
+
image: (value: {
|
|
592
|
+
readonly type: "image";
|
|
593
|
+
readonly index: number;
|
|
594
|
+
readonly image: Media.Asset;
|
|
595
|
+
}) => any;
|
|
596
|
+
finish: (value: {
|
|
597
|
+
readonly type: "finish";
|
|
598
|
+
readonly providerMetadata?: {
|
|
599
|
+
readonly [x: string]: {
|
|
600
|
+
readonly [x: string]: unknown;
|
|
601
|
+
};
|
|
602
|
+
} | undefined;
|
|
603
|
+
readonly usage?: {
|
|
604
|
+
readonly type: "tokens";
|
|
605
|
+
readonly input?: number | undefined;
|
|
606
|
+
readonly output?: number | undefined;
|
|
607
|
+
readonly total?: number | undefined;
|
|
608
|
+
readonly details?: {
|
|
609
|
+
readonly [x: string]: unknown;
|
|
610
|
+
} | undefined;
|
|
611
|
+
} | {
|
|
612
|
+
readonly type: "seconds";
|
|
613
|
+
readonly seconds: number;
|
|
614
|
+
} | {
|
|
615
|
+
readonly type: "characters";
|
|
616
|
+
readonly characters: number;
|
|
617
|
+
} | {
|
|
618
|
+
readonly type: "credits";
|
|
619
|
+
readonly credits: number;
|
|
620
|
+
} | {
|
|
621
|
+
readonly type: "compute";
|
|
622
|
+
readonly seconds: number;
|
|
623
|
+
} | undefined;
|
|
624
|
+
readonly notices?: readonly {
|
|
625
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
626
|
+
readonly message: string;
|
|
627
|
+
readonly providerMetadata?: {
|
|
628
|
+
readonly [x: string]: {
|
|
629
|
+
readonly [x: string]: unknown;
|
|
630
|
+
};
|
|
631
|
+
} | undefined;
|
|
632
|
+
}[] | undefined;
|
|
633
|
+
}) => any;
|
|
634
|
+
}>(value: {
|
|
635
|
+
readonly type: "image";
|
|
636
|
+
readonly index: number;
|
|
637
|
+
readonly image: Media.Asset;
|
|
638
|
+
} | {
|
|
639
|
+
readonly type: "finish";
|
|
640
|
+
readonly providerMetadata?: {
|
|
641
|
+
readonly [x: string]: {
|
|
642
|
+
readonly [x: string]: unknown;
|
|
643
|
+
};
|
|
644
|
+
} | undefined;
|
|
645
|
+
readonly usage?: {
|
|
646
|
+
readonly type: "tokens";
|
|
647
|
+
readonly input?: number | undefined;
|
|
648
|
+
readonly output?: number | undefined;
|
|
649
|
+
readonly total?: number | undefined;
|
|
650
|
+
readonly details?: {
|
|
651
|
+
readonly [x: string]: unknown;
|
|
652
|
+
} | undefined;
|
|
653
|
+
} | {
|
|
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
|
+
} | undefined;
|
|
666
|
+
readonly notices?: readonly {
|
|
667
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
668
|
+
readonly message: string;
|
|
669
|
+
readonly providerMetadata?: {
|
|
670
|
+
readonly [x: string]: {
|
|
671
|
+
readonly [x: string]: unknown;
|
|
672
|
+
};
|
|
673
|
+
} | undefined;
|
|
674
|
+
}[] | undefined;
|
|
675
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
676
|
+
<Cases extends {
|
|
677
|
+
image: (value: {
|
|
678
|
+
readonly type: "image";
|
|
679
|
+
readonly index: number;
|
|
680
|
+
readonly image: Media.Asset;
|
|
681
|
+
}) => any;
|
|
682
|
+
finish: (value: {
|
|
683
|
+
readonly type: "finish";
|
|
684
|
+
readonly providerMetadata?: {
|
|
685
|
+
readonly [x: string]: {
|
|
686
|
+
readonly [x: string]: unknown;
|
|
687
|
+
};
|
|
688
|
+
} | undefined;
|
|
689
|
+
readonly usage?: {
|
|
690
|
+
readonly type: "tokens";
|
|
691
|
+
readonly input?: number | undefined;
|
|
692
|
+
readonly output?: number | undefined;
|
|
693
|
+
readonly total?: number | undefined;
|
|
694
|
+
readonly details?: {
|
|
695
|
+
readonly [x: string]: unknown;
|
|
696
|
+
} | undefined;
|
|
697
|
+
} | {
|
|
698
|
+
readonly type: "seconds";
|
|
699
|
+
readonly seconds: number;
|
|
700
|
+
} | {
|
|
701
|
+
readonly type: "characters";
|
|
702
|
+
readonly characters: number;
|
|
703
|
+
} | {
|
|
704
|
+
readonly type: "credits";
|
|
705
|
+
readonly credits: number;
|
|
706
|
+
} | {
|
|
707
|
+
readonly type: "compute";
|
|
708
|
+
readonly seconds: number;
|
|
709
|
+
} | undefined;
|
|
710
|
+
readonly notices?: readonly {
|
|
711
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
712
|
+
readonly message: string;
|
|
713
|
+
readonly providerMetadata?: {
|
|
714
|
+
readonly [x: string]: {
|
|
715
|
+
readonly [x: string]: unknown;
|
|
716
|
+
};
|
|
717
|
+
} | undefined;
|
|
718
|
+
}[] | undefined;
|
|
719
|
+
}) => any;
|
|
720
|
+
}>(cases: Cases): (value: {
|
|
721
|
+
readonly type: "image";
|
|
722
|
+
readonly index: number;
|
|
723
|
+
readonly image: Media.Asset;
|
|
724
|
+
} | {
|
|
725
|
+
readonly type: "finish";
|
|
726
|
+
readonly providerMetadata?: {
|
|
727
|
+
readonly [x: string]: {
|
|
728
|
+
readonly [x: string]: unknown;
|
|
729
|
+
};
|
|
730
|
+
} | undefined;
|
|
731
|
+
readonly usage?: {
|
|
732
|
+
readonly type: "tokens";
|
|
733
|
+
readonly input?: number | undefined;
|
|
734
|
+
readonly output?: number | undefined;
|
|
735
|
+
readonly total?: number | undefined;
|
|
736
|
+
readonly details?: {
|
|
737
|
+
readonly [x: string]: unknown;
|
|
738
|
+
} | undefined;
|
|
739
|
+
} | {
|
|
740
|
+
readonly type: "seconds";
|
|
741
|
+
readonly seconds: number;
|
|
742
|
+
} | {
|
|
743
|
+
readonly type: "characters";
|
|
744
|
+
readonly characters: number;
|
|
745
|
+
} | {
|
|
746
|
+
readonly type: "credits";
|
|
747
|
+
readonly credits: number;
|
|
748
|
+
} | {
|
|
749
|
+
readonly type: "compute";
|
|
750
|
+
readonly seconds: number;
|
|
751
|
+
} | undefined;
|
|
752
|
+
readonly notices?: readonly {
|
|
753
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
754
|
+
readonly message: string;
|
|
755
|
+
readonly providerMetadata?: {
|
|
756
|
+
readonly [x: string]: {
|
|
757
|
+
readonly [x: string]: unknown;
|
|
758
|
+
};
|
|
759
|
+
} | undefined;
|
|
760
|
+
}[] | undefined;
|
|
761
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
762
|
+
};
|
|
763
|
+
readonly matchOrElse: {
|
|
764
|
+
<Cases extends {
|
|
765
|
+
image?: ((value: {
|
|
766
|
+
readonly type: "image";
|
|
767
|
+
readonly index: number;
|
|
768
|
+
readonly image: Media.Asset;
|
|
769
|
+
}) => any) | undefined;
|
|
770
|
+
finish?: ((value: {
|
|
771
|
+
readonly type: "finish";
|
|
772
|
+
readonly providerMetadata?: {
|
|
773
|
+
readonly [x: string]: {
|
|
774
|
+
readonly [x: string]: unknown;
|
|
775
|
+
};
|
|
776
|
+
} | undefined;
|
|
777
|
+
readonly usage?: {
|
|
778
|
+
readonly type: "tokens";
|
|
779
|
+
readonly input?: number | undefined;
|
|
780
|
+
readonly output?: number | undefined;
|
|
781
|
+
readonly total?: number | undefined;
|
|
782
|
+
readonly details?: {
|
|
783
|
+
readonly [x: string]: unknown;
|
|
784
|
+
} | undefined;
|
|
785
|
+
} | {
|
|
786
|
+
readonly type: "seconds";
|
|
787
|
+
readonly seconds: number;
|
|
788
|
+
} | {
|
|
789
|
+
readonly type: "characters";
|
|
790
|
+
readonly characters: number;
|
|
791
|
+
} | {
|
|
792
|
+
readonly type: "credits";
|
|
793
|
+
readonly credits: number;
|
|
794
|
+
} | {
|
|
795
|
+
readonly type: "compute";
|
|
796
|
+
readonly seconds: number;
|
|
797
|
+
} | undefined;
|
|
798
|
+
readonly notices?: readonly {
|
|
799
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
800
|
+
readonly message: string;
|
|
801
|
+
readonly providerMetadata?: {
|
|
802
|
+
readonly [x: string]: {
|
|
803
|
+
readonly [x: string]: unknown;
|
|
804
|
+
};
|
|
805
|
+
} | undefined;
|
|
806
|
+
}[] | undefined;
|
|
807
|
+
}) => any) | undefined;
|
|
808
|
+
} & { [K in Exclude<keyof Cases, "image" | "finish">]: never; }, OrElse extends (value: Exclude<{
|
|
809
|
+
readonly type: "image";
|
|
810
|
+
readonly index: number;
|
|
811
|
+
readonly image: Media.Asset;
|
|
812
|
+
}, {
|
|
813
|
+
readonly type: keyof Cases;
|
|
814
|
+
}> | Exclude<{
|
|
815
|
+
readonly type: "finish";
|
|
816
|
+
readonly providerMetadata?: {
|
|
817
|
+
readonly [x: string]: {
|
|
818
|
+
readonly [x: string]: unknown;
|
|
819
|
+
};
|
|
820
|
+
} | undefined;
|
|
821
|
+
readonly usage?: {
|
|
822
|
+
readonly type: "tokens";
|
|
823
|
+
readonly input?: number | undefined;
|
|
824
|
+
readonly output?: number | undefined;
|
|
825
|
+
readonly total?: number | undefined;
|
|
826
|
+
readonly details?: {
|
|
827
|
+
readonly [x: string]: unknown;
|
|
828
|
+
} | undefined;
|
|
829
|
+
} | {
|
|
830
|
+
readonly type: "seconds";
|
|
831
|
+
readonly seconds: number;
|
|
832
|
+
} | {
|
|
833
|
+
readonly type: "characters";
|
|
834
|
+
readonly characters: number;
|
|
835
|
+
} | {
|
|
836
|
+
readonly type: "credits";
|
|
837
|
+
readonly credits: number;
|
|
838
|
+
} | {
|
|
839
|
+
readonly type: "compute";
|
|
840
|
+
readonly seconds: number;
|
|
841
|
+
} | undefined;
|
|
842
|
+
readonly notices?: readonly {
|
|
843
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
844
|
+
readonly message: string;
|
|
845
|
+
readonly providerMetadata?: {
|
|
846
|
+
readonly [x: string]: {
|
|
847
|
+
readonly [x: string]: unknown;
|
|
848
|
+
};
|
|
849
|
+
} | undefined;
|
|
850
|
+
}[] | undefined;
|
|
851
|
+
}, {
|
|
852
|
+
readonly type: keyof Cases;
|
|
853
|
+
}>) => any>(value: {
|
|
854
|
+
readonly type: "image";
|
|
855
|
+
readonly index: number;
|
|
856
|
+
readonly image: Media.Asset;
|
|
857
|
+
} | {
|
|
858
|
+
readonly type: "finish";
|
|
859
|
+
readonly providerMetadata?: {
|
|
860
|
+
readonly [x: string]: {
|
|
861
|
+
readonly [x: string]: unknown;
|
|
862
|
+
};
|
|
863
|
+
} | undefined;
|
|
864
|
+
readonly usage?: {
|
|
865
|
+
readonly type: "tokens";
|
|
866
|
+
readonly input?: number | undefined;
|
|
867
|
+
readonly output?: number | undefined;
|
|
868
|
+
readonly total?: number | undefined;
|
|
869
|
+
readonly details?: {
|
|
870
|
+
readonly [x: string]: unknown;
|
|
871
|
+
} | undefined;
|
|
872
|
+
} | {
|
|
873
|
+
readonly type: "seconds";
|
|
874
|
+
readonly seconds: number;
|
|
875
|
+
} | {
|
|
876
|
+
readonly type: "characters";
|
|
877
|
+
readonly characters: number;
|
|
878
|
+
} | {
|
|
879
|
+
readonly type: "credits";
|
|
880
|
+
readonly credits: number;
|
|
881
|
+
} | {
|
|
882
|
+
readonly type: "compute";
|
|
883
|
+
readonly seconds: number;
|
|
884
|
+
} | undefined;
|
|
885
|
+
readonly notices?: readonly {
|
|
886
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
887
|
+
readonly message: string;
|
|
888
|
+
readonly providerMetadata?: {
|
|
889
|
+
readonly [x: string]: {
|
|
890
|
+
readonly [x: string]: unknown;
|
|
891
|
+
};
|
|
892
|
+
} | undefined;
|
|
893
|
+
}[] | undefined;
|
|
894
|
+
}, 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>>;
|
|
895
|
+
<Cases extends {
|
|
896
|
+
image?: ((value: {
|
|
897
|
+
readonly type: "image";
|
|
898
|
+
readonly index: number;
|
|
899
|
+
readonly image: Media.Asset;
|
|
900
|
+
}) => any) | undefined;
|
|
901
|
+
finish?: ((value: {
|
|
902
|
+
readonly type: "finish";
|
|
903
|
+
readonly providerMetadata?: {
|
|
904
|
+
readonly [x: string]: {
|
|
905
|
+
readonly [x: string]: unknown;
|
|
906
|
+
};
|
|
907
|
+
} | undefined;
|
|
908
|
+
readonly usage?: {
|
|
909
|
+
readonly type: "tokens";
|
|
910
|
+
readonly input?: number | undefined;
|
|
911
|
+
readonly output?: number | undefined;
|
|
912
|
+
readonly total?: number | undefined;
|
|
913
|
+
readonly details?: {
|
|
914
|
+
readonly [x: string]: unknown;
|
|
915
|
+
} | undefined;
|
|
916
|
+
} | {
|
|
917
|
+
readonly type: "seconds";
|
|
918
|
+
readonly seconds: number;
|
|
919
|
+
} | {
|
|
920
|
+
readonly type: "characters";
|
|
921
|
+
readonly characters: number;
|
|
922
|
+
} | {
|
|
923
|
+
readonly type: "credits";
|
|
924
|
+
readonly credits: number;
|
|
925
|
+
} | {
|
|
926
|
+
readonly type: "compute";
|
|
927
|
+
readonly seconds: number;
|
|
928
|
+
} | undefined;
|
|
929
|
+
readonly notices?: readonly {
|
|
930
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
931
|
+
readonly message: string;
|
|
932
|
+
readonly providerMetadata?: {
|
|
933
|
+
readonly [x: string]: {
|
|
934
|
+
readonly [x: string]: unknown;
|
|
935
|
+
};
|
|
936
|
+
} | undefined;
|
|
937
|
+
}[] | undefined;
|
|
938
|
+
}) => any) | undefined;
|
|
939
|
+
} & { [K in Exclude<keyof Cases, "image" | "finish">]: never; }, OrElse extends (value: Exclude<{
|
|
940
|
+
readonly type: "image";
|
|
941
|
+
readonly index: number;
|
|
942
|
+
readonly image: Media.Asset;
|
|
943
|
+
}, {
|
|
944
|
+
readonly type: keyof Cases;
|
|
945
|
+
}> | Exclude<{
|
|
946
|
+
readonly type: "finish";
|
|
947
|
+
readonly providerMetadata?: {
|
|
948
|
+
readonly [x: string]: {
|
|
949
|
+
readonly [x: string]: unknown;
|
|
950
|
+
};
|
|
951
|
+
} | undefined;
|
|
952
|
+
readonly usage?: {
|
|
953
|
+
readonly type: "tokens";
|
|
954
|
+
readonly input?: number | undefined;
|
|
955
|
+
readonly output?: number | undefined;
|
|
956
|
+
readonly total?: number | undefined;
|
|
957
|
+
readonly details?: {
|
|
958
|
+
readonly [x: string]: unknown;
|
|
959
|
+
} | undefined;
|
|
960
|
+
} | {
|
|
961
|
+
readonly type: "seconds";
|
|
962
|
+
readonly seconds: number;
|
|
963
|
+
} | {
|
|
964
|
+
readonly type: "characters";
|
|
965
|
+
readonly characters: number;
|
|
966
|
+
} | {
|
|
967
|
+
readonly type: "credits";
|
|
968
|
+
readonly credits: number;
|
|
969
|
+
} | {
|
|
970
|
+
readonly type: "compute";
|
|
971
|
+
readonly seconds: number;
|
|
972
|
+
} | undefined;
|
|
973
|
+
readonly notices?: readonly {
|
|
974
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
975
|
+
readonly message: string;
|
|
976
|
+
readonly providerMetadata?: {
|
|
977
|
+
readonly [x: string]: {
|
|
978
|
+
readonly [x: string]: unknown;
|
|
979
|
+
};
|
|
980
|
+
} | undefined;
|
|
981
|
+
}[] | undefined;
|
|
982
|
+
}, {
|
|
983
|
+
readonly type: keyof Cases;
|
|
984
|
+
}>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
985
|
+
readonly type: "image";
|
|
986
|
+
readonly index: number;
|
|
987
|
+
readonly image: Media.Asset;
|
|
988
|
+
} | {
|
|
989
|
+
readonly type: "finish";
|
|
990
|
+
readonly providerMetadata?: {
|
|
991
|
+
readonly [x: string]: {
|
|
992
|
+
readonly [x: string]: unknown;
|
|
993
|
+
};
|
|
994
|
+
} | undefined;
|
|
995
|
+
readonly usage?: {
|
|
996
|
+
readonly type: "tokens";
|
|
997
|
+
readonly input?: number | undefined;
|
|
998
|
+
readonly output?: number | undefined;
|
|
999
|
+
readonly total?: number | undefined;
|
|
1000
|
+
readonly details?: {
|
|
1001
|
+
readonly [x: string]: unknown;
|
|
1002
|
+
} | undefined;
|
|
1003
|
+
} | {
|
|
1004
|
+
readonly type: "seconds";
|
|
1005
|
+
readonly seconds: number;
|
|
1006
|
+
} | {
|
|
1007
|
+
readonly type: "characters";
|
|
1008
|
+
readonly characters: number;
|
|
1009
|
+
} | {
|
|
1010
|
+
readonly type: "credits";
|
|
1011
|
+
readonly credits: number;
|
|
1012
|
+
} | {
|
|
1013
|
+
readonly type: "compute";
|
|
1014
|
+
readonly seconds: number;
|
|
1015
|
+
} | undefined;
|
|
1016
|
+
readonly notices?: readonly {
|
|
1017
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
1018
|
+
readonly message: string;
|
|
1019
|
+
readonly providerMetadata?: {
|
|
1020
|
+
readonly [x: string]: {
|
|
1021
|
+
readonly [x: string]: unknown;
|
|
1022
|
+
};
|
|
1023
|
+
} | undefined;
|
|
1024
|
+
}[] | undefined;
|
|
1025
|
+
}) => 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>>;
|
|
1026
|
+
};
|
|
1027
|
+
} & {
|
|
1028
|
+
is: {
|
|
1029
|
+
image: (u: unknown) => u is {
|
|
1030
|
+
readonly type: "image";
|
|
1031
|
+
readonly index: number;
|
|
1032
|
+
readonly image: Media.Asset;
|
|
1033
|
+
};
|
|
1034
|
+
finish: (u: unknown) => u is {
|
|
1035
|
+
readonly type: "finish";
|
|
1036
|
+
readonly providerMetadata?: {
|
|
1037
|
+
readonly [x: string]: {
|
|
1038
|
+
readonly [x: string]: unknown;
|
|
1039
|
+
};
|
|
1040
|
+
} | undefined;
|
|
1041
|
+
readonly usage?: {
|
|
1042
|
+
readonly type: "tokens";
|
|
1043
|
+
readonly input?: number | undefined;
|
|
1044
|
+
readonly output?: number | undefined;
|
|
1045
|
+
readonly total?: number | undefined;
|
|
1046
|
+
readonly details?: {
|
|
1047
|
+
readonly [x: string]: unknown;
|
|
1048
|
+
} | undefined;
|
|
1049
|
+
} | {
|
|
1050
|
+
readonly type: "seconds";
|
|
1051
|
+
readonly seconds: number;
|
|
1052
|
+
} | {
|
|
1053
|
+
readonly type: "characters";
|
|
1054
|
+
readonly characters: number;
|
|
1055
|
+
} | {
|
|
1056
|
+
readonly type: "credits";
|
|
1057
|
+
readonly credits: number;
|
|
1058
|
+
} | {
|
|
1059
|
+
readonly type: "compute";
|
|
1060
|
+
readonly seconds: number;
|
|
1061
|
+
} | undefined;
|
|
1062
|
+
readonly notices?: readonly {
|
|
1063
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
1064
|
+
readonly message: string;
|
|
1065
|
+
readonly providerMetadata?: {
|
|
1066
|
+
readonly [x: string]: {
|
|
1067
|
+
readonly [x: string]: unknown;
|
|
1068
|
+
};
|
|
1069
|
+
} | undefined;
|
|
1070
|
+
}[] | undefined;
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
|
+
export type ImageEvent = Schema.Schema.Type<typeof imageEventTagged>;
|
|
1075
|
+
/** Inline routes produce every image at once; expand the response into the streaming event shape. */
|
|
1076
|
+
export declare const responseEvents: (response: ImageResponse) => ReadonlyArray<ImageEvent>;
|
|
1077
|
+
export declare function request<const Model extends ImageModel>(input: ImageRequestInput<Model>): ImageRequestFor<ImageModelOptions<Model>>;
|
|
103
1078
|
export declare function request(input: ImageRequest): ImageRequest;
|
|
104
|
-
export declare function generate<const Model extends
|
|
1079
|
+
export declare function generate<const Model extends ImageModel>(input: ImageRequestInput<Model>): Effect.Effect<ImageResponse, AIError, Service>;
|
|
105
1080
|
export declare function generate(input: ImageRequest): Effect.Effect<ImageResponse, AIError, Service>;
|
|
1081
|
+
export declare function stream<const Model extends ImageModel>(input: ImageRequestInput<Model>): Stream.Stream<ImageEvent, AIError, Service>;
|
|
1082
|
+
export declare function stream(input: ImageRequest): Stream.Stream<ImageEvent, AIError, Service>;
|
|
106
1083
|
export declare const Image: {
|
|
107
1084
|
readonly request: typeof request;
|
|
108
1085
|
readonly generate: typeof generate;
|
|
1086
|
+
readonly stream: typeof stream;
|
|
109
1087
|
};
|
|
110
1088
|
export {};
|