@opencode/ai 2.1.2 → 2.1.4

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 (140) hide show
  1. package/dist/cache-policy.js +6 -5
  2. package/dist/experimental/evaluation.d.ts +7 -6
  3. package/dist/experimental/evaluation.js +3 -11
  4. package/dist/experimental/realtime.d.ts +59 -0
  5. package/dist/experimental/realtime.js +21 -13
  6. package/dist/experimental.d.ts +1 -1
  7. package/dist/generation.js +1 -1
  8. package/dist/image-client.d.ts +11 -9
  9. package/dist/image.d.ts +158 -150
  10. package/dist/image.js +2 -2
  11. package/dist/llm.d.ts +2 -4
  12. package/dist/llm.js +2 -2
  13. package/dist/media-model.d.ts +2 -2
  14. package/dist/media-model.js +1 -1
  15. package/dist/promise.d.ts +121 -121
  16. package/dist/promise.js +3 -5
  17. package/dist/protocols/alibaba-chat.d.ts +18 -18
  18. package/dist/protocols/alibaba-chat.js +3 -3
  19. package/dist/protocols/alibaba-messages.d.ts +12 -12
  20. package/dist/protocols/alibaba-messages.js +1 -1
  21. package/dist/protocols/alibaba-responses.d.ts +38 -38
  22. package/dist/protocols/anthropic-messages.d.ts +40 -44
  23. package/dist/protocols/anthropic-messages.js +13 -15
  24. package/dist/protocols/bedrock-converse.d.ts +36 -85
  25. package/dist/protocols/bedrock-converse.js +6 -6
  26. package/dist/protocols/bedrock-event-stream.d.ts +6 -1
  27. package/dist/protocols/bedrock-event-stream.js +9 -8
  28. package/dist/protocols/cartesia-speech.d.ts +32 -32
  29. package/dist/protocols/cohere-chat.d.ts +13 -10
  30. package/dist/protocols/cohere-chat.js +2 -2
  31. package/dist/protocols/deepgram-speech.d.ts +32 -32
  32. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  33. package/dist/protocols/gemini.d.ts +46 -36
  34. package/dist/protocols/gemini.js +12 -15
  35. package/dist/protocols/google-interactions.d.ts +14 -13
  36. package/dist/protocols/google-interactions.js +16 -11
  37. package/dist/protocols/google-speech.d.ts +32 -32
  38. package/dist/protocols/google-transcription.d.ts +32 -32
  39. package/dist/protocols/meta-messages.d.ts +23 -23
  40. package/dist/protocols/meta-responses.d.ts +84 -84
  41. package/dist/protocols/mistral-chat.d.ts +81 -78
  42. package/dist/protocols/mistral-chat.js +3 -5
  43. package/dist/protocols/open-responses-channel.js +47 -46
  44. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  45. package/dist/protocols/open-responses-continuation.js +3 -1
  46. package/dist/protocols/open-responses.d.ts +419 -419
  47. package/dist/protocols/open-responses.js +11 -10
  48. package/dist/protocols/openai-chat.d.ts +68 -67
  49. package/dist/protocols/openai-chat.js +7 -8
  50. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  51. package/dist/protocols/openai-compatible-responses.d.ts +39 -40
  52. package/dist/protocols/openai-images.d.ts +32 -32
  53. package/dist/protocols/openai-responses.d.ts +253 -253
  54. package/dist/protocols/openai-responses.js +1 -1
  55. package/dist/protocols/openai-speech.d.ts +32 -32
  56. package/dist/protocols/openai-transcription.d.ts +32 -32
  57. package/dist/protocols/openai-transcription.js +12 -7
  58. package/dist/protocols/utils/open-responses-options.d.ts +8 -8
  59. package/dist/protocols/utils/open-responses-options.js +4 -6
  60. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  61. package/dist/protocols/utils/partial-json-options.js +0 -1
  62. package/dist/protocols/utils/partial-json.js +5 -4
  63. package/dist/protocols/utils/tool-schema.d.ts +0 -3
  64. package/dist/protocols/utils/tool-schema.js +0 -4
  65. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  66. package/dist/protocols/venice-chat.d.ts +52 -53
  67. package/dist/protocols/venice-chat.js +6 -5
  68. package/dist/protocols/xai-images.js +3 -4
  69. package/dist/protocols/xai-responses.d.ts +81 -81
  70. package/dist/protocols/zai-chat.d.ts +33 -30
  71. package/dist/protocols/zai-chat.js +8 -3
  72. package/dist/protocols/zai-messages.d.ts +21 -19
  73. package/dist/protocols/zai-messages.js +3 -2
  74. package/dist/provider-error.js +8 -7
  75. package/dist/providers/alibaba.d.ts +74 -74
  76. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  77. package/dist/providers/amazon-bedrock.d.ts +16 -13
  78. package/dist/providers/anthropic-compatible.d.ts +13 -13
  79. package/dist/providers/anthropic.d.ts +13 -13
  80. package/dist/providers/azure.d.ts +112 -112
  81. package/dist/providers/baseten.d.ts +24 -24
  82. package/dist/providers/cerebras.d.ts +24 -24
  83. package/dist/providers/cloudflare-ai-gateway.d.ts +237 -234
  84. package/dist/providers/cloudflare-ai-gateway.js +3 -6
  85. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  86. package/dist/providers/cohere.d.ts +78 -74
  87. package/dist/providers/deepinfra.d.ts +24 -24
  88. package/dist/providers/deepseek.d.ts +24 -24
  89. package/dist/providers/digitalocean.d.ts +36 -36
  90. package/dist/providers/fireworks.d.ts +24 -24
  91. package/dist/providers/google-vertex-chat.d.ts +12 -12
  92. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  93. package/dist/providers/google-vertex-messages.d.ts +20 -20
  94. package/dist/providers/google-vertex-mistral.d.ts +14 -14
  95. package/dist/providers/google-vertex-responses.d.ts +38 -38
  96. package/dist/providers/google-vertex.d.ts +17 -17
  97. package/dist/providers/google-vertex.js +2 -2
  98. package/dist/providers/google.d.ts +79 -79
  99. package/dist/providers/groq.d.ts +24 -24
  100. package/dist/providers/meta.d.ts +189 -189
  101. package/dist/providers/minimax.d.ts +202 -202
  102. package/dist/providers/mistral.d.ts +28 -28
  103. package/dist/providers/moonshot.d.ts +202 -202
  104. package/dist/providers/open-responses-options.d.ts +0 -1
  105. package/dist/providers/open-responses-options.js +1 -1
  106. package/dist/providers/openai-compatible-responses.d.ts +38 -38
  107. package/dist/providers/openai-compatible.d.ts +12 -12
  108. package/dist/providers/openai-compatible.js +1 -1
  109. package/dist/providers/openai-options.d.ts +3 -4
  110. package/dist/providers/openai-options.js +0 -1
  111. package/dist/providers/openai.d.ts +103 -103
  112. package/dist/providers/openrouter.d.ts +171 -112
  113. package/dist/providers/openrouter.js +40 -33
  114. package/dist/providers/togetherai.d.ts +24 -24
  115. package/dist/providers/venice.d.ts +195 -20
  116. package/dist/providers/xai.d.ts +12 -12
  117. package/dist/providers/zai-coding-plan.d.ts +152 -72
  118. package/dist/providers/zai.d.ts +84 -19
  119. package/dist/route/auth-options.d.ts +0 -3
  120. package/dist/route/auth.d.ts +0 -2
  121. package/dist/route/auth.js +0 -2
  122. package/dist/route/client.d.ts +0 -218
  123. package/dist/route/client.js +3 -7
  124. package/dist/route/executor-service.js +1 -1
  125. package/dist/route/transport/http.js +5 -8
  126. package/dist/schema/errors.d.ts +1 -1
  127. package/dist/schema/errors.js +1 -1
  128. package/dist/schema/messages.js +4 -7
  129. package/dist/speech-client.d.ts +11 -9
  130. package/dist/speech.d.ts +158 -150
  131. package/dist/speech.js +2 -2
  132. package/dist/transcription-client.d.ts +11 -9
  133. package/dist/transcription.d.ts +158 -150
  134. package/dist/transcription.js +2 -2
  135. package/dist/video-client.d.ts +11 -9
  136. package/dist/video.d.ts +124 -116
  137. package/dist/video.js +2 -2
  138. package/package.json +7 -6
  139. package/dist/protocols/utils/openai-options.d.ts +0 -16
  140. package/dist/protocols/utils/openai-options.js +0 -15
package/dist/video.d.ts CHANGED
@@ -14,7 +14,11 @@ export declare class VideoModel<Options extends VideoOptions = VideoOptions> ext
14
14
  static fromRoute<Options extends VideoOptions, Frame, State>(route: MediaModel.StreamRouteInput<VideoRequestFor<Options>, VideoEvent, Frame, State>, input: MediaRoute.ModelInput): VideoModel<Options>;
15
15
  static fromRoute<Options extends VideoOptions, Token>(route: MediaModel.QueuedRouteInput<VideoRequestFor<Options>, VideoResponse, Token>, input: MediaRoute.ModelInput): VideoModel<Options>;
16
16
  }
17
- export declare const VideoModelSchema: Schema.declare<VideoModel<MediaModel.Options>, VideoModel<MediaModel.Options>>;
17
+ export declare const VideoModelSchema: Schema.declare<VideoModel<{
18
+ readonly [x: string]: unknown;
19
+ }>, VideoModel<{
20
+ readonly [x: string]: unknown;
21
+ }>>;
18
22
  export type VideoAspectRatio = Media.AspectRatio;
19
23
  export declare const VideoAspectRatio: Schema.declare<`${number}:${number}`, `${number}:${number}`>;
20
24
  export type VideoResolution = OpenString<"480p" | "720p" | "1080p" | "4k">;
@@ -85,7 +89,11 @@ export declare const VideoFrames: Schema.Struct<{
85
89
  }>;
86
90
  export type VideoFrames = Schema.Schema.Type<typeof VideoFrames>;
87
91
  declare const VideoRequest_base: Schema.Class<VideoRequest, Schema.Struct<{
88
- readonly model: Schema.declare<VideoModel<MediaModel.Options>, VideoModel<MediaModel.Options>>;
92
+ readonly model: Schema.declare<VideoModel<{
93
+ readonly [x: string]: unknown;
94
+ }>, VideoModel<{
95
+ readonly [x: string]: unknown;
96
+ }>>;
89
97
  readonly prompt: Schema.String;
90
98
  readonly frames: Schema.optional<Schema.Struct<{
91
99
  readonly first: Schema.optional<Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
@@ -581,6 +589,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
581
589
  }>;
582
590
  };
583
591
  readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
592
+ readonly type: "video";
593
+ readonly index: number;
594
+ readonly video: Media.Asset;
595
+ } | {
584
596
  readonly type: "generation-queued";
585
597
  readonly id: string;
586
598
  readonly position?: number | undefined;
@@ -588,21 +600,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
588
600
  readonly type: "generation-progress";
589
601
  readonly id: string;
590
602
  readonly progress?: number | undefined;
591
- } | {
592
- readonly type: "video";
593
- readonly index: number;
594
- readonly video: Media.Asset;
595
603
  } | {
596
604
  readonly type: "finish";
597
605
  readonly usage?: {
598
- readonly type: "tokens";
599
- readonly input?: number | undefined;
600
- readonly output?: number | undefined;
601
- readonly total?: number | undefined;
602
- readonly details?: {
603
- readonly [x: string]: unknown;
604
- } | undefined;
605
- } | {
606
606
  readonly type: "seconds";
607
607
  readonly seconds: number;
608
608
  } | {
@@ -614,6 +614,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
614
614
  } | {
615
615
  readonly type: "compute";
616
616
  readonly seconds: number;
617
+ } | {
618
+ readonly type: "tokens";
619
+ readonly input?: number | undefined;
620
+ readonly output?: number | undefined;
621
+ readonly total?: number | undefined;
622
+ readonly details?: {
623
+ readonly [x: string]: unknown;
624
+ } | undefined;
617
625
  } | undefined;
618
626
  readonly notices?: readonly {
619
627
  readonly type: "filtered" | "moderated" | "other";
@@ -630,6 +638,12 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
630
638
  };
631
639
  } | undefined;
632
640
  }) => value is Extract<{
641
+ readonly type: "video";
642
+ readonly index: number;
643
+ readonly video: Media.Asset;
644
+ }, {
645
+ readonly type: Keys;
646
+ }> | Extract<{
633
647
  readonly type: "generation-queued";
634
648
  readonly id: string;
635
649
  readonly position?: number | undefined;
@@ -641,23 +655,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
641
655
  readonly progress?: number | undefined;
642
656
  }, {
643
657
  readonly type: Keys;
644
- }> | Extract<{
645
- readonly type: "video";
646
- readonly index: number;
647
- readonly video: Media.Asset;
648
- }, {
649
- readonly type: Keys;
650
658
  }> | Extract<{
651
659
  readonly type: "finish";
652
660
  readonly usage?: {
653
- readonly type: "tokens";
654
- readonly input?: number | undefined;
655
- readonly output?: number | undefined;
656
- readonly total?: number | undefined;
657
- readonly details?: {
658
- readonly [x: string]: unknown;
659
- } | undefined;
660
- } | {
661
661
  readonly type: "seconds";
662
662
  readonly seconds: number;
663
663
  } | {
@@ -669,6 +669,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
669
669
  } | {
670
670
  readonly type: "compute";
671
671
  readonly seconds: number;
672
+ } | {
673
+ readonly type: "tokens";
674
+ readonly input?: number | undefined;
675
+ readonly output?: number | undefined;
676
+ readonly total?: number | undefined;
677
+ readonly details?: {
678
+ readonly [x: string]: unknown;
679
+ } | undefined;
672
680
  } | undefined;
673
681
  readonly notices?: readonly {
674
682
  readonly type: "filtered" | "moderated" | "other";
@@ -691,14 +699,6 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
691
699
  finish: (u: unknown) => u is {
692
700
  readonly type: "finish";
693
701
  readonly usage?: {
694
- readonly type: "tokens";
695
- readonly input?: number | undefined;
696
- readonly output?: number | undefined;
697
- readonly total?: number | undefined;
698
- readonly details?: {
699
- readonly [x: string]: unknown;
700
- } | undefined;
701
- } | {
702
702
  readonly type: "seconds";
703
703
  readonly seconds: number;
704
704
  } | {
@@ -710,6 +710,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
710
710
  } | {
711
711
  readonly type: "compute";
712
712
  readonly seconds: number;
713
+ } | {
714
+ readonly type: "tokens";
715
+ readonly input?: number | undefined;
716
+ readonly output?: number | undefined;
717
+ readonly total?: number | undefined;
718
+ readonly details?: {
719
+ readonly [x: string]: unknown;
720
+ } | undefined;
713
721
  } | undefined;
714
722
  readonly notices?: readonly {
715
723
  readonly type: "filtered" | "moderated" | "other";
@@ -813,6 +821,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
813
821
  }>>>;
814
822
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
815
823
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
824
+ readonly type: "video";
825
+ readonly index: number;
826
+ readonly video: Media.Asset;
827
+ } | {
816
828
  readonly type: "generation-queued";
817
829
  readonly id: string;
818
830
  readonly position?: number | undefined;
@@ -820,21 +832,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
820
832
  readonly type: "generation-progress";
821
833
  readonly id: string;
822
834
  readonly progress?: number | undefined;
823
- } | {
824
- readonly type: "video";
825
- readonly index: number;
826
- readonly video: Media.Asset;
827
835
  } | {
828
836
  readonly type: "finish";
829
837
  readonly usage?: {
830
- readonly type: "tokens";
831
- readonly input?: number | undefined;
832
- readonly output?: number | undefined;
833
- readonly total?: number | undefined;
834
- readonly details?: {
835
- readonly [x: string]: unknown;
836
- } | undefined;
837
- } | {
838
838
  readonly type: "seconds";
839
839
  readonly seconds: number;
840
840
  } | {
@@ -846,6 +846,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
846
846
  } | {
847
847
  readonly type: "compute";
848
848
  readonly seconds: number;
849
+ } | {
850
+ readonly type: "tokens";
851
+ readonly input?: number | undefined;
852
+ readonly output?: number | undefined;
853
+ readonly total?: number | undefined;
854
+ readonly details?: {
855
+ readonly [x: string]: unknown;
856
+ } | undefined;
849
857
  } | undefined;
850
858
  readonly notices?: readonly {
851
859
  readonly type: "filtered" | "moderated" | "other";
@@ -932,6 +940,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
932
940
  }>>>;
933
941
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
934
942
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
943
+ readonly type: "video";
944
+ readonly index: number;
945
+ readonly video: Media.Asset;
946
+ } | {
935
947
  readonly type: "generation-queued";
936
948
  readonly id: string;
937
949
  readonly position?: number | undefined;
@@ -939,21 +951,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
939
951
  readonly type: "generation-progress";
940
952
  readonly id: string;
941
953
  readonly progress?: number | undefined;
942
- } | {
943
- readonly type: "video";
944
- readonly index: number;
945
- readonly video: Media.Asset;
946
954
  } | {
947
955
  readonly type: "finish";
948
956
  readonly usage?: {
949
- readonly type: "tokens";
950
- readonly input?: number | undefined;
951
- readonly output?: number | undefined;
952
- readonly total?: number | undefined;
953
- readonly details?: {
954
- readonly [x: string]: unknown;
955
- } | undefined;
956
- } | {
957
957
  readonly type: "seconds";
958
958
  readonly seconds: number;
959
959
  } | {
@@ -965,6 +965,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
965
965
  } | {
966
966
  readonly type: "compute";
967
967
  readonly seconds: number;
968
+ } | {
969
+ readonly type: "tokens";
970
+ readonly input?: number | undefined;
971
+ readonly output?: number | undefined;
972
+ readonly total?: number | undefined;
973
+ readonly details?: {
974
+ readonly [x: string]: unknown;
975
+ } | undefined;
968
976
  } | undefined;
969
977
  readonly notices?: readonly {
970
978
  readonly type: "filtered" | "moderated" | "other";
@@ -1053,6 +1061,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1053
1061
  }>>>;
1054
1062
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1055
1063
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "video">]: never; }, OrElse extends (value: Exclude<{
1064
+ readonly type: "video";
1065
+ readonly index: number;
1066
+ readonly video: Media.Asset;
1067
+ } | {
1056
1068
  readonly type: "generation-queued";
1057
1069
  readonly id: string;
1058
1070
  readonly position?: number | undefined;
@@ -1060,21 +1072,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1060
1072
  readonly type: "generation-progress";
1061
1073
  readonly id: string;
1062
1074
  readonly progress?: number | undefined;
1063
- } | {
1064
- readonly type: "video";
1065
- readonly index: number;
1066
- readonly video: Media.Asset;
1067
1075
  } | {
1068
1076
  readonly type: "finish";
1069
1077
  readonly usage?: {
1070
- readonly type: "tokens";
1071
- readonly input?: number | undefined;
1072
- readonly output?: number | undefined;
1073
- readonly total?: number | undefined;
1074
- readonly details?: {
1075
- readonly [x: string]: unknown;
1076
- } | undefined;
1077
- } | {
1078
1078
  readonly type: "seconds";
1079
1079
  readonly seconds: number;
1080
1080
  } | {
@@ -1086,6 +1086,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1086
1086
  } | {
1087
1087
  readonly type: "compute";
1088
1088
  readonly seconds: number;
1089
+ } | {
1090
+ readonly type: "tokens";
1091
+ readonly input?: number | undefined;
1092
+ readonly output?: number | undefined;
1093
+ readonly total?: number | undefined;
1094
+ readonly details?: {
1095
+ readonly [x: string]: unknown;
1096
+ } | undefined;
1089
1097
  } | undefined;
1090
1098
  readonly notices?: readonly {
1091
1099
  readonly type: "filtered" | "moderated" | "other";
@@ -1102,6 +1110,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1102
1110
  };
1103
1111
  } | undefined;
1104
1112
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
1113
+ readonly type: "video";
1114
+ readonly index: number;
1115
+ readonly video: Media.Asset;
1116
+ } | {
1105
1117
  readonly type: "generation-queued";
1106
1118
  readonly id: string;
1107
1119
  readonly position?: number | undefined;
@@ -1109,21 +1121,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1109
1121
  readonly type: "generation-progress";
1110
1122
  readonly id: string;
1111
1123
  readonly progress?: number | undefined;
1112
- } | {
1113
- readonly type: "video";
1114
- readonly index: number;
1115
- readonly video: Media.Asset;
1116
1124
  } | {
1117
1125
  readonly type: "finish";
1118
1126
  readonly usage?: {
1119
- readonly type: "tokens";
1120
- readonly input?: number | undefined;
1121
- readonly output?: number | undefined;
1122
- readonly total?: number | undefined;
1123
- readonly details?: {
1124
- readonly [x: string]: unknown;
1125
- } | undefined;
1126
- } | {
1127
1127
  readonly type: "seconds";
1128
1128
  readonly seconds: number;
1129
1129
  } | {
@@ -1135,6 +1135,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1135
1135
  } | {
1136
1136
  readonly type: "compute";
1137
1137
  readonly seconds: number;
1138
+ } | {
1139
+ readonly type: "tokens";
1140
+ readonly input?: number | undefined;
1141
+ readonly output?: number | undefined;
1142
+ readonly total?: number | undefined;
1143
+ readonly details?: {
1144
+ readonly [x: string]: unknown;
1145
+ } | undefined;
1138
1146
  } | undefined;
1139
1147
  readonly notices?: readonly {
1140
1148
  readonly type: "filtered" | "moderated" | "other";
@@ -1221,6 +1229,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1221
1229
  }>>>;
1222
1230
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1223
1231
  }> as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "finish" | "generation-progress" | "generation-queued" | "video">]: never; }, OrElse extends (value: Exclude<{
1232
+ readonly type: "video";
1233
+ readonly index: number;
1234
+ readonly video: Media.Asset;
1235
+ } | {
1224
1236
  readonly type: "generation-queued";
1225
1237
  readonly id: string;
1226
1238
  readonly position?: number | undefined;
@@ -1228,21 +1240,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1228
1240
  readonly type: "generation-progress";
1229
1241
  readonly id: string;
1230
1242
  readonly progress?: number | undefined;
1231
- } | {
1232
- readonly type: "video";
1233
- readonly index: number;
1234
- readonly video: Media.Asset;
1235
1243
  } | {
1236
1244
  readonly type: "finish";
1237
1245
  readonly usage?: {
1238
- readonly type: "tokens";
1239
- readonly input?: number | undefined;
1240
- readonly output?: number | undefined;
1241
- readonly total?: number | undefined;
1242
- readonly details?: {
1243
- readonly [x: string]: unknown;
1244
- } | undefined;
1245
- } | {
1246
1246
  readonly type: "seconds";
1247
1247
  readonly seconds: number;
1248
1248
  } | {
@@ -1254,6 +1254,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1254
1254
  } | {
1255
1255
  readonly type: "compute";
1256
1256
  readonly seconds: number;
1257
+ } | {
1258
+ readonly type: "tokens";
1259
+ readonly input?: number | undefined;
1260
+ readonly output?: number | undefined;
1261
+ readonly total?: number | undefined;
1262
+ readonly details?: {
1263
+ readonly [x: string]: unknown;
1264
+ } | undefined;
1257
1265
  } | undefined;
1258
1266
  readonly notices?: readonly {
1259
1267
  readonly type: "filtered" | "moderated" | "other";
@@ -1270,6 +1278,10 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1270
1278
  };
1271
1279
  } | undefined;
1272
1280
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1281
+ readonly type: "video";
1282
+ readonly index: number;
1283
+ readonly video: Media.Asset;
1284
+ } | {
1273
1285
  readonly type: "generation-queued";
1274
1286
  readonly id: string;
1275
1287
  readonly position?: number | undefined;
@@ -1277,21 +1289,9 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1277
1289
  readonly type: "generation-progress";
1278
1290
  readonly id: string;
1279
1291
  readonly progress?: number | undefined;
1280
- } | {
1281
- readonly type: "video";
1282
- readonly index: number;
1283
- readonly video: Media.Asset;
1284
1292
  } | {
1285
1293
  readonly type: "finish";
1286
1294
  readonly usage?: {
1287
- readonly type: "tokens";
1288
- readonly input?: number | undefined;
1289
- readonly output?: number | undefined;
1290
- readonly total?: number | undefined;
1291
- readonly details?: {
1292
- readonly [x: string]: unknown;
1293
- } | undefined;
1294
- } | {
1295
1295
  readonly type: "seconds";
1296
1296
  readonly seconds: number;
1297
1297
  } | {
@@ -1303,6 +1303,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1303
1303
  } | {
1304
1304
  readonly type: "compute";
1305
1305
  readonly seconds: number;
1306
+ } | {
1307
+ readonly type: "tokens";
1308
+ readonly input?: number | undefined;
1309
+ readonly output?: number | undefined;
1310
+ readonly total?: number | undefined;
1311
+ readonly details?: {
1312
+ readonly [x: string]: unknown;
1313
+ } | undefined;
1306
1314
  } | undefined;
1307
1315
  readonly notices?: readonly {
1308
1316
  readonly type: "filtered" | "moderated" | "other";
@@ -1340,14 +1348,6 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1340
1348
  finish: (u: unknown) => u is {
1341
1349
  readonly type: "finish";
1342
1350
  readonly usage?: {
1343
- readonly type: "tokens";
1344
- readonly input?: number | undefined;
1345
- readonly output?: number | undefined;
1346
- readonly total?: number | undefined;
1347
- readonly details?: {
1348
- readonly [x: string]: unknown;
1349
- } | undefined;
1350
- } | {
1351
1351
  readonly type: "seconds";
1352
1352
  readonly seconds: number;
1353
1353
  } | {
@@ -1359,6 +1359,14 @@ export declare const VideoEvent: Schema.Union<readonly [Schema.Struct<{
1359
1359
  } | {
1360
1360
  readonly type: "compute";
1361
1361
  readonly seconds: number;
1362
+ } | {
1363
+ readonly type: "tokens";
1364
+ readonly input?: number | undefined;
1365
+ readonly output?: number | undefined;
1366
+ readonly total?: number | undefined;
1367
+ readonly details?: {
1368
+ readonly [x: string]: unknown;
1369
+ } | undefined;
1362
1370
  } | undefined;
1363
1371
  readonly notices?: readonly {
1364
1372
  readonly type: "filtered" | "moderated" | "other";
package/dist/video.js CHANGED
@@ -3,7 +3,7 @@ import { Generation, ProgressEvent, QueuedEvent } from "./generation.js";
3
3
  import { Media } from "./media.js";
4
4
  import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
5
5
  import { MediaRoute } from "./route/media.js";
6
- import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
6
+ import { AIError, HttpOptions, MediaUsage, ProviderMetadata, ProviderOptions, } from "./schema/index.js";
7
7
  import { VideoClient, Service } from "./video-client.js";
8
8
  export class VideoModel extends MediaModel {
9
9
  static fromRoute(route, input) {
@@ -40,7 +40,7 @@ export class VideoRequest extends Schema.Class("Video.Request")({
40
40
  n: Schema.optional(Schema.Int),
41
41
  seed: Schema.optional(Schema.Number),
42
42
  negativePrompt: Schema.optional(Schema.String),
43
- providerOptions: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
43
+ providerOptions: Schema.optional(ProviderOptions),
44
44
  http: Schema.optional(HttpOptions),
45
45
  }) {
46
46
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
8
  "setup:recording-env": "bun run script/setup-recording-env.ts",
9
9
  "test": "bun test --timeout 30000 --only-failures",
10
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.types.json",
10
+ "typecheck": "bun check --no-script && bun check --no-script -p tsconfig.types.json",
11
+ "typecheck:tsc": "tsc --noEmit && tsc --noEmit -p tsconfig.types.json",
11
12
  "build": "tsc -p tsconfig.build.json"
12
13
  },
13
14
  "files": [
@@ -34,17 +35,17 @@
34
35
  "devDependencies": {
35
36
  "@clack/prompts": "1.0.0-alpha.1",
36
37
  "@effect/platform-node": "4.0.1",
37
- "@opencode/http-recorder": "2.1.2",
38
+ "@opencode/http-recorder": "2.1.4",
38
39
  "@tsconfig/bun": "1.0.9",
39
- "@types/bun": "1.4.0",
40
- "@typescript/native": "npm:typescript@7.0.2",
40
+ "@types/bun": "1.4.3",
41
+ "@typescript/native": "npm:typescript@7.1.0-beta",
41
42
  "typescript": "npm:@typescript/typescript6@6.0.2"
42
43
  },
43
44
  "dependencies": {
44
45
  "@aws-sdk/credential-providers": "3.1057.0",
45
46
  "@smithy/eventstream-codec": "4.2.14",
46
47
  "@smithy/util-utf8": "4.2.2",
47
- "@opencode/schema": "2.1.2",
48
+ "@opencode/schema": "2.1.4",
48
49
  "aws4fetch": "1.0.20",
49
50
  "effect": "4.0.1",
50
51
  "google-auth-library": "10.5.0"
@@ -1,16 +0,0 @@
1
- import { OpenResponsesOptions } from "./open-responses-options.js";
2
- export declare const OpenAIReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
- export type OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
4
- export declare const OpenAITextVerbosities: readonly ["low", "medium", "high"];
5
- export type OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
6
- export declare const OpenAIResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
7
- export type OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludable;
8
- export declare const OpenAIServiceTiers: readonly ["auto", "default", "flex", "priority", "scale", "fast", "ultrafast"];
9
- export type OpenAIServiceTier = (typeof OpenAIServiceTiers)[number] | (string & {});
10
- export declare const OpenAIReasoningEffort: import("effect/Schema").declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>;
11
- export declare const OpenAITextVerbosity: import("effect/Schema").declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>;
12
- export declare const OpenAIResponseIncludable: import("effect/Schema").declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>;
13
- export declare const OpenAIServiceTier: import("effect/Schema").declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>;
14
- export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
15
- export declare const resolve: typeof OpenResponsesOptions.resolve;
16
- export * as OpenAIOptions from "./openai-options.js";
@@ -1,15 +0,0 @@
1
- import { OpenResponsesOptions } from "./open-responses-options.js";
2
- export const OpenAIReasoningEfforts = OpenResponsesOptions.ReasoningEfforts;
3
- export const OpenAITextVerbosities = OpenResponsesOptions.TextVerbosities;
4
- // Mirrors OpenAI's `ResponseIncludable` union from the official SDK. Keep this
5
- // in lockstep with `openai-node/src/resources/responses/responses.ts`.
6
- export const OpenAIResponseIncludables = OpenResponsesOptions.ResponseIncludables;
7
- // Mirrors OpenAI's `ServiceTier` union from the official SDK.
8
- export const OpenAIServiceTiers = [...OpenResponsesOptions.ServiceTiers, "scale", "fast", "ultrafast"];
9
- export const OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
10
- export const OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
11
- export const OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludableSchema;
12
- export const OpenAIServiceTier = OpenResponsesOptions.ServiceTierSchema;
13
- export const isReasoningEffort = (effort) => typeof effort === "string";
14
- export const resolve = OpenResponsesOptions.resolve;
15
- export * as OpenAIOptions from "./openai-options.js";