@mastra/server 1.5.0-alpha.0 → 1.5.0-alpha.1

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.
@@ -1780,7 +1780,7 @@ var zodToJsonSchema = (schema, options) => {
1780
1780
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
1781
1781
  var esm_default = zodToJsonSchema;
1782
1782
 
1783
- // ../schema-compat/dist/chunk-BXZCXMXO.js
1783
+ // ../schema-compat/dist/chunk-4EY4LZB2.js
1784
1784
  var PATCHED = /* @__PURE__ */ Symbol("__mastra_patched__");
1785
1785
  function patchRecordSchemas(schema) {
1786
1786
  if (!schema || typeof schema !== "object") return schema;
@@ -1789,7 +1789,7 @@ function patchRecordSchemas(schema) {
1789
1789
  const def = schema._zod?.def;
1790
1790
  if (def?.type === "record" && def.keyType && !def.valueType) {
1791
1791
  def.valueType = def.keyType;
1792
- def.keyType = z.string();
1792
+ def.keyType = z$1.string();
1793
1793
  }
1794
1794
  if (!def) return schema;
1795
1795
  if (def.type === "object" && def.shape) {
@@ -1878,10 +1878,9 @@ function fixAnyOfNullable(schema) {
1878
1878
  return result;
1879
1879
  }
1880
1880
  function zodToJsonSchema2(zodSchema5, target = "jsonSchema7", strategy = "relative") {
1881
- const fn = "toJSONSchema";
1882
- if (fn in z) {
1881
+ if (zodSchema5?._zod) {
1883
1882
  patchRecordSchemas(zodSchema5);
1884
- const jsonSchema5 = z[fn](zodSchema5, {
1883
+ const jsonSchema5 = z$1.toJSONSchema(zodSchema5, {
1885
1884
  unrepresentable: "any",
1886
1885
  override: (ctx) => {
1887
1886
  const def = ctx.zodSchema?._def || ctx.zodSchema?._zod?.def;
@@ -19910,12 +19909,12 @@ async function getVercelRequestId() {
19910
19909
  var VERSION3 = "2.0.15";
19911
19910
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
19912
19911
  function createGatewayProvider(options = {}) {
19913
- var _a832, _b83;
19912
+ var _a832, _b84;
19914
19913
  let pendingMetadata = null;
19915
19914
  let metadataCache = null;
19916
19915
  const cacheRefreshMillis = (_a832 = options.metadataCacheRefreshMillis) != null ? _a832 : 1e3 * 60 * 5;
19917
19916
  let lastFetchTime = 0;
19918
- const baseURL = (_b83 = withoutTrailingSlash(options.baseURL)) != null ? _b83 : "https://ai-gateway.vercel.sh/v1/ai";
19917
+ const baseURL = (_b84 = withoutTrailingSlash(options.baseURL)) != null ? _b84 : "https://ai-gateway.vercel.sh/v1/ai";
19919
19918
  const getHeaders = async () => {
19920
19919
  const auth = await getGatewayAuthToken(options);
19921
19920
  if (auth) {
@@ -19968,8 +19967,8 @@ function createGatewayProvider(options = {}) {
19968
19967
  });
19969
19968
  };
19970
19969
  const getAvailableModels = async () => {
19971
- var _a922, _b92, _c;
19972
- const now2 = (_c = (_b92 = (_a922 = options._internal) == null ? void 0 : _a922.currentDate) == null ? void 0 : _b92.call(_a922).getTime()) != null ? _c : Date.now();
19970
+ var _a923, _b92, _c;
19971
+ const now2 = (_c = (_b92 = (_a923 = options._internal) == null ? void 0 : _a923.currentDate) == null ? void 0 : _b92.call(_a923).getTime()) != null ? _c : Date.now();
19973
19972
  if (!pendingMetadata || now2 - lastFetchTime > cacheRefreshMillis) {
19974
19973
  lastFetchTime = now2;
19975
19974
  pendingMetadata = new GatewayFetchMetadata({
@@ -20146,12 +20145,12 @@ function registerGlobal22(type, instance, diag, allowOverride) {
20146
20145
  return true;
20147
20146
  }
20148
20147
  function getGlobal22(type) {
20149
- var _a163, _b83;
20148
+ var _a163, _b84;
20150
20149
  var globalVersion = (_a163 = _global22[GLOBAL_OPENTELEMETRY_API_KEY22]) === null || _a163 === void 0 ? void 0 : _a163.version;
20151
20150
  if (!globalVersion || !isCompatible22(globalVersion)) {
20152
20151
  return;
20153
20152
  }
20154
- return (_b83 = _global22[GLOBAL_OPENTELEMETRY_API_KEY22]) === null || _b83 === void 0 ? void 0 : _b83[type];
20153
+ return (_b84 = _global22[GLOBAL_OPENTELEMETRY_API_KEY22]) === null || _b84 === void 0 ? void 0 : _b84[type];
20155
20154
  }
20156
20155
  function unregisterGlobal22(type, diag) {
20157
20156
  diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION222 + ".");
@@ -20316,7 +20315,7 @@ var DiagAPI22 = (
20316
20315
  }
20317
20316
  var self = this;
20318
20317
  var setLogger = function(logger, optionsOrLogLevel) {
20319
- var _a163, _b83, _c;
20318
+ var _a163, _b84, _c;
20320
20319
  if (optionsOrLogLevel === void 0) {
20321
20320
  optionsOrLogLevel = { logLevel: DiagLogLevel22.INFO };
20322
20321
  }
@@ -20331,7 +20330,7 @@ var DiagAPI22 = (
20331
20330
  };
20332
20331
  }
20333
20332
  var oldLogger = getGlobal22("diag");
20334
- var newLogger = createLogLevelDiagLogger22((_b83 = optionsOrLogLevel.logLevel) !== null && _b83 !== void 0 ? _b83 : DiagLogLevel22.INFO, logger);
20333
+ var newLogger = createLogLevelDiagLogger22((_b84 = optionsOrLogLevel.logLevel) !== null && _b84 !== void 0 ? _b84 : DiagLogLevel22.INFO, logger);
20335
20334
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
20336
20335
  var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
20337
20336
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -20870,8 +20869,8 @@ var dataContentSchema22 = z$1.union([
20870
20869
  z$1.custom(
20871
20870
  // Buffer might not be available in some environments such as CloudFlare:
20872
20871
  (value) => {
20873
- var _a163, _b83;
20874
- return (_b83 = (_a163 = globalThis.Buffer) == null ? void 0 : _a163.isBuffer(value)) != null ? _b83 : false;
20872
+ var _a163, _b84;
20873
+ return (_b84 = (_a163 = globalThis.Buffer) == null ? void 0 : _a163.isBuffer(value)) != null ? _b84 : false;
20875
20874
  },
20876
20875
  { message: "Must be a Buffer" }
20877
20876
  )
@@ -22473,7 +22472,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
22473
22472
  );
22474
22473
  return Object.fromEntries(normalizedHeaders.entries());
22475
22474
  }
22476
- var VERSION4 = "4.0.13";
22475
+ var VERSION4 = "4.0.15";
22477
22476
  var getOriginalFetch3 = () => globalThis.fetch;
22478
22477
  var getFromApi2 = async ({
22479
22478
  url,
@@ -24481,7 +24480,7 @@ async function createGatewayErrorFromResponse2({
24481
24480
  cause,
24482
24481
  authMethod
24483
24482
  }) {
24484
- var _a832;
24483
+ var _a932;
24485
24484
  const parseResult = await safeValidateTypes3({
24486
24485
  value: response,
24487
24486
  schema: gatewayErrorResponseSchema2
@@ -24500,7 +24499,7 @@ async function createGatewayErrorFromResponse2({
24500
24499
  const validatedResponse = parseResult.value;
24501
24500
  const errorType = validatedResponse.error.type;
24502
24501
  const message = validatedResponse.error.message;
24503
- const generationId = (_a832 = validatedResponse.generationId) != null ? _a832 : void 0;
24502
+ const generationId = (_a932 = validatedResponse.generationId) != null ? _a932 : void 0;
24504
24503
  switch (errorType) {
24505
24504
  case "authentication_error":
24506
24505
  return GatewayAuthenticationError2.createContextualError({
@@ -24566,21 +24565,88 @@ var gatewayErrorResponseSchema2 = lazySchema(
24566
24565
  })
24567
24566
  )
24568
24567
  );
24569
- function asGatewayError2(error, authMethod) {
24570
- var _a832;
24568
+ var name76 = "GatewayTimeoutError";
24569
+ var marker86 = `vercel.ai.gateway.error.${name76}`;
24570
+ var symbol86 = Symbol.for(marker86);
24571
+ var _a86;
24572
+ var _b83;
24573
+ var GatewayTimeoutError = class _GatewayTimeoutError extends (_b83 = GatewayError2, _a86 = symbol86, _b83) {
24574
+ constructor({
24575
+ message = "Request timed out",
24576
+ statusCode = 408,
24577
+ cause,
24578
+ generationId
24579
+ } = {}) {
24580
+ super({ message, statusCode, cause, generationId });
24581
+ this[_a86] = true;
24582
+ this.name = name76;
24583
+ this.type = "timeout_error";
24584
+ }
24585
+ static isInstance(error) {
24586
+ return GatewayError2.hasMarker(error) && symbol86 in error;
24587
+ }
24588
+ /**
24589
+ * Creates a helpful timeout error message with troubleshooting guidance
24590
+ */
24591
+ static createTimeoutError({
24592
+ originalMessage,
24593
+ statusCode = 408,
24594
+ cause,
24595
+ generationId
24596
+ }) {
24597
+ const message = `Gateway request timed out: ${originalMessage}
24598
+
24599
+ This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;
24600
+ return new _GatewayTimeoutError({
24601
+ message,
24602
+ statusCode,
24603
+ cause,
24604
+ generationId
24605
+ });
24606
+ }
24607
+ };
24608
+ function isTimeoutError(error) {
24609
+ if (!(error instanceof Error)) {
24610
+ return false;
24611
+ }
24612
+ const errorCode = error.code;
24613
+ if (typeof errorCode === "string") {
24614
+ const undiciTimeoutCodes = [
24615
+ "UND_ERR_HEADERS_TIMEOUT",
24616
+ "UND_ERR_BODY_TIMEOUT",
24617
+ "UND_ERR_CONNECT_TIMEOUT"
24618
+ ];
24619
+ return undiciTimeoutCodes.includes(errorCode);
24620
+ }
24621
+ return false;
24622
+ }
24623
+ async function asGatewayError2(error, authMethod) {
24624
+ var _a932;
24571
24625
  if (GatewayError2.isInstance(error)) {
24572
24626
  return error;
24573
24627
  }
24628
+ if (isTimeoutError(error)) {
24629
+ return GatewayTimeoutError.createTimeoutError({
24630
+ originalMessage: error instanceof Error ? error.message : "Unknown error",
24631
+ cause: error
24632
+ });
24633
+ }
24574
24634
  if (APICallError3.isInstance(error)) {
24575
- return createGatewayErrorFromResponse2({
24635
+ if (error.cause && isTimeoutError(error.cause)) {
24636
+ return GatewayTimeoutError.createTimeoutError({
24637
+ originalMessage: error.message,
24638
+ cause: error
24639
+ });
24640
+ }
24641
+ return await createGatewayErrorFromResponse2({
24576
24642
  response: extractApiCallResponse2(error),
24577
- statusCode: (_a832 = error.statusCode) != null ? _a832 : 500,
24643
+ statusCode: (_a932 = error.statusCode) != null ? _a932 : 500,
24578
24644
  defaultMessage: "Gateway request failed",
24579
24645
  cause: error,
24580
24646
  authMethod
24581
24647
  });
24582
24648
  }
24583
- return createGatewayErrorFromResponse2({
24649
+ return await createGatewayErrorFromResponse2({
24584
24650
  response: {},
24585
24651
  statusCode: 500,
24586
24652
  defaultMessage: error instanceof Error ? `Gateway request failed: ${error.message}` : "Unknown Gateway error",
@@ -24682,7 +24748,7 @@ var gatewayAvailableModelsResponseSchema2 = lazySchema(
24682
24748
  provider: z$1.string(),
24683
24749
  modelId: z$1.string()
24684
24750
  }),
24685
- modelType: z$1.enum(["language", "embedding", "image"]).nullish()
24751
+ modelType: z$1.enum(["embedding", "image", "language", "video"]).nullish()
24686
24752
  })
24687
24753
  )
24688
24754
  })
@@ -24861,7 +24927,7 @@ var GatewayEmbeddingModel2 = class {
24861
24927
  abortSignal,
24862
24928
  providerOptions
24863
24929
  }) {
24864
- var _a832;
24930
+ var _a932;
24865
24931
  const resolvedHeaders = await resolve2(this.config.headers());
24866
24932
  try {
24867
24933
  const {
@@ -24892,7 +24958,7 @@ var GatewayEmbeddingModel2 = class {
24892
24958
  });
24893
24959
  return {
24894
24960
  embeddings: responseBody.embeddings,
24895
- usage: (_a832 = responseBody.usage) != null ? _a832 : void 0,
24961
+ usage: (_a932 = responseBody.usage) != null ? _a932 : void 0,
24896
24962
  providerMetadata: responseBody.providerMetadata,
24897
24963
  response: { headers: responseHeaders, body: rawValue },
24898
24964
  warnings: []
@@ -24942,7 +25008,7 @@ var GatewayImageModel2 = class {
24942
25008
  headers,
24943
25009
  abortSignal
24944
25010
  }) {
24945
- var _a832;
25011
+ var _a932, _b92, _c, _d;
24946
25012
  const resolvedHeaders = await resolve2(this.config.headers());
24947
25013
  try {
24948
25014
  const {
@@ -24981,16 +25047,23 @@ var GatewayImageModel2 = class {
24981
25047
  return {
24982
25048
  images: responseBody.images,
24983
25049
  // Always base64 strings from server
24984
- warnings: (_a832 = responseBody.warnings) != null ? _a832 : [],
25050
+ warnings: (_a932 = responseBody.warnings) != null ? _a932 : [],
24985
25051
  providerMetadata: responseBody.providerMetadata,
24986
25052
  response: {
24987
25053
  timestamp: /* @__PURE__ */ new Date(),
24988
25054
  modelId: this.modelId,
24989
25055
  headers: responseHeaders
25056
+ },
25057
+ ...responseBody.usage != null && {
25058
+ usage: {
25059
+ inputTokens: (_b92 = responseBody.usage.inputTokens) != null ? _b92 : void 0,
25060
+ outputTokens: (_c = responseBody.usage.outputTokens) != null ? _c : void 0,
25061
+ totalTokens: (_d = responseBody.usage.totalTokens) != null ? _d : void 0
25062
+ }
24990
25063
  }
24991
25064
  };
24992
25065
  } catch (error) {
24993
- throw asGatewayError2(error, await parseAuthMethod2(resolvedHeaders));
25066
+ throw await asGatewayError2(error, await parseAuthMethod2(resolvedHeaders));
24994
25067
  }
24995
25068
  }
24996
25069
  getUrl() {
@@ -25015,16 +25088,160 @@ function maybeEncodeImageFile(file) {
25015
25088
  var providerMetadataEntrySchema2 = z$1.object({
25016
25089
  images: z$1.array(z$1.unknown()).optional()
25017
25090
  }).catchall(z$1.unknown());
25091
+ var gatewayImageWarningSchema = z$1.discriminatedUnion("type", [
25092
+ z$1.object({
25093
+ type: z$1.literal("unsupported"),
25094
+ feature: z$1.string(),
25095
+ details: z$1.string().optional()
25096
+ }),
25097
+ z$1.object({
25098
+ type: z$1.literal("compatibility"),
25099
+ feature: z$1.string(),
25100
+ details: z$1.string().optional()
25101
+ }),
25102
+ z$1.object({
25103
+ type: z$1.literal("other"),
25104
+ message: z$1.string()
25105
+ })
25106
+ ]);
25107
+ var gatewayImageUsageSchema = z$1.object({
25108
+ inputTokens: z$1.number().nullish(),
25109
+ outputTokens: z$1.number().nullish(),
25110
+ totalTokens: z$1.number().nullish()
25111
+ });
25018
25112
  var gatewayImageResponseSchema2 = z$1.object({
25019
25113
  images: z$1.array(z$1.string()),
25020
25114
  // Always base64 strings over the wire
25021
- warnings: z$1.array(
25022
- z$1.object({
25023
- type: z$1.literal("other"),
25024
- message: z$1.string()
25025
- })
25026
- ).optional(),
25027
- providerMetadata: z$1.record(z$1.string(), providerMetadataEntrySchema2).optional()
25115
+ warnings: z$1.array(gatewayImageWarningSchema).optional(),
25116
+ providerMetadata: z$1.record(z$1.string(), providerMetadataEntrySchema2).optional(),
25117
+ usage: gatewayImageUsageSchema.optional()
25118
+ });
25119
+ var GatewayVideoModel = class {
25120
+ constructor(modelId, config) {
25121
+ this.modelId = modelId;
25122
+ this.config = config;
25123
+ this.specificationVersion = "v3";
25124
+ this.maxVideosPerCall = Number.MAX_SAFE_INTEGER;
25125
+ }
25126
+ get provider() {
25127
+ return this.config.provider;
25128
+ }
25129
+ async doGenerate({
25130
+ prompt,
25131
+ n,
25132
+ aspectRatio,
25133
+ resolution,
25134
+ duration,
25135
+ fps,
25136
+ seed,
25137
+ image,
25138
+ providerOptions,
25139
+ headers,
25140
+ abortSignal
25141
+ }) {
25142
+ var _a932;
25143
+ const resolvedHeaders = await resolve2(this.config.headers());
25144
+ try {
25145
+ const {
25146
+ responseHeaders,
25147
+ value: responseBody
25148
+ } = await postJsonToApi2({
25149
+ url: this.getUrl(),
25150
+ headers: combineHeaders2(
25151
+ resolvedHeaders,
25152
+ headers != null ? headers : {},
25153
+ this.getModelConfigHeaders(),
25154
+ await resolve2(this.config.o11yHeaders)
25155
+ ),
25156
+ body: {
25157
+ prompt,
25158
+ n,
25159
+ ...aspectRatio && { aspectRatio },
25160
+ ...resolution && { resolution },
25161
+ ...duration && { duration },
25162
+ ...fps && { fps },
25163
+ ...seed && { seed },
25164
+ ...providerOptions && { providerOptions },
25165
+ ...image && { image: maybeEncodeVideoFile(image) }
25166
+ },
25167
+ successfulResponseHandler: createJsonResponseHandler2(
25168
+ gatewayVideoResponseSchema
25169
+ ),
25170
+ failedResponseHandler: createJsonErrorResponseHandler2({
25171
+ errorSchema: z$1.any(),
25172
+ errorToMessage: (data) => data
25173
+ }),
25174
+ ...abortSignal && { abortSignal },
25175
+ fetch: this.config.fetch
25176
+ });
25177
+ return {
25178
+ videos: responseBody.videos,
25179
+ warnings: (_a932 = responseBody.warnings) != null ? _a932 : [],
25180
+ providerMetadata: responseBody.providerMetadata,
25181
+ response: {
25182
+ timestamp: /* @__PURE__ */ new Date(),
25183
+ modelId: this.modelId,
25184
+ headers: responseHeaders
25185
+ }
25186
+ };
25187
+ } catch (error) {
25188
+ throw await asGatewayError2(error, await parseAuthMethod2(resolvedHeaders));
25189
+ }
25190
+ }
25191
+ getUrl() {
25192
+ return `${this.config.baseURL}/video-model`;
25193
+ }
25194
+ getModelConfigHeaders() {
25195
+ return {
25196
+ "ai-video-model-specification-version": "3",
25197
+ "ai-model-id": this.modelId
25198
+ };
25199
+ }
25200
+ };
25201
+ function maybeEncodeVideoFile(file) {
25202
+ if (file.type === "file" && file.data instanceof Uint8Array) {
25203
+ return {
25204
+ ...file,
25205
+ data: convertUint8ArrayToBase643(file.data)
25206
+ };
25207
+ }
25208
+ return file;
25209
+ }
25210
+ var providerMetadataEntrySchema22 = z$1.object({
25211
+ videos: z$1.array(z$1.unknown()).optional()
25212
+ }).catchall(z$1.unknown());
25213
+ var gatewayVideoDataSchema = z$1.union([
25214
+ z$1.object({
25215
+ type: z$1.literal("url"),
25216
+ url: z$1.string(),
25217
+ mediaType: z$1.string()
25218
+ }),
25219
+ z$1.object({
25220
+ type: z$1.literal("base64"),
25221
+ data: z$1.string(),
25222
+ mediaType: z$1.string()
25223
+ })
25224
+ ]);
25225
+ var gatewayVideoWarningSchema = z$1.discriminatedUnion("type", [
25226
+ z$1.object({
25227
+ type: z$1.literal("unsupported"),
25228
+ feature: z$1.string(),
25229
+ details: z$1.string().optional()
25230
+ }),
25231
+ z$1.object({
25232
+ type: z$1.literal("compatibility"),
25233
+ feature: z$1.string(),
25234
+ details: z$1.string().optional()
25235
+ }),
25236
+ z$1.object({
25237
+ type: z$1.literal("other"),
25238
+ message: z$1.string()
25239
+ })
25240
+ ]);
25241
+ var gatewayVideoResponseSchema = z$1.object({
25242
+ videos: z$1.array(gatewayVideoDataSchema),
25243
+ warnings: z$1.array(gatewayVideoWarningSchema).optional(),
25244
+ providerMetadata: z$1.record(z$1.string(), providerMetadataEntrySchema22).optional()
25028
25245
  });
25029
25246
  var parallelSearchInputSchema = lazySchema(
25030
25247
  () => zodSchema3(
@@ -25199,18 +25416,18 @@ var gatewayTools = {
25199
25416
  perplexitySearch
25200
25417
  };
25201
25418
  async function getVercelRequestId2() {
25202
- var _a832;
25203
- return (_a832 = (0, import_oidc3.getContext)().headers) == null ? void 0 : _a832["x-vercel-id"];
25419
+ var _a932;
25420
+ return (_a932 = (0, import_oidc3.getContext)().headers) == null ? void 0 : _a932["x-vercel-id"];
25204
25421
  }
25205
- var VERSION5 = "3.0.32";
25422
+ var VERSION5 = "3.0.50";
25206
25423
  var AI_GATEWAY_PROTOCOL_VERSION2 = "0.0.1";
25207
25424
  function createGatewayProvider2(options = {}) {
25208
- var _a832, _b83;
25425
+ var _a932, _b92;
25209
25426
  let pendingMetadata = null;
25210
25427
  let metadataCache = null;
25211
- const cacheRefreshMillis = (_a832 = options.metadataCacheRefreshMillis) != null ? _a832 : 1e3 * 60 * 5;
25428
+ const cacheRefreshMillis = (_a932 = options.metadataCacheRefreshMillis) != null ? _a932 : 1e3 * 60 * 5;
25212
25429
  let lastFetchTime = 0;
25213
- const baseURL = (_b83 = withoutTrailingSlash2(options.baseURL)) != null ? _b83 : "https://ai-gateway.vercel.sh/v3/ai";
25430
+ const baseURL = (_b92 = withoutTrailingSlash2(options.baseURL)) != null ? _b92 : "https://ai-gateway.vercel.sh/v3/ai";
25214
25431
  const getHeaders = async () => {
25215
25432
  try {
25216
25433
  const auth = await getGatewayAuthToken2(options);
@@ -25265,8 +25482,8 @@ function createGatewayProvider2(options = {}) {
25265
25482
  });
25266
25483
  };
25267
25484
  const getAvailableModels = async () => {
25268
- var _a922, _b92, _c;
25269
- const now2 = (_c = (_b92 = (_a922 = options._internal) == null ? void 0 : _a922.currentDate) == null ? void 0 : _b92.call(_a922).getTime()) != null ? _c : Date.now();
25485
+ var _a1022, _b102, _c;
25486
+ const now2 = (_c = (_b102 = (_a1022 = options._internal) == null ? void 0 : _a1022.currentDate) == null ? void 0 : _b102.call(_a1022).getTime()) != null ? _c : Date.now();
25270
25487
  if (!pendingMetadata || now2 - lastFetchTime > cacheRefreshMillis) {
25271
25488
  lastFetchTime = now2;
25272
25489
  pendingMetadata = new GatewayFetchMetadata2({
@@ -25329,6 +25546,19 @@ function createGatewayProvider2(options = {}) {
25329
25546
  };
25330
25547
  provider.embeddingModel = createEmbeddingModel;
25331
25548
  provider.textEmbeddingModel = createEmbeddingModel;
25549
+ provider.videoModel = (modelId) => {
25550
+ return new GatewayVideoModel(modelId, {
25551
+ provider: "gateway",
25552
+ baseURL,
25553
+ headers: getHeaders,
25554
+ fetch: options.fetch,
25555
+ o11yHeaders: createO11yHeaders()
25556
+ });
25557
+ };
25558
+ provider.chat = provider.languageModel;
25559
+ provider.embedding = provider.embeddingModel;
25560
+ provider.image = provider.imageModel;
25561
+ provider.video = provider.videoModel;
25332
25562
  provider.tools = gatewayTools;
25333
25563
  return provider;
25334
25564
  }
@@ -25443,12 +25673,12 @@ function registerGlobal3(type, instance, diag, allowOverride) {
25443
25673
  return true;
25444
25674
  }
25445
25675
  function getGlobal3(type) {
25446
- var _a21, _b83;
25676
+ var _a21, _b92;
25447
25677
  var globalVersion = (_a21 = _global3[GLOBAL_OPENTELEMETRY_API_KEY3]) === null || _a21 === void 0 ? void 0 : _a21.version;
25448
25678
  if (!globalVersion || !isCompatible3(globalVersion)) {
25449
25679
  return;
25450
25680
  }
25451
- return (_b83 = _global3[GLOBAL_OPENTELEMETRY_API_KEY3]) === null || _b83 === void 0 ? void 0 : _b83[type];
25681
+ return (_b92 = _global3[GLOBAL_OPENTELEMETRY_API_KEY3]) === null || _b92 === void 0 ? void 0 : _b92[type];
25452
25682
  }
25453
25683
  function unregisterGlobal3(type, diag) {
25454
25684
  diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION23 + ".");
@@ -25613,7 +25843,7 @@ var DiagAPI3 = (
25613
25843
  }
25614
25844
  var self = this;
25615
25845
  var setLogger = function(logger, optionsOrLogLevel) {
25616
- var _a21, _b83, _c;
25846
+ var _a21, _b92, _c;
25617
25847
  if (optionsOrLogLevel === void 0) {
25618
25848
  optionsOrLogLevel = { logLevel: DiagLogLevel3.INFO };
25619
25849
  }
@@ -25628,7 +25858,7 @@ var DiagAPI3 = (
25628
25858
  };
25629
25859
  }
25630
25860
  var oldLogger = getGlobal3("diag");
25631
- var newLogger = createLogLevelDiagLogger3((_b83 = optionsOrLogLevel.logLevel) !== null && _b83 !== void 0 ? _b83 : DiagLogLevel3.INFO, logger);
25861
+ var newLogger = createLogLevelDiagLogger3((_b92 = optionsOrLogLevel.logLevel) !== null && _b92 !== void 0 ? _b92 : DiagLogLevel3.INFO, logger);
25632
25862
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
25633
25863
  var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
25634
25864
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -26061,10 +26291,10 @@ var __export32 = (target, all) => {
26061
26291
  for (var name21 in all)
26062
26292
  __defProp4(target, name21, { get: all[name21], enumerable: true });
26063
26293
  };
26064
- var name76 = "AI_InvalidArgumentError";
26065
- var marker86 = `vercel.ai.error.${name76}`;
26066
- var symbol86 = Symbol.for(marker86);
26067
- var _a86;
26294
+ var name86 = "AI_InvalidArgumentError";
26295
+ var marker96 = `vercel.ai.error.${name86}`;
26296
+ var symbol96 = Symbol.for(marker96);
26297
+ var _a96;
26068
26298
  var InvalidArgumentError23 = class extends AISDKError3 {
26069
26299
  constructor({
26070
26300
  parameter,
@@ -26072,20 +26302,20 @@ var InvalidArgumentError23 = class extends AISDKError3 {
26072
26302
  message
26073
26303
  }) {
26074
26304
  super({
26075
- name: name76,
26305
+ name: name86,
26076
26306
  message: `Invalid argument for parameter ${parameter}: ${message}`
26077
26307
  });
26078
- this[_a86] = true;
26308
+ this[_a96] = true;
26079
26309
  this.parameter = parameter;
26080
26310
  this.value = value;
26081
26311
  }
26082
26312
  static isInstance(error) {
26083
- return AISDKError3.hasMarker(error, marker86);
26313
+ return AISDKError3.hasMarker(error, marker96);
26084
26314
  }
26085
26315
  };
26086
- _a86 = symbol86;
26087
- var name86 = "AI_NoObjectGeneratedError";
26088
- var marker823 = `vercel.ai.error.${name86}`;
26316
+ _a96 = symbol96;
26317
+ var name822 = "AI_NoObjectGeneratedError";
26318
+ var marker823 = `vercel.ai.error.${name822}`;
26089
26319
  var symbol823 = Symbol.for(marker823);
26090
26320
  var _a823;
26091
26321
  var NoObjectGeneratedError3 = class extends AISDKError3 {
@@ -26097,7 +26327,7 @@ var NoObjectGeneratedError3 = class extends AISDKError3 {
26097
26327
  usage,
26098
26328
  finishReason
26099
26329
  }) {
26100
- super({ name: name86, message, cause });
26330
+ super({ name: name822, message, cause });
26101
26331
  this[_a823] = true;
26102
26332
  this.text = text222;
26103
26333
  this.response = response;
@@ -26257,7 +26487,7 @@ function getTotalTimeoutMs(timeout) {
26257
26487
  }
26258
26488
  return timeout.totalMs;
26259
26489
  }
26260
- var VERSION33 = "6.0.69";
26490
+ var VERSION33 = "6.0.91";
26261
26491
  var dataContentSchema3 = z$1.union([
26262
26492
  z$1.string(),
26263
26493
  z$1.instanceof(Uint8Array),
@@ -26265,8 +26495,8 @@ var dataContentSchema3 = z$1.union([
26265
26495
  z$1.custom(
26266
26496
  // Buffer might not be available in some environments such as CloudFlare:
26267
26497
  (value) => {
26268
- var _a21, _b83;
26269
- return (_b83 = (_a21 = globalThis.Buffer) == null ? void 0 : _a21.isBuffer(value)) != null ? _b83 : false;
26498
+ var _a21, _b92;
26499
+ return (_b92 = (_a21 = globalThis.Buffer) == null ? void 0 : _a21.isBuffer(value)) != null ? _b92 : false;
26270
26500
  },
26271
26501
  { message: "Must be a Buffer" }
26272
26502
  )
@@ -39935,5 +40165,5 @@ var OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({
39935
40165
  });
39936
40166
 
39937
40167
  export { CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE, LIST_AGENT_BUILDER_ACTIONS_ROUTE, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, RESUME_AGENT_BUILDER_ACTION_ROUTE, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE, START_AGENT_BUILDER_ACTION_RUN_ROUTE, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE, STREAM_AGENT_BUILDER_ACTION_ROUTE, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, agent_builder_exports };
39938
- //# sourceMappingURL=chunk-CJSEBQNO.js.map
39939
- //# sourceMappingURL=chunk-CJSEBQNO.js.map
40168
+ //# sourceMappingURL=chunk-X5YYYBPT.js.map
40169
+ //# sourceMappingURL=chunk-X5YYYBPT.js.map