@opencode/ai 2.1.3 → 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 (106) hide show
  1. package/dist/experimental/evaluation.js +3 -10
  2. package/dist/image-client.d.ts +8 -8
  3. package/dist/image.d.ts +148 -148
  4. package/dist/promise.d.ts +120 -120
  5. package/dist/protocols/alibaba-chat.d.ts +12 -12
  6. package/dist/protocols/alibaba-messages.d.ts +11 -11
  7. package/dist/protocols/alibaba-responses.d.ts +35 -35
  8. package/dist/protocols/anthropic-messages.d.ts +40 -44
  9. package/dist/protocols/anthropic-messages.js +3 -3
  10. package/dist/protocols/bedrock-converse.d.ts +30 -32
  11. package/dist/protocols/bedrock-converse.js +2 -3
  12. package/dist/protocols/cartesia-speech.d.ts +32 -32
  13. package/dist/protocols/cohere-chat.d.ts +7 -8
  14. package/dist/protocols/deepgram-speech.d.ts +32 -32
  15. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  16. package/dist/protocols/gemini.d.ts +34 -34
  17. package/dist/protocols/gemini.js +2 -2
  18. package/dist/protocols/google-interactions.d.ts +14 -14
  19. package/dist/protocols/google-interactions.js +2 -2
  20. package/dist/protocols/google-speech.d.ts +32 -32
  21. package/dist/protocols/google-transcription.d.ts +32 -32
  22. package/dist/protocols/meta-messages.d.ts +23 -23
  23. package/dist/protocols/meta-responses.d.ts +78 -78
  24. package/dist/protocols/mistral-chat.d.ts +81 -78
  25. package/dist/protocols/mistral-chat.js +2 -1
  26. package/dist/protocols/open-responses-channel.js +47 -46
  27. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  28. package/dist/protocols/open-responses-continuation.js +3 -1
  29. package/dist/protocols/open-responses.d.ts +398 -398
  30. package/dist/protocols/open-responses.js +8 -7
  31. package/dist/protocols/openai-chat.d.ts +60 -60
  32. package/dist/protocols/openai-chat.js +3 -3
  33. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  34. package/dist/protocols/openai-compatible-responses.d.ts +36 -37
  35. package/dist/protocols/openai-images.d.ts +32 -32
  36. package/dist/protocols/openai-responses.d.ts +235 -235
  37. package/dist/protocols/openai-responses.js +1 -1
  38. package/dist/protocols/openai-speech.d.ts +32 -32
  39. package/dist/protocols/openai-transcription.d.ts +32 -32
  40. package/dist/protocols/openai-transcription.js +12 -7
  41. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  42. package/dist/protocols/utils/partial-json-options.js +0 -1
  43. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  44. package/dist/protocols/venice-chat.d.ts +52 -53
  45. package/dist/protocols/venice-chat.js +6 -5
  46. package/dist/protocols/xai-responses.d.ts +78 -78
  47. package/dist/protocols/zai-chat.d.ts +33 -30
  48. package/dist/protocols/zai-chat.js +8 -3
  49. package/dist/protocols/zai-messages.d.ts +21 -19
  50. package/dist/protocols/zai-messages.js +3 -2
  51. package/dist/provider-error.js +5 -3
  52. package/dist/providers/alibaba.d.ts +69 -69
  53. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  54. package/dist/providers/amazon-bedrock.d.ts +15 -15
  55. package/dist/providers/anthropic-compatible.d.ts +13 -13
  56. package/dist/providers/anthropic.d.ts +13 -13
  57. package/dist/providers/azure.d.ts +106 -106
  58. package/dist/providers/baseten.d.ts +24 -24
  59. package/dist/providers/cerebras.d.ts +24 -24
  60. package/dist/providers/cloudflare-ai-gateway.d.ts +230 -227
  61. package/dist/providers/cloudflare-ai-gateway.js +1 -2
  62. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  63. package/dist/providers/cohere.d.ts +75 -75
  64. package/dist/providers/deepinfra.d.ts +24 -24
  65. package/dist/providers/deepseek.d.ts +24 -24
  66. package/dist/providers/digitalocean.d.ts +36 -36
  67. package/dist/providers/fireworks.d.ts +24 -24
  68. package/dist/providers/google-vertex-chat.d.ts +12 -12
  69. package/dist/providers/google-vertex-messages.d.ts +13 -13
  70. package/dist/providers/google-vertex-mistral.d.ts +17 -17
  71. package/dist/providers/google-vertex-responses.d.ts +35 -35
  72. package/dist/providers/google-vertex.d.ts +17 -17
  73. package/dist/providers/google-vertex.js +2 -2
  74. package/dist/providers/google.d.ts +17 -17
  75. package/dist/providers/groq.d.ts +24 -24
  76. package/dist/providers/meta.d.ts +179 -179
  77. package/dist/providers/minimax.d.ts +71 -71
  78. package/dist/providers/mistral.d.ts +28 -28
  79. package/dist/providers/moonshot.d.ts +202 -202
  80. package/dist/providers/open-responses-options.d.ts +0 -1
  81. package/dist/providers/open-responses-options.js +1 -1
  82. package/dist/providers/openai-compatible-responses.d.ts +35 -35
  83. package/dist/providers/openai-compatible.d.ts +12 -12
  84. package/dist/providers/openai-compatible.js +1 -1
  85. package/dist/providers/openai-options.d.ts +0 -1
  86. package/dist/providers/openai-options.js +0 -1
  87. package/dist/providers/openai.d.ts +100 -100
  88. package/dist/providers/openrouter.d.ts +36 -36
  89. package/dist/providers/togetherai.d.ts +24 -24
  90. package/dist/providers/venice.d.ts +195 -20
  91. package/dist/providers/xai.d.ts +12 -12
  92. package/dist/providers/zai-coding-plan.d.ts +149 -69
  93. package/dist/providers/zai.d.ts +84 -19
  94. package/dist/route/auth-options.d.ts +0 -3
  95. package/dist/route/auth.d.ts +0 -2
  96. package/dist/route/auth.js +0 -2
  97. package/dist/route/client.d.ts +0 -2
  98. package/dist/route/client.js +3 -4
  99. package/dist/route/executor-service.js +1 -1
  100. package/dist/speech-client.d.ts +8 -8
  101. package/dist/speech.d.ts +148 -148
  102. package/dist/transcription-client.d.ts +8 -8
  103. package/dist/transcription.d.ts +148 -148
  104. package/dist/video-client.d.ts +8 -8
  105. package/dist/video.d.ts +114 -114
  106. package/package.json +6 -5
@@ -1,5 +1,6 @@
1
1
  import { Effect, Schema } from "effect";
2
- import { AIError, HttpOptions, InvalidRequestError, ModelID, ProviderID, ProviderMetadata, Usage, } from "../schema/index.js";
2
+ import { tryRequest } from "../media-model.js";
3
+ import { AIError, HttpOptions, ModelID, ProviderID, ProviderMetadata, Usage, } from "../schema/index.js";
3
4
  import { EvaluationClient, Service } from "./evaluation-client.js";
4
5
  export const EvaluationInput = Schema.Union([Schema.String, Schema.JsonObject, Schema.Array(Schema.Json)]);
5
6
  const EvaluationCriterion = Schema.NullOr(EvaluationInput);
@@ -99,15 +100,7 @@ export function request(input) {
99
100
  });
100
101
  }
101
102
  export function run(input) {
102
- return Effect.try({
103
- try: () => request(input),
104
- catch: (cause) => new AIError({
105
- reason: new InvalidRequestError({
106
- message: cause instanceof Error ? cause.message : String(cause),
107
- cause,
108
- }),
109
- }),
110
- }).pipe(Effect.flatMap(EvaluationClient.evaluate));
103
+ return tryRequest(() => request(input)).pipe(Effect.flatMap(EvaluationClient.evaluate));
111
104
  }
112
105
  export const Evaluation = {
113
106
  request,
@@ -21,14 +21,6 @@ export declare const ImageClient: {
21
21
  } | {
22
22
  readonly type: "finish";
23
23
  readonly usage?: {
24
- readonly type: "tokens";
25
- readonly input?: number | undefined;
26
- readonly output?: number | undefined;
27
- readonly total?: number | undefined;
28
- readonly details?: {
29
- readonly [x: string]: unknown;
30
- } | undefined;
31
- } | {
32
24
  readonly type: "seconds";
33
25
  readonly seconds: number;
34
26
  } | {
@@ -40,6 +32,14 @@ export declare const ImageClient: {
40
32
  } | {
41
33
  readonly type: "compute";
42
34
  readonly seconds: number;
35
+ } | {
36
+ readonly type: "tokens";
37
+ readonly input?: number | undefined;
38
+ readonly output?: number | undefined;
39
+ readonly total?: number | undefined;
40
+ readonly details?: {
41
+ readonly [x: string]: unknown;
42
+ } | undefined;
43
43
  } | undefined;
44
44
  readonly notices?: readonly {
45
45
  readonly type: "filtered" | "moderated" | "other";
package/dist/image.d.ts CHANGED
@@ -597,14 +597,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
597
597
  }>;
598
598
  };
599
599
  readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
600
- readonly type: "generation-queued";
601
- readonly id: string;
602
- readonly position?: number | undefined;
603
- } | {
604
- readonly type: "generation-progress";
605
- readonly id: string;
606
- readonly progress?: number | undefined;
607
- } | {
608
600
  readonly type: "image-partial";
609
601
  readonly index: number;
610
602
  readonly image: Media.Asset;
@@ -612,17 +604,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
612
604
  readonly type: "image";
613
605
  readonly index: number;
614
606
  readonly image: Media.Asset;
607
+ } | {
608
+ readonly type: "generation-queued";
609
+ readonly id: string;
610
+ readonly position?: number | undefined;
611
+ } | {
612
+ readonly type: "generation-progress";
613
+ readonly id: string;
614
+ readonly progress?: number | undefined;
615
615
  } | {
616
616
  readonly type: "finish";
617
617
  readonly usage?: {
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;
625
- } | {
626
618
  readonly type: "seconds";
627
619
  readonly seconds: number;
628
620
  } | {
@@ -634,6 +626,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
634
626
  } | {
635
627
  readonly type: "compute";
636
628
  readonly seconds: number;
629
+ } | {
630
+ readonly type: "tokens";
631
+ readonly input?: number | undefined;
632
+ readonly output?: number | undefined;
633
+ readonly total?: number | undefined;
634
+ readonly details?: {
635
+ readonly [x: string]: unknown;
636
+ } | undefined;
637
637
  } | undefined;
638
638
  readonly notices?: readonly {
639
639
  readonly type: "filtered" | "moderated" | "other";
@@ -650,18 +650,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
650
650
  };
651
651
  } | undefined;
652
652
  }) => value is Extract<{
653
- readonly type: "generation-queued";
654
- readonly id: string;
655
- readonly position?: number | undefined;
656
- }, {
657
- readonly type: Keys;
658
- }> | Extract<{
659
- readonly type: "generation-progress";
660
- readonly id: string;
661
- readonly progress?: number | undefined;
662
- }, {
663
- readonly type: Keys;
664
- }> | Extract<{
665
653
  readonly type: "image-partial";
666
654
  readonly index: number;
667
655
  readonly image: Media.Asset;
@@ -673,17 +661,21 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
673
661
  readonly image: Media.Asset;
674
662
  }, {
675
663
  readonly type: Keys;
664
+ }> | Extract<{
665
+ readonly type: "generation-queued";
666
+ readonly id: string;
667
+ readonly position?: number | undefined;
668
+ }, {
669
+ readonly type: Keys;
670
+ }> | Extract<{
671
+ readonly type: "generation-progress";
672
+ readonly id: string;
673
+ readonly progress?: number | undefined;
674
+ }, {
675
+ readonly type: Keys;
676
676
  }> | Extract<{
677
677
  readonly type: "finish";
678
678
  readonly usage?: {
679
- readonly type: "tokens";
680
- readonly input?: number | undefined;
681
- readonly output?: number | undefined;
682
- readonly total?: number | undefined;
683
- readonly details?: {
684
- readonly [x: string]: unknown;
685
- } | undefined;
686
- } | {
687
679
  readonly type: "seconds";
688
680
  readonly seconds: number;
689
681
  } | {
@@ -695,6 +687,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
695
687
  } | {
696
688
  readonly type: "compute";
697
689
  readonly seconds: number;
690
+ } | {
691
+ readonly type: "tokens";
692
+ readonly input?: number | undefined;
693
+ readonly output?: number | undefined;
694
+ readonly total?: number | undefined;
695
+ readonly details?: {
696
+ readonly [x: string]: unknown;
697
+ } | undefined;
698
698
  } | undefined;
699
699
  readonly notices?: readonly {
700
700
  readonly type: "filtered" | "moderated" | "other";
@@ -717,14 +717,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
717
717
  finish: (u: unknown) => u is {
718
718
  readonly type: "finish";
719
719
  readonly usage?: {
720
- readonly type: "tokens";
721
- readonly input?: number | undefined;
722
- readonly output?: number | undefined;
723
- readonly total?: number | undefined;
724
- readonly details?: {
725
- readonly [x: string]: unknown;
726
- } | undefined;
727
- } | {
728
720
  readonly type: "seconds";
729
721
  readonly seconds: number;
730
722
  } | {
@@ -736,6 +728,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
736
728
  } | {
737
729
  readonly type: "compute";
738
730
  readonly seconds: number;
731
+ } | {
732
+ readonly type: "tokens";
733
+ readonly input?: number | undefined;
734
+ readonly output?: number | undefined;
735
+ readonly total?: number | undefined;
736
+ readonly details?: {
737
+ readonly [x: string]: unknown;
738
+ } | undefined;
739
739
  } | undefined;
740
740
  readonly notices?: readonly {
741
741
  readonly type: "filtered" | "moderated" | "other";
@@ -878,14 +878,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
878
878
  }>>>;
879
879
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
880
880
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
881
- readonly type: "generation-queued";
882
- readonly id: string;
883
- readonly position?: number | undefined;
884
- } | {
885
- readonly type: "generation-progress";
886
- readonly id: string;
887
- readonly progress?: number | undefined;
888
- } | {
889
881
  readonly type: "image-partial";
890
882
  readonly index: number;
891
883
  readonly image: Media.Asset;
@@ -893,17 +885,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
893
885
  readonly type: "image";
894
886
  readonly index: number;
895
887
  readonly image: Media.Asset;
888
+ } | {
889
+ readonly type: "generation-queued";
890
+ readonly id: string;
891
+ readonly position?: number | undefined;
892
+ } | {
893
+ readonly type: "generation-progress";
894
+ readonly id: string;
895
+ readonly progress?: number | undefined;
896
896
  } | {
897
897
  readonly type: "finish";
898
898
  readonly usage?: {
899
- readonly type: "tokens";
900
- readonly input?: number | undefined;
901
- readonly output?: number | undefined;
902
- readonly total?: number | undefined;
903
- readonly details?: {
904
- readonly [x: string]: unknown;
905
- } | undefined;
906
- } | {
907
899
  readonly type: "seconds";
908
900
  readonly seconds: number;
909
901
  } | {
@@ -915,6 +907,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
915
907
  } | {
916
908
  readonly type: "compute";
917
909
  readonly seconds: number;
910
+ } | {
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
918
  } | undefined;
919
919
  readonly notices?: readonly {
920
920
  readonly type: "filtered" | "moderated" | "other";
@@ -1035,14 +1035,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1035
1035
  }>>>;
1036
1036
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1037
1037
  }> as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
1038
- readonly type: "generation-queued";
1039
- readonly id: string;
1040
- readonly position?: number | undefined;
1041
- } | {
1042
- readonly type: "generation-progress";
1043
- readonly id: string;
1044
- readonly progress?: number | undefined;
1045
- } | {
1046
1038
  readonly type: "image-partial";
1047
1039
  readonly index: number;
1048
1040
  readonly image: Media.Asset;
@@ -1050,17 +1042,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1050
1042
  readonly type: "image";
1051
1043
  readonly index: number;
1052
1044
  readonly image: Media.Asset;
1045
+ } | {
1046
+ readonly type: "generation-queued";
1047
+ readonly id: string;
1048
+ readonly position?: number | undefined;
1049
+ } | {
1050
+ readonly type: "generation-progress";
1051
+ readonly id: string;
1052
+ readonly progress?: number | undefined;
1053
1053
  } | {
1054
1054
  readonly type: "finish";
1055
1055
  readonly usage?: {
1056
- readonly type: "tokens";
1057
- readonly input?: number | undefined;
1058
- readonly output?: number | undefined;
1059
- readonly total?: number | undefined;
1060
- readonly details?: {
1061
- readonly [x: string]: unknown;
1062
- } | undefined;
1063
- } | {
1064
1056
  readonly type: "seconds";
1065
1057
  readonly seconds: number;
1066
1058
  } | {
@@ -1072,6 +1064,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1072
1064
  } | {
1073
1065
  readonly type: "compute";
1074
1066
  readonly seconds: number;
1067
+ } | {
1068
+ readonly type: "tokens";
1069
+ readonly input?: number | undefined;
1070
+ readonly output?: number | undefined;
1071
+ readonly total?: number | undefined;
1072
+ readonly details?: {
1073
+ readonly [x: string]: unknown;
1074
+ } | undefined;
1075
1075
  } | undefined;
1076
1076
  readonly notices?: readonly {
1077
1077
  readonly type: "filtered" | "moderated" | "other";
@@ -1194,14 +1194,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1194
1194
  }>>>;
1195
1195
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1196
1196
  }> 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<{
1197
- readonly type: "generation-queued";
1198
- readonly id: string;
1199
- readonly position?: number | undefined;
1200
- } | {
1201
- readonly type: "generation-progress";
1202
- readonly id: string;
1203
- readonly progress?: number | undefined;
1204
- } | {
1205
1197
  readonly type: "image-partial";
1206
1198
  readonly index: number;
1207
1199
  readonly image: Media.Asset;
@@ -1209,17 +1201,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1209
1201
  readonly type: "image";
1210
1202
  readonly index: number;
1211
1203
  readonly image: Media.Asset;
1204
+ } | {
1205
+ readonly type: "generation-queued";
1206
+ readonly id: string;
1207
+ readonly position?: number | undefined;
1208
+ } | {
1209
+ readonly type: "generation-progress";
1210
+ readonly id: string;
1211
+ readonly progress?: number | undefined;
1212
1212
  } | {
1213
1213
  readonly type: "finish";
1214
1214
  readonly usage?: {
1215
- readonly type: "tokens";
1216
- readonly input?: number | undefined;
1217
- readonly output?: number | undefined;
1218
- readonly total?: number | undefined;
1219
- readonly details?: {
1220
- readonly [x: string]: unknown;
1221
- } | undefined;
1222
- } | {
1223
1215
  readonly type: "seconds";
1224
1216
  readonly seconds: number;
1225
1217
  } | {
@@ -1231,6 +1223,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1231
1223
  } | {
1232
1224
  readonly type: "compute";
1233
1225
  readonly seconds: number;
1226
+ } | {
1227
+ readonly type: "tokens";
1228
+ readonly input?: number | undefined;
1229
+ readonly output?: number | undefined;
1230
+ readonly total?: number | undefined;
1231
+ readonly details?: {
1232
+ readonly [x: string]: unknown;
1233
+ } | undefined;
1234
1234
  } | undefined;
1235
1235
  readonly notices?: readonly {
1236
1236
  readonly type: "filtered" | "moderated" | "other";
@@ -1247,14 +1247,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1247
1247
  };
1248
1248
  } | undefined;
1249
1249
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
1250
- readonly type: "generation-queued";
1251
- readonly id: string;
1252
- readonly position?: number | undefined;
1253
- } | {
1254
- readonly type: "generation-progress";
1255
- readonly id: string;
1256
- readonly progress?: number | undefined;
1257
- } | {
1258
1250
  readonly type: "image-partial";
1259
1251
  readonly index: number;
1260
1252
  readonly image: Media.Asset;
@@ -1262,17 +1254,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1262
1254
  readonly type: "image";
1263
1255
  readonly index: number;
1264
1256
  readonly image: Media.Asset;
1257
+ } | {
1258
+ readonly type: "generation-queued";
1259
+ readonly id: string;
1260
+ readonly position?: number | undefined;
1261
+ } | {
1262
+ readonly type: "generation-progress";
1263
+ readonly id: string;
1264
+ readonly progress?: number | undefined;
1265
1265
  } | {
1266
1266
  readonly type: "finish";
1267
1267
  readonly usage?: {
1268
- readonly type: "tokens";
1269
- readonly input?: number | undefined;
1270
- readonly output?: number | undefined;
1271
- readonly total?: number | undefined;
1272
- readonly details?: {
1273
- readonly [x: string]: unknown;
1274
- } | undefined;
1275
- } | {
1276
1268
  readonly type: "seconds";
1277
1269
  readonly seconds: number;
1278
1270
  } | {
@@ -1284,6 +1276,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1284
1276
  } | {
1285
1277
  readonly type: "compute";
1286
1278
  readonly seconds: number;
1279
+ } | {
1280
+ readonly type: "tokens";
1281
+ readonly input?: number | undefined;
1282
+ readonly output?: number | undefined;
1283
+ readonly total?: number | undefined;
1284
+ readonly details?: {
1285
+ readonly [x: string]: unknown;
1286
+ } | undefined;
1287
1287
  } | undefined;
1288
1288
  readonly notices?: readonly {
1289
1289
  readonly type: "filtered" | "moderated" | "other";
@@ -1404,14 +1404,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1404
1404
  }>>>;
1405
1405
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
1406
1406
  }> 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<{
1407
- readonly type: "generation-queued";
1408
- readonly id: string;
1409
- readonly position?: number | undefined;
1410
- } | {
1411
- readonly type: "generation-progress";
1412
- readonly id: string;
1413
- readonly progress?: number | undefined;
1414
- } | {
1415
1407
  readonly type: "image-partial";
1416
1408
  readonly index: number;
1417
1409
  readonly image: Media.Asset;
@@ -1419,17 +1411,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1419
1411
  readonly type: "image";
1420
1412
  readonly index: number;
1421
1413
  readonly image: Media.Asset;
1414
+ } | {
1415
+ readonly type: "generation-queued";
1416
+ readonly id: string;
1417
+ readonly position?: number | undefined;
1418
+ } | {
1419
+ readonly type: "generation-progress";
1420
+ readonly id: string;
1421
+ readonly progress?: number | undefined;
1422
1422
  } | {
1423
1423
  readonly type: "finish";
1424
1424
  readonly usage?: {
1425
- readonly type: "tokens";
1426
- readonly input?: number | undefined;
1427
- readonly output?: number | undefined;
1428
- readonly total?: number | undefined;
1429
- readonly details?: {
1430
- readonly [x: string]: unknown;
1431
- } | undefined;
1432
- } | {
1433
1425
  readonly type: "seconds";
1434
1426
  readonly seconds: number;
1435
1427
  } | {
@@ -1441,6 +1433,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1441
1433
  } | {
1442
1434
  readonly type: "compute";
1443
1435
  readonly seconds: number;
1436
+ } | {
1437
+ readonly type: "tokens";
1438
+ readonly input?: number | undefined;
1439
+ readonly output?: number | undefined;
1440
+ readonly total?: number | undefined;
1441
+ readonly details?: {
1442
+ readonly [x: string]: unknown;
1443
+ } | undefined;
1444
1444
  } | undefined;
1445
1445
  readonly notices?: readonly {
1446
1446
  readonly type: "filtered" | "moderated" | "other";
@@ -1457,14 +1457,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1457
1457
  };
1458
1458
  } | undefined;
1459
1459
  }, { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
1460
- readonly type: "generation-queued";
1461
- readonly id: string;
1462
- readonly position?: number | undefined;
1463
- } | {
1464
- readonly type: "generation-progress";
1465
- readonly id: string;
1466
- readonly progress?: number | undefined;
1467
- } | {
1468
1460
  readonly type: "image-partial";
1469
1461
  readonly index: number;
1470
1462
  readonly image: Media.Asset;
@@ -1472,17 +1464,17 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1472
1464
  readonly type: "image";
1473
1465
  readonly index: number;
1474
1466
  readonly image: Media.Asset;
1467
+ } | {
1468
+ readonly type: "generation-queued";
1469
+ readonly id: string;
1470
+ readonly position?: number | undefined;
1471
+ } | {
1472
+ readonly type: "generation-progress";
1473
+ readonly id: string;
1474
+ readonly progress?: number | undefined;
1475
1475
  } | {
1476
1476
  readonly type: "finish";
1477
1477
  readonly usage?: {
1478
- readonly type: "tokens";
1479
- readonly input?: number | undefined;
1480
- readonly output?: number | undefined;
1481
- readonly total?: number | undefined;
1482
- readonly details?: {
1483
- readonly [x: string]: unknown;
1484
- } | undefined;
1485
- } | {
1486
1478
  readonly type: "seconds";
1487
1479
  readonly seconds: number;
1488
1480
  } | {
@@ -1494,6 +1486,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1494
1486
  } | {
1495
1487
  readonly type: "compute";
1496
1488
  readonly seconds: number;
1489
+ } | {
1490
+ readonly type: "tokens";
1491
+ readonly input?: number | undefined;
1492
+ readonly output?: number | undefined;
1493
+ readonly total?: number | undefined;
1494
+ readonly details?: {
1495
+ readonly [x: string]: unknown;
1496
+ } | undefined;
1497
1497
  } | undefined;
1498
1498
  readonly notices?: readonly {
1499
1499
  readonly type: "filtered" | "moderated" | "other";
@@ -1536,14 +1536,6 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1536
1536
  finish: (u: unknown) => u is {
1537
1537
  readonly type: "finish";
1538
1538
  readonly usage?: {
1539
- readonly type: "tokens";
1540
- readonly input?: number | undefined;
1541
- readonly output?: number | undefined;
1542
- readonly total?: number | undefined;
1543
- readonly details?: {
1544
- readonly [x: string]: unknown;
1545
- } | undefined;
1546
- } | {
1547
1539
  readonly type: "seconds";
1548
1540
  readonly seconds: number;
1549
1541
  } | {
@@ -1555,6 +1547,14 @@ export declare const ImageEvent: Schema.Union<readonly [Schema.Struct<{
1555
1547
  } | {
1556
1548
  readonly type: "compute";
1557
1549
  readonly seconds: number;
1550
+ } | {
1551
+ readonly type: "tokens";
1552
+ readonly input?: number | undefined;
1553
+ readonly output?: number | undefined;
1554
+ readonly total?: number | undefined;
1555
+ readonly details?: {
1556
+ readonly [x: string]: unknown;
1557
+ } | undefined;
1558
1558
  } | undefined;
1559
1559
  readonly notices?: readonly {
1560
1560
  readonly type: "filtered" | "moderated" | "other";