@opencode/ai 0.0.0-dev-20140 → 0.0.0-dev-20141
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/dist/image-client.d.ts +54 -21
- package/dist/image-client.js +14 -39
- package/dist/image.d.ts +13 -25
- package/dist/image.js +2 -13
- package/dist/media-client.d.ts +30 -0
- package/dist/media-client.js +51 -0
- package/dist/media-model.d.ts +9 -8
- package/dist/media-model.js +10 -10
- package/dist/promise.d.ts +26 -10
- package/dist/promise.js +15 -20
- package/dist/protocols/cartesia-speech.d.ts +16 -0
- package/dist/protocols/deepgram-speech.d.ts +16 -0
- package/dist/protocols/elevenlabs-speech.d.ts +16 -0
- package/dist/protocols/google-speech.d.ts +16 -0
- package/dist/protocols/openai-speech.d.ts +16 -0
- package/dist/route/media.d.ts +4 -14
- package/dist/route/media.js +1 -36
- package/dist/speech-client.d.ts +57 -14
- package/dist/speech-client.js +15 -20
- package/dist/speech.d.ts +176 -19
- package/dist/speech.js +11 -6
- package/dist/transcription-client.d.ts +73 -21
- package/dist/transcription-client.js +7 -39
- package/dist/transcription.d.ts +13 -25
- package/dist/transcription.js +2 -8
- package/dist/video-client.d.ts +50 -21
- package/dist/video-client.js +14 -35
- package/dist/video.d.ts +14 -22
- package/dist/video.js +13 -14
- package/package.json +3 -3
package/dist/speech.d.ts
CHANGED
|
@@ -2,21 +2,18 @@ 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 type { MediaProtocol } from "./route/media-protocol.js";
|
|
6
5
|
import { AIError, HttpOptions, type OpenString } from "./schema/index.js";
|
|
7
6
|
import { Service } from "./speech-client.js";
|
|
8
|
-
export type SpeechOptions =
|
|
9
|
-
export type SpeechRoute
|
|
10
|
-
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute
|
|
7
|
+
export type SpeechOptions = MediaModel.Options;
|
|
8
|
+
export type SpeechRoute = MediaRoute.AnyRoute<SpeechRequestFor, SpeechEvent, SpeechResponse>;
|
|
9
|
+
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute, Options> {
|
|
11
10
|
protected readonly _SpeechModel: void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static fromRoute<Options extends SpeechOptions
|
|
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<SpeechRequestFor<Options>, SpeechResponse>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
13
|
+
static fromRoute<Options extends SpeechOptions, Frame, State>(route: MediaModel.StreamRouteInput<SpeechRequestFor<Options>, SpeechEvent, Frame, State>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
14
|
+
static fromRoute<Options extends SpeechOptions, Token>(route: MediaModel.QueuedRouteInput<SpeechRequestFor<Options>, SpeechResponse, Token>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
17
|
-
type RouteInput<Options extends SpeechOptions = SpeechOptions, Frame = unknown, State = unknown> = MediaModel.RouteInput<MediaProtocol.Addressed<SpeechRequestFor<Options>>, MediaProtocol.Streamed<SpeechRequestFor<Options>, SpeechEvent, Frame, State>>;
|
|
18
|
-
}
|
|
19
|
-
export declare const SpeechModelSchema: Schema.declare<SpeechModel<SpeechOptions>, SpeechModel<SpeechOptions>>;
|
|
16
|
+
export declare const SpeechModelSchema: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
|
|
20
17
|
/** Provider-native: a name on OpenAI and Gemini, a voice id on ElevenLabs and Cartesia; `{ id }` is an OpenAI custom voice. */
|
|
21
18
|
export declare const SpeechVoice: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
22
19
|
readonly id: Schema.String;
|
|
@@ -31,7 +28,7 @@ export declare const SpeechTimestamp: Schema.Struct<{
|
|
|
31
28
|
}>;
|
|
32
29
|
export type SpeechTimestamp = Schema.Schema.Type<typeof SpeechTimestamp>;
|
|
33
30
|
declare const SpeechRequest_base: Schema.Class<SpeechRequest, Schema.Struct<{
|
|
34
|
-
readonly model: Schema.declare<SpeechModel<
|
|
31
|
+
readonly model: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
|
|
35
32
|
readonly text: Schema.String;
|
|
36
33
|
readonly voice: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
37
34
|
readonly id: Schema.String;
|
|
@@ -197,6 +194,14 @@ export declare const SpeechFinishEvent: Schema.Struct<{
|
|
|
197
194
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
198
195
|
}>;
|
|
199
196
|
declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
197
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
198
|
+
readonly id: Schema.String;
|
|
199
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
202
|
+
readonly id: Schema.String;
|
|
203
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
204
|
+
}>, Schema.Struct<{
|
|
200
205
|
readonly type: Schema.tag<"audio-delta">;
|
|
201
206
|
readonly chunk: Schema.Uint8Array;
|
|
202
207
|
}>, Schema.Struct<{
|
|
@@ -266,6 +271,14 @@ declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.S
|
|
|
266
271
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
267
272
|
}>]>;
|
|
268
273
|
export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
274
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
275
|
+
readonly id: Schema.String;
|
|
276
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
277
|
+
}>, Schema.Struct<{
|
|
278
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
279
|
+
readonly id: Schema.String;
|
|
280
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
281
|
+
}>, Schema.Struct<{
|
|
269
282
|
readonly type: Schema.tag<"audio-delta">;
|
|
270
283
|
readonly chunk: Schema.Uint8Array;
|
|
271
284
|
}>, Schema.Struct<{
|
|
@@ -334,8 +347,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
334
347
|
}>>>;
|
|
335
348
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
336
349
|
}>]> & {
|
|
337
|
-
readonly discriminants: readonly ["audio-delta", "timestamps", "finish"];
|
|
350
|
+
readonly discriminants: readonly ["generation-queued", "generation-progress", "audio-delta", "timestamps", "finish"];
|
|
338
351
|
readonly cases: {
|
|
352
|
+
"generation-queued": Schema.Struct<{
|
|
353
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
354
|
+
readonly id: Schema.String;
|
|
355
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
356
|
+
}>;
|
|
357
|
+
"generation-progress": Schema.Struct<{
|
|
358
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
359
|
+
readonly id: Schema.String;
|
|
360
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
361
|
+
}>;
|
|
339
362
|
"audio-delta": Schema.Struct<{
|
|
340
363
|
readonly type: Schema.tag<"audio-delta">;
|
|
341
364
|
readonly chunk: Schema.Uint8Array;
|
|
@@ -409,6 +432,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
409
432
|
}>;
|
|
410
433
|
};
|
|
411
434
|
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
435
|
+
readonly id: string;
|
|
436
|
+
readonly type: "generation-queued";
|
|
437
|
+
readonly position?: number | undefined;
|
|
438
|
+
} | {
|
|
439
|
+
readonly id: string;
|
|
440
|
+
readonly type: "generation-progress";
|
|
441
|
+
readonly progress?: number | undefined;
|
|
442
|
+
} | {
|
|
412
443
|
readonly type: "audio-delta";
|
|
413
444
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
414
445
|
} | {
|
|
@@ -457,6 +488,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
457
488
|
} | undefined;
|
|
458
489
|
}[] | undefined;
|
|
459
490
|
}) => value is Extract<{
|
|
491
|
+
readonly id: string;
|
|
492
|
+
readonly type: "generation-queued";
|
|
493
|
+
readonly position?: number | undefined;
|
|
494
|
+
}, {
|
|
495
|
+
readonly type: Keys;
|
|
496
|
+
}> | Extract<{
|
|
497
|
+
readonly id: string;
|
|
498
|
+
readonly type: "generation-progress";
|
|
499
|
+
readonly progress?: number | undefined;
|
|
500
|
+
}, {
|
|
501
|
+
readonly type: Keys;
|
|
502
|
+
}> | Extract<{
|
|
460
503
|
readonly type: "audio-delta";
|
|
461
504
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
462
505
|
}, {
|
|
@@ -512,6 +555,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
512
555
|
readonly type: Keys;
|
|
513
556
|
}>;
|
|
514
557
|
readonly guards: {
|
|
558
|
+
"generation-queued": (u: unknown) => u is {
|
|
559
|
+
readonly id: string;
|
|
560
|
+
readonly type: "generation-queued";
|
|
561
|
+
readonly position?: number | undefined;
|
|
562
|
+
};
|
|
563
|
+
"generation-progress": (u: unknown) => u is {
|
|
564
|
+
readonly id: string;
|
|
565
|
+
readonly type: "generation-progress";
|
|
566
|
+
readonly progress?: number | undefined;
|
|
567
|
+
};
|
|
515
568
|
"audio-delta": (u: unknown) => u is {
|
|
516
569
|
readonly type: "audio-delta";
|
|
517
570
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -566,6 +619,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
566
619
|
};
|
|
567
620
|
readonly match: {
|
|
568
621
|
<Cases extends {
|
|
622
|
+
"generation-queued": (value: {
|
|
623
|
+
readonly id: string;
|
|
624
|
+
readonly type: "generation-queued";
|
|
625
|
+
readonly position?: number | undefined;
|
|
626
|
+
}) => any;
|
|
627
|
+
"generation-progress": (value: {
|
|
628
|
+
readonly id: string;
|
|
629
|
+
readonly type: "generation-progress";
|
|
630
|
+
readonly progress?: number | undefined;
|
|
631
|
+
}) => any;
|
|
569
632
|
"audio-delta": (value: {
|
|
570
633
|
readonly type: "audio-delta";
|
|
571
634
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -618,6 +681,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
618
681
|
}[] | undefined;
|
|
619
682
|
}) => any;
|
|
620
683
|
}>(value: {
|
|
684
|
+
readonly id: string;
|
|
685
|
+
readonly type: "generation-queued";
|
|
686
|
+
readonly position?: number | undefined;
|
|
687
|
+
} | {
|
|
688
|
+
readonly id: string;
|
|
689
|
+
readonly type: "generation-progress";
|
|
690
|
+
readonly progress?: number | undefined;
|
|
691
|
+
} | {
|
|
621
692
|
readonly type: "audio-delta";
|
|
622
693
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
623
694
|
} | {
|
|
@@ -667,6 +738,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
667
738
|
}[] | undefined;
|
|
668
739
|
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
669
740
|
<Cases extends {
|
|
741
|
+
"generation-queued": (value: {
|
|
742
|
+
readonly id: string;
|
|
743
|
+
readonly type: "generation-queued";
|
|
744
|
+
readonly position?: number | undefined;
|
|
745
|
+
}) => any;
|
|
746
|
+
"generation-progress": (value: {
|
|
747
|
+
readonly id: string;
|
|
748
|
+
readonly type: "generation-progress";
|
|
749
|
+
readonly progress?: number | undefined;
|
|
750
|
+
}) => any;
|
|
670
751
|
"audio-delta": (value: {
|
|
671
752
|
readonly type: "audio-delta";
|
|
672
753
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -719,6 +800,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
719
800
|
}[] | undefined;
|
|
720
801
|
}) => any;
|
|
721
802
|
}>(cases: Cases): (value: {
|
|
803
|
+
readonly id: string;
|
|
804
|
+
readonly type: "generation-queued";
|
|
805
|
+
readonly position?: number | undefined;
|
|
806
|
+
} | {
|
|
807
|
+
readonly id: string;
|
|
808
|
+
readonly type: "generation-progress";
|
|
809
|
+
readonly progress?: number | undefined;
|
|
810
|
+
} | {
|
|
722
811
|
readonly type: "audio-delta";
|
|
723
812
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
724
813
|
} | {
|
|
@@ -770,6 +859,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
770
859
|
};
|
|
771
860
|
readonly matchOrElse: {
|
|
772
861
|
<Cases extends {
|
|
862
|
+
"generation-queued"?: ((value: {
|
|
863
|
+
readonly id: string;
|
|
864
|
+
readonly type: "generation-queued";
|
|
865
|
+
readonly position?: number | undefined;
|
|
866
|
+
}) => any) | undefined;
|
|
867
|
+
"generation-progress"?: ((value: {
|
|
868
|
+
readonly id: string;
|
|
869
|
+
readonly type: "generation-progress";
|
|
870
|
+
readonly progress?: number | undefined;
|
|
871
|
+
}) => any) | undefined;
|
|
773
872
|
"audio-delta"?: ((value: {
|
|
774
873
|
readonly type: "audio-delta";
|
|
775
874
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -821,7 +920,19 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
821
920
|
} | undefined;
|
|
822
921
|
}[] | undefined;
|
|
823
922
|
}) => any) | undefined;
|
|
824
|
-
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
923
|
+
} & { [K in Exclude<keyof Cases, "finish" | "generation-queued" | "generation-progress" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
924
|
+
readonly id: string;
|
|
925
|
+
readonly type: "generation-queued";
|
|
926
|
+
readonly position?: number | undefined;
|
|
927
|
+
}, {
|
|
928
|
+
readonly type: keyof Cases;
|
|
929
|
+
}> | Exclude<{
|
|
930
|
+
readonly id: string;
|
|
931
|
+
readonly type: "generation-progress";
|
|
932
|
+
readonly progress?: number | undefined;
|
|
933
|
+
}, {
|
|
934
|
+
readonly type: keyof Cases;
|
|
935
|
+
}> | Exclude<{
|
|
825
936
|
readonly type: "audio-delta";
|
|
826
937
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
827
938
|
}, {
|
|
@@ -876,6 +987,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
876
987
|
}, {
|
|
877
988
|
readonly type: keyof Cases;
|
|
878
989
|
}>) => any>(value: {
|
|
990
|
+
readonly id: string;
|
|
991
|
+
readonly type: "generation-queued";
|
|
992
|
+
readonly position?: number | undefined;
|
|
993
|
+
} | {
|
|
994
|
+
readonly id: string;
|
|
995
|
+
readonly type: "generation-progress";
|
|
996
|
+
readonly progress?: number | undefined;
|
|
997
|
+
} | {
|
|
879
998
|
readonly type: "audio-delta";
|
|
880
999
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
881
1000
|
} | {
|
|
@@ -925,6 +1044,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
925
1044
|
}[] | undefined;
|
|
926
1045
|
}, 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>>;
|
|
927
1046
|
<Cases extends {
|
|
1047
|
+
"generation-queued"?: ((value: {
|
|
1048
|
+
readonly id: string;
|
|
1049
|
+
readonly type: "generation-queued";
|
|
1050
|
+
readonly position?: number | undefined;
|
|
1051
|
+
}) => any) | undefined;
|
|
1052
|
+
"generation-progress"?: ((value: {
|
|
1053
|
+
readonly id: string;
|
|
1054
|
+
readonly type: "generation-progress";
|
|
1055
|
+
readonly progress?: number | undefined;
|
|
1056
|
+
}) => any) | undefined;
|
|
928
1057
|
"audio-delta"?: ((value: {
|
|
929
1058
|
readonly type: "audio-delta";
|
|
930
1059
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -976,7 +1105,19 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
976
1105
|
} | undefined;
|
|
977
1106
|
}[] | undefined;
|
|
978
1107
|
}) => any) | undefined;
|
|
979
|
-
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
1108
|
+
} & { [K in Exclude<keyof Cases, "finish" | "generation-queued" | "generation-progress" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
1109
|
+
readonly id: string;
|
|
1110
|
+
readonly type: "generation-queued";
|
|
1111
|
+
readonly position?: number | undefined;
|
|
1112
|
+
}, {
|
|
1113
|
+
readonly type: keyof Cases;
|
|
1114
|
+
}> | Exclude<{
|
|
1115
|
+
readonly id: string;
|
|
1116
|
+
readonly type: "generation-progress";
|
|
1117
|
+
readonly progress?: number | undefined;
|
|
1118
|
+
}, {
|
|
1119
|
+
readonly type: keyof Cases;
|
|
1120
|
+
}> | Exclude<{
|
|
980
1121
|
readonly type: "audio-delta";
|
|
981
1122
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
982
1123
|
}, {
|
|
@@ -1031,6 +1172,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1031
1172
|
}, {
|
|
1032
1173
|
readonly type: keyof Cases;
|
|
1033
1174
|
}>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
1175
|
+
readonly id: string;
|
|
1176
|
+
readonly type: "generation-queued";
|
|
1177
|
+
readonly position?: number | undefined;
|
|
1178
|
+
} | {
|
|
1179
|
+
readonly id: string;
|
|
1180
|
+
readonly type: "generation-progress";
|
|
1181
|
+
readonly progress?: number | undefined;
|
|
1182
|
+
} | {
|
|
1034
1183
|
readonly type: "audio-delta";
|
|
1035
1184
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1036
1185
|
} | {
|
|
@@ -1082,6 +1231,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1082
1231
|
};
|
|
1083
1232
|
} & {
|
|
1084
1233
|
is: {
|
|
1234
|
+
generationQueued: (u: unknown) => u is {
|
|
1235
|
+
readonly id: string;
|
|
1236
|
+
readonly type: "generation-queued";
|
|
1237
|
+
readonly position?: number | undefined;
|
|
1238
|
+
};
|
|
1239
|
+
generationProgress: (u: unknown) => u is {
|
|
1240
|
+
readonly id: string;
|
|
1241
|
+
readonly type: "generation-progress";
|
|
1242
|
+
readonly progress?: number | undefined;
|
|
1243
|
+
};
|
|
1085
1244
|
audioDelta: (u: unknown) => u is {
|
|
1086
1245
|
readonly type: "audio-delta";
|
|
1087
1246
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -1138,10 +1297,8 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1138
1297
|
export type SpeechEvent = Schema.Schema.Type<typeof speechEventTagged>;
|
|
1139
1298
|
export declare function request<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): SpeechRequestFor<SpeechModelOptions<Model>>;
|
|
1140
1299
|
export declare function request(input: SpeechRequest): SpeechRequest;
|
|
1141
|
-
export declare function generate<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
1142
|
-
export declare function
|
|
1143
|
-
export declare function stream<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1144
|
-
export declare function stream(input: SpeechRequest): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1300
|
+
export declare function generate<const Model extends SpeechModel>(input: SpeechRequest | SpeechRequestInput<Model>): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
1301
|
+
export declare function stream<const Model extends SpeechModel>(input: SpeechRequest | SpeechRequestInput<Model>): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1145
1302
|
export declare const Speech: {
|
|
1146
1303
|
readonly request: typeof request;
|
|
1147
1304
|
readonly generate: typeof generate;
|
package/dist/speech.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
import { ProgressEvent, QueuedEvent } from "./generation.js";
|
|
2
3
|
import { Media } from "./media.js";
|
|
3
4
|
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
4
5
|
import { MediaRoute } from "./route/media.js";
|
|
5
6
|
import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
|
|
6
7
|
import { SpeechClient, Service } from "./speech-client.js";
|
|
7
8
|
export class SpeechModel extends MediaModel {
|
|
8
|
-
static make(input) {
|
|
9
|
-
return new SpeechModel(input);
|
|
10
|
-
}
|
|
11
|
-
/** Compose a streaming speech protocol with its canonical path into a model for one deployment. */
|
|
12
9
|
static fromRoute(route, input) {
|
|
13
10
|
return new SpeechModel({
|
|
14
11
|
id: input.id,
|
|
15
12
|
provider: route.protocol.provider,
|
|
16
13
|
http: input.http,
|
|
17
|
-
route: composeRoute(
|
|
14
|
+
route: composeRoute(route, input, collectResponse),
|
|
18
15
|
});
|
|
19
16
|
}
|
|
20
17
|
}
|
|
@@ -75,9 +72,17 @@ export const SpeechFinishEvent = Schema.Struct({
|
|
|
75
72
|
notices: Schema.optional(Schema.Array(Media.Notice)),
|
|
76
73
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
77
74
|
}).annotate({ identifier: "Speech.Event.Finish" });
|
|
78
|
-
const speechEventTagged = Schema.Union([
|
|
75
|
+
const speechEventTagged = Schema.Union([
|
|
76
|
+
QueuedEvent,
|
|
77
|
+
ProgressEvent,
|
|
78
|
+
SpeechAudioDeltaEvent,
|
|
79
|
+
SpeechTimestampsEvent,
|
|
80
|
+
SpeechFinishEvent,
|
|
81
|
+
]).pipe(Schema.toTaggedUnion("type"));
|
|
79
82
|
export const SpeechEvent = Object.assign(speechEventTagged, {
|
|
80
83
|
is: {
|
|
84
|
+
generationQueued: speechEventTagged.guards["generation-queued"],
|
|
85
|
+
generationProgress: speechEventTagged.guards["generation-progress"],
|
|
81
86
|
audioDelta: speechEventTagged.guards["audio-delta"],
|
|
82
87
|
timestamps: speechEventTagged.guards.timestamps,
|
|
83
88
|
finish: speechEventTagged.guards.finish,
|
|
@@ -1,30 +1,82 @@
|
|
|
1
|
-
import { Context
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { type TranscriptionEvent, type TranscriptionModel, type TranscriptionOptions, type TranscriptionRequestFor, type TranscriptionResponse } from "./transcription.js";
|
|
6
|
-
export interface Interface {
|
|
7
|
-
readonly generate: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Effect.Effect<TranscriptionResponse, AIError>;
|
|
8
|
-
readonly stream: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Stream.Stream<TranscriptionEvent, AIError>;
|
|
9
|
-
readonly start: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>) => Effect.Effect<Generation<TranscriptionResponse>, AIError>;
|
|
10
|
-
readonly resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError>;
|
|
11
|
-
}
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
import { MediaClient } from "./media-client.js";
|
|
3
|
+
import { type TranscriptionEvent, type TranscriptionRequestFor, type TranscriptionResponse } from "./transcription.js";
|
|
4
|
+
export type Interface = MediaClient.Interface<TranscriptionRequestFor, TranscriptionEvent, TranscriptionResponse>;
|
|
12
5
|
declare const TranscriptionClientService_base: Context.ServiceClass<TranscriptionClientService, "@opencode/TranscriptionClient", Interface>;
|
|
13
6
|
export declare class TranscriptionClientService extends TranscriptionClientService_base {
|
|
14
7
|
}
|
|
15
8
|
export declare const Service: typeof TranscriptionClientService;
|
|
16
9
|
export type Service = TranscriptionClientService;
|
|
17
|
-
export declare const generate: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Effect.Effect<TranscriptionResponse, AIError, Service>;
|
|
18
|
-
export declare const stream: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
19
|
-
export declare const start: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
20
|
-
export declare const resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
21
|
-
export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
|
|
22
10
|
export declare const TranscriptionClient: {
|
|
11
|
+
readonly layer: import("effect/Layer").Layer<TranscriptionClientService, never, import("./route/executor-service.js").RequestExecutorService>;
|
|
12
|
+
readonly generate: (request: TranscriptionRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<TranscriptionResponse, import("./index.js").AIError, TranscriptionClientService>;
|
|
13
|
+
readonly stream: (request: TranscriptionRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<import("./generation.js").Observation | {
|
|
14
|
+
readonly type: "text-delta";
|
|
15
|
+
readonly delta: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "segment";
|
|
18
|
+
readonly segment: {
|
|
19
|
+
readonly text: string;
|
|
20
|
+
readonly startSeconds: number;
|
|
21
|
+
readonly endSeconds: number;
|
|
22
|
+
readonly speaker?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "finish";
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly durationSeconds?: number | undefined;
|
|
28
|
+
readonly providerMetadata?: {
|
|
29
|
+
readonly [x: string]: {
|
|
30
|
+
readonly [x: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly usage?: {
|
|
34
|
+
readonly type: "tokens";
|
|
35
|
+
readonly input?: number | undefined;
|
|
36
|
+
readonly output?: number | undefined;
|
|
37
|
+
readonly total?: number | undefined;
|
|
38
|
+
readonly details?: {
|
|
39
|
+
readonly [x: string]: unknown;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "seconds";
|
|
43
|
+
readonly seconds: number;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "characters";
|
|
46
|
+
readonly characters: number;
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "credits";
|
|
49
|
+
readonly credits: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "compute";
|
|
52
|
+
readonly seconds: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly notices?: readonly {
|
|
55
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
56
|
+
readonly message: string;
|
|
57
|
+
readonly providerMetadata?: {
|
|
58
|
+
readonly [x: string]: {
|
|
59
|
+
readonly [x: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
} | undefined;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
readonly language?: string | undefined;
|
|
64
|
+
readonly segments?: readonly {
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly startSeconds: number;
|
|
67
|
+
readonly endSeconds: number;
|
|
68
|
+
readonly speaker?: string | undefined;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
readonly words?: readonly {
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly startSeconds: number;
|
|
73
|
+
readonly endSeconds: number;
|
|
74
|
+
readonly speaker?: string | undefined;
|
|
75
|
+
readonly confidence?: number | undefined;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
}, import("./index.js").AIError, TranscriptionClientService>;
|
|
78
|
+
readonly start: (request: TranscriptionRequestFor) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
|
|
79
|
+
readonly resume: (model: import("./transcription.js").TranscriptionModel<import("./media-model.js").MediaModel.Options>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
|
|
23
80
|
readonly Service: typeof TranscriptionClientService;
|
|
24
|
-
readonly layer: Layer.Layer<TranscriptionClientService, never, import("./route/executor-service.js").RequestExecutorService>;
|
|
25
|
-
readonly generate: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Effect.Effect<TranscriptionResponse, AIError, Service>;
|
|
26
|
-
readonly stream: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
27
|
-
readonly start: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
28
|
-
readonly resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
29
81
|
};
|
|
30
82
|
export {};
|
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
import { Context
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { responseEvents, } from "./transcription.js";
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
import { MediaClient } from "./media-client.js";
|
|
3
|
+
import { TranscriptionFinishEvent, } from "./transcription.js";
|
|
5
4
|
export class TranscriptionClientService extends Context.Service()("@opencode/TranscriptionClient") {
|
|
6
5
|
}
|
|
7
6
|
export const Service = TranscriptionClientService;
|
|
8
|
-
export const generate = (request, options) => Effect.gen(function* () {
|
|
9
|
-
const client = yield* Service;
|
|
10
|
-
return yield* client.generate(request, options);
|
|
11
|
-
});
|
|
12
|
-
export const stream = (request, options) => Stream.unwrap(Effect.gen(function* () {
|
|
13
|
-
const client = yield* Service;
|
|
14
|
-
return client.stream(request, options);
|
|
15
|
-
}));
|
|
16
|
-
export const start = (request) => Effect.gen(function* () {
|
|
17
|
-
const client = yield* Service;
|
|
18
|
-
return yield* client.start(request);
|
|
19
|
-
});
|
|
20
|
-
export const resume = (model, token) => Effect.gen(function* () {
|
|
21
|
-
const client = yield* Service;
|
|
22
|
-
return yield* client.resume(model, token);
|
|
23
|
-
});
|
|
24
|
-
export const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
25
|
-
const executor = yield* RequestExecutor.Service;
|
|
26
|
-
const dispatch = MediaRoute.dispatch({
|
|
27
|
-
modality: "transcription",
|
|
28
|
-
execute: executor.execute,
|
|
29
|
-
responseEvents,
|
|
30
|
-
});
|
|
31
|
-
return Service.of({
|
|
32
|
-
start: (request) => dispatch.start(request.model.route, request),
|
|
33
|
-
resume: (model, token) => dispatch.resume(model.route, model, token),
|
|
34
|
-
generate: (request, options) => dispatch.generate(request.model.route, request, options),
|
|
35
|
-
stream: (request, options) => dispatch.stream(request.model.route, request, options),
|
|
36
|
-
});
|
|
37
|
-
}));
|
|
38
7
|
export const TranscriptionClient = {
|
|
39
8
|
Service,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
resume,
|
|
9
|
+
...MediaClient.make(Service, {
|
|
10
|
+
modality: "transcription",
|
|
11
|
+
responseEvents: (response) => [TranscriptionFinishEvent.make({ ...response })],
|
|
12
|
+
}),
|
|
45
13
|
};
|
package/dist/transcription.d.ts
CHANGED
|
@@ -3,30 +3,22 @@ import { Generation, type AwaitOptions } from "./generation.js";
|
|
|
3
3
|
import { Media } from "./media.js";
|
|
4
4
|
import { MediaModel } from "./media-model.js";
|
|
5
5
|
import { MediaRoute } from "./route/media.js";
|
|
6
|
-
import type { MediaProtocol } from "./route/media-protocol.js";
|
|
7
6
|
import { AIError, HttpOptions } from "./schema/index.js";
|
|
8
7
|
import { Service } from "./transcription-client.js";
|
|
9
|
-
export type TranscriptionOptions =
|
|
10
|
-
export type TranscriptionRoute
|
|
11
|
-
export declare class TranscriptionModel<Options extends TranscriptionOptions = TranscriptionOptions> extends MediaModel<TranscriptionRoute
|
|
8
|
+
export type TranscriptionOptions = MediaModel.Options;
|
|
9
|
+
export type TranscriptionRoute = MediaRoute.AnyRoute<TranscriptionRequestFor, TranscriptionEvent, TranscriptionResponse>;
|
|
10
|
+
export declare class TranscriptionModel<Options extends TranscriptionOptions = TranscriptionOptions> extends MediaModel<TranscriptionRoute, Options> {
|
|
12
11
|
protected readonly _TranscriptionModel: void;
|
|
13
|
-
static make<Options extends TranscriptionOptions = TranscriptionOptions>(input: MediaModel.Input<TranscriptionRoute<Options>>): TranscriptionModel<Options>;
|
|
14
12
|
/** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
|
|
15
|
-
static fromRoute<Options extends TranscriptionOptions>(route:
|
|
16
|
-
static fromRoute<Options extends TranscriptionOptions, Frame, State>(route:
|
|
17
|
-
static fromRoute<Options extends TranscriptionOptions, Token>(route:
|
|
13
|
+
static fromRoute<Options extends TranscriptionOptions>(route: MediaModel.InlineRouteInput<TranscriptionRequestFor<Options>, TranscriptionResponse>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
|
|
14
|
+
static fromRoute<Options extends TranscriptionOptions, Frame, State>(route: MediaModel.StreamRouteInput<TranscriptionRequestFor<Options>, TranscriptionEvent, Frame, State>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
|
|
15
|
+
static fromRoute<Options extends TranscriptionOptions, Token>(route: MediaModel.QueuedRouteInput<TranscriptionRequestFor<Options>, TranscriptionResponse, Token>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
|
|
18
16
|
}
|
|
19
|
-
export declare
|
|
20
|
-
type InlineRouteInput<Options extends TranscriptionOptions = TranscriptionOptions> = MediaModel.RouteInput<TranscriptionRequestFor<Options>, MediaProtocol.Inline<TranscriptionRequestFor<Options>, TranscriptionResponse>>;
|
|
21
|
-
type StreamRouteInput<Options extends TranscriptionOptions = TranscriptionOptions, Frame = unknown, State = unknown> = MediaModel.RouteInput<MediaProtocol.Addressed<TranscriptionRequestFor<Options>>, MediaProtocol.Streamed<TranscriptionRequestFor<Options>, TranscriptionEvent, Frame, State>>;
|
|
22
|
-
type QueuedRouteInput<Options extends TranscriptionOptions = TranscriptionOptions, Token = unknown> = MediaModel.RouteInput<TranscriptionRequestFor<Options>, MediaProtocol.Queued<TranscriptionRequestFor<Options>, TranscriptionResponse, Token>>;
|
|
23
|
-
type RouteInput<Options extends TranscriptionOptions = TranscriptionOptions, Frame = unknown, State = unknown, Token = unknown> = MediaModel.AnyRouteInput<TranscriptionRequestFor<Options>, TranscriptionEvent, TranscriptionResponse, Frame, State, Token>;
|
|
24
|
-
}
|
|
25
|
-
export declare const TranscriptionModelSchema: Schema.declare<TranscriptionModel<TranscriptionOptions>, TranscriptionModel<TranscriptionOptions>>;
|
|
17
|
+
export declare const TranscriptionModelSchema: Schema.declare<TranscriptionModel<MediaModel.Options>, TranscriptionModel<MediaModel.Options>>;
|
|
26
18
|
export declare const TranscriptionTimestamps: Schema.Literals<readonly ["none", "segment", "word"]>;
|
|
27
19
|
export type TranscriptionTimestamps = Schema.Schema.Type<typeof TranscriptionTimestamps>;
|
|
28
20
|
declare const TranscriptionRequest_base: Schema.Class<TranscriptionRequest, Schema.Struct<{
|
|
29
|
-
readonly model: Schema.declare<TranscriptionModel<
|
|
21
|
+
readonly model: Schema.declare<TranscriptionModel<MediaModel.Options>, TranscriptionModel<MediaModel.Options>>;
|
|
30
22
|
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
31
23
|
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
32
24
|
readonly type: Schema.Literal<"bytes">;
|
|
@@ -1483,22 +1475,18 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1483
1475
|
};
|
|
1484
1476
|
};
|
|
1485
1477
|
export type TranscriptionEvent = Schema.Schema.Type<typeof transcriptionEventTagged>;
|
|
1486
|
-
export declare const responseEvents: (response: TranscriptionResponse) => ReadonlyArray<TranscriptionEvent>;
|
|
1487
1478
|
export declare function request<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>): TranscriptionRequestFor<TranscriptionModelOptions<Model>>;
|
|
1488
1479
|
export declare function request(input: TranscriptionRequest): TranscriptionRequest;
|
|
1489
|
-
export declare function generate<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>, options?: AwaitOptions): Effect.Effect<TranscriptionResponse, AIError, Service>;
|
|
1490
|
-
export declare function
|
|
1491
|
-
export declare function stream<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>, options?: AwaitOptions): Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
1492
|
-
export declare function stream(input: TranscriptionRequest, options?: AwaitOptions): Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
1480
|
+
export declare function generate<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>, options?: AwaitOptions): Effect.Effect<TranscriptionResponse, AIError, Service>;
|
|
1481
|
+
export declare function stream<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>, options?: AwaitOptions): Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
1493
1482
|
/** Inline and streaming routes fail with `UnsupportedOperation`. */
|
|
1494
|
-
export declare function start<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>): Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
1495
|
-
export declare
|
|
1496
|
-
export declare const resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
1483
|
+
export declare function start<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>): Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
1484
|
+
export declare const resume: (model: TranscriptionModel, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
1497
1485
|
export declare const Transcription: {
|
|
1498
1486
|
readonly request: typeof request;
|
|
1499
1487
|
readonly generate: typeof generate;
|
|
1500
1488
|
readonly stream: typeof stream;
|
|
1501
1489
|
readonly start: typeof start;
|
|
1502
|
-
readonly resume:
|
|
1490
|
+
readonly resume: (model: TranscriptionModel, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
1503
1491
|
};
|
|
1504
1492
|
export {};
|
package/dist/transcription.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
2
|
import { Generation, ProgressEvent, QueuedEvent } from "./generation.js";
|
|
3
3
|
import { Media } from "./media.js";
|
|
4
|
-
import { MediaModel,
|
|
4
|
+
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
5
5
|
import { MediaRoute } from "./route/media.js";
|
|
6
6
|
import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
|
|
7
7
|
import { TranscriptionClient, Service } from "./transcription-client.js";
|
|
8
8
|
export class TranscriptionModel extends MediaModel {
|
|
9
|
-
static make(input) {
|
|
10
|
-
return new TranscriptionModel(input);
|
|
11
|
-
}
|
|
12
9
|
static fromRoute(route, input) {
|
|
13
10
|
return new TranscriptionModel({
|
|
14
11
|
id: input.id,
|
|
15
12
|
provider: route.protocol.provider,
|
|
16
13
|
http: input.http,
|
|
17
|
-
route:
|
|
14
|
+
route: composeRoute(route, input, collectResponse),
|
|
18
15
|
});
|
|
19
16
|
}
|
|
20
17
|
}
|
|
@@ -94,9 +91,6 @@ export const TranscriptionEvent = Object.assign(transcriptionEventTagged, {
|
|
|
94
91
|
finish: transcriptionEventTagged.guards.finish,
|
|
95
92
|
},
|
|
96
93
|
});
|
|
97
|
-
export const responseEvents = (response) => [
|
|
98
|
-
TranscriptionFinishEvent.make({ ...response }),
|
|
99
|
-
];
|
|
100
94
|
const collectResponse = (events) => {
|
|
101
95
|
const finish = events.find(TranscriptionEvent.is.finish);
|
|
102
96
|
// Every transcription protocol's `finish` emits the terminal event or fails, so a completed stream always has one.
|