@opencode/ai 0.0.0-dev-1286 → 0.0.0-dev-1288
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 +52 -10
- package/dist/effect.d.ts +3 -1
- package/dist/image-client.d.ts +52 -59
- package/dist/image-client.js +47 -8
- package/dist/image.d.ts +27 -7
- package/dist/image.js +10 -6
- package/dist/index.d.ts +12 -7
- package/dist/index.js +12 -7
- package/dist/media-client.d.ts +13 -5
- package/dist/media-client.js +42 -37
- package/dist/media.d.ts +8 -0
- package/dist/media.js +14 -0
- package/dist/protocols/google-interactions-video.d.ts +38 -0
- package/dist/protocols/google-interactions-video.js +187 -0
- package/dist/protocols/google-interactions.d.ts +14 -1
- package/dist/protocols/google-interactions.js +1 -1
- package/dist/protocols/minimax-video.d.ts +45 -0
- package/dist/protocols/minimax-video.js +293 -0
- package/dist/protocols/openrouter-video.d.ts +4 -9
- package/dist/protocols/openrouter-video.js +8 -7
- package/dist/protocols/seedance-video.d.ts +4 -9
- package/dist/protocols/seedance-video.js +9 -8
- package/dist/protocols/utils/responses-compaction.js +1 -1
- package/dist/protocols/xai-video.d.ts +4 -9
- package/dist/protocols/xai-video.js +8 -7
- package/dist/providers/google/videos.d.ts +2 -0
- package/dist/providers/google/videos.js +1 -0
- package/dist/providers/google.d.ts +5 -0
- package/dist/providers/google.js +7 -0
- package/dist/providers/minimax/videos.d.ts +3 -0
- package/dist/providers/minimax/videos.js +1 -0
- package/dist/providers/minimax.d.ts +6 -1
- package/dist/providers/minimax.js +10 -1
- package/dist/providers/xai/videos.d.ts +2 -0
- package/dist/providers/xai/videos.js +1 -0
- package/dist/providers/xai.d.ts +4 -3
- package/dist/providers/xai.js +5 -1
- package/dist/public.d.ts +1 -1
- package/dist/route/executor-service.d.ts +6 -0
- package/dist/route/executor-service.js +7 -0
- package/dist/route/executor.d.ts +7 -1
- package/dist/route/executor.js +7 -2
- package/dist/route/media-protocol.d.ts +5 -0
- package/dist/route/media.js +4 -3
- package/dist/route/transport/http.js +1 -1
- package/dist/schema/options.d.ts +8 -0
- package/dist/schema/options.js +1 -0
- package/dist/video-client.d.ts +6 -6
- package/dist/video-client.js +13 -11
- package/dist/video.d.ts +14 -72
- package/dist/video.js +9 -8
- package/package.json +19 -3
package/dist/route/media.js
CHANGED
|
@@ -57,7 +57,8 @@ export const queued = (input) => {
|
|
|
57
57
|
const generationRoute = (token, exchange, execute) => {
|
|
58
58
|
// Only the GET exchange retries: a decoded terminal failure (`output.ended`) can be a `ProviderInternal` too, and
|
|
59
59
|
// re-reading it would spin until the caller's deadline.
|
|
60
|
-
const
|
|
60
|
+
const get = (path) => transport.call("GET", path, exchange, execute).pipe(Effect.retry({ schedule: READ_RETRY, while: isRetryable }), Effect.map((sent) => sent.response));
|
|
61
|
+
const poll = (operation) => get(operation.path(token)).pipe(Effect.flatMap((response) => operation.decode(response, { token, get, headers: (url) => transport.headers(url, exchange) })));
|
|
61
62
|
const status = poll(protocol.status);
|
|
62
63
|
const cancel = protocol.cancel;
|
|
63
64
|
return {
|
|
@@ -138,7 +139,7 @@ const makeTransport = (input) => {
|
|
|
138
139
|
body: encoded.text,
|
|
139
140
|
headers: encoded.headers,
|
|
140
141
|
});
|
|
141
|
-
const response = yield* execute(encoded.apply(HttpClientRequest.make(call.method)(url).pipe(HttpClientRequest.setHeaders(headers))), RequestExecutor.withFetch(fetch));
|
|
142
|
+
const response = yield* RequestExecutor.withTls(execute, call.request.http?.tls)(encoded.apply(HttpClientRequest.make(call.method)(url).pipe(HttpClientRequest.setHeaders(headers))), RequestExecutor.withFetch(fetch));
|
|
142
143
|
return { response };
|
|
143
144
|
});
|
|
144
145
|
return {
|
|
@@ -153,7 +154,7 @@ const makeTransport = (input) => {
|
|
|
153
154
|
const headers = Headers.fromInput(merged);
|
|
154
155
|
const prepared = protocol.prepare === undefined
|
|
155
156
|
? request
|
|
156
|
-
: yield* protocol.prepare(request, (path, body) => send({ method: "POST", url: baseURL(path), headers, request, body }, request.fetch, execute).pipe(Effect.map((sent) => sent.response)));
|
|
157
|
+
: yield* protocol.prepare(request, (path, body) => send({ method: "POST", url: baseURL(path), headers, request: { ...request, http }, body }, request.fetch, execute).pipe(Effect.map((sent) => sent.response)));
|
|
157
158
|
// Sanitize after merging so model-level overlays are covered; the model value is restored, not sanitized.
|
|
158
159
|
const resolved = {
|
|
159
160
|
...sanitizeSurrogates({ ...prepared, headers: merged, http, providerOptions }),
|
|
@@ -66,7 +66,7 @@ export const httpJson = (input) => ({
|
|
|
66
66
|
const limits = timeoutConfig(request.timeout);
|
|
67
67
|
// Unlike the header and chunk limits, the whole-request budget has no default.
|
|
68
68
|
const total = limits.total ? Duration.millis(limits.total) : Duration.infinity;
|
|
69
|
-
const response = yield* runtime.http.execute(prepared.request, prepared.middleware).pipe(Effect.timeoutOrElse({
|
|
69
|
+
const response = yield* RequestExecutor.withTls(runtime.http.execute, request.http?.tls)(prepared.request, prepared.middleware).pipe(Effect.timeoutOrElse({
|
|
70
70
|
duration: Duration.min(timeoutDuration(limits.headers), total),
|
|
71
71
|
orElse: () => timeout("request", "Timed out waiting for response headers"),
|
|
72
72
|
}));
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -29,6 +29,14 @@ export interface HttpOptions {
|
|
|
29
29
|
readonly body?: Record<string, unknown>;
|
|
30
30
|
/** Compression for JSON request bodies. Only set it for endpoints known to decode it. */
|
|
31
31
|
readonly encoding?: RequestEncoding;
|
|
32
|
+
/** Client certificate presented to HTTPS endpoints that request one (mutual TLS). */
|
|
33
|
+
readonly tls?: ClientTls;
|
|
34
|
+
}
|
|
35
|
+
/** PEM client certificate and private key, with the passphrase of an encrypted key. */
|
|
36
|
+
export interface ClientTls {
|
|
37
|
+
readonly cert: string;
|
|
38
|
+
readonly key: string;
|
|
39
|
+
readonly passphrase?: string;
|
|
32
40
|
}
|
|
33
41
|
/** Per-phase time limits in milliseconds. */
|
|
34
42
|
export interface TimeoutConfig {
|
package/dist/schema/options.js
CHANGED
|
@@ -61,6 +61,7 @@ export const mergeTransport = (...items) => {
|
|
|
61
61
|
query: mergeStringRecords(...http.map((item) => item?.query)),
|
|
62
62
|
body: mergeJsonRecords(...http.map((item) => item?.body)),
|
|
63
63
|
encoding: last(http.map((item) => item?.encoding)),
|
|
64
|
+
tls: last(http.map((item) => item?.tls)),
|
|
64
65
|
}),
|
|
65
66
|
};
|
|
66
67
|
};
|
package/dist/video-client.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { AIError } from "./schema/index.js";
|
|
|
4
4
|
import type { VideoJob, VideoModel, VideoRequest, VideoResponse, VideoStatus } from "./video.js";
|
|
5
5
|
export interface Interface {
|
|
6
6
|
readonly start: (request: VideoRequest) => Effect.Effect<VideoJob, AIError>;
|
|
7
|
-
readonly status: (model: VideoModel,
|
|
8
|
-
readonly result: (model: VideoModel,
|
|
9
|
-
readonly cancel: (model: VideoModel,
|
|
7
|
+
readonly status: (model: VideoModel, id: string) => Effect.Effect<VideoStatus, AIError>;
|
|
8
|
+
readonly result: (model: VideoModel, id: string) => Effect.Effect<VideoResponse, AIError>;
|
|
9
|
+
readonly cancel: (model: VideoModel, id: string) => Effect.Effect<void, AIError>;
|
|
10
10
|
}
|
|
11
11
|
declare const VideoClientService_base: Context.ServiceClass<VideoClientService, "@opencode/VideoClient", Interface>;
|
|
12
12
|
export declare class VideoClientService extends VideoClientService_base {
|
|
@@ -18,8 +18,8 @@ export declare const VideoClient: {
|
|
|
18
18
|
readonly Service: typeof VideoClientService;
|
|
19
19
|
readonly layer: Layer.Layer<VideoClientService, never, RequestExecutor.RequestExecutorService>;
|
|
20
20
|
readonly start: (request: VideoRequest) => Effect.Effect<VideoJob, AIError, VideoClientService>;
|
|
21
|
-
readonly status: (model: VideoModel,
|
|
22
|
-
readonly result: (model: VideoModel,
|
|
23
|
-
readonly cancel: (model: VideoModel,
|
|
21
|
+
readonly status: (model: VideoModel, id: string) => Effect.Effect<VideoStatus, AIError, VideoClientService>;
|
|
22
|
+
readonly result: (model: VideoModel, id: string) => Effect.Effect<VideoResponse, AIError, VideoClientService>;
|
|
23
|
+
readonly cancel: (model: VideoModel, id: string) => Effect.Effect<void, AIError, VideoClientService>;
|
|
24
24
|
};
|
|
25
25
|
export {};
|
package/dist/video-client.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
2
|
import { RequestExecutor } from "./route/executor.js";
|
|
3
3
|
import { AIError, UnsupportedOperationError } from "./schema/index.js";
|
|
4
4
|
export class VideoClientService extends Context.Service()("@opencode/VideoClient") {
|
|
5
5
|
}
|
|
6
6
|
export const Service = VideoClientService;
|
|
7
|
+
// A video route whose token isn't a string is a programmer defect, not a provider error.
|
|
8
|
+
const decodeID = (token) => Schema.decodeUnknownEffect(Schema.String)(token).pipe(Effect.orDie);
|
|
7
9
|
export const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
8
10
|
const executor = yield* RequestExecutor.Service;
|
|
9
|
-
const attach = (model,
|
|
11
|
+
const attach = (model, id) => model.route.attach(model, id, executor.execute);
|
|
10
12
|
return Service.of({
|
|
11
|
-
start: (request) => request.model.route
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
status: (model,
|
|
15
|
-
result: (model,
|
|
16
|
-
cancel: (model,
|
|
13
|
+
start: (request) => request.model.route.start(request, executor.execute).pipe(
|
|
14
|
+
// The token, not the snapshot id, is what `status` and `result` decode; `VideoModel.fromRoute` makes it a string.
|
|
15
|
+
Effect.flatMap((generation) => decodeID(generation.token)), Effect.map((id) => ({ id }))),
|
|
16
|
+
status: (model, id) => attach(model, id).pipe(Effect.flatMap((route) => route.status), Effect.map((snapshot) => ({ status: snapshot.status, progress: snapshot.progress }))),
|
|
17
|
+
result: (model, id) => attach(model, id).pipe(Effect.flatMap((route) => route.result)),
|
|
18
|
+
cancel: (model, id) => attach(model, id).pipe(Effect.flatMap((route) => route.cancel ??
|
|
17
19
|
Effect.fail(new AIError({
|
|
18
20
|
reason: new UnsupportedOperationError({
|
|
19
21
|
operation: "video.cancel",
|
|
@@ -28,7 +30,7 @@ export const VideoClient = {
|
|
|
28
30
|
Service,
|
|
29
31
|
layer,
|
|
30
32
|
start: (request) => Service.use((client) => client.start(request)),
|
|
31
|
-
status: (model,
|
|
32
|
-
result: (model,
|
|
33
|
-
cancel: (model,
|
|
33
|
+
status: (model, id) => Service.use((client) => client.status(model, id)),
|
|
34
|
+
result: (model, id) => Service.use((client) => client.result(model, id)),
|
|
35
|
+
cancel: (model, id) => Service.use((client) => client.cancel(model, id)),
|
|
34
36
|
};
|
package/dist/video.d.ts
CHANGED
|
@@ -6,11 +6,12 @@ import { MediaRoute } from "./route/media.js";
|
|
|
6
6
|
import { AIError, type OpenString, type BaseRequest } from "./schema/index.js";
|
|
7
7
|
import { Service } from "./video-client.js";
|
|
8
8
|
export type VideoOptions = MediaModel.Options;
|
|
9
|
-
/** Video generation is always a queued job: submit, then read its status and result by
|
|
9
|
+
/** Video generation is always a queued job: submit, then read its status and result by the provider's job ID. */
|
|
10
10
|
export type VideoRoute = MediaRoute.QueuedRoute<VideoRequest, VideoResponse>;
|
|
11
11
|
export declare class VideoModel<Options extends VideoOptions = VideoOptions> extends MediaModel<VideoRoute, Options> {
|
|
12
12
|
protected readonly _VideoModel: void;
|
|
13
|
-
|
|
13
|
+
/** A video route's token is the provider's job ID, so `VideoJob.id` is exactly what `status` and `result` take. */
|
|
14
|
+
static fromRoute<Options extends VideoOptions>(route: MediaModel.QueuedRouteInput<VideoRequest<VideoModel<Options>>, VideoResponse, string>, input: MediaRoute.ModelInput): VideoModel<Options>;
|
|
14
15
|
}
|
|
15
16
|
export declare const VideoModelSchema: Schema.declare<VideoModel<{
|
|
16
17
|
readonly [x: string]: unknown;
|
|
@@ -33,69 +34,9 @@ declare const VideoRequestSchema: Schema.Struct<{
|
|
|
33
34
|
}>>;
|
|
34
35
|
readonly prompt: Schema.String;
|
|
35
36
|
/** Image the video starts on exactly. */
|
|
36
|
-
readonly start: Schema.optional<Schema.
|
|
37
|
-
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
38
|
-
readonly type: Schema.Literal<"bytes">;
|
|
39
|
-
readonly data: Schema.Uint8Array;
|
|
40
|
-
readonly mediaType: Schema.String;
|
|
41
|
-
}>, Schema.Struct<{
|
|
42
|
-
readonly type: Schema.Literal<"base64">;
|
|
43
|
-
readonly data: Schema.String;
|
|
44
|
-
readonly mediaType: Schema.String;
|
|
45
|
-
}>, Schema.Struct<{
|
|
46
|
-
readonly type: Schema.Literal<"url">;
|
|
47
|
-
readonly url: Schema.String;
|
|
48
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
49
|
-
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
50
|
-
}>, Schema.Struct<{
|
|
51
|
-
readonly type: Schema.Literal<"ref">;
|
|
52
|
-
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
53
|
-
readonly id: Schema.String;
|
|
54
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
55
|
-
}>]>;
|
|
56
|
-
readonly info: Schema.optional<Schema.Struct<{
|
|
57
|
-
readonly width: Schema.optional<Schema.Number>;
|
|
58
|
-
readonly height: Schema.optional<Schema.Number>;
|
|
59
|
-
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
60
|
-
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
61
|
-
readonly channels: Schema.optional<Schema.Number>;
|
|
62
|
-
readonly encoding: Schema.optional<Schema.String>;
|
|
63
|
-
readonly format: Schema.optional<Schema.String>;
|
|
64
|
-
}>>;
|
|
65
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
66
|
-
}>, never, never>>;
|
|
37
|
+
readonly start: Schema.optional<Schema.brand<Schema.declare<Media.Asset, Media.Asset>, "Media.ImageAsset">>;
|
|
67
38
|
/** Image the video ends on exactly. */
|
|
68
|
-
readonly end: Schema.optional<Schema.
|
|
69
|
-
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
70
|
-
readonly type: Schema.Literal<"bytes">;
|
|
71
|
-
readonly data: Schema.Uint8Array;
|
|
72
|
-
readonly mediaType: Schema.String;
|
|
73
|
-
}>, Schema.Struct<{
|
|
74
|
-
readonly type: Schema.Literal<"base64">;
|
|
75
|
-
readonly data: Schema.String;
|
|
76
|
-
readonly mediaType: Schema.String;
|
|
77
|
-
}>, Schema.Struct<{
|
|
78
|
-
readonly type: Schema.Literal<"url">;
|
|
79
|
-
readonly url: Schema.String;
|
|
80
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
81
|
-
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
82
|
-
}>, Schema.Struct<{
|
|
83
|
-
readonly type: Schema.Literal<"ref">;
|
|
84
|
-
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
85
|
-
readonly id: Schema.String;
|
|
86
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
87
|
-
}>]>;
|
|
88
|
-
readonly info: Schema.optional<Schema.Struct<{
|
|
89
|
-
readonly width: Schema.optional<Schema.Number>;
|
|
90
|
-
readonly height: Schema.optional<Schema.Number>;
|
|
91
|
-
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
92
|
-
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
93
|
-
readonly channels: Schema.optional<Schema.Number>;
|
|
94
|
-
readonly encoding: Schema.optional<Schema.String>;
|
|
95
|
-
readonly format: Schema.optional<Schema.String>;
|
|
96
|
-
}>>;
|
|
97
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
98
|
-
}>, never, never>>;
|
|
39
|
+
readonly end: Schema.optional<Schema.brand<Schema.declare<Media.Asset, Media.Asset>, "Media.ImageAsset">>;
|
|
99
40
|
/** Images, videos or audio that guide the subject or style without pinning a frame. */
|
|
100
41
|
readonly references: Schema.optional<Schema.$Array<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
101
42
|
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -142,17 +83,18 @@ export type VideoRequest<Model extends VideoModel = VideoModel> = Omit<typeof Vi
|
|
|
142
83
|
export type VideoModelOptions<Model> = Model extends VideoModel<infer Options> ? Options : never;
|
|
143
84
|
/** Input accepted by `ai.video.request` and `ai.video.start`; a `VideoRequest` is also a valid input. */
|
|
144
85
|
export type VideoRequestInput<Model extends VideoModel = VideoModel> = Omit<VideoRequest<Model>, "start" | "end" | "references" | "providerOptions"> & {
|
|
145
|
-
|
|
146
|
-
readonly
|
|
86
|
+
/** An image: `Media.image(...)`, or a URL, data URL, base64 string or bytes, which must not be a known non-image. */
|
|
87
|
+
readonly start?: Media.ImageAsset | Media.Data;
|
|
88
|
+
readonly end?: Media.ImageAsset | Media.Data;
|
|
147
89
|
readonly references?: ReadonlyArray<Media.Input>;
|
|
148
90
|
readonly providerOptions?: NoInfer<VideoModelOptions<Model>>;
|
|
149
91
|
};
|
|
150
92
|
/** Seconds in a request's `duration`, for protocols that send a number. */
|
|
151
93
|
export declare const seconds: (duration: VideoDuration) => number;
|
|
152
|
-
/** A submitted generation. Store `
|
|
94
|
+
/** A submitted generation. Store `id` with the model to read the job later, from any process. */
|
|
153
95
|
export interface VideoJob {
|
|
96
|
+
/** The provider's job ID. */
|
|
154
97
|
readonly id: string;
|
|
155
|
-
readonly token: unknown;
|
|
156
98
|
}
|
|
157
99
|
export interface VideoStatus {
|
|
158
100
|
readonly status: Status;
|
|
@@ -219,12 +161,12 @@ export declare class VideoResponse extends VideoResponse_base {
|
|
|
219
161
|
export declare const request: <const Model extends VideoModel>(input: VideoRequestInput<Model>) => VideoRequest<Model>;
|
|
220
162
|
/** Submit a generation and return at once; nothing polls. */
|
|
221
163
|
export declare function start<const Model extends VideoModel>(input: VideoRequestInput<Model>): Effect.Effect<VideoJob, AIError, Service>;
|
|
222
|
-
/** One status read for a
|
|
223
|
-
export declare const status: (model: VideoModel,
|
|
164
|
+
/** One status read for a job ID. */
|
|
165
|
+
export declare const status: (model: VideoModel, id: string) => Effect.Effect<VideoStatus, AIError, Service>;
|
|
224
166
|
/** The finished videos; fails while the job is still running, or with the provider's reason when it failed. */
|
|
225
|
-
export declare const result: (model: VideoModel,
|
|
167
|
+
export declare const result: (model: VideoModel, id: string) => Effect.Effect<VideoResponse, AIError, Service>;
|
|
226
168
|
/** Ask the provider to stop the job; fails with `UnsupportedOperation` when the provider has no cancel call. */
|
|
227
|
-
export declare const cancel: (model: VideoModel,
|
|
169
|
+
export declare const cancel: (model: VideoModel, id: string) => Effect.Effect<void, AIError, Service>;
|
|
228
170
|
export declare const Video: {
|
|
229
171
|
readonly request: typeof request;
|
|
230
172
|
readonly start: typeof start;
|
package/dist/video.js
CHANGED
|
@@ -5,6 +5,7 @@ import { MediaRoute } from "./route/media.js";
|
|
|
5
5
|
import { AIError, MediaUsage, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
|
|
6
6
|
import { VideoClient, Service } from "./video-client.js";
|
|
7
7
|
export class VideoModel extends MediaModel {
|
|
8
|
+
/** A video route's token is the provider's job ID, so `VideoJob.id` is exactly what `status` and `result` take. */
|
|
8
9
|
static fromRoute(route, input) {
|
|
9
10
|
return new VideoModel({
|
|
10
11
|
id: input.id,
|
|
@@ -24,9 +25,9 @@ const VideoRequestSchema = Schema.Struct({
|
|
|
24
25
|
model: VideoModelSchema,
|
|
25
26
|
prompt: Schema.String,
|
|
26
27
|
/** Image the video starts on exactly. */
|
|
27
|
-
start: Schema.optional(Media.
|
|
28
|
+
start: Schema.optional(Media.ImageAssetSchema),
|
|
28
29
|
/** Image the video ends on exactly. */
|
|
29
|
-
end: Schema.optional(Media.
|
|
30
|
+
end: Schema.optional(Media.ImageAssetSchema),
|
|
30
31
|
/** Images, videos or audio that guide the subject or style without pinning a frame. */
|
|
31
32
|
references: Schema.optional(Schema.Array(Media.AssetSchema)),
|
|
32
33
|
duration: Schema.optional(VideoDuration),
|
|
@@ -53,8 +54,8 @@ export class VideoResponse extends Schema.Class("Video.Response")({
|
|
|
53
54
|
/** Normalize video request input into a plain `VideoRequest`. */
|
|
54
55
|
export const request = (input) => ({
|
|
55
56
|
...input,
|
|
56
|
-
start: input.start === undefined ? undefined : Media.
|
|
57
|
-
end: input.end === undefined ? undefined : Media.
|
|
57
|
+
start: input.start === undefined ? undefined : Media.image(input.start),
|
|
58
|
+
end: input.end === undefined ? undefined : Media.image(input.end),
|
|
58
59
|
references: input.references?.map((reference) => Media.make(reference)),
|
|
59
60
|
});
|
|
60
61
|
const validate = Schema.decodeUnknownSync(VideoRequestSchema);
|
|
@@ -66,12 +67,12 @@ const requestEffect = (input) => tryRequest(() => {
|
|
|
66
67
|
export function start(input) {
|
|
67
68
|
return requestEffect(input).pipe(Effect.flatMap((request) => VideoClient.start(request)));
|
|
68
69
|
}
|
|
69
|
-
/** One status read for a
|
|
70
|
-
export const status = (model,
|
|
70
|
+
/** One status read for a job ID. */
|
|
71
|
+
export const status = (model, id) => VideoClient.status(model, id);
|
|
71
72
|
/** The finished videos; fails while the job is still running, or with the provider's reason when it failed. */
|
|
72
|
-
export const result = (model,
|
|
73
|
+
export const result = (model, id) => VideoClient.result(model, id);
|
|
73
74
|
/** Ask the provider to stop the job; fails with `UnsupportedOperation` when the provider has no cancel call. */
|
|
74
|
-
export const cancel = (model,
|
|
75
|
+
export const cancel = (model, id) => VideoClient.cancel(model, id);
|
|
75
76
|
export const Video = {
|
|
76
77
|
request,
|
|
77
78
|
start,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-1288",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -284,6 +284,10 @@
|
|
|
284
284
|
"types": "./dist/providers/google/interactions.d.ts",
|
|
285
285
|
"import": "./dist/providers/google/interactions.js"
|
|
286
286
|
},
|
|
287
|
+
"./providers/google/videos": {
|
|
288
|
+
"types": "./dist/providers/google/videos.d.ts",
|
|
289
|
+
"import": "./dist/providers/google/videos.js"
|
|
290
|
+
},
|
|
287
291
|
"./providers/groq": {
|
|
288
292
|
"types": "./dist/providers/groq.d.ts",
|
|
289
293
|
"import": "./dist/providers/groq.js"
|
|
@@ -328,6 +332,10 @@
|
|
|
328
332
|
"types": "./dist/providers/minimax/responses.d.ts",
|
|
329
333
|
"import": "./dist/providers/minimax/responses.js"
|
|
330
334
|
},
|
|
335
|
+
"./providers/minimax/videos": {
|
|
336
|
+
"types": "./dist/providers/minimax/videos.d.ts",
|
|
337
|
+
"import": "./dist/providers/minimax/videos.js"
|
|
338
|
+
},
|
|
331
339
|
"./providers/mistral": {
|
|
332
340
|
"types": "./dist/providers/mistral.d.ts",
|
|
333
341
|
"import": "./dist/providers/mistral.js"
|
|
@@ -488,6 +496,10 @@
|
|
|
488
496
|
"types": "./dist/providers/xai/images.d.ts",
|
|
489
497
|
"import": "./dist/providers/xai/images.js"
|
|
490
498
|
},
|
|
499
|
+
"./providers/xai/videos": {
|
|
500
|
+
"types": "./dist/providers/xai/videos.d.ts",
|
|
501
|
+
"import": "./dist/providers/xai/videos.js"
|
|
502
|
+
},
|
|
491
503
|
"./providers/zai": {
|
|
492
504
|
"types": "./dist/providers/zai.d.ts",
|
|
493
505
|
"import": "./dist/providers/zai.js"
|
|
@@ -544,6 +556,10 @@
|
|
|
544
556
|
"types": "./dist/protocols/google-images.d.ts",
|
|
545
557
|
"import": "./dist/protocols/google-images.js"
|
|
546
558
|
},
|
|
559
|
+
"./protocols/google-interactions-video": {
|
|
560
|
+
"types": "./dist/protocols/google-interactions-video.d.ts",
|
|
561
|
+
"import": "./dist/protocols/google-interactions-video.js"
|
|
562
|
+
},
|
|
547
563
|
"./protocols/google-speech": {
|
|
548
564
|
"types": "./dist/protocols/google-speech.d.ts",
|
|
549
565
|
"import": "./dist/protocols/google-speech.js"
|
|
@@ -608,7 +624,7 @@
|
|
|
608
624
|
"devDependencies": {
|
|
609
625
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
610
626
|
"@effect/platform-node": "4.1.0",
|
|
611
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
627
|
+
"@opencode/http-recorder": "0.0.0-dev-1288",
|
|
612
628
|
"@tsconfig/bun": "1.0.9",
|
|
613
629
|
"@types/bun": "1.4.3",
|
|
614
630
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -618,7 +634,7 @@
|
|
|
618
634
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
619
635
|
"@smithy/eventstream-codec": "4.2.14",
|
|
620
636
|
"@smithy/util-utf8": "4.2.2",
|
|
621
|
-
"@opencode/schema": "0.0.0-dev-
|
|
637
|
+
"@opencode/schema": "0.0.0-dev-1288",
|
|
622
638
|
"aws4fetch": "1.0.20",
|
|
623
639
|
"effect": "4.1.0",
|
|
624
640
|
"google-auth-library": "10.5.0"
|