@opencode/ai 0.0.0-dev-420 → 0.0.0-dev-425

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/speech.d.ts CHANGED
@@ -575,78 +575,84 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
575
575
  };
576
576
  };
577
577
  readonly match: {
578
- <Cases extends { [M in Schema.Struct<{
579
- readonly type: Schema.tag<"generation-queued">;
580
- readonly id: Schema.String;
581
- readonly position: Schema.optional<Schema.Number>;
582
- }> | Schema.Struct<{
583
- readonly type: Schema.tag<"generation-progress">;
584
- readonly id: Schema.String;
585
- readonly progress: Schema.optional<Schema.Number>;
586
- }> | Schema.Struct<{
587
- readonly type: Schema.tag<"audio-delta">;
588
- readonly chunk: Schema.Uint8Array;
589
- }> | Schema.Struct<{
590
- readonly type: Schema.tag<"timestamps">;
591
- readonly items: Schema.$Array<Schema.Struct<{
592
- readonly text: Schema.String;
593
- readonly startSeconds: Schema.Number;
594
- readonly endSeconds: Schema.Number;
595
- }>>;
596
- }> | Schema.Struct<{
597
- readonly type: Schema.tag<"finish">;
598
- readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
599
- readonly source: Schema.Union<readonly [Schema.Struct<{
600
- readonly type: Schema.Literal<"bytes">;
601
- readonly data: Schema.Uint8Array;
602
- readonly mediaType: Schema.String;
578
+ <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
579
+ readonly "audio-delta": Schema.Struct<{
580
+ readonly type: Schema.tag<"audio-delta">;
581
+ readonly chunk: Schema.Uint8Array;
582
+ }>;
583
+ readonly finish: Schema.Struct<{
584
+ readonly type: Schema.tag<"finish">;
585
+ readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
586
+ readonly source: Schema.Union<readonly [Schema.Struct<{
587
+ readonly type: Schema.Literal<"bytes">;
588
+ readonly data: Schema.Uint8Array;
589
+ readonly mediaType: Schema.String;
590
+ }>, Schema.Struct<{
591
+ readonly type: Schema.Literal<"base64">;
592
+ readonly data: Schema.String;
593
+ readonly mediaType: Schema.String;
594
+ }>, Schema.Struct<{
595
+ readonly type: Schema.Literal<"url">;
596
+ readonly url: Schema.String;
597
+ readonly mediaType: Schema.optional<Schema.String>;
598
+ readonly expiresAt: Schema.optional<Schema.Number>;
599
+ }>, Schema.Struct<{
600
+ readonly type: Schema.Literal<"ref">;
601
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
602
+ readonly id: Schema.String;
603
+ readonly mediaType: Schema.optional<Schema.String>;
604
+ }>]>;
605
+ readonly info: Schema.optional<Schema.Struct<{
606
+ readonly width: Schema.optional<Schema.Number>;
607
+ readonly height: Schema.optional<Schema.Number>;
608
+ readonly durationSeconds: Schema.optional<Schema.Number>;
609
+ readonly sampleRate: Schema.optional<Schema.Number>;
610
+ readonly channels: Schema.optional<Schema.Number>;
611
+ readonly encoding: Schema.optional<Schema.String>;
612
+ readonly format: Schema.optional<Schema.String>;
613
+ }>>;
614
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
615
+ }>, never, never>;
616
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
617
+ readonly type: Schema.Literal<"tokens">;
618
+ readonly input: Schema.optional<Schema.Number>;
619
+ readonly output: Schema.optional<Schema.Number>;
620
+ readonly total: Schema.optional<Schema.Number>;
621
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
603
622
  }>, Schema.Struct<{
604
- readonly type: Schema.Literal<"base64">;
605
- readonly data: Schema.String;
606
- readonly mediaType: Schema.String;
623
+ readonly type: Schema.Literal<"seconds">;
624
+ readonly seconds: Schema.Number;
607
625
  }>, Schema.Struct<{
608
- readonly type: Schema.Literal<"url">;
609
- readonly url: Schema.String;
610
- readonly mediaType: Schema.optional<Schema.String>;
611
- readonly expiresAt: Schema.optional<Schema.Number>;
626
+ readonly type: Schema.Literal<"characters">;
627
+ readonly characters: Schema.Number;
612
628
  }>, Schema.Struct<{
613
- readonly type: Schema.Literal<"ref">;
614
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
615
- readonly id: Schema.String;
616
- readonly mediaType: Schema.optional<Schema.String>;
617
- }>]>;
618
- readonly info: Schema.optional<Schema.Struct<{
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
- }>>;
629
+ readonly type: Schema.Literal<"credits">;
630
+ readonly credits: Schema.Number;
631
+ }>, Schema.Struct<{
632
+ readonly type: Schema.Literal<"compute">;
633
+ readonly seconds: Schema.Number;
634
+ }>]>>;
627
635
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
628
- }>, never, never>;
629
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
630
- readonly type: Schema.Literal<"tokens">;
631
- readonly input: Schema.optional<Schema.Number>;
632
- readonly output: Schema.optional<Schema.Number>;
633
- readonly total: Schema.optional<Schema.Number>;
634
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
635
- }>, Schema.Struct<{
636
- readonly type: Schema.Literal<"seconds">;
637
- readonly seconds: Schema.Number;
638
- }>, Schema.Struct<{
639
- readonly type: Schema.Literal<"characters">;
640
- readonly characters: Schema.Number;
641
- }>, Schema.Struct<{
642
- readonly type: Schema.Literal<"credits">;
643
- readonly credits: Schema.Number;
644
- }>, Schema.Struct<{
645
- readonly type: Schema.Literal<"compute">;
646
- readonly seconds: Schema.Number;
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: {
636
+ }>;
637
+ readonly "generation-progress": Schema.Struct<{
638
+ readonly type: Schema.tag<"generation-progress">;
639
+ readonly id: Schema.String;
640
+ readonly progress: Schema.optional<Schema.Number>;
641
+ }>;
642
+ readonly "generation-queued": Schema.Struct<{
643
+ readonly type: Schema.tag<"generation-queued">;
644
+ readonly id: Schema.String;
645
+ readonly position: Schema.optional<Schema.Number>;
646
+ }>;
647
+ readonly timestamps: Schema.Struct<{
648
+ readonly type: Schema.tag<"timestamps">;
649
+ readonly items: Schema.$Array<Schema.Struct<{
650
+ readonly text: Schema.String;
651
+ readonly startSeconds: Schema.Number;
652
+ readonly endSeconds: Schema.Number;
653
+ }>>;
654
+ }>;
655
+ }[K]["Type"]) => any; }>(value: {
650
656
  readonly type: "audio-delta";
651
657
  readonly chunk: Uint8Array<ArrayBufferLike>;
652
658
  } | {
@@ -693,79 +699,85 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
693
699
  readonly [x: string]: unknown;
694
700
  };
695
701
  } | undefined;
696
- }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
697
- <Cases extends { [M in Schema.Struct<{
698
- readonly type: Schema.tag<"generation-queued">;
699
- readonly id: Schema.String;
700
- readonly position: Schema.optional<Schema.Number>;
701
- }> | Schema.Struct<{
702
- readonly type: Schema.tag<"generation-progress">;
703
- readonly id: Schema.String;
704
- readonly progress: Schema.optional<Schema.Number>;
705
- }> | Schema.Struct<{
706
- readonly type: Schema.tag<"audio-delta">;
707
- readonly chunk: Schema.Uint8Array;
708
- }> | Schema.Struct<{
709
- readonly type: Schema.tag<"timestamps">;
710
- readonly items: Schema.$Array<Schema.Struct<{
711
- readonly text: Schema.String;
712
- readonly startSeconds: Schema.Number;
713
- readonly endSeconds: Schema.Number;
714
- }>>;
715
- }> | Schema.Struct<{
716
- readonly type: Schema.tag<"finish">;
717
- readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
718
- readonly source: Schema.Union<readonly [Schema.Struct<{
719
- readonly type: Schema.Literal<"bytes">;
720
- readonly data: Schema.Uint8Array;
721
- readonly mediaType: Schema.String;
702
+ }, cases: Handlers): import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
703
+ <Handlers extends { [K in "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]: (value: {
704
+ readonly "audio-delta": Schema.Struct<{
705
+ readonly type: Schema.tag<"audio-delta">;
706
+ readonly chunk: Schema.Uint8Array;
707
+ }>;
708
+ readonly finish: Schema.Struct<{
709
+ readonly type: Schema.tag<"finish">;
710
+ readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
711
+ readonly source: Schema.Union<readonly [Schema.Struct<{
712
+ readonly type: Schema.Literal<"bytes">;
713
+ readonly data: Schema.Uint8Array;
714
+ readonly mediaType: Schema.String;
715
+ }>, Schema.Struct<{
716
+ readonly type: Schema.Literal<"base64">;
717
+ readonly data: Schema.String;
718
+ readonly mediaType: Schema.String;
719
+ }>, Schema.Struct<{
720
+ readonly type: Schema.Literal<"url">;
721
+ readonly url: Schema.String;
722
+ readonly mediaType: Schema.optional<Schema.String>;
723
+ readonly expiresAt: Schema.optional<Schema.Number>;
724
+ }>, Schema.Struct<{
725
+ readonly type: Schema.Literal<"ref">;
726
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
727
+ readonly id: Schema.String;
728
+ readonly mediaType: Schema.optional<Schema.String>;
729
+ }>]>;
730
+ readonly info: Schema.optional<Schema.Struct<{
731
+ readonly width: Schema.optional<Schema.Number>;
732
+ readonly height: Schema.optional<Schema.Number>;
733
+ readonly durationSeconds: Schema.optional<Schema.Number>;
734
+ readonly sampleRate: Schema.optional<Schema.Number>;
735
+ readonly channels: Schema.optional<Schema.Number>;
736
+ readonly encoding: Schema.optional<Schema.String>;
737
+ readonly format: Schema.optional<Schema.String>;
738
+ }>>;
739
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
740
+ }>, never, never>;
741
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
742
+ readonly type: Schema.Literal<"tokens">;
743
+ readonly input: Schema.optional<Schema.Number>;
744
+ readonly output: Schema.optional<Schema.Number>;
745
+ readonly total: Schema.optional<Schema.Number>;
746
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
722
747
  }>, Schema.Struct<{
723
- readonly type: Schema.Literal<"base64">;
724
- readonly data: Schema.String;
725
- readonly mediaType: Schema.String;
748
+ readonly type: Schema.Literal<"seconds">;
749
+ readonly seconds: Schema.Number;
726
750
  }>, Schema.Struct<{
727
- readonly type: Schema.Literal<"url">;
728
- readonly url: Schema.String;
729
- readonly mediaType: Schema.optional<Schema.String>;
730
- readonly expiresAt: Schema.optional<Schema.Number>;
751
+ readonly type: Schema.Literal<"characters">;
752
+ readonly characters: Schema.Number;
731
753
  }>, Schema.Struct<{
732
- readonly type: Schema.Literal<"ref">;
733
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
734
- readonly id: Schema.String;
735
- readonly mediaType: Schema.optional<Schema.String>;
736
- }>]>;
737
- readonly info: Schema.optional<Schema.Struct<{
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
- }>>;
754
+ readonly type: Schema.Literal<"credits">;
755
+ readonly credits: Schema.Number;
756
+ }>, Schema.Struct<{
757
+ readonly type: Schema.Literal<"compute">;
758
+ readonly seconds: Schema.Number;
759
+ }>]>>;
746
760
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
747
- }>, never, never>;
748
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
749
- readonly type: Schema.Literal<"tokens">;
750
- readonly input: Schema.optional<Schema.Number>;
751
- readonly output: Schema.optional<Schema.Number>;
752
- readonly total: Schema.optional<Schema.Number>;
753
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
754
- }>, Schema.Struct<{
755
- readonly type: Schema.Literal<"seconds">;
756
- readonly seconds: Schema.Number;
757
- }>, Schema.Struct<{
758
- readonly type: Schema.Literal<"characters">;
759
- readonly characters: Schema.Number;
760
- }>, Schema.Struct<{
761
- readonly type: Schema.Literal<"credits">;
762
- readonly credits: Schema.Number;
763
- }>, Schema.Struct<{
764
- readonly type: Schema.Literal<"compute">;
765
- readonly seconds: Schema.Number;
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: {
761
+ }>;
762
+ readonly "generation-progress": Schema.Struct<{
763
+ readonly type: Schema.tag<"generation-progress">;
764
+ readonly id: Schema.String;
765
+ readonly progress: Schema.optional<Schema.Number>;
766
+ }>;
767
+ readonly "generation-queued": Schema.Struct<{
768
+ readonly type: Schema.tag<"generation-queued">;
769
+ readonly id: Schema.String;
770
+ readonly position: Schema.optional<Schema.Number>;
771
+ }>;
772
+ readonly timestamps: Schema.Struct<{
773
+ readonly type: Schema.tag<"timestamps">;
774
+ readonly items: Schema.$Array<Schema.Struct<{
775
+ readonly text: Schema.String;
776
+ readonly startSeconds: Schema.Number;
777
+ readonly endSeconds: Schema.Number;
778
+ }>>;
779
+ }>;
780
+ }[K]["Type"]) => any; }>(cases: Handlers): (value: {
769
781
  readonly type: "audio-delta";
770
782
  readonly chunk: Uint8Array<ArrayBufferLike>;
771
783
  } | {
@@ -812,81 +824,10 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
812
824
  readonly [x: string]: unknown;
813
825
  };
814
826
  } | undefined;
815
- }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
827
+ }) => import("effect/Unify").Unify<ReturnType<Handlers["audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"]>>;
816
828
  };
817
829
  readonly matchOrElse: {
818
- <Cases extends { [M in Schema.Struct<{
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<{
830
+ <Handlers, OrElse>(value: {
890
831
  readonly type: "audio-delta";
891
832
  readonly chunk: Uint8Array<ArrayBufferLike>;
892
833
  } | {
@@ -933,25 +874,86 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
933
874
  readonly [x: string]: unknown;
934
875
  };
935
876
  } | undefined;
936
- }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
877
+ }, cases: Handlers & {
878
+ readonly "audio-delta"?: ((value: {
879
+ readonly type: "audio-delta";
880
+ readonly chunk: Uint8Array<ArrayBufferLike>;
881
+ }) => any) | undefined;
882
+ readonly finish?: ((value: {
883
+ readonly type: "finish";
884
+ readonly audio: Media.Asset;
885
+ readonly usage?: {
886
+ readonly type: "seconds";
887
+ readonly seconds: number;
888
+ } | {
889
+ readonly type: "characters";
890
+ readonly characters: number;
891
+ } | {
892
+ readonly type: "credits";
893
+ readonly credits: number;
894
+ } | {
895
+ readonly type: "compute";
896
+ readonly seconds: number;
897
+ } | {
898
+ readonly type: "tokens";
899
+ readonly input?: number | undefined;
900
+ readonly output?: number | undefined;
901
+ readonly total?: number | undefined;
902
+ readonly details?: {
903
+ readonly [x: string]: unknown;
904
+ } | undefined;
905
+ } | undefined;
906
+ readonly providerMetadata?: {
907
+ readonly [x: string]: {
908
+ readonly [x: string]: unknown;
909
+ };
910
+ } | undefined;
911
+ }) => any) | undefined;
912
+ readonly "generation-progress"?: ((value: {
913
+ readonly type: "generation-progress";
914
+ readonly id: string;
915
+ readonly progress?: number | undefined;
916
+ }) => any) | undefined;
917
+ readonly "generation-queued"?: ((value: {
918
+ readonly type: "generation-queued";
919
+ readonly id: string;
920
+ readonly position?: number | undefined;
921
+ }) => any) | undefined;
922
+ readonly timestamps?: ((value: {
923
+ readonly type: "timestamps";
924
+ readonly items: readonly {
925
+ readonly text: string;
926
+ readonly startSeconds: number;
927
+ readonly endSeconds: number;
928
+ }[];
929
+ }) => any) | undefined;
930
+ } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
937
931
  readonly type: "audio-delta";
938
932
  readonly chunk: Uint8Array<ArrayBufferLike>;
939
- } | {
933
+ }, {
934
+ readonly type: keyof Handlers;
935
+ }> | Exclude<{
940
936
  readonly type: "timestamps";
941
937
  readonly items: readonly {
942
938
  readonly text: string;
943
939
  readonly startSeconds: number;
944
940
  readonly endSeconds: number;
945
941
  }[];
946
- } | {
942
+ }, {
943
+ readonly type: keyof Handlers;
944
+ }> | Exclude<{
947
945
  readonly type: "generation-queued";
948
946
  readonly id: string;
949
947
  readonly position?: number | undefined;
950
- } | {
948
+ }, {
949
+ readonly type: keyof Handlers;
950
+ }> | Exclude<{
951
951
  readonly type: "generation-progress";
952
952
  readonly id: string;
953
953
  readonly progress?: number | undefined;
954
- } | {
954
+ }, {
955
+ readonly type: keyof Handlers;
956
+ }> | Exclude<{
955
957
  readonly type: "finish";
956
958
  readonly audio: Media.Asset;
957
959
  readonly usage?: {
@@ -980,97 +982,89 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
980
982
  readonly [x: string]: unknown;
981
983
  };
982
984
  } | undefined;
983
- }, 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>>;
984
- <Cases extends { [M in Schema.Struct<{
985
- readonly type: Schema.tag<"generation-queued">;
986
- readonly id: Schema.String;
987
- readonly position: Schema.optional<Schema.Number>;
988
- }> | Schema.Struct<{
989
- readonly type: Schema.tag<"generation-progress">;
990
- readonly id: Schema.String;
991
- readonly progress: Schema.optional<Schema.Number>;
992
- }> | Schema.Struct<{
993
- readonly type: Schema.tag<"audio-delta">;
994
- readonly chunk: Schema.Uint8Array;
995
- }> | Schema.Struct<{
996
- readonly type: Schema.tag<"timestamps">;
997
- readonly items: Schema.$Array<Schema.Struct<{
998
- readonly text: Schema.String;
999
- readonly startSeconds: Schema.Number;
1000
- readonly endSeconds: Schema.Number;
1001
- }>>;
1002
- }> | Schema.Struct<{
1003
- readonly type: Schema.tag<"finish">;
1004
- readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
1005
- readonly source: Schema.Union<readonly [Schema.Struct<{
1006
- readonly type: Schema.Literal<"bytes">;
1007
- readonly data: Schema.Uint8Array;
1008
- readonly mediaType: Schema.String;
1009
- }>, Schema.Struct<{
1010
- readonly type: Schema.Literal<"base64">;
1011
- readonly data: Schema.String;
1012
- readonly mediaType: Schema.String;
1013
- }>, Schema.Struct<{
1014
- readonly type: Schema.Literal<"url">;
1015
- readonly url: Schema.String;
1016
- readonly mediaType: Schema.optional<Schema.String>;
1017
- readonly expiresAt: Schema.optional<Schema.Number>;
1018
- }>, Schema.Struct<{
1019
- readonly type: Schema.Literal<"ref">;
1020
- readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
1021
- readonly id: Schema.String;
1022
- readonly mediaType: Schema.optional<Schema.String>;
1023
- }>]>;
1024
- readonly info: Schema.optional<Schema.Struct<{
1025
- readonly width: Schema.optional<Schema.Number>;
1026
- readonly height: Schema.optional<Schema.Number>;
1027
- readonly durationSeconds: Schema.optional<Schema.Number>;
1028
- readonly sampleRate: Schema.optional<Schema.Number>;
1029
- readonly channels: Schema.optional<Schema.Number>;
1030
- readonly encoding: Schema.optional<Schema.String>;
1031
- readonly format: Schema.optional<Schema.String>;
1032
- }>>;
1033
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1034
- }>, never, never>;
1035
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1036
- readonly type: Schema.Literal<"tokens">;
1037
- readonly input: Schema.optional<Schema.Number>;
1038
- readonly output: Schema.optional<Schema.Number>;
1039
- readonly total: Schema.optional<Schema.Number>;
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<{
985
+ }, {
986
+ readonly type: keyof Handlers;
987
+ }>) => 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)>;
988
+ <Handlers, OrElse>(cases: Handlers & {
989
+ readonly "audio-delta"?: ((value: {
990
+ readonly type: "audio-delta";
991
+ readonly chunk: Uint8Array<ArrayBufferLike>;
992
+ }) => any) | undefined;
993
+ readonly finish?: ((value: {
994
+ readonly type: "finish";
995
+ readonly audio: Media.Asset;
996
+ readonly usage?: {
997
+ readonly type: "seconds";
998
+ readonly seconds: number;
999
+ } | {
1000
+ readonly type: "characters";
1001
+ readonly characters: number;
1002
+ } | {
1003
+ readonly type: "credits";
1004
+ readonly credits: number;
1005
+ } | {
1006
+ readonly type: "compute";
1007
+ readonly seconds: number;
1008
+ } | {
1009
+ readonly type: "tokens";
1010
+ readonly input?: number | undefined;
1011
+ readonly output?: number | undefined;
1012
+ readonly total?: number | undefined;
1013
+ readonly details?: {
1014
+ readonly [x: string]: unknown;
1015
+ } | undefined;
1016
+ } | undefined;
1017
+ readonly providerMetadata?: {
1018
+ readonly [x: string]: {
1019
+ readonly [x: string]: unknown;
1020
+ };
1021
+ } | undefined;
1022
+ }) => any) | undefined;
1023
+ readonly "generation-progress"?: ((value: {
1024
+ readonly type: "generation-progress";
1025
+ readonly id: string;
1026
+ readonly progress?: number | undefined;
1027
+ }) => any) | undefined;
1028
+ readonly "generation-queued"?: ((value: {
1029
+ readonly type: "generation-queued";
1030
+ readonly id: string;
1031
+ readonly position?: number | undefined;
1032
+ }) => any) | undefined;
1033
+ readonly timestamps?: ((value: {
1034
+ readonly type: "timestamps";
1035
+ readonly items: readonly {
1036
+ readonly text: string;
1037
+ readonly startSeconds: number;
1038
+ readonly endSeconds: number;
1039
+ }[];
1040
+ }) => any) | undefined;
1041
+ } & (Exclude<keyof Handlers, "audio-delta" | "finish" | "generation-progress" | "generation-queued" | "timestamps"> extends never ? unknown : never), orElse: OrElse & ((value: Exclude<{
1056
1042
  readonly type: "audio-delta";
1057
1043
  readonly chunk: Uint8Array<ArrayBufferLike>;
1058
- } | {
1044
+ }, {
1045
+ readonly type: keyof Handlers;
1046
+ }> | Exclude<{
1059
1047
  readonly type: "timestamps";
1060
1048
  readonly items: readonly {
1061
1049
  readonly text: string;
1062
1050
  readonly startSeconds: number;
1063
1051
  readonly endSeconds: number;
1064
1052
  }[];
1065
- } | {
1053
+ }, {
1054
+ readonly type: keyof Handlers;
1055
+ }> | Exclude<{
1066
1056
  readonly type: "generation-queued";
1067
1057
  readonly id: string;
1068
1058
  readonly position?: number | undefined;
1069
- } | {
1059
+ }, {
1060
+ readonly type: keyof Handlers;
1061
+ }> | Exclude<{
1070
1062
  readonly type: "generation-progress";
1071
1063
  readonly id: string;
1072
1064
  readonly progress?: number | undefined;
1073
- } | {
1065
+ }, {
1066
+ readonly type: keyof Handlers;
1067
+ }> | Exclude<{
1074
1068
  readonly type: "finish";
1075
1069
  readonly audio: Media.Asset;
1076
1070
  readonly usage?: {
@@ -1099,7 +1093,9 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1099
1093
  readonly [x: string]: unknown;
1100
1094
  };
1101
1095
  } | undefined;
1102
- }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1096
+ }, {
1097
+ readonly type: keyof Handlers;
1098
+ }>) => any)): (value: {
1103
1099
  readonly type: "audio-delta";
1104
1100
  readonly chunk: Uint8Array<ArrayBufferLike>;
1105
1101
  } | {
@@ -1146,7 +1142,7 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
1146
1142
  readonly [x: string]: unknown;
1147
1143
  };
1148
1144
  } | undefined;
1149
- }) => import("effect/Unify").Unify<{ [K in keyof Cases]-?: NonNullable<Cases[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1145
+ }) => 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
1146
  };
1151
1147
  } & {
1152
1148
  is: {