@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.
Files changed (264) hide show
  1. package/README.md +133 -69
  2. package/dist/cache-policy.d.ts +1 -1
  3. package/dist/cache-policy.js +16 -4
  4. package/dist/decision-client.d.ts +3 -3
  5. package/dist/decision.d.ts +20 -125
  6. package/dist/decision.js +25 -15
  7. package/dist/effect.d.ts +4 -15
  8. package/dist/effect.js +2 -6
  9. package/dist/effort-updates.d.ts +3 -3
  10. package/dist/effort-updates.js +2 -2
  11. package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
  12. package/dist/experimental/cloudflare-run-extraction.js +4 -1
  13. package/dist/experimental/extraction.d.ts +10 -40
  14. package/dist/experimental/extraction.js +14 -13
  15. package/dist/experimental.d.ts +8 -8
  16. package/dist/experimental.js +4 -4
  17. package/dist/generation.d.ts +0 -2
  18. package/dist/generation.js +2 -2
  19. package/dist/image-client.d.ts +13 -7
  20. package/dist/image-client.js +1 -1
  21. package/dist/image.d.ts +357 -464
  22. package/dist/image.js +17 -15
  23. package/dist/index.d.ts +28 -465
  24. package/dist/index.js +18 -17
  25. package/dist/llm.d.ts +65 -266
  26. package/dist/llm.js +101 -92
  27. package/dist/loop.d.ts +38 -0
  28. package/dist/loop.js +136 -0
  29. package/dist/media-model.d.ts +1 -1
  30. package/dist/media-model.js +8 -6
  31. package/dist/media.d.ts +9 -0
  32. package/dist/media.js +37 -2
  33. package/dist/protocols/alibaba-chat.d.ts +5 -1
  34. package/dist/protocols/alibaba-chat.js +3 -3
  35. package/dist/protocols/alibaba-images.d.ts +2 -2
  36. package/dist/protocols/alibaba-messages.js +3 -3
  37. package/dist/protocols/alibaba-responses.js +8 -20
  38. package/dist/protocols/anthropic-messages.d.ts +1 -1
  39. package/dist/protocols/anthropic-messages.js +54 -173
  40. package/dist/protocols/assemblyai-transcription.d.ts +2 -2
  41. package/dist/protocols/bedrock-converse.js +10 -16
  42. package/dist/protocols/cartesia-speech.d.ts +2 -2
  43. package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
  44. package/dist/protocols/cohere-chat.js +9 -12
  45. package/dist/protocols/deepgram-speech.d.ts +2 -2
  46. package/dist/protocols/deepgram-transcription.d.ts +2 -2
  47. package/dist/protocols/elevenlabs-speech.d.ts +2 -2
  48. package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
  49. package/dist/protocols/gemini.d.ts +3 -0
  50. package/dist/protocols/gemini.js +54 -72
  51. package/dist/protocols/google-images.d.ts +2 -2
  52. package/dist/protocols/google-interactions.d.ts +3 -4
  53. package/dist/protocols/google-interactions.js +44 -30
  54. package/dist/protocols/google-speech.d.ts +2 -2
  55. package/dist/protocols/google-transcription.d.ts +2 -2
  56. package/dist/protocols/google-video.d.ts +2 -2
  57. package/dist/protocols/meta-images.d.ts +2 -2
  58. package/dist/protocols/meta-responses.js +26 -23
  59. package/dist/protocols/minimax-images.d.ts +2 -2
  60. package/dist/protocols/mistral-chat.js +7 -10
  61. package/dist/protocols/open-responses-channel.js +6 -19
  62. package/dist/protocols/open-responses-continuation.d.ts +1 -5
  63. package/dist/protocols/open-responses-continuation.js +1 -3
  64. package/dist/protocols/open-responses.d.ts +1 -21
  65. package/dist/protocols/open-responses.js +10 -15
  66. package/dist/protocols/openai-chat.d.ts +3 -23
  67. package/dist/protocols/openai-chat.js +26 -47
  68. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  69. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  70. package/dist/protocols/openai-compatible-responses.js +1 -1
  71. package/dist/protocols/openai-decisions.js +1 -1
  72. package/dist/protocols/openai-images.d.ts +2 -2
  73. package/dist/protocols/openai-responses.js +10 -29
  74. package/dist/protocols/openai-speech.d.ts +2 -2
  75. package/dist/protocols/openai-transcription.d.ts +2 -2
  76. package/dist/protocols/runway-video.d.ts +2 -2
  77. package/dist/protocols/shared.d.ts +1 -4
  78. package/dist/protocols/shared.js +13 -11
  79. package/dist/protocols/system-one.d.ts +4 -4
  80. package/dist/protocols/utils/bedrock-cache.js +2 -5
  81. package/dist/protocols/utils/bedrock-media.d.ts +0 -3
  82. package/dist/protocols/utils/cache.d.ts +3 -0
  83. package/dist/protocols/utils/cache.js +15 -2
  84. package/dist/protocols/utils/image-sizing.d.ts +1 -1
  85. package/dist/protocols/utils/responses-checkpoint.js +1 -1
  86. package/dist/protocols/utils/responses-compaction.d.ts +1 -1
  87. package/dist/protocols/utils/responses-compaction.js +6 -5
  88. package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
  89. package/dist/protocols/utils/responses-hosted-tools.js +31 -0
  90. package/dist/protocols/utils/tool-stream.d.ts +5 -271
  91. package/dist/protocols/utils/tool-stream.js +3 -13
  92. package/dist/protocols/venice-chat.d.ts +3 -1
  93. package/dist/protocols/venice-chat.js +4 -4
  94. package/dist/protocols/xai-images.d.ts +2 -2
  95. package/dist/protocols/xai-responses.js +5 -25
  96. package/dist/protocols/xai-video.d.ts +2 -2
  97. package/dist/protocols/zai-chat.d.ts +5 -1
  98. package/dist/protocols/zai-chat.js +1 -1
  99. package/dist/protocols/zai-images.d.ts +2 -2
  100. package/dist/protocols/zai-messages.js +3 -3
  101. package/dist/provider-error.d.ts +0 -1
  102. package/dist/provider-error.js +7 -80
  103. package/dist/providers/alibaba.d.ts +67 -4
  104. package/dist/providers/alibaba.js +6 -1
  105. package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
  106. package/dist/providers/amazon-bedrock-mantle.js +6 -3
  107. package/dist/providers/amazon-bedrock.d.ts +6 -7
  108. package/dist/providers/amazon-bedrock.js +1 -1
  109. package/dist/providers/anthropic-compatible.d.ts +7 -8
  110. package/dist/providers/anthropic-compatible.js +2 -5
  111. package/dist/providers/anthropic.d.ts +8 -9
  112. package/dist/providers/anthropic.js +2 -7
  113. package/dist/providers/assemblyai.d.ts +2 -2
  114. package/dist/providers/assemblyai.js +2 -7
  115. package/dist/providers/azure/messages.d.ts +2 -0
  116. package/dist/providers/azure/messages.js +1 -0
  117. package/dist/providers/azure.d.ts +322 -7
  118. package/dist/providers/azure.js +25 -9
  119. package/dist/providers/baseten.d.ts +5 -5
  120. package/dist/providers/baseten.js +7 -21
  121. package/dist/providers/cartesia.d.ts +1 -1
  122. package/dist/providers/cerebras.d.ts +5 -5
  123. package/dist/providers/cerebras.js +4 -15
  124. package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
  125. package/dist/providers/cloudflare-ai-gateway.js +28 -40
  126. package/dist/providers/cloudflare-shared.d.ts +9 -0
  127. package/dist/providers/cloudflare-shared.js +25 -0
  128. package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
  129. package/dist/providers/cloudflare-workers-ai.js +4 -20
  130. package/dist/providers/cohere/chat.js +2 -7
  131. package/dist/providers/cohere.d.ts +6 -5
  132. package/dist/providers/cohere.js +7 -13
  133. package/dist/providers/deepgram.d.ts +2 -2
  134. package/dist/providers/deepgram.js +2 -7
  135. package/dist/providers/deepinfra.d.ts +5 -5
  136. package/dist/providers/deepinfra.js +5 -13
  137. package/dist/providers/deepseek.d.ts +5 -5
  138. package/dist/providers/deepseek.js +3 -14
  139. package/dist/providers/digitalocean.d.ts +8 -5
  140. package/dist/providers/digitalocean.js +13 -14
  141. package/dist/providers/elevenlabs.d.ts +2 -2
  142. package/dist/providers/elevenlabs.js +2 -7
  143. package/dist/providers/fireworks.d.ts +5 -5
  144. package/dist/providers/fireworks.js +4 -15
  145. package/dist/providers/google/interactions.d.ts +1 -1
  146. package/dist/providers/google/interactions.js +2 -7
  147. package/dist/providers/google-vertex-chat.d.ts +3 -3
  148. package/dist/providers/google-vertex-chat.js +3 -29
  149. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  150. package/dist/providers/google-vertex-messages.d.ts +3 -3
  151. package/dist/providers/google-vertex-messages.js +3 -29
  152. package/dist/providers/google-vertex-mistral.d.ts +3 -3
  153. package/dist/providers/google-vertex-mistral.js +3 -29
  154. package/dist/providers/google-vertex-responses.d.ts +3 -3
  155. package/dist/providers/google-vertex-responses.js +4 -30
  156. package/dist/providers/google-vertex-shared.d.ts +31 -0
  157. package/dist/providers/google-vertex-shared.js +25 -0
  158. package/dist/providers/google-vertex.d.ts +3 -3
  159. package/dist/providers/google.d.ts +15 -13
  160. package/dist/providers/google.js +9 -19
  161. package/dist/providers/groq.d.ts +5 -5
  162. package/dist/providers/groq.js +4 -15
  163. package/dist/providers/meta.d.ts +5 -5
  164. package/dist/providers/meta.js +10 -23
  165. package/dist/providers/minimax/chat.js +2 -7
  166. package/dist/providers/minimax/responses.js +2 -7
  167. package/dist/providers/minimax.d.ts +5 -5
  168. package/dist/providers/minimax.js +7 -22
  169. package/dist/providers/mistral.d.ts +10 -11
  170. package/dist/providers/mistral.js +3 -14
  171. package/dist/providers/moonshot/messages.js +2 -7
  172. package/dist/providers/moonshot/responses.js +2 -7
  173. package/dist/providers/moonshot.d.ts +5 -5
  174. package/dist/providers/moonshot.js +4 -16
  175. package/dist/providers/openai-compatible-responses.d.ts +6 -7
  176. package/dist/providers/openai-compatible-responses.js +2 -8
  177. package/dist/providers/openai-compatible.d.ts +6 -7
  178. package/dist/providers/openai-compatible.js +4 -10
  179. package/dist/providers/openai.d.ts +4 -4
  180. package/dist/providers/openai.js +3 -3
  181. package/dist/providers/opencode.d.ts +4 -4
  182. package/dist/providers/opencode.js +6 -2
  183. package/dist/providers/openrouter.d.ts +8 -5
  184. package/dist/providers/openrouter.js +16 -24
  185. package/dist/providers/runway.d.ts +1 -1
  186. package/dist/providers/settings.d.ts +40 -0
  187. package/dist/providers/settings.js +19 -0
  188. package/dist/providers/togetherai.d.ts +5 -5
  189. package/dist/providers/togetherai.js +5 -15
  190. package/dist/providers/typesafe-ai.d.ts +4 -4
  191. package/dist/providers/typesafe-ai.js +6 -2
  192. package/dist/providers/venice.d.ts +4 -4
  193. package/dist/providers/venice.js +6 -2
  194. package/dist/providers/vercel-ai-gateway.d.ts +5 -5
  195. package/dist/providers/vercel-ai-gateway.js +15 -28
  196. package/dist/providers/xai.d.ts +4 -4
  197. package/dist/providers/xai.js +4 -12
  198. package/dist/providers/zai-coding-plan/messages.js +2 -7
  199. package/dist/providers/zai-coding-plan/responses.js +2 -7
  200. package/dist/providers/zai-coding-plan.d.ts +5 -5
  201. package/dist/providers/zai-coding-plan.js +8 -15
  202. package/dist/providers/zai.d.ts +5 -5
  203. package/dist/providers/zai.js +10 -22
  204. package/dist/public.d.ts +12 -0
  205. package/dist/public.js +5 -0
  206. package/dist/route/auth-options.d.ts +9 -5
  207. package/dist/route/auth-options.js +10 -7
  208. package/dist/route/client.d.ts +50 -37
  209. package/dist/route/client.js +42 -53
  210. package/dist/route/decision.d.ts +8 -8
  211. package/dist/route/decision.js +3 -3
  212. package/dist/route/executor.d.ts +5 -0
  213. package/dist/route/executor.js +10 -0
  214. package/dist/route/index.d.ts +5 -7
  215. package/dist/route/index.js +1 -1
  216. package/dist/route/media.d.ts +7 -11
  217. package/dist/route/media.js +22 -26
  218. package/dist/route/transport/http.js +6 -5
  219. package/dist/route/transport/websocket.js +7 -1
  220. package/dist/schema/errors.d.ts +16 -17
  221. package/dist/schema/errors.js +63 -12
  222. package/dist/schema/events.d.ts +2563 -2954
  223. package/dist/schema/events.js +54 -109
  224. package/dist/schema/messages.d.ts +194 -137
  225. package/dist/schema/messages.js +66 -83
  226. package/dist/schema/options.d.ts +112 -65
  227. package/dist/schema/options.js +52 -101
  228. package/dist/speech-client.d.ts +7 -7
  229. package/dist/speech.d.ts +306 -316
  230. package/dist/speech.js +16 -14
  231. package/dist/testing.d.ts +31 -175
  232. package/dist/testing.js +60 -5
  233. package/dist/tool-history.d.ts +1 -1
  234. package/dist/tool-history.js +3 -10
  235. package/dist/tool-runtime.d.ts +9 -2
  236. package/dist/tool-runtime.js +17 -31
  237. package/dist/tool.d.ts +39 -43
  238. package/dist/tool.js +16 -26
  239. package/dist/transcription-client.d.ts +7 -7
  240. package/dist/transcription.d.ts +314 -265
  241. package/dist/transcription.js +16 -14
  242. package/dist/utils/provider-codes.d.ts +3 -0
  243. package/dist/utils/provider-codes.js +41 -0
  244. package/dist/video-client.d.ts +7 -7
  245. package/dist/video-client.js +1 -1
  246. package/dist/video.d.ts +269 -287
  247. package/dist/video.js +16 -14
  248. package/package.json +9 -9
  249. package/dist/experimental/testing.d.ts +0 -3
  250. package/dist/experimental/testing.js +0 -3
  251. package/dist/testing/decision.d.ts +0 -16
  252. package/dist/testing/decision.js +0 -20
  253. package/dist/testing/image.d.ts +0 -14
  254. package/dist/testing/image.js +0 -12
  255. package/dist/testing/media.d.ts +0 -18
  256. package/dist/testing/media.js +0 -36
  257. package/dist/testing/script.d.ts +0 -28
  258. package/dist/testing/script.js +0 -60
  259. package/dist/testing/speech.d.ts +0 -14
  260. package/dist/testing/speech.js +0 -12
  261. package/dist/testing/transcription.d.ts +0 -14
  262. package/dist/testing/transcription.js +0 -12
  263. package/dist/testing/video.d.ts +0 -14
  264. package/dist/testing/video.js +0 -12
@@ -3,16 +3,16 @@ 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 { AIError, HttpOptions } from "./schema/index.js";
6
+ import { AIError, type BaseRequest } from "./schema/index.js";
7
7
  import { Service } from "./transcription-client.js";
8
8
  export type TranscriptionOptions = MediaModel.Options;
9
- export type TranscriptionRoute = MediaRoute.AnyRoute<TranscriptionRequestFor, TranscriptionEvent, TranscriptionResponse>;
9
+ export type TranscriptionRoute = MediaRoute.AnyRoute<TranscriptionRequest, TranscriptionEvent, TranscriptionResponse>;
10
10
  export declare class TranscriptionModel<Options extends TranscriptionOptions = TranscriptionOptions> extends MediaModel<TranscriptionRoute, Options> {
11
11
  protected readonly _TranscriptionModel: void;
12
12
  /** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
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>;
13
+ static fromRoute<Options extends TranscriptionOptions>(route: MediaModel.InlineRouteInput<TranscriptionRequest<TranscriptionModel<Options>>, TranscriptionResponse>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
14
+ static fromRoute<Options extends TranscriptionOptions, Frame, State>(route: MediaModel.StreamRouteInput<TranscriptionRequest<TranscriptionModel<Options>>, TranscriptionEvent, Frame, State>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
15
+ static fromRoute<Options extends TranscriptionOptions, Token>(route: MediaModel.QueuedRouteInput<TranscriptionRequest<TranscriptionModel<Options>>, TranscriptionResponse, Token>, input: MediaRoute.ModelInput): TranscriptionModel<Options>;
16
16
  }
17
17
  export declare const TranscriptionModelSchema: Schema.declare<TranscriptionModel<{
18
18
  readonly [x: string]: unknown;
@@ -21,7 +21,7 @@ export declare const TranscriptionModelSchema: Schema.declare<TranscriptionModel
21
21
  }>>;
22
22
  export declare const TranscriptionTimestamps: Schema.Literals<readonly ["none", "segment", "word"]>;
23
23
  export type TranscriptionTimestamps = Schema.Schema.Type<typeof TranscriptionTimestamps>;
24
- declare const TranscriptionRequest_base: Schema.Class<TranscriptionRequest, Schema.Struct<{
24
+ declare const TranscriptionRequestSchema: Schema.Struct<{
25
25
  readonly model: Schema.declare<TranscriptionModel<{
26
26
  readonly [x: string]: unknown;
27
27
  }>, TranscriptionModel<{
@@ -65,20 +65,13 @@ declare const TranscriptionRequest_base: Schema.Class<TranscriptionRequest, Sche
65
65
  readonly diarize: Schema.optional<Schema.Boolean>;
66
66
  readonly speakers: Schema.optional<Schema.Int>;
67
67
  readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
68
- readonly http: Schema.optional<typeof HttpOptions>;
69
- }>, {}>;
70
- export declare class TranscriptionRequest extends TranscriptionRequest_base {
71
- protected readonly _TranscriptionRequest: void;
72
- }
73
- export type TranscriptionRequestFor<Options extends TranscriptionOptions = TranscriptionOptions> = Omit<TranscriptionRequest, "model" | "providerOptions"> & {
74
- readonly model: TranscriptionModel<Options>;
75
- readonly providerOptions?: Options;
76
- };
68
+ }>;
69
+ /** A normalized transcription request, the plain object `Transcription.request(...)` returns. */
70
+ export type TranscriptionRequest<Model extends TranscriptionModel = TranscriptionModel> = Omit<typeof TranscriptionRequestSchema.Type, "model" | "providerOptions"> & BaseRequest<Model, TranscriptionModelOptions<Model>>;
77
71
  export type TranscriptionModelOptions<Model> = Model extends TranscriptionModel<infer Options> ? Options : never;
78
- export type TranscriptionRequestInput<Model extends TranscriptionModel = TranscriptionModel> = Omit<ConstructorParameters<typeof TranscriptionRequest>[0], "model" | "providerOptions" | "http"> & {
79
- readonly model: Model;
72
+ /** Input accepted by `Transcription.request` and the calls; a `TranscriptionRequest` is also a valid input. */
73
+ export type TranscriptionRequestInput<Model extends TranscriptionModel = TranscriptionModel> = Omit<TranscriptionRequest<Model>, "providerOptions"> & {
80
74
  readonly providerOptions?: NoInfer<TranscriptionModelOptions<Model>>;
81
- readonly http?: HttpOptions.Input;
82
75
  };
83
76
  /** Speaker labels are provider-native (`A`, `0`, `spk:0`, `speaker_0`, or a known speaker name). */
84
77
  export declare const TranscriptionSegment: Schema.Struct<{
@@ -579,64 +572,70 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
579
572
  };
580
573
  };
581
574
  readonly match: {
582
- <Cases extends { [M in Schema.Struct<{
583
- readonly type: Schema.tag<"generation-queued">;
584
- readonly id: Schema.String;
585
- readonly position: Schema.optional<Schema.Number>;
586
- }> | Schema.Struct<{
587
- readonly type: Schema.tag<"generation-progress">;
588
- readonly id: Schema.String;
589
- readonly progress: Schema.optional<Schema.Number>;
590
- }> | Schema.Struct<{
591
- readonly type: Schema.tag<"text-delta">;
592
- readonly delta: Schema.String;
593
- }> | Schema.Struct<{
594
- readonly type: Schema.tag<"segment">;
595
- readonly segment: Schema.Struct<{
575
+ <Handlers extends { [K in "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"]: (value: {
576
+ readonly finish: Schema.Struct<{
596
577
  readonly text: Schema.String;
597
- readonly startSeconds: Schema.Number;
598
- readonly endSeconds: Schema.Number;
599
- readonly speaker: Schema.optional<Schema.String>;
578
+ readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
579
+ readonly text: Schema.String;
580
+ readonly startSeconds: Schema.Number;
581
+ readonly endSeconds: Schema.Number;
582
+ readonly speaker: Schema.optional<Schema.String>;
583
+ }>>>;
584
+ readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
585
+ readonly text: Schema.String;
586
+ readonly startSeconds: Schema.Number;
587
+ readonly endSeconds: Schema.Number;
588
+ readonly speaker: Schema.optional<Schema.String>;
589
+ readonly confidence: Schema.optional<Schema.Number>;
590
+ }>>>;
591
+ readonly language: Schema.optional<Schema.String>;
592
+ readonly durationSeconds: Schema.optional<Schema.Number>;
593
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
594
+ readonly type: Schema.Literal<"tokens">;
595
+ readonly input: Schema.optional<Schema.Number>;
596
+ readonly output: Schema.optional<Schema.Number>;
597
+ readonly total: Schema.optional<Schema.Number>;
598
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
599
+ }>, Schema.Struct<{
600
+ readonly type: Schema.Literal<"seconds">;
601
+ readonly seconds: Schema.Number;
602
+ }>, Schema.Struct<{
603
+ readonly type: Schema.Literal<"characters">;
604
+ readonly characters: Schema.Number;
605
+ }>, Schema.Struct<{
606
+ readonly type: Schema.Literal<"credits">;
607
+ readonly credits: Schema.Number;
608
+ }>, Schema.Struct<{
609
+ readonly type: Schema.Literal<"compute">;
610
+ readonly seconds: Schema.Number;
611
+ }>]>>;
612
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
613
+ readonly type: Schema.tag<"finish">;
600
614
  }>;
601
- }> | Schema.Struct<{
602
- readonly text: Schema.String;
603
- readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
604
- readonly text: Schema.String;
605
- readonly startSeconds: Schema.Number;
606
- readonly endSeconds: Schema.Number;
607
- readonly speaker: Schema.optional<Schema.String>;
608
- }>>>;
609
- readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
610
- readonly text: Schema.String;
611
- readonly startSeconds: Schema.Number;
612
- readonly endSeconds: Schema.Number;
613
- readonly speaker: Schema.optional<Schema.String>;
614
- readonly confidence: Schema.optional<Schema.Number>;
615
- }>>>;
616
- readonly language: Schema.optional<Schema.String>;
617
- readonly durationSeconds: Schema.optional<Schema.Number>;
618
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
619
- readonly type: Schema.Literal<"tokens">;
620
- readonly input: Schema.optional<Schema.Number>;
621
- readonly output: Schema.optional<Schema.Number>;
622
- readonly total: Schema.optional<Schema.Number>;
623
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
624
- }>, Schema.Struct<{
625
- readonly type: Schema.Literal<"seconds">;
626
- readonly seconds: Schema.Number;
627
- }>, Schema.Struct<{
628
- readonly type: Schema.Literal<"characters">;
629
- readonly characters: Schema.Number;
630
- }>, Schema.Struct<{
631
- readonly type: Schema.Literal<"credits">;
632
- readonly credits: Schema.Number;
633
- }>, Schema.Struct<{
634
- readonly type: Schema.Literal<"compute">;
635
- readonly seconds: Schema.Number;
636
- }>]>>;
637
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
638
- readonly type: Schema.tag<"finish">;
639
- }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
615
+ readonly "generation-progress": Schema.Struct<{
616
+ readonly type: Schema.tag<"generation-progress">;
617
+ readonly id: Schema.String;
618
+ readonly progress: Schema.optional<Schema.Number>;
619
+ }>;
620
+ readonly "generation-queued": Schema.Struct<{
621
+ readonly type: Schema.tag<"generation-queued">;
622
+ readonly id: Schema.String;
623
+ readonly position: Schema.optional<Schema.Number>;
624
+ }>;
625
+ readonly segment: Schema.Struct<{
626
+ readonly type: Schema.tag<"segment">;
627
+ readonly segment: Schema.Struct<{
628
+ readonly text: Schema.String;
629
+ readonly startSeconds: Schema.Number;
630
+ readonly endSeconds: Schema.Number;
631
+ readonly speaker: Schema.optional<Schema.String>;
632
+ }>;
633
+ }>;
634
+ readonly "text-delta": Schema.Struct<{
635
+ readonly type: Schema.tag<"text-delta">;
636
+ readonly delta: Schema.String;
637
+ }>;
638
+ }[K]["Type"]) => any; }>(value: {
640
639
  readonly type: "text-delta";
641
640
  readonly delta: string;
642
641
  } | {
@@ -699,65 +698,71 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
699
698
  };
700
699
  } | undefined;
701
700
  readonly type: "finish";
702
- }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
703
- <Cases extends { [M in Schema.Struct<{
704
- readonly type: Schema.tag<"generation-queued">;
705
- readonly id: Schema.String;
706
- readonly position: Schema.optional<Schema.Number>;
707
- }> | Schema.Struct<{
708
- readonly type: Schema.tag<"generation-progress">;
709
- readonly id: Schema.String;
710
- readonly progress: Schema.optional<Schema.Number>;
711
- }> | Schema.Struct<{
712
- readonly type: Schema.tag<"text-delta">;
713
- readonly delta: Schema.String;
714
- }> | Schema.Struct<{
715
- readonly type: Schema.tag<"segment">;
716
- readonly segment: Schema.Struct<{
701
+ }, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"]>>;
702
+ <Handlers extends { [K in "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"]: (value: {
703
+ readonly finish: Schema.Struct<{
717
704
  readonly text: Schema.String;
718
- readonly startSeconds: Schema.Number;
719
- readonly endSeconds: Schema.Number;
720
- readonly speaker: Schema.optional<Schema.String>;
705
+ readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
706
+ readonly text: Schema.String;
707
+ readonly startSeconds: Schema.Number;
708
+ readonly endSeconds: Schema.Number;
709
+ readonly speaker: Schema.optional<Schema.String>;
710
+ }>>>;
711
+ readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
712
+ readonly text: Schema.String;
713
+ readonly startSeconds: Schema.Number;
714
+ readonly endSeconds: Schema.Number;
715
+ readonly speaker: Schema.optional<Schema.String>;
716
+ readonly confidence: Schema.optional<Schema.Number>;
717
+ }>>>;
718
+ readonly language: Schema.optional<Schema.String>;
719
+ readonly durationSeconds: Schema.optional<Schema.Number>;
720
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
721
+ readonly type: Schema.Literal<"tokens">;
722
+ readonly input: Schema.optional<Schema.Number>;
723
+ readonly output: Schema.optional<Schema.Number>;
724
+ readonly total: Schema.optional<Schema.Number>;
725
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
726
+ }>, Schema.Struct<{
727
+ readonly type: Schema.Literal<"seconds">;
728
+ readonly seconds: Schema.Number;
729
+ }>, Schema.Struct<{
730
+ readonly type: Schema.Literal<"characters">;
731
+ readonly characters: Schema.Number;
732
+ }>, Schema.Struct<{
733
+ readonly type: Schema.Literal<"credits">;
734
+ readonly credits: Schema.Number;
735
+ }>, Schema.Struct<{
736
+ readonly type: Schema.Literal<"compute">;
737
+ readonly seconds: Schema.Number;
738
+ }>]>>;
739
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
740
+ readonly type: Schema.tag<"finish">;
721
741
  }>;
722
- }> | Schema.Struct<{
723
- readonly text: Schema.String;
724
- readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
725
- readonly text: Schema.String;
726
- readonly startSeconds: Schema.Number;
727
- readonly endSeconds: Schema.Number;
728
- readonly speaker: Schema.optional<Schema.String>;
729
- }>>>;
730
- readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
731
- readonly text: Schema.String;
732
- readonly startSeconds: Schema.Number;
733
- readonly endSeconds: Schema.Number;
734
- readonly speaker: Schema.optional<Schema.String>;
735
- readonly confidence: Schema.optional<Schema.Number>;
736
- }>>>;
737
- readonly language: Schema.optional<Schema.String>;
738
- readonly durationSeconds: Schema.optional<Schema.Number>;
739
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
740
- readonly type: Schema.Literal<"tokens">;
741
- readonly input: Schema.optional<Schema.Number>;
742
- readonly output: Schema.optional<Schema.Number>;
743
- readonly total: Schema.optional<Schema.Number>;
744
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
745
- }>, Schema.Struct<{
746
- readonly type: Schema.Literal<"seconds">;
747
- readonly seconds: Schema.Number;
748
- }>, Schema.Struct<{
749
- readonly type: Schema.Literal<"characters">;
750
- readonly characters: Schema.Number;
751
- }>, Schema.Struct<{
752
- readonly type: Schema.Literal<"credits">;
753
- readonly credits: Schema.Number;
754
- }>, Schema.Struct<{
755
- readonly type: Schema.Literal<"compute">;
756
- readonly seconds: Schema.Number;
757
- }>]>>;
758
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
759
- readonly type: Schema.tag<"finish">;
760
- }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
742
+ readonly "generation-progress": Schema.Struct<{
743
+ readonly type: Schema.tag<"generation-progress">;
744
+ readonly id: Schema.String;
745
+ readonly progress: Schema.optional<Schema.Number>;
746
+ }>;
747
+ readonly "generation-queued": Schema.Struct<{
748
+ readonly type: Schema.tag<"generation-queued">;
749
+ readonly id: Schema.String;
750
+ readonly position: Schema.optional<Schema.Number>;
751
+ }>;
752
+ readonly segment: Schema.Struct<{
753
+ readonly type: Schema.tag<"segment">;
754
+ readonly segment: Schema.Struct<{
755
+ readonly text: Schema.String;
756
+ readonly startSeconds: Schema.Number;
757
+ readonly endSeconds: Schema.Number;
758
+ readonly speaker: Schema.optional<Schema.String>;
759
+ }>;
760
+ }>;
761
+ readonly "text-delta": Schema.Struct<{
762
+ readonly type: Schema.tag<"text-delta">;
763
+ readonly delta: Schema.String;
764
+ }>;
765
+ }[K]["Type"]) => any; }>(cases: Handlers): (value: {
761
766
  readonly type: "text-delta";
762
767
  readonly delta: string;
763
768
  } | {
@@ -820,67 +825,10 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
820
825
  };
821
826
  } | undefined;
822
827
  readonly type: "finish";
823
- }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
828
+ }) => import("effect/Unify").Unify<ReturnType<Handlers["finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"]>>;
824
829
  };
825
830
  readonly matchOrElse: {
826
- <Cases extends { [M in Schema.Struct<{
827
- readonly type: Schema.tag<"generation-queued">;
828
- readonly id: Schema.String;
829
- readonly position: Schema.optional<Schema.Number>;
830
- }> | Schema.Struct<{
831
- readonly type: Schema.tag<"generation-progress">;
832
- readonly id: Schema.String;
833
- readonly progress: Schema.optional<Schema.Number>;
834
- }> | Schema.Struct<{
835
- readonly type: Schema.tag<"text-delta">;
836
- readonly delta: Schema.String;
837
- }> | Schema.Struct<{
838
- readonly type: Schema.tag<"segment">;
839
- readonly segment: Schema.Struct<{
840
- readonly text: Schema.String;
841
- readonly startSeconds: Schema.Number;
842
- readonly endSeconds: Schema.Number;
843
- readonly speaker: Schema.optional<Schema.String>;
844
- }>;
845
- }> | Schema.Struct<{
846
- readonly text: Schema.String;
847
- readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
848
- readonly text: Schema.String;
849
- readonly startSeconds: Schema.Number;
850
- readonly endSeconds: Schema.Number;
851
- readonly speaker: Schema.optional<Schema.String>;
852
- }>>>;
853
- readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
854
- readonly text: Schema.String;
855
- readonly startSeconds: Schema.Number;
856
- readonly endSeconds: Schema.Number;
857
- readonly speaker: Schema.optional<Schema.String>;
858
- readonly confidence: Schema.optional<Schema.Number>;
859
- }>>>;
860
- readonly language: Schema.optional<Schema.String>;
861
- readonly durationSeconds: Schema.optional<Schema.Number>;
862
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
863
- readonly type: Schema.Literal<"tokens">;
864
- readonly input: Schema.optional<Schema.Number>;
865
- readonly output: Schema.optional<Schema.Number>;
866
- readonly total: Schema.optional<Schema.Number>;
867
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
868
- }>, Schema.Struct<{
869
- readonly type: Schema.Literal<"seconds">;
870
- readonly seconds: Schema.Number;
871
- }>, Schema.Struct<{
872
- readonly type: Schema.Literal<"characters">;
873
- readonly characters: Schema.Number;
874
- }>, Schema.Struct<{
875
- readonly type: Schema.Literal<"credits">;
876
- readonly credits: Schema.Number;
877
- }>, Schema.Struct<{
878
- readonly type: Schema.Literal<"compute">;
879
- readonly seconds: Schema.Number;
880
- }>]>>;
881
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
882
- readonly type: Schema.tag<"finish">;
883
- }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta">]: never; }, OrElse extends (value: Exclude<{
831
+ <Handlers, OrElse>(value: {
884
832
  readonly type: "text-delta";
885
833
  readonly delta: string;
886
834
  } | {
@@ -943,10 +891,81 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
943
891
  };
944
892
  } | undefined;
945
893
  readonly type: "finish";
946
- }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
894
+ }, cases: Handlers & {
895
+ readonly finish?: ((value: {
896
+ readonly text: string;
897
+ readonly segments?: readonly {
898
+ readonly text: string;
899
+ readonly startSeconds: number;
900
+ readonly endSeconds: number;
901
+ readonly speaker?: string | undefined;
902
+ }[] | undefined;
903
+ readonly words?: readonly {
904
+ readonly text: string;
905
+ readonly startSeconds: number;
906
+ readonly endSeconds: number;
907
+ readonly speaker?: string | undefined;
908
+ readonly confidence?: number | undefined;
909
+ }[] | undefined;
910
+ readonly language?: string | undefined;
911
+ readonly durationSeconds?: number | undefined;
912
+ readonly usage?: {
913
+ readonly type: "seconds";
914
+ readonly seconds: number;
915
+ } | {
916
+ readonly type: "characters";
917
+ readonly characters: number;
918
+ } | {
919
+ readonly type: "credits";
920
+ readonly credits: number;
921
+ } | {
922
+ readonly type: "compute";
923
+ readonly seconds: number;
924
+ } | {
925
+ readonly type: "tokens";
926
+ readonly input?: number | undefined;
927
+ readonly output?: number | undefined;
928
+ readonly total?: number | undefined;
929
+ readonly details?: {
930
+ readonly [x: string]: unknown;
931
+ } | undefined;
932
+ } | undefined;
933
+ readonly providerMetadata?: {
934
+ readonly [x: string]: {
935
+ readonly [x: string]: unknown;
936
+ };
937
+ } | undefined;
938
+ readonly type: "finish";
939
+ }) => any) | undefined;
940
+ readonly "generation-progress"?: ((value: {
941
+ readonly type: "generation-progress";
942
+ readonly id: string;
943
+ readonly progress?: number | undefined;
944
+ }) => any) | undefined;
945
+ readonly "generation-queued"?: ((value: {
946
+ readonly type: "generation-queued";
947
+ readonly id: string;
948
+ readonly position?: number | undefined;
949
+ }) => any) | undefined;
950
+ readonly segment?: ((value: {
951
+ readonly type: "segment";
952
+ readonly segment: {
953
+ readonly text: string;
954
+ readonly startSeconds: number;
955
+ readonly endSeconds: number;
956
+ readonly speaker?: string | undefined;
957
+ };
958
+ }) => any) | undefined;
959
+ readonly "text-delta"?: ((value: {
960
+ readonly type: "text-delta";
961
+ readonly delta: string;
962
+ }) => any) | undefined;
963
+ } & (Exclude<keyof Handlers, "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
947
964
  readonly type: "text-delta";
948
965
  readonly delta: string;
949
- } | {
966
+ }, {
967
+ readonly type: keyof Handlers;
968
+ }> | Exclude<{
950
969
  readonly type: "segment";
951
970
  readonly segment: {
952
971
  readonly text: string;
@@ -954,15 +973,21 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
954
973
  readonly endSeconds: number;
955
974
  readonly speaker?: string | undefined;
956
975
  };
957
- } | {
976
+ }, {
977
+ readonly type: keyof Handlers;
978
+ }> | Exclude<{
958
979
  readonly type: "generation-queued";
959
980
  readonly id: string;
960
981
  readonly position?: number | undefined;
961
- } | {
982
+ }, {
983
+ readonly type: keyof Handlers;
984
+ }> | Exclude<{
962
985
  readonly type: "generation-progress";
963
986
  readonly id: string;
964
987
  readonly progress?: number | undefined;
965
- } | {
988
+ }, {
989
+ readonly type: keyof Handlers;
990
+ }> | Exclude<{
966
991
  readonly text: string;
967
992
  readonly segments?: readonly {
968
993
  readonly text: string;
@@ -1006,68 +1031,84 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
1006
1031
  };
1007
1032
  } | undefined;
1008
1033
  readonly type: "finish";
1009
- }, cases: Cases, orElse: OrElse): import("effect/Unify").Unify<{ [K in keyof Cases]-?: NonNullable<Cases[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1010
- <Cases extends { [M in Schema.Struct<{
1011
- readonly type: Schema.tag<"generation-queued">;
1012
- readonly id: Schema.String;
1013
- readonly position: Schema.optional<Schema.Number>;
1014
- }> | Schema.Struct<{
1015
- readonly type: Schema.tag<"generation-progress">;
1016
- readonly id: Schema.String;
1017
- readonly progress: Schema.optional<Schema.Number>;
1018
- }> | Schema.Struct<{
1019
- readonly type: Schema.tag<"text-delta">;
1020
- readonly delta: Schema.String;
1021
- }> | Schema.Struct<{
1022
- readonly type: Schema.tag<"segment">;
1023
- readonly segment: Schema.Struct<{
1024
- readonly text: Schema.String;
1025
- readonly startSeconds: Schema.Number;
1026
- readonly endSeconds: Schema.Number;
1027
- readonly speaker: Schema.optional<Schema.String>;
1028
- }>;
1029
- }> | Schema.Struct<{
1030
- readonly text: Schema.String;
1031
- readonly segments: Schema.optional<Schema.$Array<Schema.Struct<{
1032
- readonly text: Schema.String;
1033
- readonly startSeconds: Schema.Number;
1034
- readonly endSeconds: Schema.Number;
1035
- readonly speaker: Schema.optional<Schema.String>;
1036
- }>>>;
1037
- readonly words: Schema.optional<Schema.$Array<Schema.Struct<{
1038
- readonly text: Schema.String;
1039
- readonly startSeconds: Schema.Number;
1040
- readonly endSeconds: Schema.Number;
1041
- readonly speaker: Schema.optional<Schema.String>;
1042
- readonly confidence: Schema.optional<Schema.Number>;
1043
- }>>>;
1044
- readonly language: Schema.optional<Schema.String>;
1045
- readonly durationSeconds: Schema.optional<Schema.Number>;
1046
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1047
- readonly type: Schema.Literal<"tokens">;
1048
- readonly input: Schema.optional<Schema.Number>;
1049
- readonly output: Schema.optional<Schema.Number>;
1050
- readonly total: Schema.optional<Schema.Number>;
1051
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
1052
- }>, Schema.Struct<{
1053
- readonly type: Schema.Literal<"seconds">;
1054
- readonly seconds: Schema.Number;
1055
- }>, Schema.Struct<{
1056
- readonly type: Schema.Literal<"characters">;
1057
- readonly characters: Schema.Number;
1058
- }>, Schema.Struct<{
1059
- readonly type: Schema.Literal<"credits">;
1060
- readonly credits: Schema.Number;
1061
- }>, Schema.Struct<{
1062
- readonly type: Schema.Literal<"compute">;
1063
- readonly seconds: Schema.Number;
1064
- }>]>>;
1065
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1066
- readonly type: Schema.tag<"finish">;
1067
- }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta">]: never; }, OrElse extends (value: Exclude<{
1034
+ }, {
1035
+ readonly type: keyof Handlers;
1036
+ }>) => 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)>;
1037
+ <Handlers, OrElse>(cases: Handlers & {
1038
+ readonly finish?: ((value: {
1039
+ readonly text: string;
1040
+ readonly segments?: readonly {
1041
+ readonly text: string;
1042
+ readonly startSeconds: number;
1043
+ readonly endSeconds: number;
1044
+ readonly speaker?: string | undefined;
1045
+ }[] | undefined;
1046
+ readonly words?: readonly {
1047
+ readonly text: string;
1048
+ readonly startSeconds: number;
1049
+ readonly endSeconds: number;
1050
+ readonly speaker?: string | undefined;
1051
+ readonly confidence?: number | undefined;
1052
+ }[] | undefined;
1053
+ readonly language?: string | undefined;
1054
+ readonly durationSeconds?: number | undefined;
1055
+ readonly usage?: {
1056
+ readonly type: "seconds";
1057
+ readonly seconds: number;
1058
+ } | {
1059
+ readonly type: "characters";
1060
+ readonly characters: number;
1061
+ } | {
1062
+ readonly type: "credits";
1063
+ readonly credits: number;
1064
+ } | {
1065
+ readonly type: "compute";
1066
+ readonly seconds: number;
1067
+ } | {
1068
+ readonly type: "tokens";
1069
+ readonly input?: number | undefined;
1070
+ readonly output?: number | undefined;
1071
+ readonly total?: number | undefined;
1072
+ readonly details?: {
1073
+ readonly [x: string]: unknown;
1074
+ } | undefined;
1075
+ } | undefined;
1076
+ readonly providerMetadata?: {
1077
+ readonly [x: string]: {
1078
+ readonly [x: string]: unknown;
1079
+ };
1080
+ } | undefined;
1081
+ readonly type: "finish";
1082
+ }) => any) | undefined;
1083
+ readonly "generation-progress"?: ((value: {
1084
+ readonly type: "generation-progress";
1085
+ readonly id: string;
1086
+ readonly progress?: number | undefined;
1087
+ }) => any) | undefined;
1088
+ readonly "generation-queued"?: ((value: {
1089
+ readonly type: "generation-queued";
1090
+ readonly id: string;
1091
+ readonly position?: number | undefined;
1092
+ }) => any) | undefined;
1093
+ readonly segment?: ((value: {
1094
+ readonly type: "segment";
1095
+ readonly segment: {
1096
+ readonly text: string;
1097
+ readonly startSeconds: number;
1098
+ readonly endSeconds: number;
1099
+ readonly speaker?: string | undefined;
1100
+ };
1101
+ }) => any) | undefined;
1102
+ readonly "text-delta"?: ((value: {
1103
+ readonly type: "text-delta";
1104
+ readonly delta: string;
1105
+ }) => any) | undefined;
1106
+ } & (Exclude<keyof Handlers, "finish" | "generation-progress" | "generation-queued" | "segment" | "text-delta"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
1068
1107
  readonly type: "text-delta";
1069
1108
  readonly delta: string;
1070
- } | {
1109
+ }, {
1110
+ readonly type: keyof Handlers;
1111
+ }> | Exclude<{
1071
1112
  readonly type: "segment";
1072
1113
  readonly segment: {
1073
1114
  readonly text: string;
@@ -1075,15 +1116,21 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
1075
1116
  readonly endSeconds: number;
1076
1117
  readonly speaker?: string | undefined;
1077
1118
  };
1078
- } | {
1119
+ }, {
1120
+ readonly type: keyof Handlers;
1121
+ }> | Exclude<{
1079
1122
  readonly type: "generation-queued";
1080
1123
  readonly id: string;
1081
1124
  readonly position?: number | undefined;
1082
- } | {
1125
+ }, {
1126
+ readonly type: keyof Handlers;
1127
+ }> | Exclude<{
1083
1128
  readonly type: "generation-progress";
1084
1129
  readonly id: string;
1085
1130
  readonly progress?: number | undefined;
1086
- } | {
1131
+ }, {
1132
+ readonly type: keyof Handlers;
1133
+ }> | Exclude<{
1087
1134
  readonly text: string;
1088
1135
  readonly segments?: readonly {
1089
1136
  readonly text: string;
@@ -1127,7 +1174,9 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
1127
1174
  };
1128
1175
  } | undefined;
1129
1176
  readonly type: "finish";
1130
- }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1177
+ }, {
1178
+ readonly type: keyof Handlers;
1179
+ }>) => any)): (value: {
1131
1180
  readonly type: "text-delta";
1132
1181
  readonly delta: string;
1133
1182
  } | {
@@ -1190,7 +1239,7 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
1190
1239
  };
1191
1240
  } | undefined;
1192
1241
  readonly type: "finish";
1193
- }) => import("effect/Unify").Unify<{ [K in keyof Cases]-?: NonNullable<Cases[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1242
+ }) => 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)>;
1194
1243
  };
1195
1244
  } & {
1196
1245
  is: {
@@ -1265,12 +1314,12 @@ export declare const TranscriptionEvent: Schema.Union<readonly [Schema.Struct<{
1265
1314
  };
1266
1315
  };
1267
1316
  export type TranscriptionEvent = Schema.Schema.Type<typeof transcriptionEventTagged>;
1268
- export declare function request<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>): TranscriptionRequestFor<TranscriptionModelOptions<Model>>;
1269
- export declare function request(input: TranscriptionRequest): TranscriptionRequest;
1270
- export declare function generate<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>, options?: AwaitOptions): Effect.Effect<TranscriptionResponse, AIError, Service>;
1271
- export declare function stream<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>, options?: AwaitOptions): Stream.Stream<TranscriptionEvent, AIError, Service>;
1317
+ /** Normalize transcription request input into a plain `TranscriptionRequest`. */
1318
+ export declare const request: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>) => TranscriptionRequest<Model>;
1319
+ export declare function generate<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>, options?: AwaitOptions): Effect.Effect<TranscriptionResponse, AIError, Service>;
1320
+ export declare function stream<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>, options?: AwaitOptions): Stream.Stream<TranscriptionEvent, AIError, Service>;
1272
1321
  /** Inline and streaming routes fail with `UnsupportedOperation`. */
1273
- export declare function start<const Model extends TranscriptionModel>(input: TranscriptionRequest | TranscriptionRequestInput<Model>): Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
1322
+ export declare function start<const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model>): Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
1274
1323
  export declare const resume: (model: TranscriptionModel, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
1275
1324
  export declare const Transcription: {
1276
1325
  readonly request: typeof request;