@opencode/ai 0.0.0-dev-465 → 0.0.0-dev-468
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 +27 -16
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +2 -2
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +13 -120
- package/dist/decision.js +17 -13
- package/dist/effect.d.ts +8 -6
- package/dist/effect.js +4 -3
- package/dist/effort-updates.d.ts +1 -1
- package/dist/effort-updates.js +2 -2
- package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
- package/dist/experimental/cloudflare-run-extraction.js +4 -1
- package/dist/experimental/extraction.d.ts +12 -38
- package/dist/experimental/extraction.js +13 -11
- package/dist/experimental.d.ts +8 -8
- package/dist/experimental.js +4 -4
- package/dist/image-client.d.ts +11 -5
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +21 -62
- package/dist/image.js +16 -13
- package/dist/index.d.ts +20 -14
- package/dist/index.js +6 -3
- package/dist/llm.d.ts +60 -25
- package/dist/llm.js +126 -38
- package/dist/protocols/alibaba-images.d.ts +2 -2
- package/dist/protocols/alibaba-messages.js +3 -3
- package/dist/protocols/anthropic-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.js +4 -3
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
- package/dist/protocols/deepgram-speech.d.ts +2 -2
- package/dist/protocols/deepgram-transcription.d.ts +2 -2
- package/dist/protocols/elevenlabs-speech.d.ts +2 -2
- package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
- package/dist/protocols/gemini.js +2 -8
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-speech.d.ts +2 -2
- package/dist/protocols/google-transcription.d.ts +2 -2
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/meta-images.d.ts +2 -2
- package/dist/protocols/meta-responses.js +4 -3
- package/dist/protocols/minimax-images.d.ts +2 -2
- package/dist/protocols/open-responses.d.ts +1 -21
- package/dist/protocols/openai-chat.d.ts +1 -21
- package/dist/protocols/openai-chat.js +7 -9
- package/dist/protocols/openai-decisions.js +1 -1
- package/dist/protocols/openai-images.d.ts +2 -2
- package/dist/protocols/openai-responses.js +0 -1
- package/dist/protocols/openai-speech.d.ts +2 -2
- package/dist/protocols/openai-transcription.d.ts +2 -2
- package/dist/protocols/runway-video.d.ts +2 -2
- package/dist/protocols/shared.d.ts +1 -1
- package/dist/protocols/shared.js +2 -2
- package/dist/protocols/system-one.d.ts +4 -4
- package/dist/protocols/utils/responses-checkpoint.js +1 -1
- package/dist/protocols/utils/responses-compaction.d.ts +1 -1
- package/dist/protocols/utils/responses-compaction.js +4 -3
- package/dist/protocols/utils/tool-stream.d.ts +3 -63
- package/dist/protocols/xai-images.d.ts +2 -2
- package/dist/protocols/xai-video.d.ts +2 -2
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-messages.js +3 -3
- package/dist/provider-error.js +4 -4
- package/dist/providers/vercel-ai-gateway.js +4 -3
- package/dist/route/client.d.ts +43 -19
- package/dist/route/client.js +30 -18
- package/dist/route/decision.d.ts +6 -6
- package/dist/schema/errors.d.ts +1 -2
- package/dist/schema/errors.js +1 -2
- package/dist/schema/events.d.ts +61 -769
- package/dist/schema/events.js +3 -30
- package/dist/schema/messages.d.ts +20 -92
- package/dist/schema/messages.js +1 -52
- package/dist/speech-client.d.ts +5 -5
- package/dist/speech.d.ts +17 -19
- package/dist/speech.js +16 -12
- package/dist/testing.d.ts +8 -168
- package/dist/tool-runtime.js +12 -30
- package/dist/transcription-client.d.ts +5 -5
- package/dist/transcription.d.ts +17 -19
- package/dist/transcription.js +16 -12
- package/dist/video-client.d.ts +5 -5
- package/dist/video-client.js +1 -1
- package/dist/video.d.ts +18 -20
- package/dist/video.js +16 -12
- package/package.json +3 -3
package/dist/video.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import { MediaRoute } from "./route/media.js";
|
|
|
6
6
|
import { AIError, HttpOptions, type OpenString } from "./schema/index.js";
|
|
7
7
|
import { Service } from "./video-client.js";
|
|
8
8
|
export type VideoOptions = MediaModel.Options;
|
|
9
|
-
export type VideoRoute = MediaRoute.AnyRoute<
|
|
9
|
+
export type VideoRoute = MediaRoute.AnyRoute<VideoRequest, VideoEvent, VideoResponse>;
|
|
10
10
|
export declare class VideoModel<Options extends VideoOptions = VideoOptions> extends MediaModel<VideoRoute, Options> {
|
|
11
11
|
protected readonly _VideoModel: void;
|
|
12
12
|
/** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
|
|
13
|
-
static fromRoute<Options extends VideoOptions>(route: MediaModel.InlineRouteInput<
|
|
14
|
-
static fromRoute<Options extends VideoOptions, Frame, State>(route: MediaModel.StreamRouteInput<
|
|
15
|
-
static fromRoute<Options extends VideoOptions, Token>(route: MediaModel.QueuedRouteInput<
|
|
13
|
+
static fromRoute<Options extends VideoOptions>(route: MediaModel.InlineRouteInput<VideoRequest<VideoModel<Options>>, VideoResponse>, input: MediaRoute.ModelInput): VideoModel<Options>;
|
|
14
|
+
static fromRoute<Options extends VideoOptions, Frame, State>(route: MediaModel.StreamRouteInput<VideoRequest<VideoModel<Options>>, VideoEvent, Frame, State>, input: MediaRoute.ModelInput): VideoModel<Options>;
|
|
15
|
+
static fromRoute<Options extends VideoOptions, Token>(route: MediaModel.QueuedRouteInput<VideoRequest<VideoModel<Options>>, VideoResponse, Token>, input: MediaRoute.ModelInput): VideoModel<Options>;
|
|
16
16
|
}
|
|
17
17
|
export declare const VideoModelSchema: Schema.declare<VideoModel<{
|
|
18
18
|
readonly [x: string]: unknown;
|
|
@@ -88,7 +88,7 @@ export declare const VideoFrames: Schema.Struct<{
|
|
|
88
88
|
}>, never, never>>;
|
|
89
89
|
}>;
|
|
90
90
|
export type VideoFrames = Schema.Schema.Type<typeof VideoFrames>;
|
|
91
|
-
declare const
|
|
91
|
+
declare const VideoRequestSchema: Schema.Struct<{
|
|
92
92
|
readonly model: Schema.declare<VideoModel<{
|
|
93
93
|
readonly [x: string]: unknown;
|
|
94
94
|
}>, VideoModel<{
|
|
@@ -233,18 +233,16 @@ declare const VideoRequest_base: Schema.Class<VideoRequest, Schema.Struct<{
|
|
|
233
233
|
readonly negativePrompt: Schema.optional<Schema.String>;
|
|
234
234
|
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
235
235
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
export type VideoRequestFor<Options extends VideoOptions = VideoOptions> = Omit<VideoRequest, "model" | "providerOptions"> & {
|
|
241
|
-
readonly model: VideoModel<Options>;
|
|
242
|
-
readonly providerOptions?: Options;
|
|
243
|
-
};
|
|
244
|
-
export type VideoModelOptions<Model> = Model extends VideoModel<infer Options> ? Options : never;
|
|
245
|
-
export type VideoRequestInput<Model extends VideoModel = VideoModel> = Omit<ConstructorParameters<typeof VideoRequest>[0], "model" | "providerOptions" | "http" | "resolution"> & {
|
|
236
|
+
}>;
|
|
237
|
+
/** A normalized video request, the plain object `Video.request(...)` returns. */
|
|
238
|
+
export type VideoRequest<Model extends VideoModel = VideoModel> = Omit<typeof VideoRequestSchema.Type, "model" | "providerOptions" | "resolution"> & {
|
|
246
239
|
readonly model: Model;
|
|
247
240
|
readonly resolution?: VideoResolution;
|
|
241
|
+
readonly providerOptions?: VideoModelOptions<Model>;
|
|
242
|
+
};
|
|
243
|
+
export type VideoModelOptions<Model> = Model extends VideoModel<infer Options> ? Options : never;
|
|
244
|
+
/** Input accepted by `Video.request` and the calls; a `VideoRequest` is also a valid input. */
|
|
245
|
+
export type VideoRequestInput<Model extends VideoModel = VideoModel> = Omit<VideoRequest<Model>, "providerOptions" | "http"> & {
|
|
248
246
|
readonly providerOptions?: NoInfer<VideoModelOptions<Model>>;
|
|
249
247
|
readonly http?: HttpOptions.Input;
|
|
250
248
|
};
|
|
@@ -1240,13 +1238,13 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1240
1238
|
};
|
|
1241
1239
|
};
|
|
1242
1240
|
export type VideoEvent = Schema.Schema.Type<typeof videoEventTagged>;
|
|
1243
|
-
|
|
1244
|
-
export declare
|
|
1245
|
-
export declare function start<const Model extends VideoModel>(input:
|
|
1246
|
-
export declare function generate<const Model extends VideoModel>(input:
|
|
1241
|
+
/** Normalize video request input into a plain `VideoRequest`. */
|
|
1242
|
+
export declare const request: <const Model extends VideoModel>(input: VideoRequestInput<Model>) => VideoRequest<Model>;
|
|
1243
|
+
export declare function start<const Model extends VideoModel>(input: VideoRequestInput<Model>): Effect.Effect<Generation<VideoResponse>, AIError, Service>;
|
|
1244
|
+
export declare function generate<const Model extends VideoModel>(input: VideoRequestInput<Model>, options?: AwaitOptions): Effect.Effect<VideoResponse, AIError, Service>;
|
|
1247
1245
|
/** Rebuild a generation handle from a persisted `Generation.token`, refreshing its status once. */
|
|
1248
1246
|
export declare const resume: (model: VideoModel, token: unknown) => Effect.Effect<Generation<VideoResponse>, AIError, Service>;
|
|
1249
|
-
export declare function stream<const Model extends VideoModel>(input:
|
|
1247
|
+
export declare function stream<const Model extends VideoModel>(input: VideoRequestInput<Model>, options?: AwaitOptions): Stream.Stream<VideoEvent, AIError, Service>;
|
|
1250
1248
|
export declare const Video: {
|
|
1251
1249
|
readonly request: typeof request;
|
|
1252
1250
|
readonly start: typeof start;
|
package/dist/video.js
CHANGED
|
@@ -25,7 +25,7 @@ export const VideoFrames = Schema.Struct({
|
|
|
25
25
|
first: Schema.optional(Media.AssetSchema),
|
|
26
26
|
last: Schema.optional(Media.AssetSchema),
|
|
27
27
|
}).annotate({ identifier: "Video.Frames" });
|
|
28
|
-
|
|
28
|
+
const VideoRequestSchema = Schema.Struct({
|
|
29
29
|
model: VideoModelSchema,
|
|
30
30
|
prompt: Schema.String,
|
|
31
31
|
frames: Schema.optional(VideoFrames),
|
|
@@ -43,8 +43,7 @@ export class VideoRequest extends Schema.Class("Video.Request")({
|
|
|
43
43
|
negativePrompt: Schema.optional(Schema.String),
|
|
44
44
|
providerOptions: Schema.optional(ProviderOptions),
|
|
45
45
|
http: Schema.optional(HttpOptions),
|
|
46
|
-
})
|
|
47
|
-
}
|
|
46
|
+
});
|
|
48
47
|
// ---------------------------------------------------------------------------
|
|
49
48
|
// Response and events
|
|
50
49
|
// ---------------------------------------------------------------------------
|
|
@@ -87,15 +86,20 @@ const collectResponse = (events) => {
|
|
|
87
86
|
providerMetadata: finish.providerMetadata,
|
|
88
87
|
}));
|
|
89
88
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
const
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Request-shaped call API
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
/** Normalize video request input into a plain `VideoRequest`. */
|
|
93
|
+
export const request = (input) => ({
|
|
94
|
+
...input,
|
|
95
|
+
http: HttpOptions.make(input.http),
|
|
96
|
+
});
|
|
97
|
+
const validate = Schema.decodeUnknownSync(VideoRequestSchema);
|
|
98
|
+
const requestEffect = (input) => tryRequest(() => {
|
|
99
|
+
const normalized = request(input);
|
|
100
|
+
validate(normalized);
|
|
101
|
+
return normalized;
|
|
102
|
+
});
|
|
99
103
|
export function start(input) {
|
|
100
104
|
return requestEffect(input).pipe(Effect.flatMap((request) => VideoClient.start(request)));
|
|
101
105
|
}
|
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-468",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
"devDependencies": {
|
|
521
521
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
522
522
|
"@effect/platform-node": "4.1.0",
|
|
523
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
523
|
+
"@opencode/http-recorder": "0.0.0-dev-468",
|
|
524
524
|
"@tsconfig/bun": "1.0.9",
|
|
525
525
|
"@types/bun": "1.4.3",
|
|
526
526
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
531
531
|
"@smithy/eventstream-codec": "4.2.14",
|
|
532
532
|
"@smithy/util-utf8": "4.2.2",
|
|
533
|
-
"@opencode/schema": "0.0.0-dev-
|
|
533
|
+
"@opencode/schema": "0.0.0-dev-468",
|
|
534
534
|
"aws4fetch": "1.0.20",
|
|
535
535
|
"effect": "4.1.0",
|
|
536
536
|
"google-auth-library": "10.5.0"
|