@opencode/ai 2.0.32 → 2.1.0

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 (149) hide show
  1. package/dist/ai-client.d.ts +2 -2
  2. package/dist/experimental/evaluation-client.d.ts +1 -1
  3. package/dist/experimental/evaluation.d.ts +20 -20
  4. package/dist/experimental/realtime.d.ts +6 -14
  5. package/dist/experimental/realtime.js +28 -3
  6. package/dist/experimental/system-one.d.ts +1 -1
  7. package/dist/image-client.d.ts +8 -8
  8. package/dist/image.d.ts +593 -437
  9. package/dist/llm.d.ts +51 -51
  10. package/dist/media-client.d.ts +1 -1
  11. package/dist/media.d.ts +4 -4
  12. package/dist/promise.d.ts +199 -198
  13. package/dist/protocols/alibaba-chat.d.ts +81 -82
  14. package/dist/protocols/alibaba-chat.js +0 -1
  15. package/dist/protocols/alibaba-messages.d.ts +99 -99
  16. package/dist/protocols/alibaba-responses.d.ts +120 -120
  17. package/dist/protocols/anthropic-messages.d.ts +187 -187
  18. package/dist/protocols/anthropic-messages.js +3 -2
  19. package/dist/protocols/assemblyai-transcription.d.ts +1 -1
  20. package/dist/protocols/bedrock-converse.d.ts +75 -79
  21. package/dist/protocols/bfl-images.d.ts +1 -1
  22. package/dist/protocols/cartesia-speech.d.ts +17 -17
  23. package/dist/protocols/cohere-chat.d.ts +26 -23
  24. package/dist/protocols/cohere-chat.js +22 -1
  25. package/dist/protocols/deepgram-speech.d.ts +17 -17
  26. package/dist/protocols/deepgram-transcription.d.ts +1 -1
  27. package/dist/protocols/elevenlabs-speech.d.ts +17 -17
  28. package/dist/protocols/elevenlabs-transcription.d.ts +1 -1
  29. package/dist/protocols/fal-images.d.ts +1 -1
  30. package/dist/protocols/fal-video.d.ts +1 -1
  31. package/dist/protocols/gemini.d.ts +55 -55
  32. package/dist/protocols/google-images.d.ts +1 -1
  33. package/dist/protocols/google-interactions.d.ts +64 -62
  34. package/dist/protocols/google-interactions.js +19 -1
  35. package/dist/protocols/google-speech.d.ts +17 -17
  36. package/dist/protocols/google-transcription.d.ts +47 -47
  37. package/dist/protocols/google-video.d.ts +1 -1
  38. package/dist/protocols/meta-messages.d.ts +121 -121
  39. package/dist/protocols/meta-responses.d.ts +201 -201
  40. package/dist/protocols/mistral-chat.d.ts +45 -45
  41. package/dist/protocols/open-responses-channel.d.ts +1 -1
  42. package/dist/protocols/open-responses.d.ts +584 -450
  43. package/dist/protocols/open-responses.js +27 -35
  44. package/dist/protocols/openai-chat.d.ts +248 -248
  45. package/dist/protocols/openai-chat.js +11 -42
  46. package/dist/protocols/openai-compatible-chat.d.ts +32 -32
  47. package/dist/protocols/openai-compatible-responses.d.ts +88 -88
  48. package/dist/protocols/openai-images.d.ts +17 -17
  49. package/dist/protocols/openai-responses.d.ts +567 -567
  50. package/dist/protocols/openai-responses.js +1 -1
  51. package/dist/protocols/openai-speech.d.ts +17 -17
  52. package/dist/protocols/openai-transcription.d.ts +47 -47
  53. package/dist/protocols/replicate-images.d.ts +1 -1
  54. package/dist/protocols/runway-video.d.ts +1 -1
  55. package/dist/protocols/shared.d.ts +12 -1
  56. package/dist/protocols/shared.js +17 -1
  57. package/dist/protocols/stability-images.d.ts +2 -2
  58. package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
  59. package/dist/protocols/utils/bedrock-media.d.ts +4 -4
  60. package/dist/protocols/utils/openai-options.d.ts +1 -1
  61. package/dist/protocols/utils/speech-stream.d.ts +1 -1
  62. package/dist/protocols/utils/tool-schema.d.ts +10 -5
  63. package/dist/protocols/utils/tool-stream.d.ts +152 -152
  64. package/dist/protocols/venice-chat.d.ts +109 -110
  65. package/dist/protocols/venice-chat.js +0 -1
  66. package/dist/protocols/xai-images.d.ts +1 -1
  67. package/dist/protocols/xai-responses.d.ts +79 -79
  68. package/dist/protocols/xai-video.d.ts +1 -1
  69. package/dist/protocols/zai-chat.d.ts +77 -78
  70. package/dist/protocols/zai-chat.js +0 -1
  71. package/dist/protocols/zai-images.d.ts +1 -1
  72. package/dist/protocols/zai-messages.d.ts +97 -97
  73. package/dist/providers/alibaba.d.ts +222 -283
  74. package/dist/providers/amazon-bedrock-mantle.d.ts +291 -298
  75. package/dist/providers/amazon-bedrock.d.ts +22 -28
  76. package/dist/providers/anthropic-compatible.d.ts +86 -90
  77. package/dist/providers/anthropic.d.ts +86 -90
  78. package/dist/providers/assemblyai.d.ts +2 -6
  79. package/dist/providers/azure.d.ts +228 -238
  80. package/dist/providers/baseten.d.ts +66 -70
  81. package/dist/providers/black-forest-labs.d.ts +2 -6
  82. package/dist/providers/cartesia.d.ts +2 -6
  83. package/dist/providers/cerebras.d.ts +66 -70
  84. package/dist/providers/cerebras.js +0 -1
  85. package/dist/providers/cloudflare-ai-gateway.d.ts +352 -356
  86. package/dist/providers/cloudflare-workers-ai.d.ts +66 -70
  87. package/dist/providers/cohere.d.ts +122 -132
  88. package/dist/providers/cohere.js +0 -2
  89. package/dist/providers/deepgram.d.ts +2 -7
  90. package/dist/providers/deepinfra.d.ts +66 -70
  91. package/dist/providers/deepinfra.js +0 -1
  92. package/dist/providers/deepseek.d.ts +66 -70
  93. package/dist/providers/deepseek.js +1 -1
  94. package/dist/providers/digitalocean.d.ts +137 -141
  95. package/dist/providers/elevenlabs.d.ts +2 -7
  96. package/dist/providers/fal.d.ts +2 -7
  97. package/dist/providers/fireworks.d.ts +66 -70
  98. package/dist/providers/google-vertex-chat.d.ts +34 -38
  99. package/dist/providers/google-vertex-interactions.d.ts +31 -41
  100. package/dist/providers/google-vertex-messages.d.ts +81 -85
  101. package/dist/providers/google-vertex-mistral.d.ts +23 -27
  102. package/dist/providers/google-vertex-responses.d.ts +90 -94
  103. package/dist/providers/google-vertex.d.ts +26 -30
  104. package/dist/providers/google.d.ts +94 -109
  105. package/dist/providers/groq.d.ts +111 -115
  106. package/dist/providers/groq.js +0 -1
  107. package/dist/providers/meta.d.ts +309 -317
  108. package/dist/providers/meta.js +1 -1
  109. package/dist/providers/minimax.d.ts +296 -303
  110. package/dist/providers/minimax.js +1 -1
  111. package/dist/providers/mistral.d.ts +22 -26
  112. package/dist/providers/moonshot.d.ts +296 -303
  113. package/dist/providers/moonshot.js +0 -1
  114. package/dist/providers/openai-compatible-responses.d.ts +90 -94
  115. package/dist/providers/openai-compatible.d.ts +34 -38
  116. package/dist/providers/openai.d.ts +93 -108
  117. package/dist/providers/opencode.d.ts +2 -8
  118. package/dist/providers/openrouter.d.ts +137 -144
  119. package/dist/providers/replicate.d.ts +2 -6
  120. package/dist/providers/runway.d.ts +2 -6
  121. package/dist/providers/stability.d.ts +2 -7
  122. package/dist/providers/togetherai.d.ts +66 -70
  123. package/dist/providers/togetherai.js +1 -1
  124. package/dist/providers/typesafe-ai.d.ts +2 -8
  125. package/dist/providers/venice.d.ts +58 -63
  126. package/dist/providers/vercel-ai-gateway.d.ts +2 -12
  127. package/dist/providers/xai.d.ts +38 -50
  128. package/dist/providers/zai-coding-plan.d.ts +206 -213
  129. package/dist/providers/zai.d.ts +40 -46
  130. package/dist/route/client.d.ts +51 -51
  131. package/dist/route/media-protocol.d.ts +1 -1
  132. package/dist/route/transport/http.d.ts +1 -1
  133. package/dist/route/transport/websocket.d.ts +8 -8
  134. package/dist/schema/errors.d.ts +19 -19
  135. package/dist/schema/events.d.ts +3090 -3288
  136. package/dist/schema/messages.d.ts +8 -7
  137. package/dist/schema/options.d.ts +2 -1
  138. package/dist/schema/options.js +2 -1
  139. package/dist/speech-client.d.ts +8 -8
  140. package/dist/speech.d.ts +434 -398
  141. package/dist/testing.d.ts +338 -338
  142. package/dist/tool-runtime.d.ts +1 -1
  143. package/dist/transcription-client.d.ts +23 -23
  144. package/dist/transcription.d.ts +562 -646
  145. package/dist/utils/sanitize.d.ts +4 -0
  146. package/dist/utils/sanitize.js +23 -6
  147. package/dist/video-client.d.ts +8 -8
  148. package/dist/video.d.ts +416 -372
  149. package/package.json +6 -6
package/dist/image.d.ts CHANGED
@@ -479,18 +479,46 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
479
479
  }>]> & {
480
480
  readonly discriminants: readonly ["generation-queued", "generation-progress", "image-partial", "image", "finish"];
481
481
  readonly cases: {
482
- "generation-queued": Schema.Struct<{
483
- readonly type: Schema.tag<"generation-queued">;
484
- readonly id: Schema.String;
485
- readonly position: Schema.optional<Schema.Number>;
482
+ finish: Schema.Struct<{
483
+ readonly type: Schema.tag<"finish">;
484
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
485
+ readonly type: Schema.Literal<"tokens">;
486
+ readonly input: Schema.optional<Schema.Number>;
487
+ readonly output: Schema.optional<Schema.Number>;
488
+ readonly total: Schema.optional<Schema.Number>;
489
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
490
+ }>, Schema.Struct<{
491
+ readonly type: Schema.Literal<"seconds">;
492
+ readonly seconds: Schema.Number;
493
+ }>, Schema.Struct<{
494
+ readonly type: Schema.Literal<"characters">;
495
+ readonly characters: Schema.Number;
496
+ }>, Schema.Struct<{
497
+ readonly type: Schema.Literal<"credits">;
498
+ readonly credits: Schema.Number;
499
+ }>, Schema.Struct<{
500
+ readonly type: Schema.Literal<"compute">;
501
+ readonly seconds: Schema.Number;
502
+ }>]>>;
503
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
504
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
505
+ readonly message: Schema.String;
506
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
507
+ }>>>;
508
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
486
509
  }>;
487
510
  "generation-progress": Schema.Struct<{
488
511
  readonly type: Schema.tag<"generation-progress">;
489
512
  readonly id: Schema.String;
490
513
  readonly progress: Schema.optional<Schema.Number>;
491
514
  }>;
492
- "image-partial": Schema.Struct<{
493
- readonly type: Schema.tag<"image-partial">;
515
+ "generation-queued": Schema.Struct<{
516
+ readonly type: Schema.tag<"generation-queued">;
517
+ readonly id: Schema.String;
518
+ readonly position: Schema.optional<Schema.Number>;
519
+ }>;
520
+ image: Schema.Struct<{
521
+ readonly type: Schema.tag<"image">;
494
522
  readonly index: Schema.Number;
495
523
  readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
496
524
  readonly source: Schema.Union<readonly [Schema.Struct<{
@@ -524,8 +552,8 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
524
552
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
525
553
  }>, never, never>;
526
554
  }>;
527
- image: Schema.Struct<{
528
- readonly type: Schema.tag<"image">;
555
+ "image-partial": Schema.Struct<{
556
+ readonly type: Schema.tag<"image-partial">;
529
557
  readonly index: Schema.Number;
530
558
  readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
531
559
  readonly source: Schema.Union<readonly [Schema.Struct<{
@@ -559,42 +587,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
559
587
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
560
588
  }>, never, never>;
561
589
  }>;
562
- finish: Schema.Struct<{
563
- readonly type: Schema.tag<"finish">;
564
- readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
565
- readonly type: Schema.Literal<"tokens">;
566
- readonly input: Schema.optional<Schema.Number>;
567
- readonly output: Schema.optional<Schema.Number>;
568
- readonly total: Schema.optional<Schema.Number>;
569
- readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
570
- }>, Schema.Struct<{
571
- readonly type: Schema.Literal<"seconds">;
572
- readonly seconds: Schema.Number;
573
- }>, Schema.Struct<{
574
- readonly type: Schema.Literal<"characters">;
575
- readonly characters: Schema.Number;
576
- }>, Schema.Struct<{
577
- readonly type: Schema.Literal<"credits">;
578
- readonly credits: Schema.Number;
579
- }>, Schema.Struct<{
580
- readonly type: Schema.Literal<"compute">;
581
- readonly seconds: Schema.Number;
582
- }>]>>;
583
- readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
584
- readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
585
- readonly message: Schema.String;
586
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
587
- }>>>;
588
- readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
589
- }>;
590
590
  };
591
591
  readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
592
- readonly id: string;
593
592
  readonly type: "generation-queued";
593
+ readonly id: string;
594
594
  readonly position?: number | undefined;
595
595
  } | {
596
- readonly id: string;
597
596
  readonly type: "generation-progress";
597
+ readonly id: string;
598
598
  readonly progress?: number | undefined;
599
599
  } | {
600
600
  readonly type: "image-partial";
@@ -606,11 +606,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
606
606
  readonly image: Media.Asset;
607
607
  } | {
608
608
  readonly type: "finish";
609
- readonly providerMetadata?: {
610
- readonly [x: string]: {
611
- readonly [x: string]: unknown;
612
- };
613
- } | undefined;
614
609
  readonly usage?: {
615
610
  readonly type: "tokens";
616
611
  readonly input?: number | undefined;
@@ -633,7 +628,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
633
628
  readonly seconds: number;
634
629
  } | undefined;
635
630
  readonly notices?: readonly {
636
- readonly type: "other" | "moderated" | "filtered";
631
+ readonly type: "filtered" | "moderated" | "other";
637
632
  readonly message: string;
638
633
  readonly providerMetadata?: {
639
634
  readonly [x: string]: {
@@ -641,15 +636,20 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
641
636
  };
642
637
  } | undefined;
643
638
  }[] | undefined;
639
+ readonly providerMetadata?: {
640
+ readonly [x: string]: {
641
+ readonly [x: string]: unknown;
642
+ };
643
+ } | undefined;
644
644
  }) => value is Extract<{
645
- readonly id: string;
646
645
  readonly type: "generation-queued";
646
+ readonly id: string;
647
647
  readonly position?: number | undefined;
648
648
  }, {
649
649
  readonly type: Keys;
650
650
  }> | Extract<{
651
- readonly id: string;
652
651
  readonly type: "generation-progress";
652
+ readonly id: string;
653
653
  readonly progress?: number | undefined;
654
654
  }, {
655
655
  readonly type: Keys;
@@ -667,11 +667,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
667
667
  readonly type: Keys;
668
668
  }> | Extract<{
669
669
  readonly type: "finish";
670
- readonly providerMetadata?: {
671
- readonly [x: string]: {
672
- readonly [x: string]: unknown;
673
- };
674
- } | undefined;
675
670
  readonly usage?: {
676
671
  readonly type: "tokens";
677
672
  readonly input?: number | undefined;
@@ -694,7 +689,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
694
689
  readonly seconds: number;
695
690
  } | undefined;
696
691
  readonly notices?: readonly {
697
- readonly type: "other" | "moderated" | "filtered";
692
+ readonly type: "filtered" | "moderated" | "other";
698
693
  readonly message: string;
699
694
  readonly providerMetadata?: {
700
695
  readonly [x: string]: {
@@ -702,37 +697,196 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
702
697
  };
703
698
  } | undefined;
704
699
  }[] | undefined;
700
+ readonly providerMetadata?: {
701
+ readonly [x: string]: {
702
+ readonly [x: string]: unknown;
703
+ };
704
+ } | undefined;
705
705
  }, {
706
706
  readonly type: Keys;
707
707
  }>;
708
708
  readonly guards: {
709
- "generation-queued": (u: unknown) => u is {
710
- readonly id: string;
711
- readonly type: "generation-queued";
712
- readonly position?: number | undefined;
709
+ finish: (u: unknown) => u is {
710
+ readonly type: "finish";
711
+ readonly usage?: {
712
+ readonly type: "tokens";
713
+ readonly input?: number | undefined;
714
+ readonly output?: number | undefined;
715
+ readonly total?: number | undefined;
716
+ readonly details?: {
717
+ readonly [x: string]: unknown;
718
+ } | undefined;
719
+ } | {
720
+ readonly type: "seconds";
721
+ readonly seconds: number;
722
+ } | {
723
+ readonly type: "characters";
724
+ readonly characters: number;
725
+ } | {
726
+ readonly type: "credits";
727
+ readonly credits: number;
728
+ } | {
729
+ readonly type: "compute";
730
+ readonly seconds: number;
731
+ } | undefined;
732
+ readonly notices?: readonly {
733
+ readonly type: "filtered" | "moderated" | "other";
734
+ readonly message: string;
735
+ readonly providerMetadata?: {
736
+ readonly [x: string]: {
737
+ readonly [x: string]: unknown;
738
+ };
739
+ } | undefined;
740
+ }[] | undefined;
741
+ readonly providerMetadata?: {
742
+ readonly [x: string]: {
743
+ readonly [x: string]: unknown;
744
+ };
745
+ } | undefined;
713
746
  };
714
747
  "generation-progress": (u: unknown) => u is {
715
- readonly id: string;
716
748
  readonly type: "generation-progress";
749
+ readonly id: string;
717
750
  readonly progress?: number | undefined;
718
751
  };
752
+ "generation-queued": (u: unknown) => u is {
753
+ readonly type: "generation-queued";
754
+ readonly id: string;
755
+ readonly position?: number | undefined;
756
+ };
757
+ image: (u: unknown) => u is {
758
+ readonly type: "image";
759
+ readonly index: number;
760
+ readonly image: Media.Asset;
761
+ };
719
762
  "image-partial": (u: unknown) => u is {
720
763
  readonly type: "image-partial";
721
764
  readonly index: number;
722
765
  readonly image: Media.Asset;
723
766
  };
724
- image: (u: unknown) => u is {
767
+ };
768
+ readonly match: {
769
+ <Cases extends { [M in Schema.Struct<{
770
+ readonly type: Schema.tag<"generation-queued">;
771
+ readonly id: Schema.String;
772
+ readonly position: Schema.optional<Schema.Number>;
773
+ }> | Schema.Struct<{
774
+ readonly type: Schema.tag<"generation-progress">;
775
+ readonly id: Schema.String;
776
+ readonly progress: Schema.optional<Schema.Number>;
777
+ }> | Schema.Struct<{
778
+ readonly type: Schema.tag<"image-partial">;
779
+ readonly index: Schema.Number;
780
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
781
+ readonly source: Schema.Union<readonly [Schema.Struct<{
782
+ readonly type: Schema.Literal<"bytes">;
783
+ readonly data: Schema.Uint8Array;
784
+ readonly mediaType: Schema.String;
785
+ }>, Schema.Struct<{
786
+ readonly type: Schema.Literal<"base64">;
787
+ readonly data: Schema.String;
788
+ readonly mediaType: Schema.String;
789
+ }>, Schema.Struct<{
790
+ readonly type: Schema.Literal<"url">;
791
+ readonly url: Schema.String;
792
+ readonly mediaType: Schema.optional<Schema.String>;
793
+ readonly expiresAt: Schema.optional<Schema.Number>;
794
+ }>, Schema.Struct<{
795
+ readonly type: Schema.Literal<"ref">;
796
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
797
+ readonly id: Schema.String;
798
+ readonly mediaType: Schema.optional<Schema.String>;
799
+ }>]>;
800
+ readonly info: Schema.optional<Schema.Struct<{
801
+ readonly width: Schema.optional<Schema.Number>;
802
+ readonly height: Schema.optional<Schema.Number>;
803
+ readonly durationSeconds: Schema.optional<Schema.Number>;
804
+ readonly sampleRate: Schema.optional<Schema.Number>;
805
+ readonly channels: Schema.optional<Schema.Number>;
806
+ readonly encoding: Schema.optional<Schema.String>;
807
+ readonly format: Schema.optional<Schema.String>;
808
+ }>>;
809
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
810
+ }>, never, never>;
811
+ }> | Schema.Struct<{
812
+ readonly type: Schema.tag<"image">;
813
+ readonly index: Schema.Number;
814
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
815
+ readonly source: Schema.Union<readonly [Schema.Struct<{
816
+ readonly type: Schema.Literal<"bytes">;
817
+ readonly data: Schema.Uint8Array;
818
+ readonly mediaType: Schema.String;
819
+ }>, Schema.Struct<{
820
+ readonly type: Schema.Literal<"base64">;
821
+ readonly data: Schema.String;
822
+ readonly mediaType: Schema.String;
823
+ }>, Schema.Struct<{
824
+ readonly type: Schema.Literal<"url">;
825
+ readonly url: Schema.String;
826
+ readonly mediaType: Schema.optional<Schema.String>;
827
+ readonly expiresAt: Schema.optional<Schema.Number>;
828
+ }>, Schema.Struct<{
829
+ readonly type: Schema.Literal<"ref">;
830
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
831
+ readonly id: Schema.String;
832
+ readonly mediaType: Schema.optional<Schema.String>;
833
+ }>]>;
834
+ readonly info: Schema.optional<Schema.Struct<{
835
+ readonly width: Schema.optional<Schema.Number>;
836
+ readonly height: Schema.optional<Schema.Number>;
837
+ readonly durationSeconds: Schema.optional<Schema.Number>;
838
+ readonly sampleRate: Schema.optional<Schema.Number>;
839
+ readonly channels: Schema.optional<Schema.Number>;
840
+ readonly encoding: Schema.optional<Schema.String>;
841
+ readonly format: Schema.optional<Schema.String>;
842
+ }>>;
843
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
844
+ }>, never, never>;
845
+ }> | Schema.Struct<{
846
+ readonly type: Schema.tag<"finish">;
847
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
848
+ readonly type: Schema.Literal<"tokens">;
849
+ readonly input: Schema.optional<Schema.Number>;
850
+ readonly output: Schema.optional<Schema.Number>;
851
+ readonly total: Schema.optional<Schema.Number>;
852
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
853
+ }>, Schema.Struct<{
854
+ readonly type: Schema.Literal<"seconds">;
855
+ readonly seconds: Schema.Number;
856
+ }>, Schema.Struct<{
857
+ readonly type: Schema.Literal<"characters">;
858
+ readonly characters: Schema.Number;
859
+ }>, Schema.Struct<{
860
+ readonly type: Schema.Literal<"credits">;
861
+ readonly credits: Schema.Number;
862
+ }>, Schema.Struct<{
863
+ readonly type: Schema.Literal<"compute">;
864
+ readonly seconds: Schema.Number;
865
+ }>]>>;
866
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
867
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
868
+ readonly message: Schema.String;
869
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
870
+ }>>>;
871
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
872
+ }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
873
+ readonly type: "generation-queued";
874
+ readonly id: string;
875
+ readonly position?: number | undefined;
876
+ } | {
877
+ readonly type: "generation-progress";
878
+ readonly id: string;
879
+ readonly progress?: number | undefined;
880
+ } | {
881
+ readonly type: "image-partial";
882
+ readonly index: number;
883
+ readonly image: Media.Asset;
884
+ } | {
725
885
  readonly type: "image";
726
886
  readonly index: number;
727
887
  readonly image: Media.Asset;
728
- };
729
- finish: (u: unknown) => u is {
888
+ } | {
730
889
  readonly type: "finish";
731
- readonly providerMetadata?: {
732
- readonly [x: string]: {
733
- readonly [x: string]: unknown;
734
- };
735
- } | undefined;
736
890
  readonly usage?: {
737
891
  readonly type: "tokens";
738
892
  readonly input?: number | undefined;
@@ -755,7 +909,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
755
909
  readonly seconds: number;
756
910
  } | undefined;
757
911
  readonly notices?: readonly {
758
- readonly type: "other" | "moderated" | "filtered";
912
+ readonly type: "filtered" | "moderated" | "other";
759
913
  readonly message: string;
760
914
  readonly providerMetadata?: {
761
915
  readonly [x: string]: {
@@ -763,75 +917,122 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
763
917
  };
764
918
  } | undefined;
765
919
  }[] | undefined;
766
- };
767
- };
768
- readonly match: {
769
- <Cases extends {
770
- "generation-queued": (value: {
771
- readonly id: string;
772
- readonly type: "generation-queued";
773
- readonly position?: number | undefined;
774
- }) => any;
775
- "generation-progress": (value: {
776
- readonly id: string;
777
- readonly type: "generation-progress";
778
- readonly progress?: number | undefined;
779
- }) => any;
780
- "image-partial": (value: {
781
- readonly type: "image-partial";
782
- readonly index: number;
783
- readonly image: Media.Asset;
784
- }) => any;
785
- image: (value: {
786
- readonly type: "image";
787
- readonly index: number;
788
- readonly image: Media.Asset;
789
- }) => any;
790
- finish: (value: {
791
- readonly type: "finish";
792
- readonly providerMetadata?: {
793
- readonly [x: string]: {
794
- readonly [x: string]: unknown;
795
- };
796
- } | undefined;
797
- readonly usage?: {
798
- readonly type: "tokens";
799
- readonly input?: number | undefined;
800
- readonly output?: number | undefined;
801
- readonly total?: number | undefined;
802
- readonly details?: {
803
- readonly [x: string]: unknown;
804
- } | undefined;
805
- } | {
806
- readonly type: "seconds";
807
- readonly seconds: number;
808
- } | {
809
- readonly type: "characters";
810
- readonly characters: number;
811
- } | {
812
- readonly type: "credits";
813
- readonly credits: number;
814
- } | {
815
- readonly type: "compute";
816
- readonly seconds: number;
817
- } | undefined;
818
- readonly notices?: readonly {
819
- readonly type: "other" | "moderated" | "filtered";
820
- readonly message: string;
821
- readonly providerMetadata?: {
822
- readonly [x: string]: {
823
- readonly [x: string]: unknown;
824
- };
825
- } | undefined;
826
- }[] | undefined;
827
- }) => any;
828
- }>(value: {
829
- readonly id: string;
920
+ readonly providerMetadata?: {
921
+ readonly [x: string]: {
922
+ readonly [x: string]: unknown;
923
+ };
924
+ } | undefined;
925
+ }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
926
+ <Cases extends { [M in Schema.Struct<{
927
+ readonly type: Schema.tag<"generation-queued">;
928
+ readonly id: Schema.String;
929
+ readonly position: Schema.optional<Schema.Number>;
930
+ }> | Schema.Struct<{
931
+ readonly type: Schema.tag<"generation-progress">;
932
+ readonly id: Schema.String;
933
+ readonly progress: Schema.optional<Schema.Number>;
934
+ }> | Schema.Struct<{
935
+ readonly type: Schema.tag<"image-partial">;
936
+ readonly index: Schema.Number;
937
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
938
+ readonly source: Schema.Union<readonly [Schema.Struct<{
939
+ readonly type: Schema.Literal<"bytes">;
940
+ readonly data: Schema.Uint8Array;
941
+ readonly mediaType: Schema.String;
942
+ }>, Schema.Struct<{
943
+ readonly type: Schema.Literal<"base64">;
944
+ readonly data: Schema.String;
945
+ readonly mediaType: Schema.String;
946
+ }>, Schema.Struct<{
947
+ readonly type: Schema.Literal<"url">;
948
+ readonly url: Schema.String;
949
+ readonly mediaType: Schema.optional<Schema.String>;
950
+ readonly expiresAt: Schema.optional<Schema.Number>;
951
+ }>, Schema.Struct<{
952
+ readonly type: Schema.Literal<"ref">;
953
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
954
+ readonly id: Schema.String;
955
+ readonly mediaType: Schema.optional<Schema.String>;
956
+ }>]>;
957
+ readonly info: Schema.optional<Schema.Struct<{
958
+ readonly width: Schema.optional<Schema.Number>;
959
+ readonly height: Schema.optional<Schema.Number>;
960
+ readonly durationSeconds: Schema.optional<Schema.Number>;
961
+ readonly sampleRate: Schema.optional<Schema.Number>;
962
+ readonly channels: Schema.optional<Schema.Number>;
963
+ readonly encoding: Schema.optional<Schema.String>;
964
+ readonly format: Schema.optional<Schema.String>;
965
+ }>>;
966
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
967
+ }>, never, never>;
968
+ }> | Schema.Struct<{
969
+ readonly type: Schema.tag<"image">;
970
+ readonly index: Schema.Number;
971
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
972
+ readonly source: Schema.Union<readonly [Schema.Struct<{
973
+ readonly type: Schema.Literal<"bytes">;
974
+ readonly data: Schema.Uint8Array;
975
+ readonly mediaType: Schema.String;
976
+ }>, Schema.Struct<{
977
+ readonly type: Schema.Literal<"base64">;
978
+ readonly data: Schema.String;
979
+ readonly mediaType: Schema.String;
980
+ }>, Schema.Struct<{
981
+ readonly type: Schema.Literal<"url">;
982
+ readonly url: Schema.String;
983
+ readonly mediaType: Schema.optional<Schema.String>;
984
+ readonly expiresAt: Schema.optional<Schema.Number>;
985
+ }>, Schema.Struct<{
986
+ readonly type: Schema.Literal<"ref">;
987
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
988
+ readonly id: Schema.String;
989
+ readonly mediaType: Schema.optional<Schema.String>;
990
+ }>]>;
991
+ readonly info: Schema.optional<Schema.Struct<{
992
+ readonly width: Schema.optional<Schema.Number>;
993
+ readonly height: Schema.optional<Schema.Number>;
994
+ readonly durationSeconds: Schema.optional<Schema.Number>;
995
+ readonly sampleRate: Schema.optional<Schema.Number>;
996
+ readonly channels: Schema.optional<Schema.Number>;
997
+ readonly encoding: Schema.optional<Schema.String>;
998
+ readonly format: Schema.optional<Schema.String>;
999
+ }>>;
1000
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1001
+ }>, never, never>;
1002
+ }> | Schema.Struct<{
1003
+ readonly type: Schema.tag<"finish">;
1004
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1005
+ readonly type: Schema.Literal<"tokens">;
1006
+ readonly input: Schema.optional<Schema.Number>;
1007
+ readonly output: Schema.optional<Schema.Number>;
1008
+ readonly total: Schema.optional<Schema.Number>;
1009
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
1010
+ }>, Schema.Struct<{
1011
+ readonly type: Schema.Literal<"seconds">;
1012
+ readonly seconds: Schema.Number;
1013
+ }>, Schema.Struct<{
1014
+ readonly type: Schema.Literal<"characters">;
1015
+ readonly characters: Schema.Number;
1016
+ }>, Schema.Struct<{
1017
+ readonly type: Schema.Literal<"credits">;
1018
+ readonly credits: Schema.Number;
1019
+ }>, Schema.Struct<{
1020
+ readonly type: Schema.Literal<"compute">;
1021
+ readonly seconds: Schema.Number;
1022
+ }>]>>;
1023
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
1024
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
1025
+ readonly message: Schema.String;
1026
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1027
+ }>>>;
1028
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1029
+ }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
830
1030
  readonly type: "generation-queued";
1031
+ readonly id: string;
831
1032
  readonly position?: number | undefined;
832
1033
  } | {
833
- readonly id: string;
834
1034
  readonly type: "generation-progress";
1035
+ readonly id: string;
835
1036
  readonly progress?: number | undefined;
836
1037
  } | {
837
1038
  readonly type: "image-partial";
@@ -843,11 +1044,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
843
1044
  readonly image: Media.Asset;
844
1045
  } | {
845
1046
  readonly type: "finish";
846
- readonly providerMetadata?: {
847
- readonly [x: string]: {
848
- readonly [x: string]: unknown;
849
- };
850
- } | undefined;
851
1047
  readonly usage?: {
852
1048
  readonly type: "tokens";
853
1049
  readonly input?: number | undefined;
@@ -870,7 +1066,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
870
1066
  readonly seconds: number;
871
1067
  } | undefined;
872
1068
  readonly notices?: readonly {
873
- readonly type: "other" | "moderated" | "filtered";
1069
+ readonly type: "filtered" | "moderated" | "other";
874
1070
  readonly message: string;
875
1071
  readonly providerMetadata?: {
876
1072
  readonly [x: string]: {
@@ -878,73 +1074,124 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
878
1074
  };
879
1075
  } | undefined;
880
1076
  }[] | undefined;
881
- }, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
882
- <Cases extends {
883
- "generation-queued": (value: {
884
- readonly id: string;
885
- readonly type: "generation-queued";
886
- readonly position?: number | undefined;
887
- }) => any;
888
- "generation-progress": (value: {
889
- readonly id: string;
890
- readonly type: "generation-progress";
891
- readonly progress?: number | undefined;
892
- }) => any;
893
- "image-partial": (value: {
894
- readonly type: "image-partial";
895
- readonly index: number;
896
- readonly image: Media.Asset;
897
- }) => any;
898
- image: (value: {
899
- readonly type: "image";
900
- readonly index: number;
901
- readonly image: Media.Asset;
902
- }) => any;
903
- finish: (value: {
904
- readonly type: "finish";
905
- readonly providerMetadata?: {
906
- readonly [x: string]: {
907
- readonly [x: string]: unknown;
908
- };
909
- } | undefined;
910
- readonly usage?: {
911
- readonly type: "tokens";
912
- readonly input?: number | undefined;
913
- readonly output?: number | undefined;
914
- readonly total?: number | undefined;
915
- readonly details?: {
916
- readonly [x: string]: unknown;
917
- } | undefined;
918
- } | {
919
- readonly type: "seconds";
920
- readonly seconds: number;
921
- } | {
922
- readonly type: "characters";
923
- readonly characters: number;
924
- } | {
925
- readonly type: "credits";
926
- readonly credits: number;
927
- } | {
928
- readonly type: "compute";
929
- readonly seconds: number;
930
- } | undefined;
931
- readonly notices?: readonly {
932
- readonly type: "other" | "moderated" | "filtered";
933
- readonly message: string;
934
- readonly providerMetadata?: {
935
- readonly [x: string]: {
936
- readonly [x: string]: unknown;
937
- };
938
- } | undefined;
939
- }[] | undefined;
940
- }) => any;
941
- }>(cases: Cases): (value: {
942
- readonly id: string;
1077
+ readonly providerMetadata?: {
1078
+ readonly [x: string]: {
1079
+ readonly [x: string]: unknown;
1080
+ };
1081
+ } | undefined;
1082
+ }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
1083
+ };
1084
+ readonly matchOrElse: {
1085
+ <Cases extends { [M in Schema.Struct<{
1086
+ readonly type: Schema.tag<"generation-queued">;
1087
+ readonly id: Schema.String;
1088
+ readonly position: Schema.optional<Schema.Number>;
1089
+ }> | Schema.Struct<{
1090
+ readonly type: Schema.tag<"generation-progress">;
1091
+ readonly id: Schema.String;
1092
+ readonly progress: Schema.optional<Schema.Number>;
1093
+ }> | Schema.Struct<{
1094
+ readonly type: Schema.tag<"image-partial">;
1095
+ readonly index: Schema.Number;
1096
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
1097
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1098
+ readonly type: Schema.Literal<"bytes">;
1099
+ readonly data: Schema.Uint8Array;
1100
+ readonly mediaType: Schema.String;
1101
+ }>, Schema.Struct<{
1102
+ readonly type: Schema.Literal<"base64">;
1103
+ readonly data: Schema.String;
1104
+ readonly mediaType: Schema.String;
1105
+ }>, Schema.Struct<{
1106
+ readonly type: Schema.Literal<"url">;
1107
+ readonly url: Schema.String;
1108
+ readonly mediaType: Schema.optional<Schema.String>;
1109
+ readonly expiresAt: Schema.optional<Schema.Number>;
1110
+ }>, Schema.Struct<{
1111
+ readonly type: Schema.Literal<"ref">;
1112
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
1113
+ readonly id: Schema.String;
1114
+ readonly mediaType: Schema.optional<Schema.String>;
1115
+ }>]>;
1116
+ readonly info: Schema.optional<Schema.Struct<{
1117
+ readonly width: Schema.optional<Schema.Number>;
1118
+ readonly height: Schema.optional<Schema.Number>;
1119
+ readonly durationSeconds: Schema.optional<Schema.Number>;
1120
+ readonly sampleRate: Schema.optional<Schema.Number>;
1121
+ readonly channels: Schema.optional<Schema.Number>;
1122
+ readonly encoding: Schema.optional<Schema.String>;
1123
+ readonly format: Schema.optional<Schema.String>;
1124
+ }>>;
1125
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1126
+ }>, never, never>;
1127
+ }> | Schema.Struct<{
1128
+ readonly type: Schema.tag<"image">;
1129
+ readonly index: Schema.Number;
1130
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
1131
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1132
+ readonly type: Schema.Literal<"bytes">;
1133
+ readonly data: Schema.Uint8Array;
1134
+ readonly mediaType: Schema.String;
1135
+ }>, Schema.Struct<{
1136
+ readonly type: Schema.Literal<"base64">;
1137
+ readonly data: Schema.String;
1138
+ readonly mediaType: Schema.String;
1139
+ }>, Schema.Struct<{
1140
+ readonly type: Schema.Literal<"url">;
1141
+ readonly url: Schema.String;
1142
+ readonly mediaType: Schema.optional<Schema.String>;
1143
+ readonly expiresAt: Schema.optional<Schema.Number>;
1144
+ }>, Schema.Struct<{
1145
+ readonly type: Schema.Literal<"ref">;
1146
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
1147
+ readonly id: Schema.String;
1148
+ readonly mediaType: Schema.optional<Schema.String>;
1149
+ }>]>;
1150
+ readonly info: Schema.optional<Schema.Struct<{
1151
+ readonly width: Schema.optional<Schema.Number>;
1152
+ readonly height: Schema.optional<Schema.Number>;
1153
+ readonly durationSeconds: Schema.optional<Schema.Number>;
1154
+ readonly sampleRate: Schema.optional<Schema.Number>;
1155
+ readonly channels: Schema.optional<Schema.Number>;
1156
+ readonly encoding: Schema.optional<Schema.String>;
1157
+ readonly format: Schema.optional<Schema.String>;
1158
+ }>>;
1159
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1160
+ }>, never, never>;
1161
+ }> | Schema.Struct<{
1162
+ readonly type: Schema.tag<"finish">;
1163
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1164
+ readonly type: Schema.Literal<"tokens">;
1165
+ readonly input: Schema.optional<Schema.Number>;
1166
+ readonly output: Schema.optional<Schema.Number>;
1167
+ readonly total: Schema.optional<Schema.Number>;
1168
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
1169
+ }>, Schema.Struct<{
1170
+ readonly type: Schema.Literal<"seconds">;
1171
+ readonly seconds: Schema.Number;
1172
+ }>, Schema.Struct<{
1173
+ readonly type: Schema.Literal<"characters">;
1174
+ readonly characters: Schema.Number;
1175
+ }>, Schema.Struct<{
1176
+ readonly type: Schema.Literal<"credits">;
1177
+ readonly credits: Schema.Number;
1178
+ }>, Schema.Struct<{
1179
+ readonly type: Schema.Literal<"compute">;
1180
+ readonly seconds: Schema.Number;
1181
+ }>]>>;
1182
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
1183
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
1184
+ readonly message: Schema.String;
1185
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1186
+ }>>>;
1187
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1188
+ }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "image" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
943
1189
  readonly type: "generation-queued";
1190
+ readonly id: string;
944
1191
  readonly position?: number | undefined;
945
1192
  } | {
946
- readonly id: string;
947
1193
  readonly type: "generation-progress";
1194
+ readonly id: string;
948
1195
  readonly progress?: number | undefined;
949
1196
  } | {
950
1197
  readonly type: "image-partial";
@@ -956,11 +1203,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
956
1203
  readonly image: Media.Asset;
957
1204
  } | {
958
1205
  readonly type: "finish";
959
- readonly providerMetadata?: {
960
- readonly [x: string]: {
961
- readonly [x: string]: unknown;
962
- };
963
- } | undefined;
964
1206
  readonly usage?: {
965
1207
  readonly type: "tokens";
966
1208
  readonly input?: number | undefined;
@@ -983,7 +1225,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
983
1225
  readonly seconds: number;
984
1226
  } | undefined;
985
1227
  readonly notices?: readonly {
986
- readonly type: "other" | "moderated" | "filtered";
1228
+ readonly type: "filtered" | "moderated" | "other";
987
1229
  readonly message: string;
988
1230
  readonly providerMetadata?: {
989
1231
  readonly [x: string]: {
@@ -991,138 +1233,18 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
991
1233
  };
992
1234
  } | undefined;
993
1235
  }[] | undefined;
994
- }) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
995
- };
996
- readonly matchOrElse: {
997
- <Cases extends {
998
- "generation-queued"?: ((value: {
999
- readonly id: string;
1000
- readonly type: "generation-queued";
1001
- readonly position?: number | undefined;
1002
- }) => any) | undefined;
1003
- "generation-progress"?: ((value: {
1004
- readonly id: string;
1005
- readonly type: "generation-progress";
1006
- readonly progress?: number | undefined;
1007
- }) => any) | undefined;
1008
- "image-partial"?: ((value: {
1009
- readonly type: "image-partial";
1010
- readonly index: number;
1011
- readonly image: Media.Asset;
1012
- }) => any) | undefined;
1013
- image?: ((value: {
1014
- readonly type: "image";
1015
- readonly index: number;
1016
- readonly image: Media.Asset;
1017
- }) => any) | undefined;
1018
- finish?: ((value: {
1019
- readonly type: "finish";
1020
- readonly providerMetadata?: {
1021
- readonly [x: string]: {
1022
- readonly [x: string]: unknown;
1023
- };
1024
- } | undefined;
1025
- readonly usage?: {
1026
- readonly type: "tokens";
1027
- readonly input?: number | undefined;
1028
- readonly output?: number | undefined;
1029
- readonly total?: number | undefined;
1030
- readonly details?: {
1031
- readonly [x: string]: unknown;
1032
- } | undefined;
1033
- } | {
1034
- readonly type: "seconds";
1035
- readonly seconds: number;
1036
- } | {
1037
- readonly type: "characters";
1038
- readonly characters: number;
1039
- } | {
1040
- readonly type: "credits";
1041
- readonly credits: number;
1042
- } | {
1043
- readonly type: "compute";
1044
- readonly seconds: number;
1045
- } | undefined;
1046
- readonly notices?: readonly {
1047
- readonly type: "other" | "moderated" | "filtered";
1048
- readonly message: string;
1049
- readonly providerMetadata?: {
1050
- readonly [x: string]: {
1051
- readonly [x: string]: unknown;
1052
- };
1053
- } | undefined;
1054
- }[] | undefined;
1055
- }) => any) | undefined;
1056
- } & { [K in Exclude<keyof Cases, "image" | "finish" | "generation-queued" | "generation-progress" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
1057
- readonly id: string;
1058
- readonly type: "generation-queued";
1059
- readonly position?: number | undefined;
1060
- }, {
1061
- readonly type: keyof Cases;
1062
- }> | Exclude<{
1063
- readonly id: string;
1064
- readonly type: "generation-progress";
1065
- readonly progress?: number | undefined;
1066
- }, {
1067
- readonly type: keyof Cases;
1068
- }> | Exclude<{
1069
- readonly type: "image-partial";
1070
- readonly index: number;
1071
- readonly image: Media.Asset;
1072
- }, {
1073
- readonly type: keyof Cases;
1074
- }> | Exclude<{
1075
- readonly type: "image";
1076
- readonly index: number;
1077
- readonly image: Media.Asset;
1078
- }, {
1079
- readonly type: keyof Cases;
1080
- }> | Exclude<{
1081
- readonly type: "finish";
1082
1236
  readonly providerMetadata?: {
1083
1237
  readonly [x: string]: {
1084
1238
  readonly [x: string]: unknown;
1085
1239
  };
1086
1240
  } | undefined;
1087
- readonly usage?: {
1088
- readonly type: "tokens";
1089
- readonly input?: number | undefined;
1090
- readonly output?: number | undefined;
1091
- readonly total?: number | undefined;
1092
- readonly details?: {
1093
- readonly [x: string]: unknown;
1094
- } | undefined;
1095
- } | {
1096
- readonly type: "seconds";
1097
- readonly seconds: number;
1098
- } | {
1099
- readonly type: "characters";
1100
- readonly characters: number;
1101
- } | {
1102
- readonly type: "credits";
1103
- readonly credits: number;
1104
- } | {
1105
- readonly type: "compute";
1106
- readonly seconds: number;
1107
- } | undefined;
1108
- readonly notices?: readonly {
1109
- readonly type: "other" | "moderated" | "filtered";
1110
- readonly message: string;
1111
- readonly providerMetadata?: {
1112
- readonly [x: string]: {
1113
- readonly [x: string]: unknown;
1114
- };
1115
- } | undefined;
1116
- }[] | undefined;
1117
- }, {
1118
- readonly type: keyof Cases;
1119
- }>) => any>(value: {
1120
- readonly id: string;
1241
+ }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
1121
1242
  readonly type: "generation-queued";
1243
+ readonly id: string;
1122
1244
  readonly position?: number | undefined;
1123
1245
  } | {
1124
- readonly id: string;
1125
1246
  readonly type: "generation-progress";
1247
+ readonly id: string;
1126
1248
  readonly progress?: number | undefined;
1127
1249
  } | {
1128
1250
  readonly type: "image-partial";
@@ -1134,11 +1256,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1134
1256
  readonly image: Media.Asset;
1135
1257
  } | {
1136
1258
  readonly type: "finish";
1137
- readonly providerMetadata?: {
1138
- readonly [x: string]: {
1139
- readonly [x: string]: unknown;
1140
- };
1141
- } | undefined;
1142
1259
  readonly usage?: {
1143
1260
  readonly type: "tokens";
1144
1261
  readonly input?: number | undefined;
@@ -1161,7 +1278,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1161
1278
  readonly seconds: number;
1162
1279
  } | undefined;
1163
1280
  readonly notices?: readonly {
1164
- readonly type: "other" | "moderated" | "filtered";
1281
+ readonly type: "filtered" | "moderated" | "other";
1165
1282
  readonly message: string;
1166
1283
  readonly providerMetadata?: {
1167
1284
  readonly [x: string]: {
@@ -1169,97 +1286,133 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1169
1286
  };
1170
1287
  } | undefined;
1171
1288
  }[] | undefined;
1172
- }, 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>>;
1173
- <Cases extends {
1174
- "generation-queued"?: ((value: {
1175
- readonly id: string;
1176
- readonly type: "generation-queued";
1177
- readonly position?: number | undefined;
1178
- }) => any) | undefined;
1179
- "generation-progress"?: ((value: {
1180
- readonly id: string;
1181
- readonly type: "generation-progress";
1182
- readonly progress?: number | undefined;
1183
- }) => any) | undefined;
1184
- "image-partial"?: ((value: {
1185
- readonly type: "image-partial";
1186
- readonly index: number;
1187
- readonly image: Media.Asset;
1188
- }) => any) | undefined;
1189
- image?: ((value: {
1190
- readonly type: "image";
1191
- readonly index: number;
1192
- readonly image: Media.Asset;
1193
- }) => any) | undefined;
1194
- finish?: ((value: {
1195
- readonly type: "finish";
1196
- readonly providerMetadata?: {
1197
- readonly [x: string]: {
1198
- readonly [x: string]: unknown;
1199
- };
1200
- } | undefined;
1201
- readonly usage?: {
1202
- readonly type: "tokens";
1203
- readonly input?: number | undefined;
1204
- readonly output?: number | undefined;
1205
- readonly total?: number | undefined;
1206
- readonly details?: {
1207
- readonly [x: string]: unknown;
1208
- } | undefined;
1209
- } | {
1210
- readonly type: "seconds";
1211
- readonly seconds: number;
1212
- } | {
1213
- readonly type: "characters";
1214
- readonly characters: number;
1215
- } | {
1216
- readonly type: "credits";
1217
- readonly credits: number;
1218
- } | {
1219
- readonly type: "compute";
1220
- readonly seconds: number;
1221
- } | undefined;
1222
- readonly notices?: readonly {
1223
- readonly type: "other" | "moderated" | "filtered";
1224
- readonly message: string;
1225
- readonly providerMetadata?: {
1226
- readonly [x: string]: {
1227
- readonly [x: string]: unknown;
1228
- };
1229
- } | undefined;
1230
- }[] | undefined;
1231
- }) => any) | undefined;
1232
- } & { [K in Exclude<keyof Cases, "image" | "finish" | "generation-queued" | "generation-progress" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
1233
- readonly id: string;
1289
+ readonly providerMetadata?: {
1290
+ readonly [x: string]: {
1291
+ readonly [x: string]: unknown;
1292
+ };
1293
+ } | undefined;
1294
+ }, 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>>;
1295
+ <Cases extends { [M in Schema.Struct<{
1296
+ readonly type: Schema.tag<"generation-queued">;
1297
+ readonly id: Schema.String;
1298
+ readonly position: Schema.optional<Schema.Number>;
1299
+ }> | Schema.Struct<{
1300
+ readonly type: Schema.tag<"generation-progress">;
1301
+ readonly id: Schema.String;
1302
+ readonly progress: Schema.optional<Schema.Number>;
1303
+ }> | Schema.Struct<{
1304
+ readonly type: Schema.tag<"image-partial">;
1305
+ readonly index: Schema.Number;
1306
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
1307
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1308
+ readonly type: Schema.Literal<"bytes">;
1309
+ readonly data: Schema.Uint8Array;
1310
+ readonly mediaType: Schema.String;
1311
+ }>, Schema.Struct<{
1312
+ readonly type: Schema.Literal<"base64">;
1313
+ readonly data: Schema.String;
1314
+ readonly mediaType: Schema.String;
1315
+ }>, Schema.Struct<{
1316
+ readonly type: Schema.Literal<"url">;
1317
+ readonly url: Schema.String;
1318
+ readonly mediaType: Schema.optional<Schema.String>;
1319
+ readonly expiresAt: Schema.optional<Schema.Number>;
1320
+ }>, Schema.Struct<{
1321
+ readonly type: Schema.Literal<"ref">;
1322
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
1323
+ readonly id: Schema.String;
1324
+ readonly mediaType: Schema.optional<Schema.String>;
1325
+ }>]>;
1326
+ readonly info: Schema.optional<Schema.Struct<{
1327
+ readonly width: Schema.optional<Schema.Number>;
1328
+ readonly height: Schema.optional<Schema.Number>;
1329
+ readonly durationSeconds: Schema.optional<Schema.Number>;
1330
+ readonly sampleRate: Schema.optional<Schema.Number>;
1331
+ readonly channels: Schema.optional<Schema.Number>;
1332
+ readonly encoding: Schema.optional<Schema.String>;
1333
+ readonly format: Schema.optional<Schema.String>;
1334
+ }>>;
1335
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1336
+ }>, never, never>;
1337
+ }> | Schema.Struct<{
1338
+ readonly type: Schema.tag<"image">;
1339
+ readonly index: Schema.Number;
1340
+ readonly image: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
1341
+ readonly source: Schema.Union<readonly [Schema.Struct<{
1342
+ readonly type: Schema.Literal<"bytes">;
1343
+ readonly data: Schema.Uint8Array;
1344
+ readonly mediaType: Schema.String;
1345
+ }>, Schema.Struct<{
1346
+ readonly type: Schema.Literal<"base64">;
1347
+ readonly data: Schema.String;
1348
+ readonly mediaType: Schema.String;
1349
+ }>, Schema.Struct<{
1350
+ readonly type: Schema.Literal<"url">;
1351
+ readonly url: Schema.String;
1352
+ readonly mediaType: Schema.optional<Schema.String>;
1353
+ readonly expiresAt: Schema.optional<Schema.Number>;
1354
+ }>, Schema.Struct<{
1355
+ readonly type: Schema.Literal<"ref">;
1356
+ readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
1357
+ readonly id: Schema.String;
1358
+ readonly mediaType: Schema.optional<Schema.String>;
1359
+ }>]>;
1360
+ readonly info: Schema.optional<Schema.Struct<{
1361
+ readonly width: Schema.optional<Schema.Number>;
1362
+ readonly height: Schema.optional<Schema.Number>;
1363
+ readonly durationSeconds: Schema.optional<Schema.Number>;
1364
+ readonly sampleRate: Schema.optional<Schema.Number>;
1365
+ readonly channels: Schema.optional<Schema.Number>;
1366
+ readonly encoding: Schema.optional<Schema.String>;
1367
+ readonly format: Schema.optional<Schema.String>;
1368
+ }>>;
1369
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1370
+ }>, never, never>;
1371
+ }> | Schema.Struct<{
1372
+ readonly type: Schema.tag<"finish">;
1373
+ readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1374
+ readonly type: Schema.Literal<"tokens">;
1375
+ readonly input: Schema.optional<Schema.Number>;
1376
+ readonly output: Schema.optional<Schema.Number>;
1377
+ readonly total: Schema.optional<Schema.Number>;
1378
+ readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
1379
+ }>, Schema.Struct<{
1380
+ readonly type: Schema.Literal<"seconds">;
1381
+ readonly seconds: Schema.Number;
1382
+ }>, Schema.Struct<{
1383
+ readonly type: Schema.Literal<"characters">;
1384
+ readonly characters: Schema.Number;
1385
+ }>, Schema.Struct<{
1386
+ readonly type: Schema.Literal<"credits">;
1387
+ readonly credits: Schema.Number;
1388
+ }>, Schema.Struct<{
1389
+ readonly type: Schema.Literal<"compute">;
1390
+ readonly seconds: Schema.Number;
1391
+ }>]>>;
1392
+ readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
1393
+ readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
1394
+ readonly message: Schema.String;
1395
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1396
+ }>>>;
1397
+ readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1398
+ }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "image" | "image-partial">]: never; }, OrElse extends (value: Exclude<{
1234
1399
  readonly type: "generation-queued";
1235
- readonly position?: number | undefined;
1236
- }, {
1237
- readonly type: keyof Cases;
1238
- }> | Exclude<{
1239
1400
  readonly id: string;
1401
+ readonly position?: number | undefined;
1402
+ } | {
1240
1403
  readonly type: "generation-progress";
1404
+ readonly id: string;
1241
1405
  readonly progress?: number | undefined;
1242
- }, {
1243
- readonly type: keyof Cases;
1244
- }> | Exclude<{
1406
+ } | {
1245
1407
  readonly type: "image-partial";
1246
1408
  readonly index: number;
1247
1409
  readonly image: Media.Asset;
1248
- }, {
1249
- readonly type: keyof Cases;
1250
- }> | Exclude<{
1410
+ } | {
1251
1411
  readonly type: "image";
1252
1412
  readonly index: number;
1253
1413
  readonly image: Media.Asset;
1254
- }, {
1255
- readonly type: keyof Cases;
1256
- }> | Exclude<{
1414
+ } | {
1257
1415
  readonly type: "finish";
1258
- readonly providerMetadata?: {
1259
- readonly [x: string]: {
1260
- readonly [x: string]: unknown;
1261
- };
1262
- } | undefined;
1263
1416
  readonly usage?: {
1264
1417
  readonly type: "tokens";
1265
1418
  readonly input?: number | undefined;
@@ -1282,7 +1435,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1282
1435
  readonly seconds: number;
1283
1436
  } | undefined;
1284
1437
  readonly notices?: readonly {
1285
- readonly type: "other" | "moderated" | "filtered";
1438
+ readonly type: "filtered" | "moderated" | "other";
1286
1439
  readonly message: string;
1287
1440
  readonly providerMetadata?: {
1288
1441
  readonly [x: string]: {
@@ -1290,15 +1443,18 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1290
1443
  };
1291
1444
  } | undefined;
1292
1445
  }[] | undefined;
1293
- }, {
1294
- readonly type: keyof Cases;
1295
- }>) => any>(cases: Cases, orElse: OrElse): (value: {
1296
- readonly id: string;
1446
+ readonly providerMetadata?: {
1447
+ readonly [x: string]: {
1448
+ readonly [x: string]: unknown;
1449
+ };
1450
+ } | undefined;
1451
+ }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1297
1452
  readonly type: "generation-queued";
1453
+ readonly id: string;
1298
1454
  readonly position?: number | undefined;
1299
1455
  } | {
1300
- readonly id: string;
1301
1456
  readonly type: "generation-progress";
1457
+ readonly id: string;
1302
1458
  readonly progress?: number | undefined;
1303
1459
  } | {
1304
1460
  readonly type: "image-partial";
@@ -1310,11 +1466,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1310
1466
  readonly image: Media.Asset;
1311
1467
  } | {
1312
1468
  readonly type: "finish";
1313
- readonly providerMetadata?: {
1314
- readonly [x: string]: {
1315
- readonly [x: string]: unknown;
1316
- };
1317
- } | undefined;
1318
1469
  readonly usage?: {
1319
1470
  readonly type: "tokens";
1320
1471
  readonly input?: number | undefined;
@@ -1337,7 +1488,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1337
1488
  readonly seconds: number;
1338
1489
  } | undefined;
1339
1490
  readonly notices?: readonly {
1340
- readonly type: "other" | "moderated" | "filtered";
1491
+ readonly type: "filtered" | "moderated" | "other";
1341
1492
  readonly message: string;
1342
1493
  readonly providerMetadata?: {
1343
1494
  readonly [x: string]: {
@@ -1345,18 +1496,23 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1345
1496
  };
1346
1497
  } | undefined;
1347
1498
  }[] | undefined;
1348
- }) => 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>>;
1499
+ readonly providerMetadata?: {
1500
+ readonly [x: string]: {
1501
+ readonly [x: string]: unknown;
1502
+ };
1503
+ } | undefined;
1504
+ }) => import("effect/Unify").Unify<{ [K in keyof Cases]-?: NonNullable<Cases[K]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
1349
1505
  };
1350
1506
  } & {
1351
1507
  is: {
1352
1508
  generationQueued: (u: unknown) => u is {
1353
- readonly id: string;
1354
1509
  readonly type: "generation-queued";
1510
+ readonly id: string;
1355
1511
  readonly position?: number | undefined;
1356
1512
  };
1357
1513
  generationProgress: (u: unknown) => u is {
1358
- readonly id: string;
1359
1514
  readonly type: "generation-progress";
1515
+ readonly id: string;
1360
1516
  readonly progress?: number | undefined;
1361
1517
  };
1362
1518
  imagePartial: (u: unknown) => u is {
@@ -1371,11 +1527,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1371
1527
  };
1372
1528
  finish: (u: unknown) => u is {
1373
1529
  readonly type: "finish";
1374
- readonly providerMetadata?: {
1375
- readonly [x: string]: {
1376
- readonly [x: string]: unknown;
1377
- };
1378
- } | undefined;
1379
1530
  readonly usage?: {
1380
1531
  readonly type: "tokens";
1381
1532
  readonly input?: number | undefined;
@@ -1398,7 +1549,7 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1398
1549
  readonly seconds: number;
1399
1550
  } | undefined;
1400
1551
  readonly notices?: readonly {
1401
- readonly type: "other" | "moderated" | "filtered";
1552
+ readonly type: "filtered" | "moderated" | "other";
1402
1553
  readonly message: string;
1403
1554
  readonly providerMetadata?: {
1404
1555
  readonly [x: string]: {
@@ -1406,6 +1557,11 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1406
1557
  };
1407
1558
  } | undefined;
1408
1559
  }[] | undefined;
1560
+ readonly providerMetadata?: {
1561
+ readonly [x: string]: {
1562
+ readonly [x: string]: unknown;
1563
+ };
1564
+ } | undefined;
1409
1565
  };
1410
1566
  };
1411
1567
  };
@@ -1422,6 +1578,6 @@ export declare const Image: {
1422
1578
  readonly generate: typeof generate;
1423
1579
  readonly stream: typeof stream;
1424
1580
  readonly start: typeof start;
1425
- readonly resume: (model: ImageModel, token: unknown) => Effect.Effect<Generation<ImageResponse>, AIError, Service>;
1581
+ readonly resume: typeof resume;
1426
1582
  };
1427
1583
  export {};