@opencode/ai 2.2.5 → 2.2.6
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 +133 -69
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +16 -4
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +20 -125
- package/dist/decision.js +25 -15
- package/dist/effect.d.ts +4 -15
- package/dist/effect.js +2 -6
- package/dist/effort-updates.d.ts +3 -3
- 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 +10 -40
- package/dist/experimental/extraction.js +14 -13
- package/dist/experimental.d.ts +8 -8
- package/dist/experimental.js +4 -4
- package/dist/generation.d.ts +0 -2
- package/dist/generation.js +2 -2
- package/dist/image-client.d.ts +13 -7
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +357 -464
- package/dist/image.js +17 -15
- package/dist/index.d.ts +28 -465
- package/dist/index.js +18 -17
- package/dist/llm.d.ts +65 -266
- package/dist/llm.js +101 -92
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +136 -0
- package/dist/media-model.d.ts +1 -1
- package/dist/media-model.js +8 -6
- package/dist/media.d.ts +9 -0
- package/dist/media.js +37 -2
- package/dist/protocols/alibaba-chat.d.ts +5 -1
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-images.d.ts +2 -2
- package/dist/protocols/alibaba-messages.js +3 -3
- package/dist/protocols/alibaba-responses.js +8 -20
- package/dist/protocols/anthropic-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.js +54 -173
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/bedrock-converse.js +10 -16
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
- package/dist/protocols/cohere-chat.js +9 -12
- 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.d.ts +3 -0
- package/dist/protocols/gemini.js +54 -72
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-interactions.d.ts +3 -4
- package/dist/protocols/google-interactions.js +44 -30
- 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 +26 -23
- package/dist/protocols/minimax-images.d.ts +2 -2
- package/dist/protocols/mistral-chat.js +7 -10
- package/dist/protocols/open-responses-channel.js +6 -19
- package/dist/protocols/open-responses-continuation.d.ts +1 -5
- package/dist/protocols/open-responses-continuation.js +1 -3
- package/dist/protocols/open-responses.d.ts +1 -21
- package/dist/protocols/open-responses.js +10 -15
- package/dist/protocols/openai-chat.d.ts +3 -23
- package/dist/protocols/openai-chat.js +26 -47
- package/dist/protocols/openai-compatible-chat.d.ts +1 -1
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-compatible-responses.js +1 -1
- package/dist/protocols/openai-decisions.js +1 -1
- package/dist/protocols/openai-images.d.ts +2 -2
- package/dist/protocols/openai-responses.js +10 -29
- 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 -4
- package/dist/protocols/shared.js +13 -11
- package/dist/protocols/system-one.d.ts +4 -4
- package/dist/protocols/utils/bedrock-cache.js +2 -5
- package/dist/protocols/utils/bedrock-media.d.ts +0 -3
- package/dist/protocols/utils/cache.d.ts +3 -0
- package/dist/protocols/utils/cache.js +15 -2
- package/dist/protocols/utils/image-sizing.d.ts +1 -1
- 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 +6 -5
- package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
- package/dist/protocols/utils/responses-hosted-tools.js +31 -0
- package/dist/protocols/utils/tool-stream.d.ts +5 -271
- package/dist/protocols/utils/tool-stream.js +3 -13
- package/dist/protocols/venice-chat.d.ts +3 -1
- package/dist/protocols/venice-chat.js +4 -4
- package/dist/protocols/xai-images.d.ts +2 -2
- package/dist/protocols/xai-responses.js +5 -25
- package/dist/protocols/xai-video.d.ts +2 -2
- package/dist/protocols/zai-chat.d.ts +5 -1
- package/dist/protocols/zai-chat.js +1 -1
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-messages.js +3 -3
- package/dist/provider-error.d.ts +0 -1
- package/dist/provider-error.js +7 -80
- package/dist/providers/alibaba.d.ts +67 -4
- package/dist/providers/alibaba.js +6 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
- package/dist/providers/amazon-bedrock-mantle.js +6 -3
- package/dist/providers/amazon-bedrock.d.ts +6 -7
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +7 -8
- package/dist/providers/anthropic-compatible.js +2 -5
- package/dist/providers/anthropic.d.ts +8 -9
- package/dist/providers/anthropic.js +2 -7
- package/dist/providers/assemblyai.d.ts +2 -2
- package/dist/providers/assemblyai.js +2 -7
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure.d.ts +322 -7
- package/dist/providers/azure.js +25 -9
- package/dist/providers/baseten.d.ts +5 -5
- package/dist/providers/baseten.js +7 -21
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +5 -5
- package/dist/providers/cerebras.js +4 -15
- package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
- package/dist/providers/cloudflare-ai-gateway.js +28 -40
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
- package/dist/providers/cloudflare-workers-ai.js +4 -20
- package/dist/providers/cohere/chat.js +2 -7
- package/dist/providers/cohere.d.ts +6 -5
- package/dist/providers/cohere.js +7 -13
- package/dist/providers/deepgram.d.ts +2 -2
- package/dist/providers/deepgram.js +2 -7
- package/dist/providers/deepinfra.d.ts +5 -5
- package/dist/providers/deepinfra.js +5 -13
- package/dist/providers/deepseek.d.ts +5 -5
- package/dist/providers/deepseek.js +3 -14
- package/dist/providers/digitalocean.d.ts +8 -5
- package/dist/providers/digitalocean.js +13 -14
- package/dist/providers/elevenlabs.d.ts +2 -2
- package/dist/providers/elevenlabs.js +2 -7
- package/dist/providers/fireworks.d.ts +5 -5
- package/dist/providers/fireworks.js +4 -15
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +2 -7
- package/dist/providers/google-vertex-chat.d.ts +3 -3
- package/dist/providers/google-vertex-chat.js +3 -29
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +3 -3
- package/dist/providers/google-vertex-messages.js +3 -29
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-mistral.js +3 -29
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google-vertex-responses.js +4 -30
- package/dist/providers/google-vertex-shared.d.ts +31 -0
- package/dist/providers/google-vertex-shared.js +25 -0
- package/dist/providers/google-vertex.d.ts +3 -3
- package/dist/providers/google.d.ts +15 -13
- package/dist/providers/google.js +9 -19
- package/dist/providers/groq.d.ts +5 -5
- package/dist/providers/groq.js +4 -15
- package/dist/providers/meta.d.ts +5 -5
- package/dist/providers/meta.js +10 -23
- package/dist/providers/minimax/chat.js +2 -7
- package/dist/providers/minimax/responses.js +2 -7
- package/dist/providers/minimax.d.ts +5 -5
- package/dist/providers/minimax.js +7 -22
- package/dist/providers/mistral.d.ts +10 -11
- package/dist/providers/mistral.js +3 -14
- package/dist/providers/moonshot/messages.js +2 -7
- package/dist/providers/moonshot/responses.js +2 -7
- package/dist/providers/moonshot.d.ts +5 -5
- package/dist/providers/moonshot.js +4 -16
- package/dist/providers/openai-compatible-responses.d.ts +6 -7
- package/dist/providers/openai-compatible-responses.js +2 -8
- package/dist/providers/openai-compatible.d.ts +6 -7
- package/dist/providers/openai-compatible.js +4 -10
- package/dist/providers/openai.d.ts +4 -4
- package/dist/providers/openai.js +3 -3
- package/dist/providers/opencode.d.ts +4 -4
- package/dist/providers/opencode.js +6 -2
- package/dist/providers/openrouter.d.ts +8 -5
- package/dist/providers/openrouter.js +16 -24
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +19 -0
- package/dist/providers/togetherai.d.ts +5 -5
- package/dist/providers/togetherai.js +5 -15
- package/dist/providers/typesafe-ai.d.ts +4 -4
- package/dist/providers/typesafe-ai.js +6 -2
- package/dist/providers/venice.d.ts +4 -4
- package/dist/providers/venice.js +6 -2
- package/dist/providers/vercel-ai-gateway.d.ts +5 -5
- package/dist/providers/vercel-ai-gateway.js +15 -28
- package/dist/providers/xai.d.ts +4 -4
- package/dist/providers/xai.js +4 -12
- package/dist/providers/zai-coding-plan/messages.js +2 -7
- package/dist/providers/zai-coding-plan/responses.js +2 -7
- package/dist/providers/zai-coding-plan.d.ts +5 -5
- package/dist/providers/zai-coding-plan.js +8 -15
- package/dist/providers/zai.d.ts +5 -5
- package/dist/providers/zai.js +10 -22
- package/dist/public.d.ts +12 -0
- package/dist/public.js +5 -0
- package/dist/route/auth-options.d.ts +9 -5
- package/dist/route/auth-options.js +10 -7
- package/dist/route/client.d.ts +50 -37
- package/dist/route/client.js +42 -53
- package/dist/route/decision.d.ts +8 -8
- package/dist/route/decision.js +3 -3
- package/dist/route/executor.d.ts +5 -0
- package/dist/route/executor.js +10 -0
- package/dist/route/index.d.ts +5 -7
- package/dist/route/index.js +1 -1
- package/dist/route/media.d.ts +7 -11
- package/dist/route/media.js +22 -26
- package/dist/route/transport/http.js +6 -5
- package/dist/route/transport/websocket.js +7 -1
- package/dist/schema/errors.d.ts +16 -17
- package/dist/schema/errors.js +63 -12
- package/dist/schema/events.d.ts +2563 -2954
- package/dist/schema/events.js +54 -109
- package/dist/schema/messages.d.ts +194 -137
- package/dist/schema/messages.js +66 -83
- package/dist/schema/options.d.ts +112 -65
- package/dist/schema/options.js +52 -101
- package/dist/speech-client.d.ts +7 -7
- package/dist/speech.d.ts +306 -316
- package/dist/speech.js +16 -14
- package/dist/testing.d.ts +31 -175
- package/dist/testing.js +60 -5
- package/dist/tool-history.d.ts +1 -1
- package/dist/tool-history.js +3 -10
- package/dist/tool-runtime.d.ts +9 -2
- package/dist/tool-runtime.js +17 -31
- package/dist/tool.d.ts +39 -43
- package/dist/tool.js +16 -26
- package/dist/transcription-client.d.ts +7 -7
- package/dist/transcription.d.ts +314 -265
- package/dist/transcription.js +16 -14
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/video-client.d.ts +7 -7
- package/dist/video-client.js +1 -1
- package/dist/video.d.ts +269 -287
- package/dist/video.js +16 -14
- package/package.json +9 -9
- package/dist/experimental/testing.d.ts +0 -3
- package/dist/experimental/testing.js +0 -3
- package/dist/testing/decision.d.ts +0 -16
- package/dist/testing/decision.js +0 -20
- package/dist/testing/image.d.ts +0 -14
- package/dist/testing/image.js +0 -12
- package/dist/testing/media.d.ts +0 -18
- package/dist/testing/media.js +0 -36
- package/dist/testing/script.d.ts +0 -28
- package/dist/testing/script.js +0 -60
- package/dist/testing/speech.d.ts +0 -14
- package/dist/testing/speech.js +0 -12
- package/dist/testing/transcription.d.ts +0 -14
- package/dist/testing/transcription.js +0 -12
- package/dist/testing/video.d.ts +0 -14
- package/dist/testing/video.js +0 -12
package/dist/speech.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { Effect, Schema, Stream } from "effect";
|
|
|
2
2
|
import { Media } from "./media.js";
|
|
3
3
|
import { MediaModel } from "./media-model.js";
|
|
4
4
|
import { MediaRoute } from "./route/media.js";
|
|
5
|
-
import { AIError,
|
|
5
|
+
import { AIError, type OpenString, type BaseRequest } from "./schema/index.js";
|
|
6
6
|
import { Service } from "./speech-client.js";
|
|
7
7
|
export type SpeechOptions = MediaModel.Options;
|
|
8
|
-
export type SpeechRoute = MediaRoute.AnyRoute<
|
|
8
|
+
export type SpeechRoute = MediaRoute.AnyRoute<SpeechRequest, SpeechEvent, SpeechResponse>;
|
|
9
9
|
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute, Options> {
|
|
10
10
|
protected readonly _SpeechModel: void;
|
|
11
11
|
/** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
|
|
12
|
-
static fromRoute<Options extends SpeechOptions>(route: MediaModel.InlineRouteInput<
|
|
13
|
-
static fromRoute<Options extends SpeechOptions, Frame, State>(route: MediaModel.StreamRouteInput<
|
|
14
|
-
static fromRoute<Options extends SpeechOptions, Token>(route: MediaModel.QueuedRouteInput<
|
|
12
|
+
static fromRoute<Options extends SpeechOptions>(route: MediaModel.InlineRouteInput<SpeechRequest<SpeechModel<Options>>, SpeechResponse>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
13
|
+
static fromRoute<Options extends SpeechOptions, Frame, State>(route: MediaModel.StreamRouteInput<SpeechRequest<SpeechModel<Options>>, SpeechEvent, Frame, State>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
14
|
+
static fromRoute<Options extends SpeechOptions, Token>(route: MediaModel.QueuedRouteInput<SpeechRequest<SpeechModel<Options>>, SpeechResponse, Token>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
15
15
|
}
|
|
16
16
|
export declare const SpeechModelSchema: Schema.declare<SpeechModel<{
|
|
17
17
|
readonly [x: string]: unknown;
|
|
@@ -31,7 +31,7 @@ export declare const SpeechTimestamp: Schema.Struct<{
|
|
|
31
31
|
readonly endSeconds: Schema.Number;
|
|
32
32
|
}>;
|
|
33
33
|
export type SpeechTimestamp = Schema.Schema.Type<typeof SpeechTimestamp>;
|
|
34
|
-
declare const
|
|
34
|
+
declare const SpeechRequestSchema: Schema.Struct<{
|
|
35
35
|
readonly model: Schema.declare<SpeechModel<{
|
|
36
36
|
readonly [x: string]: unknown;
|
|
37
37
|
}>, SpeechModel<{
|
|
@@ -47,21 +47,15 @@ declare const SpeechRequest_base: Schema.Class<SpeechRequest, Schema.Struct<{
|
|
|
47
47
|
readonly instructions: Schema.optional<Schema.String>;
|
|
48
48
|
readonly timestamps: Schema.optional<Schema.Boolean>;
|
|
49
49
|
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
export type SpeechRequestFor<Options extends SpeechOptions = SpeechOptions> = Omit<SpeechRequest, "model" | "providerOptions"> & {
|
|
56
|
-
readonly model: SpeechModel<Options>;
|
|
57
|
-
readonly providerOptions?: Options;
|
|
50
|
+
}>;
|
|
51
|
+
/** A normalized speech request, the plain object `Speech.request(...)` returns. */
|
|
52
|
+
export type SpeechRequest<Model extends SpeechModel = SpeechModel> = Omit<typeof SpeechRequestSchema.Type, "model" | "providerOptions" | "format"> & BaseRequest<Model, SpeechModelOptions<Model>> & {
|
|
53
|
+
readonly format?: SpeechFormat;
|
|
58
54
|
};
|
|
59
55
|
export type SpeechModelOptions<Model> = Model extends SpeechModel<infer Options> ? Options : never;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
readonly format?: SpeechFormat;
|
|
56
|
+
/** Input accepted by `Speech.request` and the calls; a `SpeechRequest` is also a valid input. */
|
|
57
|
+
export type SpeechRequestInput<Model extends SpeechModel = SpeechModel> = Omit<SpeechRequest<Model>, "providerOptions"> & {
|
|
63
58
|
readonly providerOptions?: NoInfer<SpeechModelOptions<Model>>;
|
|
64
|
-
readonly http?: HttpOptions.Input;
|
|
65
59
|
};
|
|
66
60
|
declare const SpeechResponse_base: Schema.Class<SpeechResponse, Schema.Struct<{
|
|
67
61
|
/** The complete audio. Headerless PCM carries `info.encoding`, `info.sampleRate`, and `info.channels`. */
|
|
@@ -575,78 +569,84 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
575
569
|
};
|
|
576
570
|
};
|
|
577
571
|
readonly match: {
|
|
578
|
-
<
|
|
579
|
-
readonly
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
readonly
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
572
|
+
<Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
|
|
573
|
+
readonly "audio-delta": Schema.Struct<{
|
|
574
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
575
|
+
readonly chunk: Schema.Uint8Array;
|
|
576
|
+
}>;
|
|
577
|
+
readonly finish: Schema.Struct<{
|
|
578
|
+
readonly type: Schema.tag<"finish">;
|
|
579
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
580
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
581
|
+
readonly type: Schema.Literal<"bytes">;
|
|
582
|
+
readonly data: Schema.Uint8Array;
|
|
583
|
+
readonly mediaType: Schema.String;
|
|
584
|
+
}>, Schema.Struct<{
|
|
585
|
+
readonly type: Schema.Literal<"base64">;
|
|
586
|
+
readonly data: Schema.String;
|
|
587
|
+
readonly mediaType: Schema.String;
|
|
588
|
+
}>, Schema.Struct<{
|
|
589
|
+
readonly type: Schema.Literal<"url">;
|
|
590
|
+
readonly url: Schema.String;
|
|
591
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
592
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
593
|
+
}>, Schema.Struct<{
|
|
594
|
+
readonly type: Schema.Literal<"ref">;
|
|
595
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
596
|
+
readonly id: Schema.String;
|
|
597
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
598
|
+
}>]>;
|
|
599
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
600
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
601
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
602
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
603
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
604
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
605
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
606
|
+
readonly format: Schema.optional<Schema.String>;
|
|
607
|
+
}>>;
|
|
608
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
609
|
+
}>, never, never>;
|
|
610
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
611
|
+
readonly type: Schema.Literal<"tokens">;
|
|
612
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
613
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
614
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
615
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
603
616
|
}>, Schema.Struct<{
|
|
604
|
-
readonly type: Schema.Literal<"
|
|
605
|
-
readonly
|
|
606
|
-
readonly mediaType: Schema.String;
|
|
617
|
+
readonly type: Schema.Literal<"seconds">;
|
|
618
|
+
readonly seconds: Schema.Number;
|
|
607
619
|
}>, Schema.Struct<{
|
|
608
|
-
readonly type: Schema.Literal<"
|
|
609
|
-
readonly
|
|
610
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
611
|
-
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
620
|
+
readonly type: Schema.Literal<"characters">;
|
|
621
|
+
readonly characters: Schema.Number;
|
|
612
622
|
}>, Schema.Struct<{
|
|
613
|
-
readonly type: Schema.Literal<"
|
|
614
|
-
readonly
|
|
615
|
-
|
|
616
|
-
readonly
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
readonly width: Schema.optional<Schema.Number>;
|
|
620
|
-
readonly height: Schema.optional<Schema.Number>;
|
|
621
|
-
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
622
|
-
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
623
|
-
readonly channels: Schema.optional<Schema.Number>;
|
|
624
|
-
readonly encoding: Schema.optional<Schema.String>;
|
|
625
|
-
readonly format: Schema.optional<Schema.String>;
|
|
626
|
-
}>>;
|
|
623
|
+
readonly type: Schema.Literal<"credits">;
|
|
624
|
+
readonly credits: Schema.Number;
|
|
625
|
+
}>, Schema.Struct<{
|
|
626
|
+
readonly type: Schema.Literal<"compute">;
|
|
627
|
+
readonly seconds: Schema.Number;
|
|
628
|
+
}>]>>;
|
|
627
629
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
628
|
-
}
|
|
629
|
-
readonly
|
|
630
|
-
readonly type: Schema.
|
|
631
|
-
readonly
|
|
632
|
-
readonly
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
readonly
|
|
637
|
-
readonly
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
readonly
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
649
|
-
}> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
|
|
630
|
+
}>;
|
|
631
|
+
readonly "generation-progress": Schema.Struct<{
|
|
632
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
633
|
+
readonly id: Schema.String;
|
|
634
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
635
|
+
}>;
|
|
636
|
+
readonly "generation-queued": Schema.Struct<{
|
|
637
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
638
|
+
readonly id: Schema.String;
|
|
639
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
640
|
+
}>;
|
|
641
|
+
readonly timestamps: Schema.Struct<{
|
|
642
|
+
readonly type: Schema.tag<"timestamps">;
|
|
643
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
644
|
+
readonly text: Schema.String;
|
|
645
|
+
readonly startSeconds: Schema.Number;
|
|
646
|
+
readonly endSeconds: Schema.Number;
|
|
647
|
+
}>>;
|
|
648
|
+
}>;
|
|
649
|
+
}[K]["Type"]) => any; }>(value: {
|
|
650
650
|
readonly type: "audio-delta";
|
|
651
651
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
652
652
|
} | {
|
|
@@ -693,79 +693,85 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
693
693
|
readonly [x: string]: unknown;
|
|
694
694
|
};
|
|
695
695
|
} | undefined;
|
|
696
|
-
}, cases:
|
|
697
|
-
<
|
|
698
|
-
readonly
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
readonly
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
696
|
+
}, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
|
|
697
|
+
<Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
|
|
698
|
+
readonly "audio-delta": Schema.Struct<{
|
|
699
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
700
|
+
readonly chunk: Schema.Uint8Array;
|
|
701
|
+
}>;
|
|
702
|
+
readonly finish: Schema.Struct<{
|
|
703
|
+
readonly type: Schema.tag<"finish">;
|
|
704
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
705
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
706
|
+
readonly type: Schema.Literal<"bytes">;
|
|
707
|
+
readonly data: Schema.Uint8Array;
|
|
708
|
+
readonly mediaType: Schema.String;
|
|
709
|
+
}>, Schema.Struct<{
|
|
710
|
+
readonly type: Schema.Literal<"base64">;
|
|
711
|
+
readonly data: Schema.String;
|
|
712
|
+
readonly mediaType: Schema.String;
|
|
713
|
+
}>, Schema.Struct<{
|
|
714
|
+
readonly type: Schema.Literal<"url">;
|
|
715
|
+
readonly url: Schema.String;
|
|
716
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
717
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
718
|
+
}>, Schema.Struct<{
|
|
719
|
+
readonly type: Schema.Literal<"ref">;
|
|
720
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
721
|
+
readonly id: Schema.String;
|
|
722
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
723
|
+
}>]>;
|
|
724
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
725
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
726
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
727
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
728
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
729
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
730
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
731
|
+
readonly format: Schema.optional<Schema.String>;
|
|
732
|
+
}>>;
|
|
733
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
734
|
+
}>, never, never>;
|
|
735
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
736
|
+
readonly type: Schema.Literal<"tokens">;
|
|
737
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
738
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
739
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
740
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
722
741
|
}>, Schema.Struct<{
|
|
723
|
-
readonly type: Schema.Literal<"
|
|
724
|
-
readonly
|
|
725
|
-
readonly mediaType: Schema.String;
|
|
742
|
+
readonly type: Schema.Literal<"seconds">;
|
|
743
|
+
readonly seconds: Schema.Number;
|
|
726
744
|
}>, Schema.Struct<{
|
|
727
|
-
readonly type: Schema.Literal<"
|
|
728
|
-
readonly
|
|
729
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
730
|
-
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
745
|
+
readonly type: Schema.Literal<"characters">;
|
|
746
|
+
readonly characters: Schema.Number;
|
|
731
747
|
}>, Schema.Struct<{
|
|
732
|
-
readonly type: Schema.Literal<"
|
|
733
|
-
readonly
|
|
734
|
-
|
|
735
|
-
readonly
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
readonly width: Schema.optional<Schema.Number>;
|
|
739
|
-
readonly height: Schema.optional<Schema.Number>;
|
|
740
|
-
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
741
|
-
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
742
|
-
readonly channels: Schema.optional<Schema.Number>;
|
|
743
|
-
readonly encoding: Schema.optional<Schema.String>;
|
|
744
|
-
readonly format: Schema.optional<Schema.String>;
|
|
745
|
-
}>>;
|
|
748
|
+
readonly type: Schema.Literal<"credits">;
|
|
749
|
+
readonly credits: Schema.Number;
|
|
750
|
+
}>, Schema.Struct<{
|
|
751
|
+
readonly type: Schema.Literal<"compute">;
|
|
752
|
+
readonly seconds: Schema.Number;
|
|
753
|
+
}>]>>;
|
|
746
754
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
747
|
-
}
|
|
748
|
-
readonly
|
|
749
|
-
readonly type: Schema.
|
|
750
|
-
readonly
|
|
751
|
-
readonly
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
readonly
|
|
756
|
-
readonly
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
readonly
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
768
|
-
}> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
|
|
755
|
+
}>;
|
|
756
|
+
readonly "generation-progress": Schema.Struct<{
|
|
757
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
758
|
+
readonly id: Schema.String;
|
|
759
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
760
|
+
}>;
|
|
761
|
+
readonly "generation-queued": Schema.Struct<{
|
|
762
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
763
|
+
readonly id: Schema.String;
|
|
764
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
765
|
+
}>;
|
|
766
|
+
readonly timestamps: Schema.Struct<{
|
|
767
|
+
readonly type: Schema.tag<"timestamps">;
|
|
768
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
769
|
+
readonly text: Schema.String;
|
|
770
|
+
readonly startSeconds: Schema.Number;
|
|
771
|
+
readonly endSeconds: Schema.Number;
|
|
772
|
+
}>>;
|
|
773
|
+
}>;
|
|
774
|
+
}[K]["Type"]) => any; }>(cases: Handlers): (value: {
|
|
769
775
|
readonly type: "audio-delta";
|
|
770
776
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
771
777
|
} | {
|
|
@@ -812,81 +818,10 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
812
818
|
readonly [x: string]: unknown;
|
|
813
819
|
};
|
|
814
820
|
} | undefined;
|
|
815
|
-
}) =>
|
|
821
|
+
}) => import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
|
|
816
822
|
};
|
|
817
823
|
readonly matchOrElse: {
|
|
818
|
-
<
|
|
819
|
-
readonly type: Schema.tag<"generation-queued">;
|
|
820
|
-
readonly id: Schema.String;
|
|
821
|
-
readonly position: Schema.optional<Schema.Number>;
|
|
822
|
-
}> | Schema.Struct<{
|
|
823
|
-
readonly type: Schema.tag<"generation-progress">;
|
|
824
|
-
readonly id: Schema.String;
|
|
825
|
-
readonly progress: Schema.optional<Schema.Number>;
|
|
826
|
-
}> | Schema.Struct<{
|
|
827
|
-
readonly type: Schema.tag<"audio-delta">;
|
|
828
|
-
readonly chunk: Schema.Uint8Array;
|
|
829
|
-
}> | Schema.Struct<{
|
|
830
|
-
readonly type: Schema.tag<"timestamps">;
|
|
831
|
-
readonly items: Schema.$Array<Schema.Struct<{
|
|
832
|
-
readonly text: Schema.String;
|
|
833
|
-
readonly startSeconds: Schema.Number;
|
|
834
|
-
readonly endSeconds: Schema.Number;
|
|
835
|
-
}>>;
|
|
836
|
-
}> | Schema.Struct<{
|
|
837
|
-
readonly type: Schema.tag<"finish">;
|
|
838
|
-
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
839
|
-
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
840
|
-
readonly type: Schema.Literal<"bytes">;
|
|
841
|
-
readonly data: Schema.Uint8Array;
|
|
842
|
-
readonly mediaType: Schema.String;
|
|
843
|
-
}>, Schema.Struct<{
|
|
844
|
-
readonly type: Schema.Literal<"base64">;
|
|
845
|
-
readonly data: Schema.String;
|
|
846
|
-
readonly mediaType: Schema.String;
|
|
847
|
-
}>, Schema.Struct<{
|
|
848
|
-
readonly type: Schema.Literal<"url">;
|
|
849
|
-
readonly url: Schema.String;
|
|
850
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
851
|
-
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
852
|
-
}>, Schema.Struct<{
|
|
853
|
-
readonly type: Schema.Literal<"ref">;
|
|
854
|
-
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
855
|
-
readonly id: Schema.String;
|
|
856
|
-
readonly mediaType: Schema.optional<Schema.String>;
|
|
857
|
-
}>]>;
|
|
858
|
-
readonly info: Schema.optional<Schema.Struct<{
|
|
859
|
-
readonly width: Schema.optional<Schema.Number>;
|
|
860
|
-
readonly height: Schema.optional<Schema.Number>;
|
|
861
|
-
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
862
|
-
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
863
|
-
readonly channels: Schema.optional<Schema.Number>;
|
|
864
|
-
readonly encoding: Schema.optional<Schema.String>;
|
|
865
|
-
readonly format: Schema.optional<Schema.String>;
|
|
866
|
-
}>>;
|
|
867
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
868
|
-
}>, never, never>;
|
|
869
|
-
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
870
|
-
readonly type: Schema.Literal<"tokens">;
|
|
871
|
-
readonly input: Schema.optional<Schema.Number>;
|
|
872
|
-
readonly output: Schema.optional<Schema.Number>;
|
|
873
|
-
readonly total: Schema.optional<Schema.Number>;
|
|
874
|
-
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
875
|
-
}>, Schema.Struct<{
|
|
876
|
-
readonly type: Schema.Literal<"seconds">;
|
|
877
|
-
readonly seconds: Schema.Number;
|
|
878
|
-
}>, Schema.Struct<{
|
|
879
|
-
readonly type: Schema.Literal<"characters">;
|
|
880
|
-
readonly characters: Schema.Number;
|
|
881
|
-
}>, Schema.Struct<{
|
|
882
|
-
readonly type: Schema.Literal<"credits">;
|
|
883
|
-
readonly credits: Schema.Number;
|
|
884
|
-
}>, Schema.Struct<{
|
|
885
|
-
readonly type: Schema.Literal<"compute">;
|
|
886
|
-
readonly seconds: Schema.Number;
|
|
887
|
-
}>]>>;
|
|
888
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
889
|
-
}> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
|
|
824
|
+
<Handlers, OrElse>(value: {
|
|
890
825
|
readonly type: "audio-delta";
|
|
891
826
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
892
827
|
} | {
|
|
@@ -933,25 +868,86 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
933
868
|
readonly [x: string]: unknown;
|
|
934
869
|
};
|
|
935
870
|
} | undefined;
|
|
936
|
-
},
|
|
871
|
+
}, cases: Handlers & {
|
|
872
|
+
readonly "audio-delta"?: ((value: {
|
|
873
|
+
readonly type: "audio-delta";
|
|
874
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
875
|
+
}) => any) | undefined;
|
|
876
|
+
readonly finish?: ((value: {
|
|
877
|
+
readonly type: "finish";
|
|
878
|
+
readonly audio: Media.Asset;
|
|
879
|
+
readonly usage?: {
|
|
880
|
+
readonly type: "seconds";
|
|
881
|
+
readonly seconds: number;
|
|
882
|
+
} | {
|
|
883
|
+
readonly type: "characters";
|
|
884
|
+
readonly characters: number;
|
|
885
|
+
} | {
|
|
886
|
+
readonly type: "credits";
|
|
887
|
+
readonly credits: number;
|
|
888
|
+
} | {
|
|
889
|
+
readonly type: "compute";
|
|
890
|
+
readonly seconds: number;
|
|
891
|
+
} | {
|
|
892
|
+
readonly type: "tokens";
|
|
893
|
+
readonly input?: number | undefined;
|
|
894
|
+
readonly output?: number | undefined;
|
|
895
|
+
readonly total?: number | undefined;
|
|
896
|
+
readonly details?: {
|
|
897
|
+
readonly [x: string]: unknown;
|
|
898
|
+
} | undefined;
|
|
899
|
+
} | undefined;
|
|
900
|
+
readonly providerMetadata?: {
|
|
901
|
+
readonly [x: string]: {
|
|
902
|
+
readonly [x: string]: unknown;
|
|
903
|
+
};
|
|
904
|
+
} | undefined;
|
|
905
|
+
}) => any) | undefined;
|
|
906
|
+
readonly "generation-progress"?: ((value: {
|
|
907
|
+
readonly type: "generation-progress";
|
|
908
|
+
readonly id: string;
|
|
909
|
+
readonly progress?: number | undefined;
|
|
910
|
+
}) => any) | undefined;
|
|
911
|
+
readonly "generation-queued"?: ((value: {
|
|
912
|
+
readonly type: "generation-queued";
|
|
913
|
+
readonly id: string;
|
|
914
|
+
readonly position?: number | undefined;
|
|
915
|
+
}) => any) | undefined;
|
|
916
|
+
readonly timestamps?: ((value: {
|
|
917
|
+
readonly type: "timestamps";
|
|
918
|
+
readonly items: readonly {
|
|
919
|
+
readonly text: string;
|
|
920
|
+
readonly startSeconds: number;
|
|
921
|
+
readonly endSeconds: number;
|
|
922
|
+
}[];
|
|
923
|
+
}) => any) | undefined;
|
|
924
|
+
} & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
937
925
|
readonly type: "audio-delta";
|
|
938
926
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
939
|
-
}
|
|
927
|
+
}, {
|
|
928
|
+
readonly type: keyof Handlers;
|
|
929
|
+
}> | Exclude<{
|
|
940
930
|
readonly type: "timestamps";
|
|
941
931
|
readonly items: readonly {
|
|
942
932
|
readonly text: string;
|
|
943
933
|
readonly startSeconds: number;
|
|
944
934
|
readonly endSeconds: number;
|
|
945
935
|
}[];
|
|
946
|
-
}
|
|
936
|
+
}, {
|
|
937
|
+
readonly type: keyof Handlers;
|
|
938
|
+
}> | Exclude<{
|
|
947
939
|
readonly type: "generation-queued";
|
|
948
940
|
readonly id: string;
|
|
949
941
|
readonly position?: number | undefined;
|
|
950
|
-
}
|
|
942
|
+
}, {
|
|
943
|
+
readonly type: keyof Handlers;
|
|
944
|
+
}> | Exclude<{
|
|
951
945
|
readonly type: "generation-progress";
|
|
952
946
|
readonly id: string;
|
|
953
947
|
readonly progress?: number | undefined;
|
|
954
|
-
}
|
|
948
|
+
}, {
|
|
949
|
+
readonly type: keyof Handlers;
|
|
950
|
+
}> | Exclude<{
|
|
955
951
|
readonly type: "finish";
|
|
956
952
|
readonly audio: Media.Asset;
|
|
957
953
|
readonly usage?: {
|
|
@@ -980,97 +976,89 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
980
976
|
readonly [x: string]: unknown;
|
|
981
977
|
};
|
|
982
978
|
} | undefined;
|
|
983
|
-
},
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
readonly
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
readonly
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
readonly
|
|
1008
|
-
readonly
|
|
1009
|
-
|
|
1010
|
-
readonly
|
|
1011
|
-
readonly
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
readonly
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
readonly
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
readonly
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
1041
|
-
}>, Schema.Struct<{
|
|
1042
|
-
readonly type: Schema.Literal<"seconds">;
|
|
1043
|
-
readonly seconds: Schema.Number;
|
|
1044
|
-
}>, Schema.Struct<{
|
|
1045
|
-
readonly type: Schema.Literal<"characters">;
|
|
1046
|
-
readonly characters: Schema.Number;
|
|
1047
|
-
}>, Schema.Struct<{
|
|
1048
|
-
readonly type: Schema.Literal<"credits">;
|
|
1049
|
-
readonly credits: Schema.Number;
|
|
1050
|
-
}>, Schema.Struct<{
|
|
1051
|
-
readonly type: Schema.Literal<"compute">;
|
|
1052
|
-
readonly seconds: Schema.Number;
|
|
1053
|
-
}>]>>;
|
|
1054
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
1055
|
-
}> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps">]: never; }, OrElse extends (value: Exclude<{
|
|
979
|
+
}, {
|
|
980
|
+
readonly type: keyof Handlers;
|
|
981
|
+
}>) => any)): import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
982
|
+
<Handlers, OrElse>(cases: Handlers & {
|
|
983
|
+
readonly "audio-delta"?: ((value: {
|
|
984
|
+
readonly type: "audio-delta";
|
|
985
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
986
|
+
}) => any) | undefined;
|
|
987
|
+
readonly finish?: ((value: {
|
|
988
|
+
readonly type: "finish";
|
|
989
|
+
readonly audio: Media.Asset;
|
|
990
|
+
readonly usage?: {
|
|
991
|
+
readonly type: "seconds";
|
|
992
|
+
readonly seconds: number;
|
|
993
|
+
} | {
|
|
994
|
+
readonly type: "characters";
|
|
995
|
+
readonly characters: number;
|
|
996
|
+
} | {
|
|
997
|
+
readonly type: "credits";
|
|
998
|
+
readonly credits: number;
|
|
999
|
+
} | {
|
|
1000
|
+
readonly type: "compute";
|
|
1001
|
+
readonly seconds: number;
|
|
1002
|
+
} | {
|
|
1003
|
+
readonly type: "tokens";
|
|
1004
|
+
readonly input?: number | undefined;
|
|
1005
|
+
readonly output?: number | undefined;
|
|
1006
|
+
readonly total?: number | undefined;
|
|
1007
|
+
readonly details?: {
|
|
1008
|
+
readonly [x: string]: unknown;
|
|
1009
|
+
} | undefined;
|
|
1010
|
+
} | undefined;
|
|
1011
|
+
readonly providerMetadata?: {
|
|
1012
|
+
readonly [x: string]: {
|
|
1013
|
+
readonly [x: string]: unknown;
|
|
1014
|
+
};
|
|
1015
|
+
} | undefined;
|
|
1016
|
+
}) => any) | undefined;
|
|
1017
|
+
readonly "generation-progress"?: ((value: {
|
|
1018
|
+
readonly type: "generation-progress";
|
|
1019
|
+
readonly id: string;
|
|
1020
|
+
readonly progress?: number | undefined;
|
|
1021
|
+
}) => any) | undefined;
|
|
1022
|
+
readonly "generation-queued"?: ((value: {
|
|
1023
|
+
readonly type: "generation-queued";
|
|
1024
|
+
readonly id: string;
|
|
1025
|
+
readonly position?: number | undefined;
|
|
1026
|
+
}) => any) | undefined;
|
|
1027
|
+
readonly timestamps?: ((value: {
|
|
1028
|
+
readonly type: "timestamps";
|
|
1029
|
+
readonly items: readonly {
|
|
1030
|
+
readonly text: string;
|
|
1031
|
+
readonly startSeconds: number;
|
|
1032
|
+
readonly endSeconds: number;
|
|
1033
|
+
}[];
|
|
1034
|
+
}) => any) | undefined;
|
|
1035
|
+
} & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
|
|
1056
1036
|
readonly type: "audio-delta";
|
|
1057
1037
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1058
|
-
}
|
|
1038
|
+
}, {
|
|
1039
|
+
readonly type: keyof Handlers;
|
|
1040
|
+
}> | Exclude<{
|
|
1059
1041
|
readonly type: "timestamps";
|
|
1060
1042
|
readonly items: readonly {
|
|
1061
1043
|
readonly text: string;
|
|
1062
1044
|
readonly startSeconds: number;
|
|
1063
1045
|
readonly endSeconds: number;
|
|
1064
1046
|
}[];
|
|
1065
|
-
}
|
|
1047
|
+
}, {
|
|
1048
|
+
readonly type: keyof Handlers;
|
|
1049
|
+
}> | Exclude<{
|
|
1066
1050
|
readonly type: "generation-queued";
|
|
1067
1051
|
readonly id: string;
|
|
1068
1052
|
readonly position?: number | undefined;
|
|
1069
|
-
}
|
|
1053
|
+
}, {
|
|
1054
|
+
readonly type: keyof Handlers;
|
|
1055
|
+
}> | Exclude<{
|
|
1070
1056
|
readonly type: "generation-progress";
|
|
1071
1057
|
readonly id: string;
|
|
1072
1058
|
readonly progress?: number | undefined;
|
|
1073
|
-
}
|
|
1059
|
+
}, {
|
|
1060
|
+
readonly type: keyof Handlers;
|
|
1061
|
+
}> | Exclude<{
|
|
1074
1062
|
readonly type: "finish";
|
|
1075
1063
|
readonly audio: Media.Asset;
|
|
1076
1064
|
readonly usage?: {
|
|
@@ -1099,7 +1087,9 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1099
1087
|
readonly [x: string]: unknown;
|
|
1100
1088
|
};
|
|
1101
1089
|
} | undefined;
|
|
1102
|
-
}, {
|
|
1090
|
+
}, {
|
|
1091
|
+
readonly type: keyof Handlers;
|
|
1092
|
+
}>) => any)): (value: {
|
|
1103
1093
|
readonly type: "audio-delta";
|
|
1104
1094
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1105
1095
|
} | {
|
|
@@ -1146,7 +1136,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1146
1136
|
readonly [x: string]: unknown;
|
|
1147
1137
|
};
|
|
1148
1138
|
} | undefined;
|
|
1149
|
-
}) => import("effect/Unify").Unify<{ [K in keyof
|
|
1139
|
+
}) => import("effect/Unify").Unify<{ [K in keyof Handlers]-?: NonNullable<Handlers[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Handlers] | (OrElse extends (...args: Array<any>) => infer R ? R : never)>;
|
|
1150
1140
|
};
|
|
1151
1141
|
} & {
|
|
1152
1142
|
is: {
|
|
@@ -1205,10 +1195,10 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1205
1195
|
};
|
|
1206
1196
|
};
|
|
1207
1197
|
export type SpeechEvent = Schema.Schema.Type<typeof speechEventTagged>;
|
|
1208
|
-
|
|
1209
|
-
export declare
|
|
1210
|
-
export declare function generate<const Model extends SpeechModel>(input:
|
|
1211
|
-
export declare function stream<const Model extends SpeechModel>(input:
|
|
1198
|
+
/** Normalize speech request input into a plain `SpeechRequest`. */
|
|
1199
|
+
export declare const request: <const Model extends SpeechModel>(input: SpeechRequestInput<Model>) => SpeechRequest<Model>;
|
|
1200
|
+
export declare function generate<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
1201
|
+
export declare function stream<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1212
1202
|
export declare const Speech: {
|
|
1213
1203
|
readonly request: typeof request;
|
|
1214
1204
|
readonly generate: typeof generate;
|