@mastra/agent-builder 1.1.6-alpha.2 → 1.1.6-alpha.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/agent-builder
2
2
 
3
+ ## 1.1.6-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#16699](https://github.com/mastra-ai/mastra/pull/16699))
8
+ - Updated dependency [`@ai-sdk/anthropic-v5@npm:@ai-sdk/anthropic@2.0.85` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic-v5/v/2.0.85) (from `npm:@ai-sdk/anthropic@2.0.81`, in `dependencies`)
9
+ - Updated dependency [`@ai-sdk/google-v5@npm:@ai-sdk/google@2.0.78` ↗︎](https://www.npmjs.com/package/@ai-sdk/google-v5/v/2.0.78) (from `npm:@ai-sdk/google@2.0.72`, in `dependencies`)
10
+ - Updated dependency [`@ai-sdk/groq-v5@npm:@ai-sdk/groq@2.0.43` ↗︎](https://www.npmjs.com/package/@ai-sdk/groq-v5/v/2.0.43) (from `npm:@ai-sdk/groq@2.0.40`, in `dependencies`)
11
+ - Updated dependency [`@ai-sdk/openai-v5@npm:@ai-sdk/openai@2.0.110` ↗︎](https://www.npmjs.com/package/@ai-sdk/openai-v5/v/2.0.110) (from `npm:@ai-sdk/openai@2.0.106`, in `dependencies`)
12
+ - Updated dependency [`@ai-sdk/xai-v5@npm:@ai-sdk/xai@2.0.76` ↗︎](https://www.npmjs.com/package/@ai-sdk/xai-v5/v/2.0.76) (from `npm:@ai-sdk/xai@2.0.72`, in `dependencies`)
13
+ - Updated dependencies [[`bd6d240`](https://github.com/mastra-ai/mastra/commit/bd6d2402db93dddaef0721667e7e8a030e7c6e16), [`0111486`](https://github.com/mastra-ai/mastra/commit/01114867612593eef5cfa2fda6a1194dfedda841), [`96a3749`](https://github.com/mastra-ai/mastra/commit/96a37492235f5b8076b3e3177d83ed5a5e44a640), [`3e26c87`](https://github.com/mastra-ai/mastra/commit/3e26c87de0c5bc2583b795ce6ca5889b6b161acb), [`a5008f2`](https://github.com/mastra-ai/mastra/commit/a5008f22ae710ad9402ea9f2547d8c02f74d384b)]:
14
+ - @mastra/core@1.51.0-alpha.8
15
+
16
+ ## 1.1.6-alpha.3
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [[`a5c6337`](https://github.com/mastra-ai/mastra/commit/a5c6337d23c7686c81a32ce62f550f610543a240), [`031931a`](https://github.com/mastra-ai/mastra/commit/031931a715405fb90759b1903c9c25cbf05994af), [`8b97958`](https://github.com/mastra-ai/mastra/commit/8b979589f9aa59ba67cac565949475f2ffeb4ac3), [`8410541`](https://github.com/mastra-ai/mastra/commit/84105412c60ecd3bb33a9838146f59c4b588228f), [`01b338c`](https://github.com/mastra-ai/mastra/commit/01b338c56271f0219606710e3e8b26dee27ac6c2), [`8b7361d`](https://github.com/mastra-ai/mastra/commit/8b7361d35de68b80d05d30a74e0c69e7218fd612), [`c43f3a9`](https://github.com/mastra-ai/mastra/commit/c43f3a9d1efde99b38789364ba4d0ba670f430e3)]:
21
+ - @mastra/core@1.51.0-alpha.4
22
+ - @mastra/memory@1.23.0-alpha.3
23
+
3
24
  ## 1.1.6-alpha.2
4
25
 
5
26
  ### Patch Changes
package/dist/index.js CHANGED
@@ -5161,6 +5161,90 @@ function combineHeaders(...headers) {
5161
5161
  function extractResponseHeaders(response) {
5162
5162
  return Object.fromEntries([...response.headers]);
5163
5163
  }
5164
+ var name14 = "AI_DownloadError";
5165
+ var marker15 = `vercel.ai.error.${name14}`;
5166
+ var symbol15 = Symbol.for(marker15);
5167
+ var _a15;
5168
+ var _b15;
5169
+ var DownloadError = class extends (_b15 = AISDKError, _a15 = symbol15, _b15) {
5170
+ constructor({
5171
+ url,
5172
+ statusCode,
5173
+ statusText,
5174
+ cause,
5175
+ message = cause == null ? `Failed to download ${url}: ${statusCode} ${statusText}` : `Failed to download ${url}: ${cause}`
5176
+ }) {
5177
+ super({ name: name14, message, cause });
5178
+ this[_a15] = true;
5179
+ this.url = url;
5180
+ this.statusCode = statusCode;
5181
+ this.statusText = statusText;
5182
+ }
5183
+ static isInstance(error) {
5184
+ return AISDKError.hasMarker(error, marker15);
5185
+ }
5186
+ };
5187
+ async function cancelResponseBody(response) {
5188
+ var _a223;
5189
+ try {
5190
+ await ((_a223 = response.body) == null ? void 0 : _a223.cancel());
5191
+ } catch (e) {
5192
+ }
5193
+ }
5194
+ var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
5195
+ async function readResponseWithSizeLimit({
5196
+ response,
5197
+ url,
5198
+ maxBytes = DEFAULT_MAX_DOWNLOAD_SIZE
5199
+ }) {
5200
+ const contentLength = response.headers.get("content-length");
5201
+ if (contentLength != null) {
5202
+ const length = parseInt(contentLength, 10);
5203
+ if (!isNaN(length) && length > maxBytes) {
5204
+ await cancelResponseBody(response);
5205
+ throw new DownloadError({
5206
+ url,
5207
+ message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
5208
+ });
5209
+ }
5210
+ }
5211
+ const body = response.body;
5212
+ if (body == null) {
5213
+ return new Uint8Array(0);
5214
+ }
5215
+ const reader = body.getReader();
5216
+ const chunks = [];
5217
+ let totalBytes = 0;
5218
+ try {
5219
+ while (true) {
5220
+ const { done, value } = await reader.read();
5221
+ if (done) {
5222
+ break;
5223
+ }
5224
+ totalBytes += value.length;
5225
+ if (totalBytes > maxBytes) {
5226
+ throw new DownloadError({
5227
+ url,
5228
+ message: `Download of ${url} exceeded maximum size of ${maxBytes} bytes.`
5229
+ });
5230
+ }
5231
+ chunks.push(value);
5232
+ }
5233
+ } finally {
5234
+ try {
5235
+ await reader.cancel();
5236
+ } finally {
5237
+ reader.releaseLock();
5238
+ }
5239
+ }
5240
+ const result = new Uint8Array(totalBytes);
5241
+ let offset = 0;
5242
+ for (const chunk of chunks) {
5243
+ result.set(chunk, offset);
5244
+ offset += chunk.length;
5245
+ }
5246
+ return result;
5247
+ }
5164
5248
  var createIdGenerator = ({
5165
5249
  prefix,
5166
5250
  size = 16,
@@ -5261,7 +5345,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
5261
5345
  );
5262
5346
  return Object.fromEntries(normalizedHeaders.entries());
5263
5347
  }
5264
- var VERSION = "3.0.25";
5348
+ var VERSION = "3.0.28";
5265
5349
  var getOriginalFetch = () => globalThis.fetch;
5266
5350
  var getFromApi = async ({
5267
5351
  url,
@@ -5639,12 +5723,24 @@ async function resolve4(value) {
5639
5723
  }
5640
5724
  return Promise.resolve(value);
5641
5725
  }
5726
+ var textDecoder = new TextDecoder();
5727
+ async function readResponseBodyAsText({
5728
+ response,
5729
+ url
5730
+ }) {
5731
+ return textDecoder.decode(
5732
+ await readResponseWithSizeLimit({
5733
+ response,
5734
+ url
5735
+ })
5736
+ );
5737
+ }
5642
5738
  var createJsonErrorResponseHandler = ({
5643
5739
  errorSchema,
5644
5740
  errorToMessage,
5645
5741
  isRetryable
5646
5742
  }) => async ({ response, url, requestBodyValues }) => {
5647
- const responseBody = await response.text();
5743
+ const responseBody = await readResponseBodyAsText({ response, url });
5648
5744
  const responseHeaders = extractResponseHeaders(response);
5649
5745
  if (responseBody.trim() === "") {
5650
5746
  return {
@@ -5707,7 +5803,7 @@ var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) =>
5707
5803
  };
5708
5804
  };
5709
5805
  var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
5710
- const responseBody = await response.text();
5806
+ const responseBody = await readResponseBodyAsText({ response, url });
5711
5807
  const parsedResult = await safeParseJSON({
5712
5808
  text: responseBody,
5713
5809
  schema: responseSchema
@@ -7020,101 +7116,121 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
7020
7116
  });
7021
7117
  }
7022
7118
  };
7023
- var name22 = "GatewayInvalidRequestError";
7119
+ var name22 = "GatewayForbiddenError";
7024
7120
  var marker32 = `vercel.ai.gateway.error.${name22}`;
7025
7121
  var symbol32 = Symbol.for(marker32);
7026
7122
  var _a32;
7027
7123
  var _b32;
7028
- var GatewayInvalidRequestError = class extends (_b32 = GatewayError, _a32 = symbol32, _b32) {
7124
+ var GatewayForbiddenError = class extends (_b32 = GatewayError, _a32 = symbol32, _b32) {
7029
7125
  constructor({
7030
- message = "Invalid request",
7031
- statusCode = 400,
7126
+ message = "Forbidden",
7127
+ statusCode = 403,
7032
7128
  cause
7033
7129
  } = {}) {
7034
7130
  super({ message, statusCode, cause });
7035
7131
  this[_a32] = true;
7036
7132
  this.name = name22;
7037
- this.type = "invalid_request_error";
7133
+ this.type = "forbidden";
7038
7134
  }
7039
7135
  static isInstance(error) {
7040
7136
  return GatewayError.hasMarker(error) && symbol32 in error;
7041
7137
  }
7042
7138
  };
7043
- var name32 = "GatewayRateLimitError";
7139
+ var name32 = "GatewayInvalidRequestError";
7044
7140
  var marker42 = `vercel.ai.gateway.error.${name32}`;
7045
7141
  var symbol42 = Symbol.for(marker42);
7046
7142
  var _a42;
7047
7143
  var _b42;
7048
- var GatewayRateLimitError = class extends (_b42 = GatewayError, _a42 = symbol42, _b42) {
7144
+ var GatewayInvalidRequestError = class extends (_b42 = GatewayError, _a42 = symbol42, _b42) {
7049
7145
  constructor({
7050
- message = "Rate limit exceeded",
7051
- statusCode = 429,
7146
+ message = "Invalid request",
7147
+ statusCode = 400,
7052
7148
  cause
7053
7149
  } = {}) {
7054
7150
  super({ message, statusCode, cause });
7055
7151
  this[_a42] = true;
7056
7152
  this.name = name32;
7057
- this.type = "rate_limit_exceeded";
7153
+ this.type = "invalid_request_error";
7058
7154
  }
7059
7155
  static isInstance(error) {
7060
7156
  return GatewayError.hasMarker(error) && symbol42 in error;
7061
7157
  }
7062
7158
  };
7063
- var name42 = "GatewayModelNotFoundError";
7159
+ var name42 = "GatewayRateLimitError";
7064
7160
  var marker52 = `vercel.ai.gateway.error.${name42}`;
7065
7161
  var symbol52 = Symbol.for(marker52);
7066
- var modelNotFoundParamSchema = lazyValidator(
7067
- () => zodSchema(
7068
- z$1.object({
7069
- modelId: z$1.string()
7070
- })
7071
- )
7072
- );
7073
7162
  var _a52;
7074
7163
  var _b52;
7075
- var GatewayModelNotFoundError = class extends (_b52 = GatewayError, _a52 = symbol52, _b52) {
7164
+ var GatewayRateLimitError = class extends (_b52 = GatewayError, _a52 = symbol52, _b52) {
7076
7165
  constructor({
7077
- message = "Model not found",
7078
- statusCode = 404,
7079
- modelId,
7166
+ message = "Rate limit exceeded",
7167
+ statusCode = 429,
7080
7168
  cause
7081
7169
  } = {}) {
7082
7170
  super({ message, statusCode, cause });
7083
7171
  this[_a52] = true;
7084
7172
  this.name = name42;
7085
- this.type = "model_not_found";
7086
- this.modelId = modelId;
7173
+ this.type = "rate_limit_exceeded";
7087
7174
  }
7088
7175
  static isInstance(error) {
7089
7176
  return GatewayError.hasMarker(error) && symbol52 in error;
7090
7177
  }
7091
7178
  };
7092
- var name52 = "GatewayInternalServerError";
7179
+ var name52 = "GatewayModelNotFoundError";
7093
7180
  var marker62 = `vercel.ai.gateway.error.${name52}`;
7094
7181
  var symbol62 = Symbol.for(marker62);
7182
+ var modelNotFoundParamSchema = lazyValidator(
7183
+ () => zodSchema(
7184
+ z$1.object({
7185
+ modelId: z$1.string()
7186
+ })
7187
+ )
7188
+ );
7095
7189
  var _a62;
7096
7190
  var _b62;
7097
- var GatewayInternalServerError = class extends (_b62 = GatewayError, _a62 = symbol62, _b62) {
7191
+ var GatewayModelNotFoundError = class extends (_b62 = GatewayError, _a62 = symbol62, _b62) {
7098
7192
  constructor({
7099
- message = "Internal server error",
7100
- statusCode = 500,
7193
+ message = "Model not found",
7194
+ statusCode = 404,
7195
+ modelId,
7101
7196
  cause
7102
7197
  } = {}) {
7103
7198
  super({ message, statusCode, cause });
7104
7199
  this[_a62] = true;
7105
7200
  this.name = name52;
7106
- this.type = "internal_server_error";
7201
+ this.type = "model_not_found";
7202
+ this.modelId = modelId;
7107
7203
  }
7108
7204
  static isInstance(error) {
7109
7205
  return GatewayError.hasMarker(error) && symbol62 in error;
7110
7206
  }
7111
7207
  };
7112
- var name62 = "GatewayResponseError";
7208
+ var name62 = "GatewayInternalServerError";
7113
7209
  var marker72 = `vercel.ai.gateway.error.${name62}`;
7114
7210
  var symbol72 = Symbol.for(marker72);
7115
7211
  var _a72;
7116
7212
  var _b72;
7117
- var GatewayResponseError = class extends (_b72 = GatewayError, _a72 = symbol72, _b72) {
7213
+ var GatewayInternalServerError = class extends (_b72 = GatewayError, _a72 = symbol72, _b72) {
7214
+ constructor({
7215
+ message = "Internal server error",
7216
+ statusCode = 500,
7217
+ cause
7218
+ } = {}) {
7219
+ super({ message, statusCode, cause });
7220
+ this[_a72] = true;
7221
+ this.name = name62;
7222
+ this.type = "internal_server_error";
7223
+ }
7224
+ static isInstance(error) {
7225
+ return GatewayError.hasMarker(error) && symbol72 in error;
7226
+ }
7227
+ };
7228
+ var name72 = "GatewayResponseError";
7229
+ var marker82 = `vercel.ai.gateway.error.${name72}`;
7230
+ var symbol82 = Symbol.for(marker82);
7231
+ var _a82;
7232
+ var _b82;
7233
+ var GatewayResponseError = class extends (_b82 = GatewayError, _a82 = symbol82, _b82) {
7118
7234
  constructor({
7119
7235
  message = "Invalid response from Gateway",
7120
7236
  statusCode = 502,
@@ -7123,14 +7239,14 @@ var GatewayResponseError = class extends (_b72 = GatewayError, _a72 = symbol72,
7123
7239
  cause
7124
7240
  } = {}) {
7125
7241
  super({ message, statusCode, cause });
7126
- this[_a72] = true;
7127
- this.name = name62;
7242
+ this[_a82] = true;
7243
+ this.name = name72;
7128
7244
  this.type = "response_error";
7129
7245
  this.response = response;
7130
7246
  this.validationError = validationError;
7131
7247
  }
7132
7248
  static isInstance(error) {
7133
- return GatewayError.hasMarker(error) && symbol72 in error;
7249
+ return GatewayError.hasMarker(error) && symbol82 in error;
7134
7250
  }
7135
7251
  };
7136
7252
  async function createGatewayErrorFromResponse({
@@ -7182,6 +7298,8 @@ async function createGatewayErrorFromResponse({
7182
7298
  }
7183
7299
  case "internal_server_error":
7184
7300
  return new GatewayInternalServerError({ message, statusCode, cause });
7301
+ case "forbidden":
7302
+ return new GatewayForbiddenError({ message, statusCode, cause });
7185
7303
  default:
7186
7304
  return new GatewayInternalServerError({ message, statusCode, cause });
7187
7305
  }
@@ -7211,24 +7329,24 @@ function extractApiCallResponse(error) {
7211
7329
  }
7212
7330
  return {};
7213
7331
  }
7214
- var name72 = "GatewayTimeoutError";
7215
- var marker82 = `vercel.ai.gateway.error.${name72}`;
7216
- var symbol82 = Symbol.for(marker82);
7217
- var _a82;
7218
- var _b82;
7219
- var GatewayTimeoutError = class _GatewayTimeoutError extends (_b82 = GatewayError, _a82 = symbol82, _b82) {
7332
+ var name82 = "GatewayTimeoutError";
7333
+ var marker92 = `vercel.ai.gateway.error.${name82}`;
7334
+ var symbol92 = Symbol.for(marker92);
7335
+ var _a92;
7336
+ var _b92;
7337
+ var GatewayTimeoutError = class _GatewayTimeoutError extends (_b92 = GatewayError, _a92 = symbol92, _b92) {
7220
7338
  constructor({
7221
7339
  message = "Request timed out",
7222
7340
  statusCode = 408,
7223
7341
  cause
7224
7342
  } = {}) {
7225
7343
  super({ message, statusCode, cause });
7226
- this[_a82] = true;
7227
- this.name = name72;
7344
+ this[_a92] = true;
7345
+ this.name = name82;
7228
7346
  this.type = "timeout_error";
7229
7347
  }
7230
7348
  static isInstance(error) {
7231
- return GatewayError.hasMarker(error) && symbol82 in error;
7349
+ return GatewayError.hasMarker(error) && symbol92 in error;
7232
7350
  }
7233
7351
  /**
7234
7352
  * Creates a helpful timeout error message with troubleshooting guidance
@@ -7264,7 +7382,7 @@ function isTimeoutError(error) {
7264
7382
  return false;
7265
7383
  }
7266
7384
  async function asGatewayError(error, authMethod) {
7267
- var _a93;
7385
+ var _a103;
7268
7386
  if (GatewayError.isInstance(error)) {
7269
7387
  return error;
7270
7388
  }
@@ -7283,7 +7401,7 @@ async function asGatewayError(error, authMethod) {
7283
7401
  }
7284
7402
  return await createGatewayErrorFromResponse({
7285
7403
  response: extractApiCallResponse(error),
7286
- statusCode: (_a93 = error.statusCode) != null ? _a93 : 500,
7404
+ statusCode: (_a103 = error.statusCode) != null ? _a103 : 500,
7287
7405
  defaultMessage: "Gateway request failed",
7288
7406
  cause: error,
7289
7407
  authMethod
@@ -7743,7 +7861,7 @@ var GatewayEmbeddingModel = class {
7743
7861
  abortSignal,
7744
7862
  providerOptions
7745
7863
  }) {
7746
- var _a93;
7864
+ var _a103;
7747
7865
  const resolvedHeaders = await resolve4(this.config.headers());
7748
7866
  try {
7749
7867
  const {
@@ -7774,7 +7892,7 @@ var GatewayEmbeddingModel = class {
7774
7892
  });
7775
7893
  return {
7776
7894
  embeddings: responseBody.embeddings,
7777
- usage: (_a93 = responseBody.usage) != null ? _a93 : void 0,
7895
+ usage: (_a103 = responseBody.usage) != null ? _a103 : void 0,
7778
7896
  providerMetadata: responseBody.providerMetadata,
7779
7897
  response: { headers: responseHeaders, body: rawValue }
7780
7898
  };
@@ -7821,7 +7939,7 @@ var GatewayImageModel = class {
7821
7939
  headers,
7822
7940
  abortSignal
7823
7941
  }) {
7824
- var _a93, _b92, _c, _d;
7942
+ var _a103, _b102, _c, _d;
7825
7943
  const resolvedHeaders = await resolve4(this.config.headers());
7826
7944
  try {
7827
7945
  const {
@@ -7856,7 +7974,7 @@ var GatewayImageModel = class {
7856
7974
  return {
7857
7975
  images: responseBody.images,
7858
7976
  // Always base64 strings from server
7859
- warnings: (_a93 = responseBody.warnings) != null ? _a93 : [],
7977
+ warnings: (_a103 = responseBody.warnings) != null ? _a103 : [],
7860
7978
  providerMetadata: responseBody.providerMetadata,
7861
7979
  response: {
7862
7980
  timestamp: /* @__PURE__ */ new Date(),
@@ -7865,7 +7983,7 @@ var GatewayImageModel = class {
7865
7983
  },
7866
7984
  ...responseBody.usage != null && {
7867
7985
  usage: {
7868
- inputTokens: (_b92 = responseBody.usage.inputTokens) != null ? _b92 : void 0,
7986
+ inputTokens: (_b102 = responseBody.usage.inputTokens) != null ? _b102 : void 0,
7869
7987
  outputTokens: (_c = responseBody.usage.outputTokens) != null ? _c : void 0,
7870
7988
  totalTokens: (_d = responseBody.usage.totalTokens) != null ? _d : void 0
7871
7989
  }
@@ -8080,18 +8198,18 @@ var gatewayTools = {
8080
8198
  perplexitySearch
8081
8199
  };
8082
8200
  async function getVercelRequestId() {
8083
- var _a93;
8084
- return (_a93 = getContext().headers) == null ? void 0 : _a93["x-vercel-id"];
8201
+ var _a103;
8202
+ return (_a103 = getContext().headers) == null ? void 0 : _a103["x-vercel-id"];
8085
8203
  }
8086
- var VERSION2 = "2.0.88";
8204
+ var VERSION2 = "2.0.109";
8087
8205
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
8088
8206
  function createGatewayProvider(options = {}) {
8089
- var _a93, _b92;
8207
+ var _a103, _b102;
8090
8208
  let pendingMetadata = null;
8091
8209
  let metadataCache = null;
8092
- const cacheRefreshMillis = (_a93 = options.metadataCacheRefreshMillis) != null ? _a93 : 1e3 * 60 * 5;
8210
+ const cacheRefreshMillis = (_a103 = options.metadataCacheRefreshMillis) != null ? _a103 : 1e3 * 60 * 5;
8093
8211
  let lastFetchTime = 0;
8094
- const baseURL = (_b92 = withoutTrailingSlash(options.baseURL)) != null ? _b92 : "https://ai-gateway.vercel.sh/v1/ai";
8212
+ const baseURL = (_b102 = withoutTrailingSlash(options.baseURL)) != null ? _b102 : "https://ai-gateway.vercel.sh/v1/ai";
8095
8213
  const getHeaders = async () => {
8096
8214
  const auth = await getGatewayAuthToken(options);
8097
8215
  if (auth) {
@@ -8149,8 +8267,8 @@ function createGatewayProvider(options = {}) {
8149
8267
  });
8150
8268
  };
8151
8269
  const getAvailableModels = async () => {
8152
- var _a1022, _b102, _c;
8153
- const now2 = (_c = (_b102 = (_a1022 = options._internal) == null ? void 0 : _a1022.currentDate) == null ? void 0 : _b102.call(_a1022).getTime()) != null ? _c : Date.now();
8270
+ var _a1122, _b112, _c;
8271
+ const now2 = (_c = (_b112 = (_a1122 = options._internal) == null ? void 0 : _a1122.currentDate) == null ? void 0 : _b112.call(_a1122).getTime()) != null ? _c : Date.now();
8154
8272
  if (!pendingMetadata || now2 - lastFetchTime > cacheRefreshMillis) {
8155
8273
  lastFetchTime = now2;
8156
8274
  pendingMetadata = new GatewayFetchMetadata({
@@ -8354,12 +8472,12 @@ function registerGlobal(type, instance, diag, allowOverride) {
8354
8472
  return true;
8355
8473
  }
8356
8474
  function getGlobal(type) {
8357
- var _a162, _b92;
8475
+ var _a162, _b102;
8358
8476
  var globalVersion = (_a162 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a162 === void 0 ? void 0 : _a162.version;
8359
8477
  if (!globalVersion || !isCompatible(globalVersion)) {
8360
8478
  return;
8361
8479
  }
8362
- return (_b92 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b92 === void 0 ? void 0 : _b92[type];
8480
+ return (_b102 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b102 === void 0 ? void 0 : _b102[type];
8363
8481
  }
8364
8482
  function unregisterGlobal(type, diag) {
8365
8483
  diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION22 + ".");
@@ -8524,7 +8642,7 @@ var DiagAPI = (
8524
8642
  }
8525
8643
  var self = this;
8526
8644
  var setLogger = function(logger, optionsOrLogLevel) {
8527
- var _a162, _b92, _c;
8645
+ var _a162, _b102, _c;
8528
8646
  if (optionsOrLogLevel === void 0) {
8529
8647
  optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
8530
8648
  }
@@ -8539,7 +8657,7 @@ var DiagAPI = (
8539
8657
  };
8540
8658
  }
8541
8659
  var oldLogger = getGlobal("diag");
8542
- var newLogger = createLogLevelDiagLogger((_b92 = optionsOrLogLevel.logLevel) !== null && _b92 !== void 0 ? _b92 : DiagLogLevel.INFO, logger);
8660
+ var newLogger = createLogLevelDiagLogger((_b102 = optionsOrLogLevel.logLevel) !== null && _b102 !== void 0 ? _b102 : DiagLogLevel.INFO, logger);
8543
8661
  if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
8544
8662
  var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
8545
8663
  oldLogger.warn("Current logger will be overwritten from " + stack);
@@ -9003,8 +9121,8 @@ var dataContentSchema = z$1.union([
9003
9121
  z$1.custom(
9004
9122
  // Buffer might not be available in some environments such as CloudFlare:
9005
9123
  (value) => {
9006
- var _a162, _b92;
9007
- return (_b92 = (_a162 = globalThis.Buffer) == null ? void 0 : _a162.isBuffer(value)) != null ? _b92 : false;
9124
+ var _a162, _b102;
9125
+ return (_b102 = (_a162 = globalThis.Buffer) == null ? void 0 : _a162.isBuffer(value)) != null ? _b102 : false;
9008
9126
  },
9009
9127
  { message: "Must be a Buffer" }
9010
9128
  )