@probelabs/probe 0.6.0-rc324 → 0.6.0-rc329

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/cjs/index.cjs CHANGED
@@ -18380,6 +18380,70 @@ function convertUint8ArrayToBase64(array2) {
18380
18380
  function convertToBase64(value) {
18381
18381
  return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
18382
18382
  }
18383
+ async function cancelResponseBody(response) {
18384
+ var _a22;
18385
+ try {
18386
+ await ((_a22 = response.body) == null ? void 0 : _a22.cancel());
18387
+ } catch (e) {
18388
+ }
18389
+ }
18390
+ function isNodeDefaultFetch(fetch2) {
18391
+ const source = Function.prototype.toString.call(fetch2);
18392
+ return source.includes("internal/deps/undici") || source.includes("lazy loading of undici");
18393
+ }
18394
+ async function readResponseWithSizeLimit({
18395
+ response,
18396
+ url: url2,
18397
+ maxBytes = DEFAULT_MAX_DOWNLOAD_SIZE
18398
+ }) {
18399
+ const contentLength = response.headers.get("content-length");
18400
+ if (contentLength != null) {
18401
+ const length = parseInt(contentLength, 10);
18402
+ if (!isNaN(length) && length > maxBytes) {
18403
+ await cancelResponseBody(response);
18404
+ throw new DownloadError({
18405
+ url: url2,
18406
+ message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes (Content-Length: ${length}).`
18407
+ });
18408
+ }
18409
+ }
18410
+ const body = response.body;
18411
+ if (body == null) {
18412
+ return new Uint8Array(0);
18413
+ }
18414
+ const reader = body.getReader();
18415
+ const chunks = [];
18416
+ let totalBytes = 0;
18417
+ try {
18418
+ while (true) {
18419
+ const { done, value } = await reader.read();
18420
+ if (done) {
18421
+ break;
18422
+ }
18423
+ totalBytes += value.length;
18424
+ if (totalBytes > maxBytes) {
18425
+ throw new DownloadError({
18426
+ url: url2,
18427
+ message: `Download of ${url2} exceeded maximum size of ${maxBytes} bytes.`
18428
+ });
18429
+ }
18430
+ chunks.push(value);
18431
+ }
18432
+ } finally {
18433
+ try {
18434
+ await reader.cancel();
18435
+ } finally {
18436
+ reader.releaseLock();
18437
+ }
18438
+ }
18439
+ const result = new Uint8Array(totalBytes);
18440
+ let offset2 = 0;
18441
+ for (const chunk of chunks) {
18442
+ result.set(chunk, offset2);
18443
+ offset2 += chunk.length;
18444
+ }
18445
+ return result;
18446
+ }
18383
18447
  function isAbortError(error40) {
18384
18448
  return (error40 instanceof Error || error40 instanceof DOMException) && (error40.name === "AbortError" || error40.name === "ResponseAborted" || // Next.js
18385
18449
  error40.name === "TimeoutError");
@@ -18472,6 +18536,40 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
18472
18536
  );
18473
18537
  return Object.fromEntries(normalizedHeaders.entries());
18474
18538
  }
18539
+ function injectJsonInstruction({
18540
+ prompt,
18541
+ schema,
18542
+ schemaPrefix = schema != null ? DEFAULT_SCHEMA_PREFIX : void 0,
18543
+ schemaSuffix = schema != null ? DEFAULT_SCHEMA_SUFFIX : DEFAULT_GENERIC_SUFFIX
18544
+ }) {
18545
+ return [
18546
+ prompt != null && prompt.length > 0 ? prompt : void 0,
18547
+ prompt != null && prompt.length > 0 ? "" : void 0,
18548
+ // add a newline if prompt is not null
18549
+ schemaPrefix,
18550
+ schema != null ? JSON.stringify(schema) : void 0,
18551
+ schemaSuffix
18552
+ ].filter((line) => line != null).join("\n");
18553
+ }
18554
+ function injectJsonInstructionIntoMessages({
18555
+ messages,
18556
+ schema,
18557
+ schemaPrefix,
18558
+ schemaSuffix
18559
+ }) {
18560
+ var _a22, _b22;
18561
+ const systemMessage = ((_a22 = messages[0]) == null ? void 0 : _a22.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
18562
+ systemMessage.content = injectJsonInstruction({
18563
+ prompt: systemMessage.content,
18564
+ schema,
18565
+ schemaPrefix,
18566
+ schemaSuffix
18567
+ });
18568
+ return [
18569
+ systemMessage,
18570
+ ...((_b22 = messages[0]) == null ? void 0 : _b22.role) === "system" ? messages.slice(1) : messages
18571
+ ];
18572
+ }
18475
18573
  function loadOptionalSetting({
18476
18574
  settingValue,
18477
18575
  environmentVariableName
@@ -19391,15 +19489,26 @@ function isSchema(value) {
19391
19489
  return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true && "jsonSchema" in value && "validate" in value;
19392
19490
  }
19393
19491
  function asSchema(schema) {
19394
- return schema == null ? jsonSchema({ properties: {}, additionalProperties: false }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
19492
+ return schema == null ? jsonSchema({
19493
+ type: "object",
19494
+ properties: {},
19495
+ additionalProperties: false
19496
+ }) : isSchema(schema) ? schema : "~standard" in schema ? schema["~standard"].vendor === "zod" ? zodSchema(schema) : standardSchema(schema) : schema();
19395
19497
  }
19396
19498
  function standardSchema(standardSchema2) {
19397
19499
  return jsonSchema(
19398
- () => addAdditionalPropertiesToJsonSchema(
19399
- standardSchema2["~standard"].jsonSchema.input({
19400
- target: "draft-07"
19401
- })
19402
- ),
19500
+ () => {
19501
+ if (!hasStandardJsonSchema(standardSchema2)) {
19502
+ throw new Error(
19503
+ `Standard schema vendor '${standardSchema2["~standard"].vendor}' does not support JSON Schema conversion.`
19504
+ );
19505
+ }
19506
+ return addAdditionalPropertiesToJsonSchema(
19507
+ standardSchema2["~standard"].jsonSchema.input({
19508
+ target: "draft-07"
19509
+ })
19510
+ );
19511
+ },
19403
19512
  {
19404
19513
  validate: async (value) => {
19405
19514
  const result = await standardSchema2["~standard"].validate(value);
@@ -19414,6 +19523,9 @@ function standardSchema(standardSchema2) {
19414
19523
  }
19415
19524
  );
19416
19525
  }
19526
+ function hasStandardJsonSchema(schema) {
19527
+ return schema["~standard"].jsonSchema != null;
19528
+ }
19417
19529
  function zod3Schema(zodSchema2, options) {
19418
19530
  var _a22;
19419
19531
  const useReferences = (_a22 = options == null ? void 0 : options.useReferences) != null ? _a22 : false;
@@ -19560,6 +19672,17 @@ async function resolve(value) {
19560
19672
  }
19561
19673
  return Promise.resolve(value);
19562
19674
  }
19675
+ async function readResponseBodyAsText({
19676
+ response,
19677
+ url: url2
19678
+ }) {
19679
+ return textDecoder.decode(
19680
+ await readResponseWithSizeLimit({
19681
+ response,
19682
+ url: url2
19683
+ })
19684
+ );
19685
+ }
19563
19686
  function stripFileExtension(filename) {
19564
19687
  const firstDotIndex = filename.indexOf(".");
19565
19688
  return firstDotIndex === -1 ? filename : filename.slice(0, firstDotIndex);
@@ -19567,7 +19690,7 @@ function stripFileExtension(filename) {
19567
19690
  function withoutTrailingSlash(url2) {
19568
19691
  return url2 == null ? void 0 : url2.replace(/\/$/, "");
19569
19692
  }
19570
- var btoa2, atob2, name14, marker15, symbol16, _a15, _b15, DownloadError, DEFAULT_MAX_DOWNLOAD_SIZE, createIdGenerator, generateId, FETCH_FAILED_ERROR_MESSAGES, BUN_ERROR_CODES, VERSION, suspectProtoRx, suspectConstructorRx, ignoreOverride, defaultOptions, getDefaultOptions, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, getRelativePath, get$ref, addMeta, getRefs, zod3ToJsonSchema, schemaSymbol, getOriginalFetch2, postJsonToApi, postToApi, createJsonErrorResponseHandler, createJsonResponseHandler;
19693
+ var btoa2, atob2, name14, marker15, symbol16, _a15, _b15, DownloadError, initialGlobalFetch, initialGlobalFetchIsNodeDefault, DEFAULT_MAX_DOWNLOAD_SIZE, createIdGenerator, generateId, FETCH_FAILED_ERROR_MESSAGES, BUN_ERROR_CODES, VERSION, DEFAULT_SCHEMA_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_GENERIC_SUFFIX, suspectProtoRx, suspectConstructorRx, ignoreOverride, defaultOptions, getDefaultOptions, parseCatchDef, integerDateParser, isJsonSchema7AllOfType, emojiRegex2, zodPatterns, ALPHA_NUMERIC, primitiveMappings, asAnyOf, parseOptionalDef, parsePipelineDef, parseReadonlyDef, selectParser, getRelativePath, get$ref, addMeta, getRefs, zod3ToJsonSchema, schemaSymbol, getOriginalFetch2, postJsonToApi, postToApi, textDecoder, createJsonErrorResponseHandler, createJsonResponseHandler;
19571
19694
  var init_dist2 = __esm({
19572
19695
  "node_modules/@ai-sdk/provider-utils/dist/index.mjs"() {
19573
19696
  init_dist();
@@ -19606,6 +19729,8 @@ var init_dist2 = __esm({
19606
19729
  return AISDKError.hasMarker(error40, marker15);
19607
19730
  }
19608
19731
  };
19732
+ initialGlobalFetch = globalThis.fetch;
19733
+ initialGlobalFetchIsNodeDefault = isNodeDefaultFetch(initialGlobalFetch);
19609
19734
  DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
19610
19735
  createIdGenerator = ({
19611
19736
  prefix,
@@ -19643,7 +19768,10 @@ var init_dist2 = __esm({
19643
19768
  "ETIMEDOUT",
19644
19769
  "EPIPE"
19645
19770
  ];
19646
- VERSION = true ? "4.0.27" : "0.0.0-test";
19771
+ VERSION = true ? "4.0.41" : "0.0.0-test";
19772
+ DEFAULT_SCHEMA_PREFIX = "JSON schema:";
19773
+ DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
19774
+ DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
19647
19775
  suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
19648
19776
  suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
19649
19777
  ignoreOverride = /* @__PURE__ */ Symbol(
@@ -20076,12 +20204,13 @@ var init_dist2 = __esm({
20076
20204
  throw handleFetchError({ error: error40, url: url2, requestBodyValues: body.values });
20077
20205
  }
20078
20206
  };
20207
+ textDecoder = new TextDecoder();
20079
20208
  createJsonErrorResponseHandler = ({
20080
20209
  errorSchema,
20081
20210
  errorToMessage,
20082
20211
  isRetryable
20083
20212
  }) => async ({ response, url: url2, requestBodyValues }) => {
20084
- const responseBody = await response.text();
20213
+ const responseBody = await readResponseBodyAsText({ response, url: url2 });
20085
20214
  const responseHeaders = extractResponseHeaders(response);
20086
20215
  if (responseBody.trim() === "") {
20087
20216
  return {
@@ -20131,7 +20260,7 @@ var init_dist2 = __esm({
20131
20260
  }
20132
20261
  };
20133
20262
  createJsonResponseHandler = (responseSchema) => async ({ response, url: url2, requestBodyValues }) => {
20134
- const responseBody = await response.text();
20263
+ const responseBody = await readResponseBodyAsText({ response, url: url2 });
20135
20264
  const parsedResult = await safeParseJSON({
20136
20265
  text: responseBody,
20137
20266
  schema: responseSchema
@@ -20157,1111 +20286,6 @@ var init_dist2 = __esm({
20157
20286
  }
20158
20287
  });
20159
20288
 
20160
- // node_modules/tslib/tslib.es6.mjs
20161
- var tslib_es6_exports = {};
20162
- __export(tslib_es6_exports, {
20163
- __addDisposableResource: () => __addDisposableResource,
20164
- __assign: () => __assign,
20165
- __asyncDelegator: () => __asyncDelegator,
20166
- __asyncGenerator: () => __asyncGenerator,
20167
- __asyncValues: () => __asyncValues,
20168
- __await: () => __await,
20169
- __awaiter: () => __awaiter,
20170
- __classPrivateFieldGet: () => __classPrivateFieldGet,
20171
- __classPrivateFieldIn: () => __classPrivateFieldIn,
20172
- __classPrivateFieldSet: () => __classPrivateFieldSet,
20173
- __createBinding: () => __createBinding,
20174
- __decorate: () => __decorate,
20175
- __disposeResources: () => __disposeResources,
20176
- __esDecorate: () => __esDecorate,
20177
- __exportStar: () => __exportStar,
20178
- __extends: () => __extends,
20179
- __generator: () => __generator,
20180
- __importDefault: () => __importDefault,
20181
- __importStar: () => __importStar,
20182
- __makeTemplateObject: () => __makeTemplateObject,
20183
- __metadata: () => __metadata,
20184
- __param: () => __param,
20185
- __propKey: () => __propKey,
20186
- __read: () => __read,
20187
- __rest: () => __rest,
20188
- __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
20189
- __runInitializers: () => __runInitializers,
20190
- __setFunctionName: () => __setFunctionName,
20191
- __spread: () => __spread,
20192
- __spreadArray: () => __spreadArray,
20193
- __spreadArrays: () => __spreadArrays,
20194
- __values: () => __values,
20195
- default: () => tslib_es6_default
20196
- });
20197
- function __extends(d, b) {
20198
- if (typeof b !== "function" && b !== null)
20199
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
20200
- extendStatics(d, b);
20201
- function __() {
20202
- this.constructor = d;
20203
- }
20204
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20205
- }
20206
- function __rest(s, e) {
20207
- var t = {};
20208
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20209
- t[p] = s[p];
20210
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
20211
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20212
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20213
- t[p[i]] = s[p[i]];
20214
- }
20215
- return t;
20216
- }
20217
- function __decorate(decorators, target, key, desc) {
20218
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20219
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20220
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
20221
- return c > 3 && r && Object.defineProperty(target, key, r), r;
20222
- }
20223
- function __param(paramIndex, decorator) {
20224
- return function(target, key) {
20225
- decorator(target, key, paramIndex);
20226
- };
20227
- }
20228
- function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
20229
- function accept(f) {
20230
- if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
20231
- return f;
20232
- }
20233
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20234
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20235
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
20236
- var _, done = false;
20237
- for (var i = decorators.length - 1; i >= 0; i--) {
20238
- var context = {};
20239
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
20240
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
20241
- context.addInitializer = function(f) {
20242
- if (done) throw new TypeError("Cannot add initializers after decoration has completed");
20243
- extraInitializers.push(accept(f || null));
20244
- };
20245
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20246
- if (kind === "accessor") {
20247
- if (result === void 0) continue;
20248
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
20249
- if (_ = accept(result.get)) descriptor.get = _;
20250
- if (_ = accept(result.set)) descriptor.set = _;
20251
- if (_ = accept(result.init)) initializers.unshift(_);
20252
- } else if (_ = accept(result)) {
20253
- if (kind === "field") initializers.unshift(_);
20254
- else descriptor[key] = _;
20255
- }
20256
- }
20257
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
20258
- done = true;
20259
- }
20260
- function __runInitializers(thisArg, initializers, value) {
20261
- var useValue = arguments.length > 2;
20262
- for (var i = 0; i < initializers.length; i++) {
20263
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
20264
- }
20265
- return useValue ? value : void 0;
20266
- }
20267
- function __propKey(x) {
20268
- return typeof x === "symbol" ? x : "".concat(x);
20269
- }
20270
- function __setFunctionName(f, name15, prefix) {
20271
- if (typeof name15 === "symbol") name15 = name15.description ? "[".concat(name15.description, "]") : "";
20272
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name15) : name15 });
20273
- }
20274
- function __metadata(metadataKey, metadataValue) {
20275
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
20276
- }
20277
- function __awaiter(thisArg, _arguments, P, generator) {
20278
- function adopt(value) {
20279
- return value instanceof P ? value : new P(function(resolve9) {
20280
- resolve9(value);
20281
- });
20282
- }
20283
- return new (P || (P = Promise))(function(resolve9, reject2) {
20284
- function fulfilled(value) {
20285
- try {
20286
- step(generator.next(value));
20287
- } catch (e) {
20288
- reject2(e);
20289
- }
20290
- }
20291
- function rejected(value) {
20292
- try {
20293
- step(generator["throw"](value));
20294
- } catch (e) {
20295
- reject2(e);
20296
- }
20297
- }
20298
- function step(result) {
20299
- result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
20300
- }
20301
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20302
- });
20303
- }
20304
- function __generator(thisArg, body) {
20305
- var _ = { label: 0, sent: function() {
20306
- if (t[0] & 1) throw t[1];
20307
- return t[1];
20308
- }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
20309
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
20310
- return this;
20311
- }), g;
20312
- function verb(n) {
20313
- return function(v) {
20314
- return step([n, v]);
20315
- };
20316
- }
20317
- function step(op) {
20318
- if (f) throw new TypeError("Generator is already executing.");
20319
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
20320
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20321
- if (y = 0, t) op = [op[0] & 2, t.value];
20322
- switch (op[0]) {
20323
- case 0:
20324
- case 1:
20325
- t = op;
20326
- break;
20327
- case 4:
20328
- _.label++;
20329
- return { value: op[1], done: false };
20330
- case 5:
20331
- _.label++;
20332
- y = op[1];
20333
- op = [0];
20334
- continue;
20335
- case 7:
20336
- op = _.ops.pop();
20337
- _.trys.pop();
20338
- continue;
20339
- default:
20340
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
20341
- _ = 0;
20342
- continue;
20343
- }
20344
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
20345
- _.label = op[1];
20346
- break;
20347
- }
20348
- if (op[0] === 6 && _.label < t[1]) {
20349
- _.label = t[1];
20350
- t = op;
20351
- break;
20352
- }
20353
- if (t && _.label < t[2]) {
20354
- _.label = t[2];
20355
- _.ops.push(op);
20356
- break;
20357
- }
20358
- if (t[2]) _.ops.pop();
20359
- _.trys.pop();
20360
- continue;
20361
- }
20362
- op = body.call(thisArg, _);
20363
- } catch (e) {
20364
- op = [6, e];
20365
- y = 0;
20366
- } finally {
20367
- f = t = 0;
20368
- }
20369
- if (op[0] & 5) throw op[1];
20370
- return { value: op[0] ? op[1] : void 0, done: true };
20371
- }
20372
- }
20373
- function __exportStar(m, o) {
20374
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
20375
- }
20376
- function __values(o) {
20377
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
20378
- if (m) return m.call(o);
20379
- if (o && typeof o.length === "number") return {
20380
- next: function() {
20381
- if (o && i >= o.length) o = void 0;
20382
- return { value: o && o[i++], done: !o };
20383
- }
20384
- };
20385
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
20386
- }
20387
- function __read(o, n) {
20388
- var m = typeof Symbol === "function" && o[Symbol.iterator];
20389
- if (!m) return o;
20390
- var i = m.call(o), r, ar = [], e;
20391
- try {
20392
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
20393
- } catch (error40) {
20394
- e = { error: error40 };
20395
- } finally {
20396
- try {
20397
- if (r && !r.done && (m = i["return"])) m.call(i);
20398
- } finally {
20399
- if (e) throw e.error;
20400
- }
20401
- }
20402
- return ar;
20403
- }
20404
- function __spread() {
20405
- for (var ar = [], i = 0; i < arguments.length; i++)
20406
- ar = ar.concat(__read(arguments[i]));
20407
- return ar;
20408
- }
20409
- function __spreadArrays() {
20410
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
20411
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
20412
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
20413
- r[k] = a[j];
20414
- return r;
20415
- }
20416
- function __spreadArray(to, from, pack) {
20417
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20418
- if (ar || !(i in from)) {
20419
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
20420
- ar[i] = from[i];
20421
- }
20422
- }
20423
- return to.concat(ar || Array.prototype.slice.call(from));
20424
- }
20425
- function __await(v) {
20426
- return this instanceof __await ? (this.v = v, this) : new __await(v);
20427
- }
20428
- function __asyncGenerator(thisArg, _arguments, generator) {
20429
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
20430
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
20431
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
20432
- return this;
20433
- }, i;
20434
- function awaitReturn(f) {
20435
- return function(v) {
20436
- return Promise.resolve(v).then(f, reject2);
20437
- };
20438
- }
20439
- function verb(n, f) {
20440
- if (g[n]) {
20441
- i[n] = function(v) {
20442
- return new Promise(function(a, b) {
20443
- q.push([n, v, a, b]) > 1 || resume(n, v);
20444
- });
20445
- };
20446
- if (f) i[n] = f(i[n]);
20447
- }
20448
- }
20449
- function resume(n, v) {
20450
- try {
20451
- step(g[n](v));
20452
- } catch (e) {
20453
- settle(q[0][3], e);
20454
- }
20455
- }
20456
- function step(r) {
20457
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject2) : settle(q[0][2], r);
20458
- }
20459
- function fulfill(value) {
20460
- resume("next", value);
20461
- }
20462
- function reject2(value) {
20463
- resume("throw", value);
20464
- }
20465
- function settle(f, v) {
20466
- if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
20467
- }
20468
- }
20469
- function __asyncDelegator(o) {
20470
- var i, p;
20471
- return i = {}, verb("next"), verb("throw", function(e) {
20472
- throw e;
20473
- }), verb("return"), i[Symbol.iterator] = function() {
20474
- return this;
20475
- }, i;
20476
- function verb(n, f) {
20477
- i[n] = o[n] ? function(v) {
20478
- return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
20479
- } : f;
20480
- }
20481
- }
20482
- function __asyncValues(o) {
20483
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
20484
- var m = o[Symbol.asyncIterator], i;
20485
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
20486
- return this;
20487
- }, i);
20488
- function verb(n) {
20489
- i[n] = o[n] && function(v) {
20490
- return new Promise(function(resolve9, reject2) {
20491
- v = o[n](v), settle(resolve9, reject2, v.done, v.value);
20492
- });
20493
- };
20494
- }
20495
- function settle(resolve9, reject2, d, v) {
20496
- Promise.resolve(v).then(function(v2) {
20497
- resolve9({ value: v2, done: d });
20498
- }, reject2);
20499
- }
20500
- }
20501
- function __makeTemplateObject(cooked, raw) {
20502
- if (Object.defineProperty) {
20503
- Object.defineProperty(cooked, "raw", { value: raw });
20504
- } else {
20505
- cooked.raw = raw;
20506
- }
20507
- return cooked;
20508
- }
20509
- function __importStar(mod) {
20510
- if (mod && mod.__esModule) return mod;
20511
- var result = {};
20512
- if (mod != null) {
20513
- for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
20514
- }
20515
- __setModuleDefault(result, mod);
20516
- return result;
20517
- }
20518
- function __importDefault(mod) {
20519
- return mod && mod.__esModule ? mod : { default: mod };
20520
- }
20521
- function __classPrivateFieldGet(receiver, state, kind, f) {
20522
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20523
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20524
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20525
- }
20526
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
20527
- if (kind === "m") throw new TypeError("Private method is not writable");
20528
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
20529
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
20530
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
20531
- }
20532
- function __classPrivateFieldIn(state, receiver) {
20533
- if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
20534
- return typeof state === "function" ? receiver === state : state.has(receiver);
20535
- }
20536
- function __addDisposableResource(env, value, async) {
20537
- if (value !== null && value !== void 0) {
20538
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
20539
- var dispose, inner;
20540
- if (async) {
20541
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
20542
- dispose = value[Symbol.asyncDispose];
20543
- }
20544
- if (dispose === void 0) {
20545
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
20546
- dispose = value[Symbol.dispose];
20547
- if (async) inner = dispose;
20548
- }
20549
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20550
- if (inner) dispose = function() {
20551
- try {
20552
- inner.call(this);
20553
- } catch (e) {
20554
- return Promise.reject(e);
20555
- }
20556
- };
20557
- env.stack.push({ value, dispose, async });
20558
- } else if (async) {
20559
- env.stack.push({ async: true });
20560
- }
20561
- return value;
20562
- }
20563
- function __disposeResources(env) {
20564
- function fail(e) {
20565
- env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
20566
- env.hasError = true;
20567
- }
20568
- var r, s = 0;
20569
- function next() {
20570
- while (r = env.stack.pop()) {
20571
- try {
20572
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
20573
- if (r.dispose) {
20574
- var result = r.dispose.call(r.value);
20575
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
20576
- fail(e);
20577
- return next();
20578
- });
20579
- } else s |= 1;
20580
- } catch (e) {
20581
- fail(e);
20582
- }
20583
- }
20584
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
20585
- if (env.hasError) throw env.error;
20586
- }
20587
- return next();
20588
- }
20589
- function __rewriteRelativeImportExtension(path9, preserveJsx) {
20590
- if (typeof path9 === "string" && /^\.\.?\//.test(path9)) {
20591
- return path9.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext2, cm) {
20592
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext2 || !cm) ? m : d + ext2 + "." + cm.toLowerCase() + "js";
20593
- });
20594
- }
20595
- return path9;
20596
- }
20597
- var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
20598
- var init_tslib_es6 = __esm({
20599
- "node_modules/tslib/tslib.es6.mjs"() {
20600
- extendStatics = function(d, b) {
20601
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
20602
- d2.__proto__ = b2;
20603
- } || function(d2, b2) {
20604
- for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
20605
- };
20606
- return extendStatics(d, b);
20607
- };
20608
- __assign = function() {
20609
- __assign = Object.assign || function __assign2(t) {
20610
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20611
- s = arguments[i];
20612
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
20613
- }
20614
- return t;
20615
- };
20616
- return __assign.apply(this, arguments);
20617
- };
20618
- __createBinding = Object.create ? (function(o, m, k, k2) {
20619
- if (k2 === void 0) k2 = k;
20620
- var desc = Object.getOwnPropertyDescriptor(m, k);
20621
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20622
- desc = { enumerable: true, get: function() {
20623
- return m[k];
20624
- } };
20625
- }
20626
- Object.defineProperty(o, k2, desc);
20627
- }) : (function(o, m, k, k2) {
20628
- if (k2 === void 0) k2 = k;
20629
- o[k2] = m[k];
20630
- });
20631
- __setModuleDefault = Object.create ? (function(o, v) {
20632
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20633
- }) : function(o, v) {
20634
- o["default"] = v;
20635
- };
20636
- ownKeys = function(o) {
20637
- ownKeys = Object.getOwnPropertyNames || function(o2) {
20638
- var ar = [];
20639
- for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
20640
- return ar;
20641
- };
20642
- return ownKeys(o);
20643
- };
20644
- _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error40, suppressed, message) {
20645
- var e = new Error(message);
20646
- return e.name = "SuppressedError", e.error = error40, e.suppressed = suppressed, e;
20647
- };
20648
- tslib_es6_default = {
20649
- __extends,
20650
- __assign,
20651
- __rest,
20652
- __decorate,
20653
- __param,
20654
- __esDecorate,
20655
- __runInitializers,
20656
- __propKey,
20657
- __setFunctionName,
20658
- __metadata,
20659
- __awaiter,
20660
- __generator,
20661
- __createBinding,
20662
- __exportStar,
20663
- __values,
20664
- __read,
20665
- __spread,
20666
- __spreadArrays,
20667
- __spreadArray,
20668
- __await,
20669
- __asyncGenerator,
20670
- __asyncDelegator,
20671
- __asyncValues,
20672
- __makeTemplateObject,
20673
- __importStar,
20674
- __importDefault,
20675
- __classPrivateFieldGet,
20676
- __classPrivateFieldSet,
20677
- __classPrivateFieldIn,
20678
- __addDisposableResource,
20679
- __disposeResources,
20680
- __rewriteRelativeImportExtension
20681
- };
20682
- }
20683
- });
20684
-
20685
- // node_modules/@smithy/is-array-buffer/dist-cjs/index.js
20686
- var require_dist_cjs = __commonJS({
20687
- "node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) {
20688
- var __defProp2 = Object.defineProperty;
20689
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20690
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
20691
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20692
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
20693
- var __export2 = (target, all) => {
20694
- for (var name15 in all)
20695
- __defProp2(target, name15, { get: all[name15], enumerable: true });
20696
- };
20697
- var __copyProps2 = (to, from, except, desc) => {
20698
- if (from && typeof from === "object" || typeof from === "function") {
20699
- for (let key of __getOwnPropNames2(from))
20700
- if (!__hasOwnProp2.call(to, key) && key !== except)
20701
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20702
- }
20703
- return to;
20704
- };
20705
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20706
- var src_exports = {};
20707
- __export2(src_exports, {
20708
- isArrayBuffer: () => isArrayBuffer2
20709
- });
20710
- module2.exports = __toCommonJS2(src_exports);
20711
- var isArrayBuffer2 = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer");
20712
- }
20713
- });
20714
-
20715
- // node_modules/@smithy/util-buffer-from/dist-cjs/index.js
20716
- var require_dist_cjs2 = __commonJS({
20717
- "node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) {
20718
- var __defProp2 = Object.defineProperty;
20719
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20720
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
20721
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20722
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
20723
- var __export2 = (target, all) => {
20724
- for (var name15 in all)
20725
- __defProp2(target, name15, { get: all[name15], enumerable: true });
20726
- };
20727
- var __copyProps2 = (to, from, except, desc) => {
20728
- if (from && typeof from === "object" || typeof from === "function") {
20729
- for (let key of __getOwnPropNames2(from))
20730
- if (!__hasOwnProp2.call(to, key) && key !== except)
20731
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20732
- }
20733
- return to;
20734
- };
20735
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20736
- var src_exports = {};
20737
- __export2(src_exports, {
20738
- fromArrayBuffer: () => fromArrayBuffer2,
20739
- fromString: () => fromString2
20740
- });
20741
- module2.exports = __toCommonJS2(src_exports);
20742
- var import_is_array_buffer3 = require_dist_cjs();
20743
- var import_buffer = require("buffer");
20744
- var fromArrayBuffer2 = /* @__PURE__ */ __name((input, offset2 = 0, length = input.byteLength - offset2) => {
20745
- if (!(0, import_is_array_buffer3.isArrayBuffer)(input)) {
20746
- throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
20747
- }
20748
- return import_buffer.Buffer.from(input, offset2, length);
20749
- }, "fromArrayBuffer");
20750
- var fromString2 = /* @__PURE__ */ __name((input, encoding) => {
20751
- if (typeof input !== "string") {
20752
- throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
20753
- }
20754
- return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input);
20755
- }, "fromString");
20756
- }
20757
- });
20758
-
20759
- // node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/dist-cjs/index.js
20760
- var require_dist_cjs3 = __commonJS({
20761
- "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) {
20762
- var __defProp2 = Object.defineProperty;
20763
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
20764
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
20765
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
20766
- var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
20767
- var __export2 = (target, all) => {
20768
- for (var name15 in all)
20769
- __defProp2(target, name15, { get: all[name15], enumerable: true });
20770
- };
20771
- var __copyProps2 = (to, from, except, desc) => {
20772
- if (from && typeof from === "object" || typeof from === "function") {
20773
- for (let key of __getOwnPropNames2(from))
20774
- if (!__hasOwnProp2.call(to, key) && key !== except)
20775
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
20776
- }
20777
- return to;
20778
- };
20779
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20780
- var src_exports = {};
20781
- __export2(src_exports, {
20782
- fromUtf8: () => fromUtf84,
20783
- toUint8Array: () => toUint8Array2,
20784
- toUtf8: () => toUtf84
20785
- });
20786
- module2.exports = __toCommonJS2(src_exports);
20787
- var import_util_buffer_from = require_dist_cjs2();
20788
- var fromUtf84 = /* @__PURE__ */ __name((input) => {
20789
- const buf = (0, import_util_buffer_from.fromString)(input, "utf8");
20790
- return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
20791
- }, "fromUtf8");
20792
- var toUint8Array2 = /* @__PURE__ */ __name((data2) => {
20793
- if (typeof data2 === "string") {
20794
- return fromUtf84(data2);
20795
- }
20796
- if (ArrayBuffer.isView(data2)) {
20797
- return new Uint8Array(data2.buffer, data2.byteOffset, data2.byteLength / Uint8Array.BYTES_PER_ELEMENT);
20798
- }
20799
- return new Uint8Array(data2);
20800
- }, "toUint8Array");
20801
- var toUtf84 = /* @__PURE__ */ __name((input) => {
20802
- if (typeof input === "string") {
20803
- return input;
20804
- }
20805
- if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
20806
- throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
20807
- }
20808
- return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
20809
- }, "toUtf8");
20810
- }
20811
- });
20812
-
20813
- // node_modules/@aws-crypto/util/build/main/convertToBuffer.js
20814
- var require_convertToBuffer = __commonJS({
20815
- "node_modules/@aws-crypto/util/build/main/convertToBuffer.js"(exports2) {
20816
- "use strict";
20817
- Object.defineProperty(exports2, "__esModule", { value: true });
20818
- exports2.convertToBuffer = void 0;
20819
- var util_utf8_1 = require_dist_cjs3();
20820
- var fromUtf84 = typeof Buffer !== "undefined" && Buffer.from ? function(input) {
20821
- return Buffer.from(input, "utf8");
20822
- } : util_utf8_1.fromUtf8;
20823
- function convertToBuffer(data2) {
20824
- if (data2 instanceof Uint8Array)
20825
- return data2;
20826
- if (typeof data2 === "string") {
20827
- return fromUtf84(data2);
20828
- }
20829
- if (ArrayBuffer.isView(data2)) {
20830
- return new Uint8Array(data2.buffer, data2.byteOffset, data2.byteLength / Uint8Array.BYTES_PER_ELEMENT);
20831
- }
20832
- return new Uint8Array(data2);
20833
- }
20834
- exports2.convertToBuffer = convertToBuffer;
20835
- }
20836
- });
20837
-
20838
- // node_modules/@aws-crypto/util/build/main/isEmptyData.js
20839
- var require_isEmptyData = __commonJS({
20840
- "node_modules/@aws-crypto/util/build/main/isEmptyData.js"(exports2) {
20841
- "use strict";
20842
- Object.defineProperty(exports2, "__esModule", { value: true });
20843
- exports2.isEmptyData = void 0;
20844
- function isEmptyData(data2) {
20845
- if (typeof data2 === "string") {
20846
- return data2.length === 0;
20847
- }
20848
- return data2.byteLength === 0;
20849
- }
20850
- exports2.isEmptyData = isEmptyData;
20851
- }
20852
- });
20853
-
20854
- // node_modules/@aws-crypto/util/build/main/numToUint8.js
20855
- var require_numToUint8 = __commonJS({
20856
- "node_modules/@aws-crypto/util/build/main/numToUint8.js"(exports2) {
20857
- "use strict";
20858
- Object.defineProperty(exports2, "__esModule", { value: true });
20859
- exports2.numToUint8 = void 0;
20860
- function numToUint8(num) {
20861
- return new Uint8Array([
20862
- (num & 4278190080) >> 24,
20863
- (num & 16711680) >> 16,
20864
- (num & 65280) >> 8,
20865
- num & 255
20866
- ]);
20867
- }
20868
- exports2.numToUint8 = numToUint8;
20869
- }
20870
- });
20871
-
20872
- // node_modules/@aws-crypto/util/build/main/uint32ArrayFrom.js
20873
- var require_uint32ArrayFrom = __commonJS({
20874
- "node_modules/@aws-crypto/util/build/main/uint32ArrayFrom.js"(exports2) {
20875
- "use strict";
20876
- Object.defineProperty(exports2, "__esModule", { value: true });
20877
- exports2.uint32ArrayFrom = void 0;
20878
- function uint32ArrayFrom(a_lookUpTable) {
20879
- if (!Uint32Array.from) {
20880
- var return_array = new Uint32Array(a_lookUpTable.length);
20881
- var a_index = 0;
20882
- while (a_index < a_lookUpTable.length) {
20883
- return_array[a_index] = a_lookUpTable[a_index];
20884
- a_index += 1;
20885
- }
20886
- return return_array;
20887
- }
20888
- return Uint32Array.from(a_lookUpTable);
20889
- }
20890
- exports2.uint32ArrayFrom = uint32ArrayFrom;
20891
- }
20892
- });
20893
-
20894
- // node_modules/@aws-crypto/util/build/main/index.js
20895
- var require_main2 = __commonJS({
20896
- "node_modules/@aws-crypto/util/build/main/index.js"(exports2) {
20897
- "use strict";
20898
- Object.defineProperty(exports2, "__esModule", { value: true });
20899
- exports2.uint32ArrayFrom = exports2.numToUint8 = exports2.isEmptyData = exports2.convertToBuffer = void 0;
20900
- var convertToBuffer_1 = require_convertToBuffer();
20901
- Object.defineProperty(exports2, "convertToBuffer", { enumerable: true, get: function() {
20902
- return convertToBuffer_1.convertToBuffer;
20903
- } });
20904
- var isEmptyData_1 = require_isEmptyData();
20905
- Object.defineProperty(exports2, "isEmptyData", { enumerable: true, get: function() {
20906
- return isEmptyData_1.isEmptyData;
20907
- } });
20908
- var numToUint8_1 = require_numToUint8();
20909
- Object.defineProperty(exports2, "numToUint8", { enumerable: true, get: function() {
20910
- return numToUint8_1.numToUint8;
20911
- } });
20912
- var uint32ArrayFrom_1 = require_uint32ArrayFrom();
20913
- Object.defineProperty(exports2, "uint32ArrayFrom", { enumerable: true, get: function() {
20914
- return uint32ArrayFrom_1.uint32ArrayFrom;
20915
- } });
20916
- }
20917
- });
20918
-
20919
- // node_modules/@aws-crypto/crc32/build/main/aws_crc32.js
20920
- var require_aws_crc32 = __commonJS({
20921
- "node_modules/@aws-crypto/crc32/build/main/aws_crc32.js"(exports2) {
20922
- "use strict";
20923
- Object.defineProperty(exports2, "__esModule", { value: true });
20924
- exports2.AwsCrc32 = void 0;
20925
- var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
20926
- var util_1 = require_main2();
20927
- var index_1 = require_main3();
20928
- var AwsCrc32 = (
20929
- /** @class */
20930
- (function() {
20931
- function AwsCrc322() {
20932
- this.crc32 = new index_1.Crc32();
20933
- }
20934
- AwsCrc322.prototype.update = function(toHash) {
20935
- if ((0, util_1.isEmptyData)(toHash))
20936
- return;
20937
- this.crc32.update((0, util_1.convertToBuffer)(toHash));
20938
- };
20939
- AwsCrc322.prototype.digest = function() {
20940
- return tslib_1.__awaiter(this, void 0, void 0, function() {
20941
- return tslib_1.__generator(this, function(_a17) {
20942
- return [2, (0, util_1.numToUint8)(this.crc32.digest())];
20943
- });
20944
- });
20945
- };
20946
- AwsCrc322.prototype.reset = function() {
20947
- this.crc32 = new index_1.Crc32();
20948
- };
20949
- return AwsCrc322;
20950
- })()
20951
- );
20952
- exports2.AwsCrc32 = AwsCrc32;
20953
- }
20954
- });
20955
-
20956
- // node_modules/@aws-crypto/crc32/build/main/index.js
20957
- var require_main3 = __commonJS({
20958
- "node_modules/@aws-crypto/crc32/build/main/index.js"(exports2) {
20959
- "use strict";
20960
- Object.defineProperty(exports2, "__esModule", { value: true });
20961
- exports2.AwsCrc32 = exports2.Crc32 = exports2.crc32 = void 0;
20962
- var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
20963
- var util_1 = require_main2();
20964
- function crc32(data2) {
20965
- return new Crc323().update(data2).digest();
20966
- }
20967
- exports2.crc32 = crc32;
20968
- var Crc323 = (
20969
- /** @class */
20970
- (function() {
20971
- function Crc324() {
20972
- this.checksum = 4294967295;
20973
- }
20974
- Crc324.prototype.update = function(data2) {
20975
- var e_1, _a17;
20976
- try {
20977
- for (var data_1 = tslib_1.__values(data2), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
20978
- var byte = data_1_1.value;
20979
- this.checksum = this.checksum >>> 8 ^ lookupTable[(this.checksum ^ byte) & 255];
20980
- }
20981
- } catch (e_1_1) {
20982
- e_1 = { error: e_1_1 };
20983
- } finally {
20984
- try {
20985
- if (data_1_1 && !data_1_1.done && (_a17 = data_1.return)) _a17.call(data_1);
20986
- } finally {
20987
- if (e_1) throw e_1.error;
20988
- }
20989
- }
20990
- return this;
20991
- };
20992
- Crc324.prototype.digest = function() {
20993
- return (this.checksum ^ 4294967295) >>> 0;
20994
- };
20995
- return Crc324;
20996
- })()
20997
- );
20998
- exports2.Crc32 = Crc323;
20999
- var a_lookUpTable = [
21000
- 0,
21001
- 1996959894,
21002
- 3993919788,
21003
- 2567524794,
21004
- 124634137,
21005
- 1886057615,
21006
- 3915621685,
21007
- 2657392035,
21008
- 249268274,
21009
- 2044508324,
21010
- 3772115230,
21011
- 2547177864,
21012
- 162941995,
21013
- 2125561021,
21014
- 3887607047,
21015
- 2428444049,
21016
- 498536548,
21017
- 1789927666,
21018
- 4089016648,
21019
- 2227061214,
21020
- 450548861,
21021
- 1843258603,
21022
- 4107580753,
21023
- 2211677639,
21024
- 325883990,
21025
- 1684777152,
21026
- 4251122042,
21027
- 2321926636,
21028
- 335633487,
21029
- 1661365465,
21030
- 4195302755,
21031
- 2366115317,
21032
- 997073096,
21033
- 1281953886,
21034
- 3579855332,
21035
- 2724688242,
21036
- 1006888145,
21037
- 1258607687,
21038
- 3524101629,
21039
- 2768942443,
21040
- 901097722,
21041
- 1119000684,
21042
- 3686517206,
21043
- 2898065728,
21044
- 853044451,
21045
- 1172266101,
21046
- 3705015759,
21047
- 2882616665,
21048
- 651767980,
21049
- 1373503546,
21050
- 3369554304,
21051
- 3218104598,
21052
- 565507253,
21053
- 1454621731,
21054
- 3485111705,
21055
- 3099436303,
21056
- 671266974,
21057
- 1594198024,
21058
- 3322730930,
21059
- 2970347812,
21060
- 795835527,
21061
- 1483230225,
21062
- 3244367275,
21063
- 3060149565,
21064
- 1994146192,
21065
- 31158534,
21066
- 2563907772,
21067
- 4023717930,
21068
- 1907459465,
21069
- 112637215,
21070
- 2680153253,
21071
- 3904427059,
21072
- 2013776290,
21073
- 251722036,
21074
- 2517215374,
21075
- 3775830040,
21076
- 2137656763,
21077
- 141376813,
21078
- 2439277719,
21079
- 3865271297,
21080
- 1802195444,
21081
- 476864866,
21082
- 2238001368,
21083
- 4066508878,
21084
- 1812370925,
21085
- 453092731,
21086
- 2181625025,
21087
- 4111451223,
21088
- 1706088902,
21089
- 314042704,
21090
- 2344532202,
21091
- 4240017532,
21092
- 1658658271,
21093
- 366619977,
21094
- 2362670323,
21095
- 4224994405,
21096
- 1303535960,
21097
- 984961486,
21098
- 2747007092,
21099
- 3569037538,
21100
- 1256170817,
21101
- 1037604311,
21102
- 2765210733,
21103
- 3554079995,
21104
- 1131014506,
21105
- 879679996,
21106
- 2909243462,
21107
- 3663771856,
21108
- 1141124467,
21109
- 855842277,
21110
- 2852801631,
21111
- 3708648649,
21112
- 1342533948,
21113
- 654459306,
21114
- 3188396048,
21115
- 3373015174,
21116
- 1466479909,
21117
- 544179635,
21118
- 3110523913,
21119
- 3462522015,
21120
- 1591671054,
21121
- 702138776,
21122
- 2966460450,
21123
- 3352799412,
21124
- 1504918807,
21125
- 783551873,
21126
- 3082640443,
21127
- 3233442989,
21128
- 3988292384,
21129
- 2596254646,
21130
- 62317068,
21131
- 1957810842,
21132
- 3939845945,
21133
- 2647816111,
21134
- 81470997,
21135
- 1943803523,
21136
- 3814918930,
21137
- 2489596804,
21138
- 225274430,
21139
- 2053790376,
21140
- 3826175755,
21141
- 2466906013,
21142
- 167816743,
21143
- 2097651377,
21144
- 4027552580,
21145
- 2265490386,
21146
- 503444072,
21147
- 1762050814,
21148
- 4150417245,
21149
- 2154129355,
21150
- 426522225,
21151
- 1852507879,
21152
- 4275313526,
21153
- 2312317920,
21154
- 282753626,
21155
- 1742555852,
21156
- 4189708143,
21157
- 2394877945,
21158
- 397917763,
21159
- 1622183637,
21160
- 3604390888,
21161
- 2714866558,
21162
- 953729732,
21163
- 1340076626,
21164
- 3518719985,
21165
- 2797360999,
21166
- 1068828381,
21167
- 1219638859,
21168
- 3624741850,
21169
- 2936675148,
21170
- 906185462,
21171
- 1090812512,
21172
- 3747672003,
21173
- 2825379669,
21174
- 829329135,
21175
- 1181335161,
21176
- 3412177804,
21177
- 3160834842,
21178
- 628085408,
21179
- 1382605366,
21180
- 3423369109,
21181
- 3138078467,
21182
- 570562233,
21183
- 1426400815,
21184
- 3317316542,
21185
- 2998733608,
21186
- 733239954,
21187
- 1555261956,
21188
- 3268935591,
21189
- 3050360625,
21190
- 752459403,
21191
- 1541320221,
21192
- 2607071920,
21193
- 3965973030,
21194
- 1969922972,
21195
- 40735498,
21196
- 2617837225,
21197
- 3943577151,
21198
- 1913087877,
21199
- 83908371,
21200
- 2512341634,
21201
- 3803740692,
21202
- 2075208622,
21203
- 213261112,
21204
- 2463272603,
21205
- 3855990285,
21206
- 2094854071,
21207
- 198958881,
21208
- 2262029012,
21209
- 4057260610,
21210
- 1759359992,
21211
- 534414190,
21212
- 2176718541,
21213
- 4139329115,
21214
- 1873836001,
21215
- 414664567,
21216
- 2282248934,
21217
- 4279200368,
21218
- 1711684554,
21219
- 285281116,
21220
- 2405801727,
21221
- 4167216745,
21222
- 1634467795,
21223
- 376229701,
21224
- 2685067896,
21225
- 3608007406,
21226
- 1308918612,
21227
- 956543938,
21228
- 2808555105,
21229
- 3495958263,
21230
- 1231636301,
21231
- 1047427035,
21232
- 2932959818,
21233
- 3654703836,
21234
- 1088359270,
21235
- 936918e3,
21236
- 2847714899,
21237
- 3736837829,
21238
- 1202900863,
21239
- 817233897,
21240
- 3183342108,
21241
- 3401237130,
21242
- 1404277552,
21243
- 615818150,
21244
- 3134207493,
21245
- 3453421203,
21246
- 1423857449,
21247
- 601450431,
21248
- 3009837614,
21249
- 3294710456,
21250
- 1567103746,
21251
- 711928724,
21252
- 3020668471,
21253
- 3272380065,
21254
- 1510334235,
21255
- 755167117
21256
- ];
21257
- var lookupTable = (0, util_1.uint32ArrayFrom)(a_lookUpTable);
21258
- var aws_crc32_1 = require_aws_crc32();
21259
- Object.defineProperty(exports2, "AwsCrc32", { enumerable: true, get: function() {
21260
- return aws_crc32_1.AwsCrc32;
21261
- } });
21262
- }
21263
- });
21264
-
21265
20289
  // node_modules/@smithy/core/dist-es/submodules/serde/is-array-buffer/is-array-buffer.js
21266
20290
  var isArrayBuffer;
21267
20291
  var init_is_array_buffer = __esm({
@@ -21343,12 +20367,12 @@ var init_toBase64 = __esm({
21343
20367
  });
21344
20368
 
21345
20369
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/blob/Uint8ArrayBlobAdapter.js
21346
- function bindUint8ArrayBlobAdapter(toUtf84, fromUtf84, toBase643, fromBase643) {
20370
+ function bindUint8ArrayBlobAdapter(toUtf84, fromUtf84, toBase643, fromBase642) {
21347
20371
  return class Uint8ArrayBlobAdapter2 extends Uint8Array {
21348
20372
  static fromString(source, encoding = "utf-8") {
21349
20373
  if (typeof source === "string") {
21350
20374
  if (encoding === "base64") {
21351
- return Uint8ArrayBlobAdapter2.mutate(fromBase643(source));
20375
+ return Uint8ArrayBlobAdapter2.mutate(fromBase642(source));
21352
20376
  }
21353
20377
  return Uint8ArrayBlobAdapter2.mutate(fromUtf84(source));
21354
20378
  }
@@ -21412,7 +20436,7 @@ var init_v42 = __esm({
21412
20436
  var copyDocumentWithTransform;
21413
20437
  var init_copyDocumentWithTransform = __esm({
21414
20438
  "node_modules/@smithy/core/dist-es/submodules/serde/copyDocumentWithTransform.js"() {
21415
- copyDocumentWithTransform = (source, schemaRef, transform2 = (_) => _) => source;
20439
+ copyDocumentWithTransform = (source, _schemaRef, _transform2 = (_) => _) => source;
21416
20440
  }
21417
20441
  });
21418
20442
 
@@ -21691,7 +20715,7 @@ var init_date_utils = __esm({
21691
20715
  const day = parseDateValue(dayStr, "day", 1, 31);
21692
20716
  return buildDate(year2, month, day, { hours, minutes, seconds, fractionalMilliseconds });
21693
20717
  };
21694
- RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
20718
+ RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
21695
20719
  parseRfc3339DateTimeWithOffset = (value) => {
21696
20720
  if (value === null || value === void 0) {
21697
20721
  return void 0;
@@ -22073,7 +21097,7 @@ function nv(input) {
22073
21097
  var format, NumericValue;
22074
21098
  var init_NumericValue = __esm({
22075
21099
  "node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js"() {
22076
- format = /^-?\d*(\.\d+)?$/;
21100
+ format = /^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/;
22077
21101
  NumericValue = class _NumericValue {
22078
21102
  string;
22079
21103
  type;
@@ -22081,7 +21105,7 @@ var init_NumericValue = __esm({
22081
21105
  this.string = string4;
22082
21106
  this.type = type;
22083
21107
  if (!format.test(string4)) {
22084
- throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
21108
+ throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${string4}"`);
22085
21109
  }
22086
21110
  }
22087
21111
  toString() {
@@ -22172,6 +21196,9 @@ var init_toUint8Array = __esm({
22172
21196
  "node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUint8Array.js"() {
22173
21197
  init_fromUtf8();
22174
21198
  toUint8Array = (data2) => {
21199
+ if (data2 instanceof Uint8Array) {
21200
+ return data2;
21201
+ }
22175
21202
  if (typeof data2 === "string") {
22176
21203
  return fromUtf8(data2);
22177
21204
  }
@@ -22183,44 +21210,64 @@ var init_toUint8Array = __esm({
22183
21210
  }
22184
21211
  });
22185
21212
 
21213
+ // node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js
21214
+ function concatBytes(arrays, length) {
21215
+ if (length === void 0) {
21216
+ length = 0;
21217
+ for (const bytes of arrays) {
21218
+ length += bytes.byteLength;
21219
+ }
21220
+ }
21221
+ const result = new Uint8Array(length);
21222
+ let offset2 = 0;
21223
+ for (const buf of arrays) {
21224
+ result.set(buf, offset2);
21225
+ offset2 += buf.byteLength;
21226
+ }
21227
+ return result;
21228
+ }
21229
+ var init_concatBytes = __esm({
21230
+ "node_modules/@smithy/core/dist-es/submodules/serde/concatBytes.js"() {
21231
+ }
21232
+ });
21233
+
22186
21234
  // node_modules/@smithy/types/dist-cjs/index.js
22187
- var require_dist_cjs4 = __commonJS({
21235
+ var require_dist_cjs = __commonJS({
22188
21236
  "node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
22189
- "use strict";
22190
- exports2.HttpAuthLocation = void 0;
22191
- (function(HttpAuthLocation) {
22192
- HttpAuthLocation["HEADER"] = "header";
22193
- HttpAuthLocation["QUERY"] = "query";
22194
- })(exports2.HttpAuthLocation || (exports2.HttpAuthLocation = {}));
22195
- exports2.HttpApiKeyAuthLocation = void 0;
22196
- (function(HttpApiKeyAuthLocation) {
22197
- HttpApiKeyAuthLocation["HEADER"] = "header";
22198
- HttpApiKeyAuthLocation["QUERY"] = "query";
22199
- })(exports2.HttpApiKeyAuthLocation || (exports2.HttpApiKeyAuthLocation = {}));
22200
- exports2.EndpointURLScheme = void 0;
22201
- (function(EndpointURLScheme) {
22202
- EndpointURLScheme["HTTP"] = "http";
22203
- EndpointURLScheme["HTTPS"] = "https";
22204
- })(exports2.EndpointURLScheme || (exports2.EndpointURLScheme = {}));
22205
- exports2.AlgorithmId = void 0;
22206
- (function(AlgorithmId) {
22207
- AlgorithmId["MD5"] = "md5";
22208
- AlgorithmId["CRC32"] = "crc32";
22209
- AlgorithmId["CRC32C"] = "crc32c";
22210
- AlgorithmId["SHA1"] = "sha1";
22211
- AlgorithmId["SHA256"] = "sha256";
22212
- })(exports2.AlgorithmId || (exports2.AlgorithmId = {}));
21237
+ var HttpAuthLocation;
21238
+ (function(HttpAuthLocation2) {
21239
+ HttpAuthLocation2["HEADER"] = "header";
21240
+ HttpAuthLocation2["QUERY"] = "query";
21241
+ })(HttpAuthLocation || (HttpAuthLocation = {}));
21242
+ var HttpApiKeyAuthLocation;
21243
+ (function(HttpApiKeyAuthLocation2) {
21244
+ HttpApiKeyAuthLocation2["HEADER"] = "header";
21245
+ HttpApiKeyAuthLocation2["QUERY"] = "query";
21246
+ })(HttpApiKeyAuthLocation || (HttpApiKeyAuthLocation = {}));
21247
+ var EndpointURLScheme;
21248
+ (function(EndpointURLScheme2) {
21249
+ EndpointURLScheme2["HTTP"] = "http";
21250
+ EndpointURLScheme2["HTTPS"] = "https";
21251
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
21252
+ var AlgorithmId;
21253
+ (function(AlgorithmId2) {
21254
+ AlgorithmId2["MD5"] = "md5";
21255
+ AlgorithmId2["CRC32"] = "crc32";
21256
+ AlgorithmId2["CRC32C"] = "crc32c";
21257
+ AlgorithmId2["SHA1"] = "sha1";
21258
+ AlgorithmId2["SHA256"] = "sha256";
21259
+ })(AlgorithmId || (AlgorithmId = {}));
22213
21260
  var getChecksumConfiguration = (runtimeConfig) => {
22214
21261
  const checksumAlgorithms = [];
22215
21262
  if (runtimeConfig.sha256 !== void 0) {
22216
21263
  checksumAlgorithms.push({
22217
- algorithmId: () => exports2.AlgorithmId.SHA256,
21264
+ algorithmId: () => AlgorithmId.SHA256,
22218
21265
  checksumConstructor: () => runtimeConfig.sha256
22219
21266
  });
22220
21267
  }
22221
21268
  if (runtimeConfig.md5 != void 0) {
22222
21269
  checksumAlgorithms.push({
22223
- algorithmId: () => exports2.AlgorithmId.MD5,
21270
+ algorithmId: () => AlgorithmId.MD5,
22224
21271
  checksumConstructor: () => runtimeConfig.md5
22225
21272
  });
22226
21273
  }
@@ -22246,24 +21293,31 @@ var require_dist_cjs4 = __commonJS({
22246
21293
  var resolveDefaultRuntimeConfig = (config2) => {
22247
21294
  return resolveChecksumRuntimeConfig(config2);
22248
21295
  };
22249
- exports2.FieldPosition = void 0;
22250
- (function(FieldPosition) {
22251
- FieldPosition[FieldPosition["HEADER"] = 0] = "HEADER";
22252
- FieldPosition[FieldPosition["TRAILER"] = 1] = "TRAILER";
22253
- })(exports2.FieldPosition || (exports2.FieldPosition = {}));
21296
+ var FieldPosition;
21297
+ (function(FieldPosition2) {
21298
+ FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER";
21299
+ FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER";
21300
+ })(FieldPosition || (FieldPosition = {}));
22254
21301
  var SMITHY_CONTEXT_KEY2 = "__smithy_context";
22255
- exports2.IniSectionType = void 0;
22256
- (function(IniSectionType3) {
22257
- IniSectionType3["PROFILE"] = "profile";
22258
- IniSectionType3["SSO_SESSION"] = "sso-session";
22259
- IniSectionType3["SERVICES"] = "services";
22260
- })(exports2.IniSectionType || (exports2.IniSectionType = {}));
22261
- exports2.RequestHandlerProtocol = void 0;
22262
- (function(RequestHandlerProtocol) {
22263
- RequestHandlerProtocol["HTTP_0_9"] = "http/0.9";
22264
- RequestHandlerProtocol["HTTP_1_0"] = "http/1.0";
22265
- RequestHandlerProtocol["TDS_8_0"] = "tds/8.0";
22266
- })(exports2.RequestHandlerProtocol || (exports2.RequestHandlerProtocol = {}));
21302
+ var IniSectionType3;
21303
+ (function(IniSectionType4) {
21304
+ IniSectionType4["PROFILE"] = "profile";
21305
+ IniSectionType4["SSO_SESSION"] = "sso-session";
21306
+ IniSectionType4["SERVICES"] = "services";
21307
+ })(IniSectionType3 || (IniSectionType3 = {}));
21308
+ var RequestHandlerProtocol;
21309
+ (function(RequestHandlerProtocol2) {
21310
+ RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9";
21311
+ RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0";
21312
+ RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0";
21313
+ })(RequestHandlerProtocol || (RequestHandlerProtocol = {}));
21314
+ exports2.AlgorithmId = AlgorithmId;
21315
+ exports2.EndpointURLScheme = EndpointURLScheme;
21316
+ exports2.FieldPosition = FieldPosition;
21317
+ exports2.HttpApiKeyAuthLocation = HttpApiKeyAuthLocation;
21318
+ exports2.HttpAuthLocation = HttpAuthLocation;
21319
+ exports2.IniSectionType = IniSectionType3;
21320
+ exports2.RequestHandlerProtocol = RequestHandlerProtocol;
22267
21321
  exports2.SMITHY_CONTEXT_KEY = SMITHY_CONTEXT_KEY2;
22268
21322
  exports2.getDefaultClientConfiguration = getDefaultClientConfiguration;
22269
21323
  exports2.resolveDefaultRuntimeConfig = resolveDefaultRuntimeConfig;
@@ -22274,7 +21328,7 @@ var require_dist_cjs4 = __commonJS({
22274
21328
  var import_types, getSmithyContext;
22275
21329
  var init_getSmithyContext = __esm({
22276
21330
  "node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js"() {
22277
- import_types = __toESM(require_dist_cjs4());
21331
+ import_types = __toESM(require_dist_cjs());
22278
21332
  getSmithyContext = (context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {});
22279
21333
  }
22280
21334
  });
@@ -22427,7 +21481,7 @@ var init_deserializerMiddleware = __esm({
22427
21481
  const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
22428
21482
  try {
22429
21483
  error40.message += "\n " + hint;
22430
- } catch (e) {
21484
+ } catch (ignored) {
22431
21485
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
22432
21486
  console.warn(hint);
22433
21487
  } else {
@@ -22450,7 +21504,7 @@ var init_deserializerMiddleware = __esm({
22450
21504
  cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
22451
21505
  };
22452
21506
  }
22453
- } catch (e) {
21507
+ } catch (ignored) {
22454
21508
  }
22455
21509
  }
22456
21510
  throw error40;
@@ -22594,6 +21648,33 @@ var init_memoize = __esm({
22594
21648
  }
22595
21649
  });
22596
21650
 
21651
+ // node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js
21652
+ var booleanSelector;
21653
+ var init_booleanSelector = __esm({
21654
+ "node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js"() {
21655
+ booleanSelector = (obj, key, type) => {
21656
+ if (!(key in obj))
21657
+ return void 0;
21658
+ if (obj[key] === "true")
21659
+ return true;
21660
+ if (obj[key] === "false")
21661
+ return false;
21662
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
21663
+ };
21664
+ }
21665
+ });
21666
+
21667
+ // node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js
21668
+ var SelectorType;
21669
+ var init_types2 = __esm({
21670
+ "node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js"() {
21671
+ (function(SelectorType2) {
21672
+ SelectorType2["ENV"] = "env";
21673
+ SelectorType2["CONFIG"] = "shared config entry";
21674
+ })(SelectorType || (SelectorType = {}));
21675
+ }
21676
+ });
21677
+
22597
21678
  // node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
22598
21679
  var import_node_os, import_node_path, homeDirCache, getHomeDirCacheKey, getHomeDir;
22599
21680
  var init_getHomeDir = __esm({
@@ -22645,7 +21726,7 @@ var init_constants = __esm({
22645
21726
  var import_types2, getConfigData;
22646
21727
  var init_getConfigData = __esm({
22647
21728
  "node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigData.js"() {
22648
- import_types2 = __toESM(require_dist_cjs4());
21729
+ import_types2 = __toESM(require_dist_cjs());
22649
21730
  init_constants();
22650
21731
  getConfigData = (data2) => Object.entries(data2).filter(([key]) => {
22651
21732
  const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
@@ -22690,9 +21771,9 @@ var init_getCredentialsFilepath = __esm({
22690
21771
  var import_types3, prefixKeyRegex, profileNameBlockList, parseIni;
22691
21772
  var init_parseIni = __esm({
22692
21773
  "node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseIni.js"() {
22693
- import_types3 = __toESM(require_dist_cjs4());
21774
+ import_types3 = __toESM(require_dist_cjs());
22694
21775
  init_constants();
22695
- prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
21776
+ prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
22696
21777
  profileNameBlockList = ["__proto__", "profile __proto__"];
22697
21778
  parseIni = (iniData) => {
22698
21779
  const map3 = {};
@@ -22809,7 +21890,7 @@ function getSelectorName(functionString) {
22809
21890
  constants.delete("CONFIG_PREFIX_SEPARATOR");
22810
21891
  constants.delete("ENV");
22811
21892
  return [...constants].join(", ");
22812
- } catch (e) {
21893
+ } catch (ignored) {
22813
21894
  return functionString;
22814
21895
  }
22815
21896
  }
@@ -22893,16 +21974,126 @@ var init_configLoader = __esm({
22893
21974
  }
22894
21975
  });
22895
21976
 
22896
- // node_modules/@smithy/core/dist-es/submodules/client/index.js
22897
- var init_client = __esm({
22898
- "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
22899
- init_transport();
21977
+ // node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js
21978
+ var TypeRegistry;
21979
+ var init_TypeRegistry = __esm({
21980
+ "node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js"() {
21981
+ TypeRegistry = class _TypeRegistry {
21982
+ namespace;
21983
+ schemas;
21984
+ exceptions;
21985
+ static registries = /* @__PURE__ */ new Map();
21986
+ constructor(namespace, schemas = /* @__PURE__ */ new Map(), exceptions = /* @__PURE__ */ new Map()) {
21987
+ this.namespace = namespace;
21988
+ this.schemas = schemas;
21989
+ this.exceptions = exceptions;
21990
+ }
21991
+ static for(namespace) {
21992
+ if (!_TypeRegistry.registries.has(namespace)) {
21993
+ _TypeRegistry.registries.set(namespace, new _TypeRegistry(namespace));
21994
+ }
21995
+ return _TypeRegistry.registries.get(namespace);
21996
+ }
21997
+ copyFrom(other) {
21998
+ const { schemas, exceptions } = this;
21999
+ for (const [k, v] of other.schemas) {
22000
+ if (!schemas.has(k)) {
22001
+ schemas.set(k, v);
22002
+ }
22003
+ }
22004
+ for (const [k, v] of other.exceptions) {
22005
+ if (!exceptions.has(k)) {
22006
+ exceptions.set(k, v);
22007
+ }
22008
+ }
22009
+ }
22010
+ register(shapeId, schema) {
22011
+ const qualifiedName = this.normalizeShapeId(shapeId);
22012
+ for (const r of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) {
22013
+ r.schemas.set(qualifiedName, schema);
22014
+ }
22015
+ }
22016
+ getSchema(shapeId) {
22017
+ const id = this.normalizeShapeId(shapeId);
22018
+ if (!this.schemas.has(id)) {
22019
+ if (!shapeId.includes("#")) {
22020
+ const suffix = "#" + shapeId;
22021
+ const candidates = [];
22022
+ for (const [shapeId2, schema] of this.schemas.entries()) {
22023
+ if (shapeId2.endsWith(suffix)) {
22024
+ candidates.push(schema);
22025
+ }
22026
+ }
22027
+ if (candidates.length === 1) {
22028
+ return candidates[0];
22029
+ }
22030
+ }
22031
+ throw new Error(`@smithy/core/schema - schema not found for ${id}`);
22032
+ }
22033
+ return this.schemas.get(id);
22034
+ }
22035
+ registerError(es, ctor) {
22036
+ const $error = es;
22037
+ const ns = $error[1];
22038
+ for (const r of [this, _TypeRegistry.for(ns)]) {
22039
+ r.schemas.set(ns + "#" + $error[2], $error);
22040
+ r.exceptions.set($error, ctor);
22041
+ }
22042
+ }
22043
+ getErrorCtor(es) {
22044
+ const $error = es;
22045
+ if (this.exceptions.has($error)) {
22046
+ return this.exceptions.get($error);
22047
+ }
22048
+ const registry2 = _TypeRegistry.for($error[1]);
22049
+ return registry2.exceptions.get($error);
22050
+ }
22051
+ getBaseException() {
22052
+ for (const exceptionKey of this.exceptions.keys()) {
22053
+ if (Array.isArray(exceptionKey)) {
22054
+ const [, ns, name15] = exceptionKey;
22055
+ const id = ns + "#" + name15;
22056
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
22057
+ return exceptionKey;
22058
+ }
22059
+ }
22060
+ }
22061
+ return void 0;
22062
+ }
22063
+ find(predicate) {
22064
+ for (const schema of this.schemas.values()) {
22065
+ if (predicate(schema)) {
22066
+ return schema;
22067
+ }
22068
+ }
22069
+ return void 0;
22070
+ }
22071
+ clear() {
22072
+ this.schemas.clear();
22073
+ this.exceptions.clear();
22074
+ }
22075
+ normalizeShapeId(shapeId) {
22076
+ if (shapeId.includes("#")) {
22077
+ return shapeId;
22078
+ }
22079
+ return this.namespace + "#" + shapeId;
22080
+ }
22081
+ };
22082
+ }
22083
+ });
22084
+
22085
+ // node_modules/@smithy/core/dist-es/submodules/schema/index.js
22086
+ var init_schema = __esm({
22087
+ "node_modules/@smithy/core/dist-es/submodules/schema/index.js"() {
22088
+ init_TypeRegistry();
22900
22089
  }
22901
22090
  });
22902
22091
 
22903
22092
  // node_modules/@smithy/core/dist-es/submodules/config/index.js
22904
22093
  var init_config = __esm({
22905
22094
  "node_modules/@smithy/core/dist-es/submodules/config/index.js"() {
22095
+ init_booleanSelector();
22096
+ init_types2();
22906
22097
  init_constants();
22907
22098
  init_configLoader();
22908
22099
  }
@@ -22927,14 +22118,16 @@ var init_getEndpointUrlConfig = __esm({
22927
22118
  return void 0;
22928
22119
  },
22929
22120
  configFileSelector: (profile, config2) => {
22930
- if (config2 && profile.services) {
22931
- const servicesSection = config2[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
22932
- if (servicesSection) {
22933
- const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
22934
- const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
22935
- if (endpointUrl2)
22936
- return endpointUrl2;
22121
+ if (profile.services) {
22122
+ const servicesSectionKey = ["services", profile.services].join(CONFIG_PREFIX_SEPARATOR);
22123
+ if (!config2 || !config2[servicesSectionKey]) {
22124
+ throw new Error(`The services section "${profile.services}" specified in the profile is not present in the shared configuration file.`);
22937
22125
  }
22126
+ const servicesSection = config2[servicesSectionKey];
22127
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
22128
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
22129
+ if (endpointUrl2)
22130
+ return endpointUrl2;
22938
22131
  }
22939
22132
  const endpointUrl = profile[CONFIG_ENDPOINT_URL];
22940
22133
  if (endpointUrl)
@@ -22946,13 +22139,35 @@ var init_getEndpointUrlConfig = __esm({
22946
22139
  }
22947
22140
  });
22948
22141
 
22142
+ // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.js
22143
+ var ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, ignoreConfiguredEndpointUrlsConfigSelectors;
22144
+ var init_getIgnoreConfiguredEndpointUrls = __esm({
22145
+ "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getIgnoreConfiguredEndpointUrls.js"() {
22146
+ init_config();
22147
+ ENV_IGNORE_CONFIGURED_ENDPOINT_URLS = "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS";
22148
+ CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS = "ignore_configured_endpoint_urls";
22149
+ ignoreConfiguredEndpointUrlsConfigSelectors = {
22150
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.ENV),
22151
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_IGNORE_CONFIGURED_ENDPOINT_URLS, SelectorType.CONFIG),
22152
+ default: false
22153
+ };
22154
+ }
22155
+ });
22156
+
22949
22157
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js
22950
22158
  var getEndpointFromConfig;
22951
22159
  var init_getEndpointFromConfig = __esm({
22952
22160
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js"() {
22953
22161
  init_config();
22954
22162
  init_getEndpointUrlConfig();
22955
- getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
22163
+ init_getIgnoreConfiguredEndpointUrls();
22164
+ getEndpointFromConfig = async (serviceId) => {
22165
+ const ignore2 = await loadConfig(ignoreConfiguredEndpointUrlsConfigSelectors)();
22166
+ if (ignore2) {
22167
+ return void 0;
22168
+ }
22169
+ return loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
22170
+ };
22956
22171
  }
22957
22172
  });
22958
22173
 
@@ -22978,7 +22193,7 @@ var init_s3 = __esm({
22978
22193
  }
22979
22194
  return endpointParams;
22980
22195
  };
22981
- DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
22196
+ DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
22982
22197
  IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
22983
22198
  DOTS_PATTERN = /\.\./;
22984
22199
  isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
@@ -23067,7 +22282,7 @@ var init_toEndpointV12 = __esm({
23067
22282
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.js
23068
22283
  function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
23069
22284
  return async (commandInput, instructionsSupplier, clientConfig, context) => {
23070
- if (!clientConfig.isCustomEndpoint) {
22285
+ if (!clientConfig.isCustomEndpoint && !clientConfig.ignoreConfiguredEndpointUrls) {
23071
22286
  let endpointFromConfig;
23072
22287
  if (clientConfig.serviceConfiguredEndpoint) {
23073
22288
  endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
@@ -23077,6 +22292,7 @@ function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
23077
22292
  if (endpointFromConfig) {
23078
22293
  clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
23079
22294
  clientConfig.isCustomEndpoint = true;
22295
+ context?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${endpointFromConfig}`);
23080
22296
  }
23081
22297
  }
23082
22298
  const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
@@ -23182,7 +22398,7 @@ function bindEndpointMiddleware(getEndpointFromConfig2) {
23182
22398
  }
23183
22399
  var init_endpointMiddleware = __esm({
23184
22400
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js"() {
23185
- init_client();
22401
+ init_transport();
23186
22402
  init_getEndpointFromInstructions();
23187
22403
  }
23188
22404
  });
@@ -23232,7 +22448,8 @@ function bindResolveEndpointConfig(getEndpointFromConfig2) {
23232
22448
  tls,
23233
22449
  isCustomEndpoint,
23234
22450
  useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
23235
- useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
22451
+ useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false),
22452
+ ignoreConfiguredEndpointUrls: !!input.ignoreConfiguredEndpointUrls
23236
22453
  });
23237
22454
  let configuredEndpointPromise = void 0;
23238
22455
  resolvedConfig.serviceConfiguredEndpoint = async () => {
@@ -23251,61 +22468,6 @@ var init_resolveEndpointConfig = __esm({
23251
22468
  }
23252
22469
  });
23253
22470
 
23254
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js
23255
- var init_EndpointError = __esm({
23256
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js"() {
23257
- }
23258
- });
23259
-
23260
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointFunctions.js
23261
- var init_EndpointFunctions = __esm({
23262
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointFunctions.js"() {
23263
- }
23264
- });
23265
-
23266
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointRuleObject.js
23267
- var init_EndpointRuleObject = __esm({
23268
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointRuleObject.js"() {
23269
- }
23270
- });
23271
-
23272
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/ErrorRuleObject.js
23273
- var init_ErrorRuleObject = __esm({
23274
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/ErrorRuleObject.js"() {
23275
- }
23276
- });
23277
-
23278
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/RuleSetObject.js
23279
- var init_RuleSetObject = __esm({
23280
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/RuleSetObject.js"() {
23281
- }
23282
- });
23283
-
23284
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/TreeRuleObject.js
23285
- var init_TreeRuleObject = __esm({
23286
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/TreeRuleObject.js"() {
23287
- }
23288
- });
23289
-
23290
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/shared.js
23291
- var init_shared = __esm({
23292
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/shared.js"() {
23293
- }
23294
- });
23295
-
23296
- // node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/index.js
23297
- var init_types2 = __esm({
23298
- "node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/index.js"() {
23299
- init_EndpointError();
23300
- init_EndpointFunctions();
23301
- init_EndpointRuleObject();
23302
- init_ErrorRuleObject();
23303
- init_RuleSetObject();
23304
- init_TreeRuleObject();
23305
- init_shared();
23306
- }
23307
- });
23308
-
23309
22471
  // node_modules/@smithy/core/dist-es/submodules/endpoints/index.js
23310
22472
  var getEndpointFromInstructions, resolveEndpointConfig, endpointMiddleware, getEndpointPlugin;
23311
22473
  var init_endpoints = __esm({
@@ -23316,7 +22478,6 @@ var init_endpoints = __esm({
23316
22478
  init_getEndpointPlugin();
23317
22479
  init_resolveEndpointConfig();
23318
22480
  init_transport();
23319
- init_types2();
23320
22481
  getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
23321
22482
  resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
23322
22483
  endpointMiddleware = bindEndpointMiddleware(getEndpointFromConfig);
@@ -23420,58 +22581,77 @@ var init_ChecksumStream = __esm({
23420
22581
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js"() {
23421
22582
  import_node_stream = require("node:stream");
23422
22583
  init_toBase64();
23423
- ChecksumStream = class extends import_node_stream.Duplex {
22584
+ ChecksumStream = class extends import_node_stream.Readable {
23424
22585
  expectedChecksum;
23425
22586
  checksumSourceLocation;
23426
22587
  checksum;
23427
22588
  source;
23428
22589
  base64Encoder;
23429
- pendingCallback = null;
23430
22590
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder }) {
23431
22591
  super();
23432
- if (typeof source.pipe === "function") {
23433
- this.source = source;
23434
- } else {
22592
+ if (typeof source.pipe !== "function") {
23435
22593
  throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
23436
22594
  }
22595
+ this.source = source;
23437
22596
  this.base64Encoder = base64Encoder ?? toBase64;
23438
22597
  this.expectedChecksum = expectedChecksum;
23439
22598
  this.checksum = checksum;
23440
22599
  this.checksumSourceLocation = checksumSourceLocation;
23441
- this.source.pipe(this);
23442
- }
23443
- _read(size) {
23444
- if (this.pendingCallback) {
23445
- const callback = this.pendingCallback;
23446
- this.pendingCallback = null;
23447
- callback();
22600
+ this.source.on("data", this.onSourceData);
22601
+ this.source.on("end", this.onSourceEnd);
22602
+ this.source.on("error", this.onSourceError);
22603
+ this.source.on("close", this.onSourceClose);
22604
+ this.source.pause();
22605
+ }
22606
+ onSourceData = (chunk) => {
22607
+ if (this.destroyed) {
22608
+ return;
23448
22609
  }
23449
- }
23450
- _write(chunk, encoding, callback) {
23451
22610
  try {
23452
22611
  this.checksum.update(chunk);
23453
- const canPushMore = this.push(chunk);
23454
- if (!canPushMore) {
23455
- this.pendingCallback = callback;
23456
- return;
23457
- }
23458
22612
  } catch (e) {
23459
- return callback(e);
22613
+ this.destroy(e);
22614
+ return;
22615
+ }
22616
+ if (!this.push(chunk)) {
22617
+ this.source.pause();
22618
+ }
22619
+ };
22620
+ onSourceEnd = async () => {
22621
+ if (this.destroyed) {
22622
+ return;
23460
22623
  }
23461
- return callback();
23462
- }
23463
- async _final(callback) {
23464
22624
  try {
23465
22625
  const digest = await this.checksum.digest();
23466
22626
  const received = this.base64Encoder(digest);
23467
22627
  if (this.expectedChecksum !== received) {
23468
- return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}" in response header "${this.checksumSourceLocation}".`));
22628
+ this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}" in response header "${this.checksumSourceLocation}".`));
22629
+ return;
23469
22630
  }
23470
22631
  } catch (e) {
23471
- return callback(e);
22632
+ this.destroy(e);
22633
+ return;
23472
22634
  }
23473
22635
  this.push(null);
23474
- return callback();
22636
+ };
22637
+ onSourceError = (error40) => {
22638
+ this.destroy(error40);
22639
+ };
22640
+ onSourceClose = () => {
22641
+ if (!this.destroyed && !this.source.readableEnded) {
22642
+ this.destroy(new Error("Connection lost or stream closed before all data was received."));
22643
+ }
22644
+ };
22645
+ _read(_size2) {
22646
+ this.source.resume();
22647
+ }
22648
+ _destroy(error40, callback) {
22649
+ this.source?.removeListener("data", this.onSourceData);
22650
+ this.source?.removeListener("end", this.onSourceEnd);
22651
+ this.source?.removeListener("error", this.onSourceError);
22652
+ this.source?.removeListener("close", this.onSourceClose);
22653
+ this.source?.destroy();
22654
+ callback(error40);
23475
22655
  }
23476
22656
  };
23477
22657
  }
@@ -23939,6 +23119,7 @@ var import_node_stream4, headStream2, Collector;
23939
23119
  var init_headStream = __esm({
23940
23120
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/headStream.js"() {
23941
23121
  import_node_stream4 = require("node:stream");
23122
+ init_concatBytes();
23942
23123
  init_headStream_browser();
23943
23124
  init_stream_type_check();
23944
23125
  headStream2 = (stream2, bytes) => {
@@ -23955,7 +23136,7 @@ var init_headStream = __esm({
23955
23136
  });
23956
23137
  collector.on("error", reject2);
23957
23138
  collector.on("finish", function() {
23958
- const bytes2 = new Uint8Array(Buffer.concat(this.buffers));
23139
+ const bytes2 = concatBytes(this.buffers);
23959
23140
  resolve9(bytes2);
23960
23141
  });
23961
23142
  });
@@ -23995,103 +23176,36 @@ var init_toUtf8_browser = __esm({
23995
23176
  }
23996
23177
  });
23997
23178
 
23998
- // node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js
23999
- var fromBase642;
24000
- var init_fromBase64_browser = __esm({
24001
- "node_modules/@smithy/core/dist-es/submodules/serde/util-base64/fromBase64.browser.js"() {
24002
- init_constants_for_browser();
24003
- fromBase642 = (input) => {
24004
- let totalByteLength = input.length / 4 * 3;
24005
- if (input.slice(-2) === "==") {
24006
- totalByteLength -= 2;
24007
- } else if (input.slice(-1) === "=") {
24008
- totalByteLength--;
24009
- }
24010
- const out = new ArrayBuffer(totalByteLength);
24011
- const dataView = new DataView(out);
24012
- for (let i = 0; i < input.length; i += 4) {
24013
- let bits = 0;
24014
- let bitLength = 0;
24015
- for (let j = i, limit = i + 3; j <= limit; j++) {
24016
- if (input[j] !== "=") {
24017
- if (!(input[j] in alphabetByEncoding)) {
24018
- throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
24019
- }
24020
- bits |= alphabetByEncoding[input[j]] << (limit - j) * bitsPerLetter;
24021
- bitLength += bitsPerLetter;
24022
- } else {
24023
- bits >>= bitsPerLetter;
24024
- }
24025
- }
24026
- const chunkOffset = i / 4 * 3;
24027
- bits >>= bitLength % bitsPerByte;
24028
- const byteLength = Math.floor(bitLength / bitsPerByte);
24029
- for (let k = 0; k < byteLength; k++) {
24030
- const offset2 = (byteLength - k - 1) * bitsPerByte;
24031
- dataView.setUint8(chunkOffset + k, (bits & 255 << offset2) >> offset2);
24032
- }
24033
- }
24034
- return new Uint8Array(out);
24035
- };
24036
- }
24037
- });
24038
-
24039
23179
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js
24040
23180
  async function collectBlob(blob) {
24041
- const base643 = await readToBase64(blob);
24042
- const arrayBuffer = fromBase642(base643);
24043
- return new Uint8Array(arrayBuffer);
23181
+ return blob.arrayBuffer().then((ab) => new Uint8Array(ab));
24044
23182
  }
24045
- async function collectStream(stream2) {
23183
+ async function collectReadableStream(stream2) {
24046
23184
  const chunks = [];
24047
23185
  const reader = stream2.getReader();
24048
- let isDone = false;
24049
23186
  let length = 0;
24050
- while (!isDone) {
23187
+ while (true) {
24051
23188
  const { done, value } = await reader.read();
24052
23189
  if (value) {
24053
23190
  chunks.push(value);
24054
23191
  length += value.length;
24055
23192
  }
24056
- isDone = done;
24057
- }
24058
- const collected = new Uint8Array(length);
24059
- let offset2 = 0;
24060
- for (const chunk of chunks) {
24061
- collected.set(chunk, offset2);
24062
- offset2 += chunk.length;
23193
+ if (done) {
23194
+ break;
23195
+ }
24063
23196
  }
24064
- return collected;
24065
- }
24066
- function readToBase64(blob) {
24067
- return new Promise((resolve9, reject2) => {
24068
- const reader = new FileReader();
24069
- reader.onloadend = () => {
24070
- if (reader.readyState !== 2) {
24071
- return reject2(new Error("Reader aborted too early"));
24072
- }
24073
- const result = reader.result ?? "";
24074
- const commaIndex = result.indexOf(",");
24075
- const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
24076
- resolve9(result.substring(dataOffset));
24077
- };
24078
- reader.onabort = () => reject2(new Error("Read aborted"));
24079
- reader.onerror = () => reject2(reader.error);
24080
- reader.readAsDataURL(blob);
24081
- });
23197
+ return concatBytes(chunks, length);
24082
23198
  }
24083
23199
  var streamCollector;
24084
23200
  var init_stream_collector_browser = __esm({
24085
23201
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.browser.js"() {
24086
- init_fromBase64_browser();
23202
+ init_concatBytes();
23203
+ init_stream_type_check();
24087
23204
  streamCollector = async (stream2) => {
24088
- if (typeof Blob === "function" && stream2 instanceof Blob || stream2.constructor?.name === "Blob") {
24089
- if (Blob.prototype.arrayBuffer !== void 0) {
24090
- return new Uint8Array(await stream2.arrayBuffer());
24091
- }
23205
+ if (isBlob(stream2)) {
24092
23206
  return collectBlob(stream2);
24093
23207
  }
24094
- return collectStream(stream2);
23208
+ return collectReadableStream(stream2);
24095
23209
  };
24096
23210
  }
24097
23211
  });
@@ -24161,57 +23275,42 @@ var init_sdk_stream_mixin_browser = __esm({
24161
23275
  });
24162
23276
 
24163
23277
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js
24164
- async function collectReadableStream(stream2) {
24165
- const chunks = [];
24166
- const reader = stream2.getReader();
24167
- let isDone = false;
24168
- let length = 0;
24169
- while (!isDone) {
24170
- const { done, value } = await reader.read();
24171
- if (value) {
24172
- chunks.push(value);
24173
- length += value.length;
24174
- }
24175
- isDone = done;
24176
- }
24177
- const collected = new Uint8Array(length);
24178
- let offset2 = 0;
24179
- for (const chunk of chunks) {
24180
- collected.set(chunk, offset2);
24181
- offset2 += chunk.length;
24182
- }
24183
- return collected;
24184
- }
24185
- var import_node_stream5, Collector2, isReadableStreamInstance, streamCollector2;
23278
+ var import_node_stream5, streamCollector2, Collector2;
24186
23279
  var init_stream_collector = __esm({
24187
23280
  "node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js"() {
24188
23281
  import_node_stream5 = require("node:stream");
24189
- Collector2 = class extends import_node_stream5.Writable {
24190
- bufferedBytes = [];
24191
- _write(chunk, encoding, callback) {
24192
- this.bufferedBytes.push(chunk);
24193
- callback();
24194
- }
24195
- };
24196
- isReadableStreamInstance = (stream2) => typeof ReadableStream === "function" && stream2 instanceof ReadableStream;
23282
+ init_concatBytes();
23283
+ init_stream_collector_browser();
23284
+ init_stream_type_check();
24197
23285
  streamCollector2 = (stream2) => {
24198
- if (isReadableStreamInstance(stream2)) {
23286
+ if (isBlob(stream2)) {
23287
+ return collectBlob(stream2);
23288
+ }
23289
+ if (isReadableStream(stream2)) {
24199
23290
  return collectReadableStream(stream2);
24200
23291
  }
24201
23292
  return new Promise((resolve9, reject2) => {
24202
23293
  const collector = new Collector2();
24203
- stream2.pipe(collector);
24204
- stream2.on("error", (err) => {
23294
+ const nodeStream = stream2;
23295
+ nodeStream.pipe(collector);
23296
+ nodeStream.on("error", (err) => {
24205
23297
  collector.end();
24206
23298
  reject2(err);
24207
23299
  });
24208
23300
  collector.on("error", reject2);
24209
23301
  collector.on("finish", function() {
24210
- const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
23302
+ const bytes = concatBytes(this.bufferedBytes);
24211
23303
  resolve9(bytes);
24212
23304
  });
24213
23305
  });
24214
23306
  };
23307
+ Collector2 = class extends import_node_stream5.Writable {
23308
+ bufferedBytes = [];
23309
+ _write(chunk, encoding, callback) {
23310
+ this.bufferedBytes.push(chunk);
23311
+ callback();
23312
+ }
23313
+ };
24215
23314
  }
24216
23315
  });
24217
23316
 
@@ -24228,7 +23327,7 @@ var init_sdk_stream_mixin = __esm({
24228
23327
  if (!(stream2 instanceof import_node_stream6.Readable)) {
24229
23328
  try {
24230
23329
  return sdkStreamMixin(stream2);
24231
- } catch (e) {
23330
+ } catch (ignored) {
24232
23331
  const name15 = stream2?.__proto__?.constructor?.name || stream2;
24233
23332
  throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name15}`);
24234
23333
  }
@@ -24315,6 +23414,7 @@ __export(serde_exports, {
24315
23414
  _parseRfc3339DateTimeWithOffset: () => _parseRfc3339DateTimeWithOffset,
24316
23415
  _parseRfc7231DateTime: () => _parseRfc7231DateTime,
24317
23416
  calculateBodyLength: () => calculateBodyLength,
23417
+ concatBytes: () => concatBytes,
24318
23418
  copyDocumentWithTransform: () => copyDocumentWithTransform,
24319
23419
  createBufferedReadable: () => createBufferedReadable,
24320
23420
  createChecksumStream: () => createChecksumStream2,
@@ -24363,6 +23463,7 @@ __export(serde_exports, {
24363
23463
  splitEvery: () => splitEvery,
24364
23464
  splitHeader: () => splitHeader,
24365
23465
  splitStream: () => splitStream2,
23466
+ streamCollector: () => streamCollector2,
24366
23467
  strictParseByte: () => strictParseByte,
24367
23468
  strictParseDouble: () => strictParseDouble,
24368
23469
  strictParseFloat: () => strictParseFloat,
@@ -24399,6 +23500,7 @@ var init_serde = __esm({
24399
23500
  init_hex_encoding();
24400
23501
  init_calculateBodyLength();
24401
23502
  init_toUint8Array();
23503
+ init_concatBytes();
24402
23504
  init_buffer_from();
24403
23505
  init_is_array_buffer();
24404
23506
  init_deserializerMiddleware();
@@ -24413,6 +23515,7 @@ var init_serde = __esm({
24413
23515
  init_sdk_stream_mixin();
24414
23516
  init_splitStream();
24415
23517
  init_stream_type_check();
23518
+ init_stream_collector();
24416
23519
  Uint8ArrayBlobAdapter = class extends bindUint8ArrayBlobAdapter(toUtf8, fromUtf8, toBase64, fromBase64) {
24417
23520
  };
24418
23521
  _getRandomValues = import_node_crypto2.getRandomValues;
@@ -24421,6 +23524,81 @@ var init_serde = __esm({
24421
23524
  }
24422
23525
  });
24423
23526
 
23527
+ // node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js
23528
+ var CRC32_TABLE, ONES, Crc32Js;
23529
+ var init_Crc32Js = __esm({
23530
+ "node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Js.js"() {
23531
+ CRC32_TABLE = new Uint32Array(256);
23532
+ for (let i = 0; i < 256; ++i) {
23533
+ let c = i;
23534
+ for (let j = 0; j < 8; ++j) {
23535
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
23536
+ }
23537
+ CRC32_TABLE[i] = c >>> 0;
23538
+ }
23539
+ ONES = 4294967295;
23540
+ Crc32Js = class {
23541
+ digestLength = 4;
23542
+ checksum = ONES;
23543
+ update(data2) {
23544
+ for (let i = 0; i < data2.length; ++i) {
23545
+ this.checksum = this.checksum >>> 8 ^ CRC32_TABLE[(this.checksum ^ data2[i]) & 255];
23546
+ }
23547
+ }
23548
+ digestSync() {
23549
+ return (this.checksum ^ ONES) >>> 0;
23550
+ }
23551
+ async digest() {
23552
+ const value = this.digestSync();
23553
+ const out = new Uint8Array(4);
23554
+ new DataView(out.buffer).setUint32(0, value, false);
23555
+ return out;
23556
+ }
23557
+ reset() {
23558
+ this.checksum = ONES;
23559
+ }
23560
+ };
23561
+ }
23562
+ });
23563
+
23564
+ // node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js
23565
+ function buildNativeClass(nativeCrc32) {
23566
+ return class Crc32Node {
23567
+ digestLength = 4;
23568
+ value = 0;
23569
+ update(data2) {
23570
+ this.value = nativeCrc32(data2, this.value);
23571
+ }
23572
+ digestSync() {
23573
+ return this.value >>> 0;
23574
+ }
23575
+ async digest() {
23576
+ const out = new Uint8Array(4);
23577
+ new DataView(out.buffer).setUint32(0, this.digestSync(), false);
23578
+ return out;
23579
+ }
23580
+ reset() {
23581
+ this.value = 0;
23582
+ }
23583
+ };
23584
+ }
23585
+ var zlib, zlibCrc32, Crc32Node;
23586
+ var init_Crc32Node = __esm({
23587
+ "node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js"() {
23588
+ zlib = __toESM(require("node:zlib"));
23589
+ init_Crc32Js();
23590
+ zlibCrc32 = typeof zlib.crc32 === "function" ? zlib.crc32 : void 0;
23591
+ Crc32Node = zlibCrc32 ? buildNativeClass(zlibCrc32) : Crc32Js;
23592
+ }
23593
+ });
23594
+
23595
+ // node_modules/@smithy/core/dist-es/submodules/checksum/index.js
23596
+ var init_checksum = __esm({
23597
+ "node_modules/@smithy/core/dist-es/submodules/checksum/index.js"() {
23598
+ init_Crc32Node();
23599
+ }
23600
+ });
23601
+
24424
23602
  // node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js
24425
23603
  function negate(bytes) {
24426
23604
  for (let i = 0; i < 8; i++) {
@@ -24502,27 +23680,27 @@ var init_HeaderMarshaller = __esm({
24502
23680
  formatHeaderValue(header) {
24503
23681
  switch (header.type) {
24504
23682
  case "boolean":
24505
- return Uint8Array.from([header.value ? 0 : 1]);
23683
+ return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
24506
23684
  case "byte":
24507
- return Uint8Array.from([2, header.value]);
23685
+ return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
24508
23686
  case "short":
24509
23687
  const shortView = new DataView(new ArrayBuffer(3));
24510
- shortView.setUint8(0, 3);
23688
+ shortView.setUint8(0, HEADER_VALUE_TYPE.short);
24511
23689
  shortView.setInt16(1, header.value, false);
24512
23690
  return new Uint8Array(shortView.buffer);
24513
23691
  case "integer":
24514
23692
  const intView = new DataView(new ArrayBuffer(5));
24515
- intView.setUint8(0, 4);
23693
+ intView.setUint8(0, HEADER_VALUE_TYPE.integer);
24516
23694
  intView.setInt32(1, header.value, false);
24517
23695
  return new Uint8Array(intView.buffer);
24518
23696
  case "long":
24519
23697
  const longBytes = new Uint8Array(9);
24520
- longBytes[0] = 5;
23698
+ longBytes[0] = HEADER_VALUE_TYPE.long;
24521
23699
  longBytes.set(header.value.bytes, 1);
24522
23700
  return longBytes;
24523
23701
  case "binary":
24524
23702
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
24525
- binView.setUint8(0, 6);
23703
+ binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
24526
23704
  binView.setUint16(1, header.value.byteLength, false);
24527
23705
  const binBytes = new Uint8Array(binView.buffer);
24528
23706
  binBytes.set(header.value, 3);
@@ -24530,14 +23708,14 @@ var init_HeaderMarshaller = __esm({
24530
23708
  case "string":
24531
23709
  const utf8Bytes = this.fromUtf8(header.value);
24532
23710
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
24533
- strView.setUint8(0, 7);
23711
+ strView.setUint8(0, HEADER_VALUE_TYPE.string);
24534
23712
  strView.setUint16(1, utf8Bytes.byteLength, false);
24535
23713
  const strBytes = new Uint8Array(strView.buffer);
24536
23714
  strBytes.set(utf8Bytes, 3);
24537
23715
  return strBytes;
24538
23716
  case "timestamp":
24539
23717
  const tsBytes = new Uint8Array(9);
24540
- tsBytes[0] = 8;
23718
+ tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
24541
23719
  tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
24542
23720
  return tsBytes;
24543
23721
  case "uuid":
@@ -24545,8 +23723,8 @@ var init_HeaderMarshaller = __esm({
24545
23723
  throw new Error(`Invalid UUID received: ${header.value}`);
24546
23724
  }
24547
23725
  const uuidBytes = new Uint8Array(17);
24548
- uuidBytes[0] = 9;
24549
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
23726
+ uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
23727
+ uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
24550
23728
  return uuidBytes;
24551
23729
  }
24552
23730
  }
@@ -24558,46 +23736,46 @@ var init_HeaderMarshaller = __esm({
24558
23736
  const name15 = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
24559
23737
  position += nameLength;
24560
23738
  switch (headers.getUint8(position++)) {
24561
- case 0:
23739
+ case HEADER_VALUE_TYPE.boolTrue:
24562
23740
  out[name15] = {
24563
23741
  type: BOOLEAN_TAG,
24564
23742
  value: true
24565
23743
  };
24566
23744
  break;
24567
- case 1:
23745
+ case HEADER_VALUE_TYPE.boolFalse:
24568
23746
  out[name15] = {
24569
23747
  type: BOOLEAN_TAG,
24570
23748
  value: false
24571
23749
  };
24572
23750
  break;
24573
- case 2:
23751
+ case HEADER_VALUE_TYPE.byte:
24574
23752
  out[name15] = {
24575
23753
  type: BYTE_TAG,
24576
23754
  value: headers.getInt8(position++)
24577
23755
  };
24578
23756
  break;
24579
- case 3:
23757
+ case HEADER_VALUE_TYPE.short:
24580
23758
  out[name15] = {
24581
23759
  type: SHORT_TAG,
24582
23760
  value: headers.getInt16(position, false)
24583
23761
  };
24584
23762
  position += 2;
24585
23763
  break;
24586
- case 4:
23764
+ case HEADER_VALUE_TYPE.integer:
24587
23765
  out[name15] = {
24588
23766
  type: INT_TAG,
24589
23767
  value: headers.getInt32(position, false)
24590
23768
  };
24591
23769
  position += 4;
24592
23770
  break;
24593
- case 5:
23771
+ case HEADER_VALUE_TYPE.long:
24594
23772
  out[name15] = {
24595
23773
  type: LONG_TAG,
24596
23774
  value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8))
24597
23775
  };
24598
23776
  position += 8;
24599
23777
  break;
24600
- case 6:
23778
+ case HEADER_VALUE_TYPE.byteArray:
24601
23779
  const binaryLength = headers.getUint16(position, false);
24602
23780
  position += 2;
24603
23781
  out[name15] = {
@@ -24606,7 +23784,7 @@ var init_HeaderMarshaller = __esm({
24606
23784
  };
24607
23785
  position += binaryLength;
24608
23786
  break;
24609
- case 7:
23787
+ case HEADER_VALUE_TYPE.string:
24610
23788
  const stringLength = headers.getUint16(position, false);
24611
23789
  position += 2;
24612
23790
  out[name15] = {
@@ -24615,14 +23793,14 @@ var init_HeaderMarshaller = __esm({
24615
23793
  };
24616
23794
  position += stringLength;
24617
23795
  break;
24618
- case 8:
23796
+ case HEADER_VALUE_TYPE.timestamp:
24619
23797
  out[name15] = {
24620
23798
  type: TIMESTAMP_TAG,
24621
23799
  value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf())
24622
23800
  };
24623
23801
  position += 8;
24624
23802
  break;
24625
- case 9:
23803
+ case HEADER_VALUE_TYPE.uuid:
24626
23804
  const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
24627
23805
  position += 16;
24628
23806
  out[name15] = {
@@ -24675,23 +23853,24 @@ function splitMessage({ byteLength, byteOffset, buffer }) {
24675
23853
  const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
24676
23854
  const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
24677
23855
  const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
24678
- const checksummer = new import_crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
24679
- if (expectedPreludeChecksum !== checksummer.digest()) {
24680
- throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
23856
+ const checksummer = new Crc32Node();
23857
+ checksummer.update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
23858
+ if (expectedPreludeChecksum !== checksummer.digestSync()) {
23859
+ throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digestSync()})`);
24681
23860
  }
24682
23861
  checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
24683
- if (expectedMessageChecksum !== checksummer.digest()) {
24684
- throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
23862
+ if (expectedMessageChecksum !== checksummer.digestSync()) {
23863
+ throw new Error(`The message checksum (${checksummer.digestSync()}) did not match the expected value of ${expectedMessageChecksum}`);
24685
23864
  }
24686
23865
  return {
24687
23866
  headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
24688
23867
  body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH))
24689
23868
  };
24690
23869
  }
24691
- var import_crc32, PRELUDE_MEMBER_LENGTH, PRELUDE_LENGTH, CHECKSUM_LENGTH, MINIMUM_MESSAGE_LENGTH;
23870
+ var PRELUDE_MEMBER_LENGTH, PRELUDE_LENGTH, CHECKSUM_LENGTH, MINIMUM_MESSAGE_LENGTH;
24692
23871
  var init_splitMessage = __esm({
24693
23872
  "node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/splitMessage.js"() {
24694
- import_crc32 = __toESM(require_main3());
23873
+ init_checksum();
24695
23874
  PRELUDE_MEMBER_LENGTH = 4;
24696
23875
  PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
24697
23876
  CHECKSUM_LENGTH = 4;
@@ -24700,10 +23879,10 @@ var init_splitMessage = __esm({
24700
23879
  });
24701
23880
 
24702
23881
  // node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js
24703
- var import_crc322, EventStreamCodec;
23882
+ var EventStreamCodec;
24704
23883
  var init_EventStreamCodec = __esm({
24705
23884
  "node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/EventStreamCodec.js"() {
24706
- import_crc322 = __toESM(require_main3());
23885
+ init_checksum();
24707
23886
  init_HeaderMarshaller();
24708
23887
  init_splitMessage();
24709
23888
  EventStreamCodec = class {
@@ -24751,13 +23930,15 @@ var init_EventStreamCodec = __esm({
24751
23930
  const length = headers.byteLength + body.byteLength + 16;
24752
23931
  const out = new Uint8Array(length);
24753
23932
  const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
24754
- const checksum = new import_crc322.Crc32();
23933
+ const checksum = new Crc32Node();
24755
23934
  view.setUint32(0, length, false);
24756
23935
  view.setUint32(4, headers.byteLength, false);
24757
- view.setUint32(8, checksum.update(out.subarray(0, 8)).digest(), false);
23936
+ checksum.update(out.subarray(0, 8));
23937
+ view.setUint32(8, checksum.digestSync(), false);
24758
23938
  out.set(headers, 12);
24759
23939
  out.set(body, headers.byteLength + 12);
24760
- view.setUint32(length - 4, checksum.update(out.subarray(8, length - 4)).digest(), false);
23940
+ checksum.update(out.subarray(8, length - 4));
23941
+ view.setUint32(length - 4, checksum.digestSync(), false);
24761
23942
  return out;
24762
23943
  }
24763
23944
  decode(message) {
@@ -25121,6 +24302,7 @@ var init_EventStreamSerdeConfig = __esm({
25121
24302
  var EventStreamSerde;
25122
24303
  var init_EventStreamSerde = __esm({
25123
24304
  "node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js"() {
24305
+ init_schema();
25124
24306
  init_serde();
25125
24307
  EventStreamSerde = class {
25126
24308
  marshaller;
@@ -25128,12 +24310,14 @@ var init_EventStreamSerde = __esm({
25128
24310
  deserializer;
25129
24311
  serdeContext;
25130
24312
  defaultContentType;
25131
- constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType }) {
24313
+ compositeErrorRegistry;
24314
+ constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, compositeErrorRegistry }) {
25132
24315
  this.marshaller = marshaller;
25133
24316
  this.serializer = serializer;
25134
24317
  this.deserializer = deserializer;
25135
24318
  this.serdeContext = serdeContext;
25136
24319
  this.defaultContentType = defaultContentType;
24320
+ this.compositeErrorRegistry = compositeErrorRegistry;
25137
24321
  }
25138
24322
  async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
25139
24323
  const marshaller = this.marshaller;
@@ -25243,16 +24427,9 @@ var init_EventStreamSerde = __esm({
25243
24427
  }
25244
24428
  }
25245
24429
  }
25246
- if (hasBindings) {
25247
- return {
25248
- [unionMember]: out
25249
- };
25250
- }
25251
- if (body.byteLength === 0) {
25252
- return {
25253
- [unionMember]: {}
25254
- };
25255
- }
24430
+ return {
24431
+ [unionMember]: await this.readEventMember(eventStreamSchema, body, hasBindings, out)
24432
+ };
25256
24433
  }
25257
24434
  return {
25258
24435
  [unionMember]: await this.deserializer.read(eventStreamSchema, body)
@@ -25291,6 +24468,29 @@ var init_EventStreamSerde = __esm({
25291
24468
  }
25292
24469
  };
25293
24470
  }
24471
+ async readEventMember(eventStreamSchema, body, hasBindings, out) {
24472
+ let ErrCtor;
24473
+ const staticStructuralSchema = eventStreamSchema.getSchema();
24474
+ if (Array.isArray(staticStructuralSchema) && staticStructuralSchema[0] === -3) {
24475
+ const namespace = staticStructuralSchema[1];
24476
+ const nsRegistry = TypeRegistry.for(namespace);
24477
+ this.compositeErrorRegistry?.copyFrom(nsRegistry);
24478
+ ErrCtor = (this.compositeErrorRegistry ?? nsRegistry)?.getErrorCtor(staticStructuralSchema);
24479
+ }
24480
+ const dataObject = hasBindings ? out : body.byteLength === 0 ? {} : await this.deserializer.read(eventStreamSchema, body);
24481
+ if (ErrCtor) {
24482
+ const message = dataObject.message ?? dataObject.Message ?? "Unknown";
24483
+ const metadata = {};
24484
+ const $fault = eventStreamSchema.getMergedTraits().error;
24485
+ if ($fault) {
24486
+ metadata.$fault = $fault;
24487
+ }
24488
+ return Object.assign(new ErrCtor({}), metadata, {
24489
+ message
24490
+ }, dataObject);
24491
+ }
24492
+ return dataObject;
24493
+ }
25294
24494
  writeEventBody(unionMember, unionSchema, event) {
25295
24495
  const serializer = this.serializer;
25296
24496
  let eventType = unionMember;
@@ -25409,7 +24609,7 @@ var init_event_streams = __esm({
25409
24609
  });
25410
24610
 
25411
24611
  // node_modules/@smithy/eventstream-codec/dist-cjs/index.js
25412
- var require_dist_cjs5 = __commonJS({
24612
+ var require_dist_cjs2 = __commonJS({
25413
24613
  "node_modules/@smithy/eventstream-codec/dist-cjs/index.js"(exports2) {
25414
24614
  "use strict";
25415
24615
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -25440,7 +24640,7 @@ var require_dist_cjs5 = __commonJS({
25440
24640
  });
25441
24641
 
25442
24642
  // node_modules/@smithy/util-utf8/dist-cjs/index.js
25443
- var require_dist_cjs6 = __commonJS({
24643
+ var require_dist_cjs3 = __commonJS({
25444
24644
  "node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2) {
25445
24645
  "use strict";
25446
24646
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -25694,10 +24894,21 @@ var init_aws4fetch_esm = __esm({
25694
24894
  });
25695
24895
 
25696
24896
  // node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs
24897
+ function supportsStrictTools(modelId) {
24898
+ return !rejectsNewerSchemaFields(modelId);
24899
+ }
24900
+ function supportsNativeStructuredOutput(modelId) {
24901
+ return !rejectsNewerSchemaFields(modelId);
24902
+ }
24903
+ function rejectsNewerSchemaFields(modelId) {
24904
+ return MODELS_REJECTING_NEWER_SCHEMA_FIELDS.some(
24905
+ (model) => modelId.includes(model)
24906
+ );
24907
+ }
25697
24908
  function createBedrockEventStreamDecoder(body, processEvent) {
25698
24909
  const codec = new import_eventstream_codec.EventStreamCodec(import_util_utf8.toUtf8, import_util_utf8.fromUtf8);
25699
24910
  let buffer = new Uint8Array(0);
25700
- const textDecoder2 = new TextDecoder();
24911
+ const textDecoder3 = new TextDecoder();
25701
24912
  return body.pipeThrough(
25702
24913
  new TransformStream({
25703
24914
  async transform(chunk, controller) {
@@ -25721,7 +24932,7 @@ function createBedrockEventStreamDecoder(body, processEvent) {
25721
24932
  buffer = buffer.slice(totalLength);
25722
24933
  const messageType = (_a17 = decoded.headers[":message-type"]) == null ? void 0 : _a17.value;
25723
24934
  const eventType = (_b16 = decoded.headers[":event-type"]) == null ? void 0 : _b16.value;
25724
- const data2 = textDecoder2.decode(decoded.body);
24935
+ const data2 = textDecoder3.decode(decoded.body);
25725
24936
  await processEvent({ messageType, eventType, data: data2 }, controller);
25726
24937
  } catch (e) {
25727
24938
  break;
@@ -25777,7 +24988,7 @@ async function prepareTools({
25777
24988
  toolChoice: preparedAnthropicToolChoice,
25778
24989
  toolWarnings: anthropicToolWarnings,
25779
24990
  betas: anthropicBetas
25780
- } = await (0, import_internal2.prepareTools)({
24991
+ } = await (0, import_internal3.prepareTools)({
25781
24992
  tools: ProviderTools,
25782
24993
  toolChoice,
25783
24994
  supportsStructuredOutput: false,
@@ -25791,7 +25002,7 @@ async function prepareTools({
25791
25002
  };
25792
25003
  }
25793
25004
  for (const tool6 of ProviderTools) {
25794
- const toolFactory = Object.values(import_internal2.anthropicTools).find((factory) => {
25005
+ const toolFactory = Object.values(import_internal3.anthropicTools).find((factory) => {
25795
25006
  const instance = factory({});
25796
25007
  return instance.id === tool6.id;
25797
25008
  });
@@ -25815,12 +25026,13 @@ async function prepareTools({
25815
25026
  }
25816
25027
  }
25817
25028
  const filteredFunctionTools = (toolChoice == null ? void 0 : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
25029
+ const supportsStrictOnTools = supportsStrictTools(modelId);
25818
25030
  for (const tool6 of filteredFunctionTools) {
25819
25031
  bedrockTools.push({
25820
25032
  toolSpec: {
25821
25033
  name: tool6.name,
25822
25034
  ...((_a17 = tool6.description) == null ? void 0 : _a17.trim()) !== "" ? { description: tool6.description } : {},
25823
- ...tool6.strict != null ? { strict: tool6.strict } : {},
25035
+ ...tool6.strict != null && supportsStrictOnTools ? { strict: tool6.strict } : {},
25824
25036
  inputSchema: {
25825
25037
  json: tool6.inputSchema
25826
25038
  }
@@ -25921,6 +25133,32 @@ function pushCachePoint(content, providerMetadata) {
25921
25133
  content.push(cachePoint);
25922
25134
  }
25923
25135
  }
25136
+ function sanitizeToolName(toolName) {
25137
+ return toolName.replace(/[^a-zA-Z0-9_-]/g, "") || "_";
25138
+ }
25139
+ function getBedrockImageSource({
25140
+ data: data2,
25141
+ functionality
25142
+ }) {
25143
+ if (data2 instanceof URL) {
25144
+ if (data2.protocol !== "s3:") {
25145
+ throw new UnsupportedFunctionalityError({ functionality });
25146
+ }
25147
+ return {
25148
+ s3Location: {
25149
+ uri: data2.toString()
25150
+ }
25151
+ };
25152
+ }
25153
+ return { bytes: convertToBase64(data2) };
25154
+ }
25155
+ function getBedrockImageFormatFromUrl(url2) {
25156
+ var _a17;
25157
+ const extension = (_a17 = url2.pathname.split(".").pop()) == null ? void 0 : _a17.toLowerCase();
25158
+ return getBedrockImageFormat(
25159
+ `image/${extension === "jpg" ? "jpeg" : extension}`
25160
+ );
25161
+ }
25924
25162
  async function shouldEnableCitations(providerMetadata) {
25925
25163
  var _a17, _b16;
25926
25164
  const bedrockOptions = await parseProviderOptions({
@@ -25973,19 +25211,22 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
25973
25211
  break;
25974
25212
  }
25975
25213
  case "file": {
25976
- if (part.data instanceof URL) {
25977
- throw new UnsupportedFunctionalityError({
25978
- functionality: "File URL data"
25979
- });
25980
- }
25981
25214
  if (part.mediaType.startsWith("image/")) {
25982
25215
  bedrockContent.push({
25983
25216
  image: {
25984
25217
  format: getBedrockImageFormat(part.mediaType),
25985
- source: { bytes: convertToBase64(part.data) }
25218
+ source: getBedrockImageSource({
25219
+ data: part.data,
25220
+ functionality: "File URL data"
25221
+ })
25986
25222
  }
25987
25223
  });
25988
25224
  } else {
25225
+ if (part.data instanceof URL) {
25226
+ throw new UnsupportedFunctionalityError({
25227
+ functionality: "File URL data"
25228
+ });
25229
+ }
25989
25230
  if (!part.mediaType) {
25990
25231
  throw new UnsupportedFunctionalityError({
25991
25232
  functionality: "file without mime type",
@@ -26039,6 +25280,18 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
26039
25280
  }
26040
25281
  };
26041
25282
  }
25283
+ case "image-url": {
25284
+ const url2 = new URL(contentPart.url);
25285
+ return {
25286
+ image: {
25287
+ format: getBedrockImageFormatFromUrl(url2),
25288
+ source: getBedrockImageSource({
25289
+ data: url2,
25290
+ functionality: `tool result image URL "${contentPart.url}"`
25291
+ })
25292
+ }
25293
+ };
25294
+ }
26042
25295
  case "file-data": {
26043
25296
  if (!contentPart.mediaType.startsWith("image/")) {
26044
25297
  const enableCitations = await shouldEnableCitations(
@@ -26086,7 +25339,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
26086
25339
  break;
26087
25340
  case "execution-denied":
26088
25341
  toolResultContent = [
26089
- { text: (_a17 = output.reason) != null ? _a17 : "Tool execution denied." }
25342
+ { text: (_a17 = output.reason) != null ? _a17 : "Tool call execution denied." }
26090
25343
  ];
26091
25344
  break;
26092
25345
  case "json":
@@ -26179,7 +25432,7 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
26179
25432
  bedrockContent.push({
26180
25433
  toolUse: {
26181
25434
  toolUseId: normalizeToolCallId(part.toolCallId, isMistral),
26182
- name: part.toolName,
25435
+ name: sanitizeToolName(part.toolName),
26183
25436
  input: part.input
26184
25437
  }
26185
25438
  });
@@ -26292,6 +25545,12 @@ function mapBedrockFinishReason(finishReason, isJsonResponseFromTool) {
26292
25545
  return "other";
26293
25546
  }
26294
25547
  }
25548
+ function isCohereEmbeddingModel(modelId) {
25549
+ return modelId.includes("cohere.embed-");
25550
+ }
25551
+ function isNovaEmbeddingModel(modelId) {
25552
+ return modelId.startsWith("amazon.nova-") && modelId.includes("embed");
25553
+ }
26295
25554
  function getBase64Data(file2) {
26296
25555
  if (file2.type === "url") {
26297
25556
  throw new Error(
@@ -26526,22 +25785,23 @@ Original error: ${errorMessage}`
26526
25785
  provider.tools = import_internal.anthropicTools;
26527
25786
  return provider;
26528
25787
  }
26529
- var import_internal, import_eventstream_codec, import_util_utf8, import_internal2, BEDROCK_STOP_REASONS, BEDROCK_IMAGE_MIME_TYPES, BEDROCK_DOCUMENT_MIME_TYPES, bedrockFilePartProviderOptions, amazonBedrockLanguageModelOptions, BedrockErrorSchema, createBedrockEventStreamResponseHandler, bedrockReasoningMetadataSchema, BedrockChatLanguageModel, BedrockStopReasonSchema, BedrockAdditionalModelResponseFieldsSchema, BedrockToolUseSchema, BedrockReasoningTextSchema, BedrockRedactedReasoningSchema, BedrockResponseSchema, BedrockStreamSchema, amazonBedrockEmbeddingModelOptionsSchema, BedrockEmbeddingModel, BedrockEmbeddingResponseSchema, modelMaxImagesPerCall, BedrockImageModel, bedrockImageResponseSchema, VERSION2, bedrockRerankingResponseSchema, amazonBedrockRerankingModelOptionsSchema, BedrockRerankingModel, bedrock;
25788
+ var import_internal, import_internal2, import_eventstream_codec, import_util_utf8, import_internal3, BEDROCK_STOP_REASONS, BEDROCK_IMAGE_MIME_TYPES, BEDROCK_DOCUMENT_MIME_TYPES, bedrockFilePartProviderOptions, amazonBedrockLanguageModelOptions, MODELS_REJECTING_NEWER_SCHEMA_FIELDS, BedrockErrorSchema, createBedrockEventStreamResponseHandler, bedrockReasoningMetadataSchema, BedrockChatLanguageModel, JsonObjectTextExtractor, BedrockStopReasonSchema, BedrockAdditionalModelResponseFieldsSchema, BedrockToolUseSchema, BedrockReasoningTextSchema, BedrockRedactedReasoningSchema, BedrockResponseSchema, BedrockStreamSchema, amazonBedrockEmbeddingModelOptionsSchema, BedrockEmbeddingModel, BedrockEmbeddingResponseSchema, modelMaxImagesPerCall, BedrockImageModel, bedrockImageResponseSchema, VERSION2, bedrockRerankingResponseSchema, amazonBedrockRerankingModelOptionsSchema, BedrockRerankingModel, bedrock;
26530
25789
  var init_dist3 = __esm({
26531
25790
  "node_modules/@ai-sdk/amazon-bedrock/dist/index.mjs"() {
26532
25791
  import_internal = require("@ai-sdk/anthropic/internal");
26533
25792
  init_dist2();
26534
25793
  init_dist2();
25794
+ import_internal2 = require("@ai-sdk/anthropic/internal");
26535
25795
  init_v4();
26536
25796
  init_v4();
26537
25797
  init_v4();
26538
25798
  init_dist();
26539
25799
  init_dist2();
26540
- import_eventstream_codec = __toESM(require_dist_cjs5(), 1);
26541
- import_util_utf8 = __toESM(require_dist_cjs6(), 1);
25800
+ import_eventstream_codec = __toESM(require_dist_cjs2(), 1);
25801
+ import_util_utf8 = __toESM(require_dist_cjs3(), 1);
26542
25802
  init_dist();
26543
25803
  init_dist2();
26544
- import_internal2 = require("@ai-sdk/anthropic/internal");
25804
+ import_internal3 = require("@ai-sdk/anthropic/internal");
26545
25805
  init_dist();
26546
25806
  init_dist2();
26547
25807
  init_v4();
@@ -26631,6 +25891,13 @@ var init_dist3 = __esm({
26631
25891
  */
26632
25892
  serviceTier: external_exports.enum(["reserved", "priority", "default", "flex"]).optional()
26633
25893
  });
25894
+ MODELS_REJECTING_NEWER_SCHEMA_FIELDS = [
25895
+ "claude-opus-4-7",
25896
+ "claude-opus-4-8",
25897
+ "claude-opus-5",
25898
+ "claude-fable-5",
25899
+ "claude-sonnet-5"
25900
+ ];
26634
25901
  BedrockErrorSchema = external_exports.object({
26635
25902
  message: external_exports.string(),
26636
25903
  type: external_exports.string().nullish()
@@ -26684,7 +25951,7 @@ var init_dist3 = __esm({
26684
25951
  this.specificationVersion = "v3";
26685
25952
  this.provider = "amazon-bedrock";
26686
25953
  this.supportedUrls = {
26687
- // no supported urls for bedrock
25954
+ "image/*": [/^s3:\/\//]
26688
25955
  };
26689
25956
  }
26690
25957
  async getArgs({
@@ -26751,8 +26018,10 @@ var init_dist3 = __esm({
26751
26018
  }
26752
26019
  const isAnthropicModel = this.modelId.includes("anthropic");
26753
26020
  const isThinkingEnabled = ((_b16 = bedrockOptions.reasoningConfig) == null ? void 0 : _b16.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
26754
- const useNativeStructuredOutput = isAnthropicModel && isThinkingEnabled && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
26755
- const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput ? {
26021
+ const { supportsStructuredOutput: modelSupportsStructuredOutput } = (0, import_internal2.getModelCapabilities)(this.modelId);
26022
+ const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
26023
+ const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8")) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
26024
+ const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
26756
26025
  type: "function",
26757
26026
  name: "json",
26758
26027
  description: "Respond with a JSON object.",
@@ -26862,7 +26131,7 @@ var init_dist3 = __esm({
26862
26131
  ...(_k = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _k.output_config,
26863
26132
  format: {
26864
26133
  type: "json_schema",
26865
- schema: responseFormat.schema
26134
+ schema: (0, import_internal2.sanitizeJsonSchema)(responseFormat.schema)
26866
26135
  }
26867
26136
  }
26868
26137
  };
@@ -26917,6 +26186,13 @@ var init_dist3 = __esm({
26917
26186
  });
26918
26187
  }
26919
26188
  }
26189
+ if (useJsonInstructionForStructuredOutput) {
26190
+ filteredPrompt = injectJsonInstructionIntoMessages({
26191
+ messages: filteredPrompt,
26192
+ schema: responseFormat.schema,
26193
+ schemaSuffix: "You MUST answer with only a JSON object that matches the JSON schema above. Do not wrap it in markdown fences or include any other text."
26194
+ });
26195
+ }
26920
26196
  const isMistral = isMistralModel(this.modelId);
26921
26197
  const { system, messages } = await convertToBedrockChatMessages(
26922
26198
  filteredPrompt,
@@ -26949,6 +26225,7 @@ var init_dist3 = __esm({
26949
26225
  ...toolConfig.tools !== void 0 && toolConfig.tools.length > 0 ? { toolConfig } : {}
26950
26226
  },
26951
26227
  warnings,
26228
+ usesJsonInstruction: useJsonInstructionForStructuredOutput,
26952
26229
  usesJsonResponseTool: jsonResponseTool != null,
26953
26230
  betas
26954
26231
  };
@@ -26959,10 +26236,11 @@ var init_dist3 = __esm({
26959
26236
  return combineHeaders(await resolve(this.config.headers), headers);
26960
26237
  }
26961
26238
  async doGenerate(options) {
26962
- var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
26239
+ var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
26963
26240
  const {
26964
26241
  command: args,
26965
26242
  warnings,
26243
+ usesJsonInstruction,
26966
26244
  usesJsonResponseTool
26967
26245
  } = await this.getArgs(options);
26968
26246
  const url2 = `${this.getUrl(this.modelId)}/converse`;
@@ -26985,9 +26263,13 @@ var init_dist3 = __esm({
26985
26263
  });
26986
26264
  const content = [];
26987
26265
  let isJsonResponseFromTool = false;
26266
+ const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
26988
26267
  for (const part of response.output.message.content) {
26989
26268
  if (part.text != null) {
26990
- content.push({ type: "text", text: part.text });
26269
+ content.push({
26270
+ type: "text",
26271
+ text: (_a17 = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(part.text)) != null ? _a17 : part.text
26272
+ });
26991
26273
  }
26992
26274
  if (part.reasoningContent) {
26993
26275
  if ("reasoningText" in part.reasoningContent) {
@@ -27009,7 +26291,7 @@ var init_dist3 = __esm({
27009
26291
  text: "",
27010
26292
  providerMetadata: {
27011
26293
  bedrock: {
27012
- redactedData: (_a17 = part.reasoningContent.redactedReasoning.data) != null ? _a17 : ""
26294
+ redactedData: (_b16 = part.reasoningContent.redactedReasoning.data) != null ? _b16 : ""
27013
26295
  }
27014
26296
  }
27015
26297
  });
@@ -27025,17 +26307,17 @@ var init_dist3 = __esm({
27025
26307
  });
27026
26308
  } else {
27027
26309
  const isMistral = isMistralModel(this.modelId);
27028
- const rawToolCallId = (_c = (_b16 = part.toolUse) == null ? void 0 : _b16.toolUseId) != null ? _c : this.config.generateId();
26310
+ const rawToolCallId = (_d = (_c = part.toolUse) == null ? void 0 : _c.toolUseId) != null ? _d : this.config.generateId();
27029
26311
  content.push({
27030
26312
  type: "tool-call",
27031
26313
  toolCallId: normalizeToolCallId(rawToolCallId, isMistral),
27032
- toolName: (_e = (_d = part.toolUse) == null ? void 0 : _d.name) != null ? _e : `tool-${this.config.generateId()}`,
27033
- input: JSON.stringify((_g = (_f = part.toolUse) == null ? void 0 : _f.input) != null ? _g : {})
26314
+ toolName: (_f = (_e = part.toolUse) == null ? void 0 : _e.name) != null ? _f : `tool-${this.config.generateId()}`,
26315
+ input: JSON.stringify((_h = (_g = part.toolUse) == null ? void 0 : _g.input) != null ? _h : {})
27034
26316
  });
27035
26317
  }
27036
26318
  }
27037
26319
  }
27038
- const stopSequence = (_j = (_i = (_h = response.additionalModelResponseFields) == null ? void 0 : _h.delta) == null ? void 0 : _i.stop_sequence) != null ? _j : null;
26320
+ const stopSequence = (_k = (_j = (_i = response.additionalModelResponseFields) == null ? void 0 : _i.delta) == null ? void 0 : _j.stop_sequence) != null ? _k : null;
27039
26321
  const providerMetadata = response.trace || response.usage || response.performanceConfig || response.serviceTier || isJsonResponseFromTool || stopSequence ? {
27040
26322
  bedrock: {
27041
26323
  ...response.trace && typeof response.trace === "object" ? { trace: response.trace } : {},
@@ -27045,7 +26327,7 @@ var init_dist3 = __esm({
27045
26327
  ...response.serviceTier && {
27046
26328
  serviceTier: response.serviceTier
27047
26329
  },
27048
- ...(((_k = response.usage) == null ? void 0 : _k.cacheWriteInputTokens) != null || ((_l = response.usage) == null ? void 0 : _l.cacheDetails) != null) && {
26330
+ ...(((_l = response.usage) == null ? void 0 : _l.cacheWriteInputTokens) != null || ((_m = response.usage) == null ? void 0 : _m.cacheDetails) != null) && {
27049
26331
  usage: {
27050
26332
  ...response.usage.cacheWriteInputTokens != null && {
27051
26333
  cacheWriteInputTokens: response.usage.cacheWriteInputTokens
@@ -27066,16 +26348,17 @@ var init_dist3 = __esm({
27066
26348
  response.stopReason,
27067
26349
  isJsonResponseFromTool
27068
26350
  ),
27069
- raw: (_m = response.stopReason) != null ? _m : void 0
26351
+ raw: (_n = response.stopReason) != null ? _n : void 0
27070
26352
  },
27071
26353
  usage: convertBedrockUsage(response.usage),
27072
26354
  response: {
27073
- id: (_n = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _n : void 0,
26355
+ id: (_o = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _o : void 0,
27074
26356
  timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
27075
26357
  modelId: this.modelId,
27076
26358
  headers: responseHeaders
27077
26359
  },
27078
26360
  warnings,
26361
+ request: { body: args },
27079
26362
  ...providerMetadata && { providerMetadata }
27080
26363
  };
27081
26364
  }
@@ -27083,6 +26366,7 @@ var init_dist3 = __esm({
27083
26366
  const {
27084
26367
  command: args,
27085
26368
  warnings,
26369
+ usesJsonInstruction,
27086
26370
  usesJsonResponseTool
27087
26371
  } = await this.getArgs(options);
27088
26372
  const modelId = this.modelId;
@@ -27108,6 +26392,7 @@ var init_dist3 = __esm({
27108
26392
  let providerMetadata = void 0;
27109
26393
  let isJsonResponseFromTool = false;
27110
26394
  let stopSequence = null;
26395
+ const jsonObjectTextExtractor = usesJsonInstruction ? new JsonObjectTextExtractor() : void 0;
27111
26396
  const contentBlocks = {};
27112
26397
  return {
27113
26398
  stream: response.pipeThrough(
@@ -27123,7 +26408,7 @@ var init_dist3 = __esm({
27123
26408
  });
27124
26409
  },
27125
26410
  transform(chunk, controller) {
27126
- var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
26411
+ var _a17, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
27127
26412
  function enqueueError(bedrockError) {
27128
26413
  finishReason = { unified: "error", raw: void 0 };
27129
26414
  controller.enqueue({ type: "error", error: bedrockError });
@@ -27211,13 +26496,18 @@ var init_dist3 = __esm({
27211
26496
  id: String(blockIndex)
27212
26497
  });
27213
26498
  }
27214
- controller.enqueue({
27215
- type: "text-delta",
27216
- id: String(blockIndex),
27217
- delta: value.contentBlockDelta.delta.text
27218
- });
26499
+ const textDelta = (_m = jsonObjectTextExtractor == null ? void 0 : jsonObjectTextExtractor.process(
26500
+ value.contentBlockDelta.delta.text
26501
+ )) != null ? _m : value.contentBlockDelta.delta.text;
26502
+ if (textDelta.length > 0) {
26503
+ controller.enqueue({
26504
+ type: "text-delta",
26505
+ id: String(blockIndex),
26506
+ delta: textDelta
26507
+ });
26508
+ }
27219
26509
  }
27220
- if (((_m = value.contentBlockStop) == null ? void 0 : _m.contentBlockIndex) != null) {
26510
+ if (((_n = value.contentBlockStop) == null ? void 0 : _n.contentBlockIndex) != null) {
27221
26511
  const blockIndex = value.contentBlockStop.contentBlockIndex;
27222
26512
  const contentBlock = contentBlocks[blockIndex];
27223
26513
  if (contentBlock != null) {
@@ -27263,7 +26553,7 @@ var init_dist3 = __esm({
27263
26553
  delete contentBlocks[blockIndex];
27264
26554
  }
27265
26555
  }
27266
- if (((_n = value.contentBlockDelta) == null ? void 0 : _n.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
26556
+ if (((_o = value.contentBlockDelta) == null ? void 0 : _o.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
27267
26557
  const blockIndex = value.contentBlockDelta.contentBlockIndex || 0;
27268
26558
  const reasoningContent = value.contentBlockDelta.delta.reasoningContent;
27269
26559
  if ("text" in reasoningContent && reasoningContent.text) {
@@ -27318,7 +26608,7 @@ var init_dist3 = __esm({
27318
26608
  }
27319
26609
  }
27320
26610
  const contentBlockStart = value.contentBlockStart;
27321
- if (((_o = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _o.toolUse) != null) {
26611
+ if (((_p = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _p.toolUse) != null) {
27322
26612
  const toolUse = contentBlockStart.start.toolUse;
27323
26613
  const blockIndex = contentBlockStart.contentBlockIndex;
27324
26614
  const isJsonResponseTool = usesJsonResponseTool && toolUse.name === "json";
@@ -27346,7 +26636,7 @@ var init_dist3 = __esm({
27346
26636
  const blockIndex = contentBlockDelta.contentBlockIndex;
27347
26637
  const contentBlock = contentBlocks[blockIndex];
27348
26638
  if ((contentBlock == null ? void 0 : contentBlock.type) === "tool-call") {
27349
- const delta = (_p = contentBlockDelta.delta.toolUse.input) != null ? _p : "";
26639
+ const delta = (_q = contentBlockDelta.delta.toolUse.input) != null ? _q : "";
27350
26640
  if (!contentBlock.isJsonResponseTool) {
27351
26641
  controller.enqueue({
27352
26642
  type: "tool-input-delta",
@@ -27388,13 +26678,63 @@ var init_dist3 = __esm({
27388
26678
  }
27389
26679
  })
27390
26680
  ),
27391
- // TODO request?
26681
+ request: { body: args },
27392
26682
  response: { headers: responseHeaders }
27393
26683
  };
27394
26684
  }
27395
26685
  getUrl(modelId) {
27396
- const encodedModelId = encodeURIComponent(modelId);
27397
- return `${this.config.baseUrl()}/model/${encodedModelId}`;
26686
+ return `${this.config.baseUrl()}/model/${encodeURIComponent(modelId)}`;
26687
+ }
26688
+ };
26689
+ JsonObjectTextExtractor = class {
26690
+ constructor() {
26691
+ this.started = false;
26692
+ this.completed = false;
26693
+ this.depth = 0;
26694
+ this.inString = false;
26695
+ this.escaped = false;
26696
+ }
26697
+ process(text) {
26698
+ let result = "";
26699
+ for (const character of text) {
26700
+ if (this.completed) {
26701
+ break;
26702
+ }
26703
+ if (!this.started) {
26704
+ if (character !== "{") {
26705
+ continue;
26706
+ }
26707
+ this.started = true;
26708
+ this.depth = 1;
26709
+ result += character;
26710
+ continue;
26711
+ }
26712
+ result += character;
26713
+ if (this.escaped) {
26714
+ this.escaped = false;
26715
+ continue;
26716
+ }
26717
+ if (character === "\\" && this.inString) {
26718
+ this.escaped = true;
26719
+ continue;
26720
+ }
26721
+ if (character === '"') {
26722
+ this.inString = !this.inString;
26723
+ continue;
26724
+ }
26725
+ if (this.inString) {
26726
+ continue;
26727
+ }
26728
+ if (character === "{") {
26729
+ this.depth++;
26730
+ } else if (character === "}") {
26731
+ this.depth--;
26732
+ if (this.depth === 0) {
26733
+ this.completed = true;
26734
+ }
26735
+ }
26736
+ }
26737
+ return result;
27398
26738
  }
27399
26739
  };
27400
26740
  BedrockStopReasonSchema = external_exports.union([
@@ -27559,9 +26899,11 @@ var init_dist3 = __esm({
27559
26899
  this.config = config2;
27560
26900
  this.specificationVersion = "v3";
27561
26901
  this.provider = "amazon-bedrock";
27562
- this.maxEmbeddingsPerCall = 1;
27563
26902
  this.supportsParallelCalls = true;
27564
26903
  }
26904
+ get maxEmbeddingsPerCall() {
26905
+ return isCohereEmbeddingModel(this.modelId) ? 96 : 1;
26906
+ }
27565
26907
  getUrl(modelId) {
27566
26908
  const encodedModelId = encodeURIComponent(modelId);
27567
26909
  return `${this.config.baseUrl()}/model/${encodedModelId}/invoke`;
@@ -27586,8 +26928,8 @@ var init_dist3 = __esm({
27586
26928
  providerOptions,
27587
26929
  schema: amazonBedrockEmbeddingModelOptionsSchema
27588
26930
  })) != null ? _a17 : {};
27589
- const isNovaModel = this.modelId.startsWith("amazon.nova-") && this.modelId.includes("embed");
27590
- const isCohereModel = this.modelId.startsWith("cohere.embed-");
26931
+ const isNovaModel = isNovaEmbeddingModel(this.modelId);
26932
+ const isCohereModel = isCohereEmbeddingModel(this.modelId);
27591
26933
  const args = isNovaModel ? {
27592
26934
  taskType: "SINGLE_EMBEDDING",
27593
26935
  singleEmbeddingParams: {
@@ -27602,7 +26944,7 @@ var init_dist3 = __esm({
27602
26944
  // Cohere embedding models on Bedrock require `input_type`.
27603
26945
  // Without it, the service attempts other schema branches and rejects the request.
27604
26946
  input_type: (_e = bedrockOptions.inputType) != null ? _e : "search_query",
27605
- texts: [values2[0]],
26947
+ texts: values2,
27606
26948
  truncate: bedrockOptions.truncate,
27607
26949
  output_dimension: bedrockOptions.outputDimension
27608
26950
  } : {
@@ -27611,7 +26953,7 @@ var init_dist3 = __esm({
27611
26953
  normalize: bedrockOptions.normalize
27612
26954
  };
27613
26955
  const url2 = this.getUrl(this.modelId);
27614
- const { value: response } = await postJsonToApi({
26956
+ const { value: response, responseHeaders } = await postJsonToApi({
27615
26957
  url: url2,
27616
26958
  headers: await resolve(
27617
26959
  combineHeaders(await resolve(this.config.headers), headers)
@@ -27627,22 +26969,25 @@ var init_dist3 = __esm({
27627
26969
  fetch: this.config.fetch,
27628
26970
  abortSignal
27629
26971
  });
27630
- let embedding;
26972
+ let embeddings;
27631
26973
  if ("embedding" in response) {
27632
- embedding = response.embedding;
26974
+ embeddings = [response.embedding];
27633
26975
  } else if (Array.isArray(response.embeddings)) {
27634
26976
  const firstEmbedding = response.embeddings[0];
27635
26977
  if (typeof firstEmbedding === "object" && firstEmbedding !== null && "embeddingType" in firstEmbedding) {
27636
- embedding = firstEmbedding.embedding;
26978
+ embeddings = [firstEmbedding.embedding];
27637
26979
  } else {
27638
- embedding = firstEmbedding;
26980
+ embeddings = response.embeddings;
27639
26981
  }
27640
26982
  } else {
27641
- embedding = response.embeddings.float[0];
26983
+ embeddings = response.embeddings.float;
27642
26984
  }
27643
- const tokens = "inputTextTokenCount" in response ? response.inputTextTokenCount : "inputTokenCount" in response ? (_f = response.inputTokenCount) != null ? _f : 0 : NaN;
26985
+ const headerTokenCount = Number(
26986
+ responseHeaders == null ? void 0 : responseHeaders["x-amzn-bedrock-input-token-count"]
26987
+ );
26988
+ const tokens = "inputTextTokenCount" in response ? response.inputTextTokenCount : "inputTokenCount" in response ? (_f = response.inputTokenCount) != null ? _f : 0 : headerTokenCount;
27644
26989
  return {
27645
- embeddings: [embedding],
26990
+ embeddings,
27646
26991
  usage: { tokens },
27647
26992
  warnings: []
27648
26993
  };
@@ -27863,7 +27208,7 @@ var init_dist3 = __esm({
27863
27208
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
27864
27209
  preview: external_exports.unknown().optional()
27865
27210
  });
27866
- VERSION2 = true ? "4.0.112" : "0.0.0-test";
27211
+ VERSION2 = true ? "4.0.144" : "0.0.0-test";
27867
27212
  bedrockRerankingResponseSchema = lazySchema(
27868
27213
  () => zodSchema(
27869
27214
  external_exports.object({
@@ -28168,7 +27513,7 @@ function tryConvertToString(arr) {
28168
27513
  if (!isValidUTF8(arr)) {
28169
27514
  return void 0;
28170
27515
  }
28171
- return textDecoder.decode(arr);
27516
+ return textDecoder2.decode(arr);
28172
27517
  }
28173
27518
  function compareUint8Arrays(a, b) {
28174
27519
  const len = Math.min(a.length, b.length);
@@ -28179,13 +27524,13 @@ function compareUint8Arrays(a, b) {
28179
27524
  }
28180
27525
  return a.length - b.length;
28181
27526
  }
28182
- var isAscii, HIGH_SURROGATE_START, HIGH_SURROGATE_END, textDecoder;
27527
+ var isAscii, HIGH_SURROGATE_START, HIGH_SURROGATE_END, textDecoder2;
28183
27528
  var init_utfUtil = __esm({
28184
27529
  "node_modules/gpt-tokenizer/esm/utfUtil.js"() {
28185
27530
  isAscii = (codePoint) => codePoint <= 127;
28186
27531
  HIGH_SURROGATE_START = 55296;
28187
27532
  HIGH_SURROGATE_END = 56319;
28188
- textDecoder = new TextDecoder("utf8", { fatal: false });
27533
+ textDecoder2 = new TextDecoder("utf8", { fatal: false });
28189
27534
  }
28190
27535
  });
28191
27536
 
@@ -32420,6 +31765,8 @@ var require_brace_expansion = __commonJS({
32420
31765
  var escClose = "\0CLOSE" + Math.random() + "\0";
32421
31766
  var escComma = "\0COMMA" + Math.random() + "\0";
32422
31767
  var escPeriod = "\0PERIOD" + Math.random() + "\0";
31768
+ var EXPANSION_MAX = 1e5;
31769
+ var EXPANSION_MAX_LENGTH = 4e6;
32423
31770
  function numeric(str) {
32424
31771
  return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
32425
31772
  }
@@ -32453,11 +31800,12 @@ var require_brace_expansion = __commonJS({
32453
31800
  if (!str)
32454
31801
  return [];
32455
31802
  options = options || {};
32456
- var max = options.max == null ? Infinity : options.max;
31803
+ var max = options.max == null ? EXPANSION_MAX : options.max;
31804
+ var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
32457
31805
  if (str.substr(0, 2) === "{}") {
32458
31806
  str = "\\{\\}" + str.substr(2);
32459
31807
  }
32460
- return expand2(escapeBraces(str), max, true).map(unescapeBraces);
31808
+ return expand2(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
32461
31809
  }
32462
31810
  function embrace(str) {
32463
31811
  return "{" + str + "}";
@@ -32471,18 +31819,90 @@ var require_brace_expansion = __commonJS({
32471
31819
  function gte(i, y) {
32472
31820
  return i >= y;
32473
31821
  }
32474
- function expand2(str, max, isTop) {
32475
- var expansions = [];
32476
- var m = balanced("{", "}", str);
32477
- if (!m) return [str];
32478
- var pre = m.pre;
32479
- var post = m.post.length ? expand2(m.post, max, false) : [""];
32480
- if (/\$$/.test(m.pre)) {
32481
- for (var k = 0; k < post.length && k < max; k++) {
32482
- var expansion = pre + "{" + m.body + "}" + post[k];
32483
- expansions.push(expansion);
31822
+ function combine(acc, pre, values2, max, maxLength, dropEmpties) {
31823
+ var out = [];
31824
+ var length = 0;
31825
+ for (var a = 0; a < acc.length; a++) {
31826
+ for (var v = 0; v < values2.length; v++) {
31827
+ if (out.length >= max) return out;
31828
+ var expansion = acc[a] + pre + values2[v];
31829
+ if (dropEmpties && !expansion) continue;
31830
+ if (length + expansion.length > maxLength) return out;
31831
+ out.push(expansion);
31832
+ length += expansion.length;
31833
+ }
31834
+ }
31835
+ return out;
31836
+ }
31837
+ function expandSequence(body, isAlphaSequence, max, maxLength) {
31838
+ var n = body.split(/\.\./);
31839
+ var N = [];
31840
+ if (n[0] === void 0 || n[1] === void 0) {
31841
+ return N;
31842
+ }
31843
+ var x = numeric(n[0]);
31844
+ var y = numeric(n[1]);
31845
+ var width = Math.max(n[0].length, n[1].length);
31846
+ var incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
31847
+ var test = lte;
31848
+ var reverse = y < x;
31849
+ if (reverse) {
31850
+ incr *= -1;
31851
+ test = gte;
31852
+ }
31853
+ var pad = n.some(isPadded);
31854
+ var length = 0;
31855
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
31856
+ var c;
31857
+ if (isAlphaSequence) {
31858
+ c = String.fromCharCode(i);
31859
+ if (c === "\\") {
31860
+ c = "";
31861
+ }
31862
+ } else {
31863
+ c = String(i);
31864
+ if (pad) {
31865
+ var need = width - c.length;
31866
+ if (need > 0) {
31867
+ var z = new Array(need + 1).join("0");
31868
+ if (i < 0) {
31869
+ c = "-" + z + c.slice(1);
31870
+ } else {
31871
+ c = z + c;
31872
+ }
31873
+ }
31874
+ }
31875
+ }
31876
+ if (length + c.length > maxLength) break;
31877
+ N.push(c);
31878
+ length += c.length;
31879
+ }
31880
+ return N;
31881
+ }
31882
+ function expand2(str, max, maxLength, isTop) {
31883
+ var acc = [""];
31884
+ var dropEmpties = false;
31885
+ var firstGroup = true;
31886
+ for (; ; ) {
31887
+ const m = balanced("{", "}", str);
31888
+ if (!m) {
31889
+ return combine(acc, str, [""], max, maxLength, dropEmpties);
31890
+ }
31891
+ const pre = m.pre;
31892
+ if (/\$$/.test(pre)) {
31893
+ acc = combine(
31894
+ acc,
31895
+ pre + "{" + m.body + "}",
31896
+ [""],
31897
+ max,
31898
+ maxLength,
31899
+ dropEmpties && !m.post.length
31900
+ );
31901
+ firstGroup = false;
31902
+ if (!m.post.length) break;
31903
+ str = m.post;
31904
+ continue;
32484
31905
  }
32485
- } else {
32486
31906
  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
32487
31907
  var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
32488
31908
  var isSequence = isNumericSequence || isAlphaSequence;
@@ -32490,74 +31910,69 @@ var require_brace_expansion = __commonJS({
32490
31910
  if (!isSequence && !isOptions) {
32491
31911
  if (m.post.match(/,(?!,).*\}/)) {
32492
31912
  str = m.pre + "{" + m.body + escClose + m.post;
32493
- return expand2(str, max, true);
31913
+ isTop = true;
31914
+ continue;
32494
31915
  }
32495
- return [str];
31916
+ return combine(
31917
+ acc,
31918
+ pre + "{" + m.body + "}" + m.post,
31919
+ [""],
31920
+ max,
31921
+ maxLength,
31922
+ dropEmpties
31923
+ );
31924
+ }
31925
+ if (firstGroup) {
31926
+ dropEmpties = isTop && !isSequence;
31927
+ firstGroup = false;
32496
31928
  }
32497
- var n;
31929
+ var values2;
32498
31930
  if (isSequence) {
32499
- n = m.body.split(/\.\./);
31931
+ values2 = expandSequence(m.body, isAlphaSequence, max, maxLength);
32500
31932
  } else {
32501
- n = parseCommaParts(m.body);
32502
- if (n.length === 1) {
32503
- n = expand2(n[0], max, false).map(embrace);
31933
+ var n = parseCommaParts(m.body);
31934
+ if (n.length === 1 && n[0] !== void 0) {
31935
+ n = expand2(n[0], max, maxLength, false).map(embrace);
32504
31936
  if (n.length === 1) {
32505
- return post.map(function(p) {
32506
- return m.pre + n[0] + p;
32507
- });
31937
+ acc = combine(
31938
+ acc,
31939
+ pre + n[0],
31940
+ [""],
31941
+ max,
31942
+ maxLength,
31943
+ dropEmpties && !m.post.length
31944
+ );
31945
+ if (!m.post.length) break;
31946
+ str = m.post;
31947
+ continue;
32508
31948
  }
32509
31949
  }
32510
- }
32511
- var N;
32512
- if (isSequence) {
32513
- var x = numeric(n[0]);
32514
- var y = numeric(n[1]);
32515
- var width = Math.max(n[0].length, n[1].length);
32516
- var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
32517
- var test = lte;
32518
- var reverse = y < x;
32519
- if (reverse) {
32520
- incr *= -1;
32521
- test = gte;
32522
- }
32523
- var pad = n.some(isPadded);
32524
- N = [];
32525
- for (var i = x; test(i, y) && N.length < max; i += incr) {
32526
- var c;
32527
- if (isAlphaSequence) {
32528
- c = String.fromCharCode(i);
32529
- if (c === "\\")
32530
- c = "";
32531
- } else {
32532
- c = String(i);
32533
- if (pad) {
32534
- var need = width - c.length;
32535
- if (need > 0) {
32536
- var z = new Array(need + 1).join("0");
32537
- if (i < 0)
32538
- c = "-" + z + c.slice(1);
32539
- else
32540
- c = z + c;
32541
- }
32542
- }
31950
+ var dropsEmpties = dropEmpties && !m.post.length && !pre;
31951
+ for (var d = 0; dropsEmpties && d < acc.length; d++) {
31952
+ if (acc[d]) {
31953
+ dropsEmpties = false;
32543
31954
  }
32544
- N.push(c);
32545
31955
  }
32546
- } else {
32547
- N = [];
32548
- for (var j = 0; j < n.length; j++) {
32549
- N.push.apply(N, expand2(n[j], max, false));
32550
- }
32551
- }
32552
- for (var j = 0; j < N.length; j++) {
32553
- for (var k = 0; k < post.length && expansions.length < max; k++) {
32554
- var expansion = pre + N[j] + post[k];
32555
- if (!isTop || isSequence || expansion)
32556
- expansions.push(expansion);
31956
+ values2 = [];
31957
+ var valuesLength = 0;
31958
+ outer: for (var j = 0; j < n.length; j++) {
31959
+ var expanded = expand2(n[j], max, maxLength, false);
31960
+ for (var k = 0; k < expanded.length; k++) {
31961
+ var v = expanded[k];
31962
+ if (dropsEmpties && !v) continue;
31963
+ if (values2.length >= max || valuesLength + v.length > maxLength) {
31964
+ break outer;
31965
+ }
31966
+ values2.push(v);
31967
+ valuesLength += v.length;
31968
+ }
32557
31969
  }
32558
31970
  }
31971
+ acc = combine(acc, pre, values2, max, maxLength, dropEmpties && !m.post.length);
31972
+ if (!m.post.length) break;
31973
+ str = m.post;
32559
31974
  }
32560
- return expansions;
31975
+ return acc;
32561
31976
  }
32562
31977
  }
32563
31978
  });
@@ -73830,6 +73245,7 @@ var require_fast_uri = __commonJS({
73830
73245
  return uriTokens.join("");
73831
73246
  }
73832
73247
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
73248
+ var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
73833
73249
  function getParseError(parsed, matches) {
73834
73250
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
73835
73251
  return 'URI path must start with "/" when authority is present.';
@@ -73859,6 +73275,11 @@ var require_fast_uri = __commonJS({
73859
73275
  uri = "//" + uri;
73860
73276
  }
73861
73277
  }
73278
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
73279
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
73280
+ parsed.error = "URI authority must not contain a literal backslash.";
73281
+ malformedAuthorityOrPort = true;
73282
+ }
73862
73283
  const matches = uri.match(URI_PARSE);
73863
73284
  if (matches) {
73864
73285
  parsed.scheme = matches[1];
@@ -73902,7 +73323,7 @@ var require_fast_uri = __commonJS({
73902
73323
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
73903
73324
  if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
73904
73325
  try {
73905
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
73326
+ parsed.host = new URL("http://" + parsed.host).hostname;
73906
73327
  } catch (e) {
73907
73328
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
73908
73329
  }
@@ -78628,11 +78049,11 @@ function createHttpTransport(url2) {
78628
78049
  }
78629
78050
  };
78630
78051
  }
78631
- var import_client2, import_stdio, import_sse, import_websocket, MCPClientManager;
78632
- var init_client2 = __esm({
78052
+ var import_client, import_stdio, import_sse, import_websocket, MCPClientManager;
78053
+ var init_client = __esm({
78633
78054
  "src/agent/mcp/client.js"() {
78634
78055
  "use strict";
78635
- import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
78056
+ import_client = require("@modelcontextprotocol/sdk/client/index.js");
78636
78057
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
78637
78058
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
78638
78059
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
@@ -78743,7 +78164,7 @@ var init_client2 = __esm({
78743
78164
  console.error(`[MCP DEBUG] Connecting to ${name15} via ${serverConfig.transport}...`);
78744
78165
  }
78745
78166
  const transport = createTransport(serverConfig);
78746
- const client = new import_client2.Client(
78167
+ const client = new import_client.Client(
78747
78168
  {
78748
78169
  name: `probe-client-${name15}`,
78749
78170
  version: "1.0.0"
@@ -79126,7 +78547,7 @@ var MCPXmlBridge;
79126
78547
  var init_xmlBridge = __esm({
79127
78548
  "src/agent/mcp/xmlBridge.js"() {
79128
78549
  "use strict";
79129
- init_client2();
78550
+ init_client();
79130
78551
  init_config2();
79131
78552
  MCPXmlBridge = class {
79132
78553
  constructor(options = {}) {
@@ -79253,10 +78674,10 @@ var init_xmlBridge = __esm({
79253
78674
  var init_mcp = __esm({
79254
78675
  "src/agent/mcp/index.js"() {
79255
78676
  "use strict";
79256
- init_client2();
78677
+ init_client();
79257
78678
  init_config2();
79258
78679
  init_xmlBridge();
79259
- init_client2();
78680
+ init_client();
79260
78681
  init_config2();
79261
78682
  init_xmlBridge();
79262
78683
  }
@@ -86980,12 +86401,13 @@ function isRetryableError(error40, retryableErrors = DEFAULT_RETRYABLE_ERRORS) {
86980
86401
  if (!error40) return false;
86981
86402
  const errorString = error40.toString().toLowerCase();
86982
86403
  const errorMessage = (error40.message || "").toLowerCase();
86404
+ const errorName = (error40.name || error40.constructor?.name || "").toLowerCase();
86983
86405
  const errorCode = (error40.code || "").toLowerCase();
86984
86406
  const errorType = (error40.type || "").toLowerCase();
86985
86407
  const statusCode = error40.statusCode || error40.status;
86986
86408
  for (const pattern of retryableErrors) {
86987
86409
  const lowerPattern = pattern.toLowerCase();
86988
- if (errorString.includes(lowerPattern) || errorMessage.includes(lowerPattern) || errorCode.includes(lowerPattern) || errorType.includes(lowerPattern) || statusCode?.toString() === pattern) {
86410
+ if (errorString.includes(lowerPattern) || errorMessage.includes(lowerPattern) || errorName.includes(lowerPattern) || errorCode.includes(lowerPattern) || errorType.includes(lowerPattern) || statusCode?.toString() === pattern) {
86989
86411
  return true;
86990
86412
  }
86991
86413
  }
@@ -87022,7 +86444,9 @@ var init_RetryManager = __esm({
87022
86444
  "ECONNRESET",
87023
86445
  "ETIMEDOUT",
87024
86446
  "ENOTFOUND",
87025
- "api_error"
86447
+ "api_error",
86448
+ "No output generated",
86449
+ "AI_NoOutputGeneratedError"
87026
86450
  ];
87027
86451
  RetryManager = class {
87028
86452
  /**
@@ -87042,7 +86466,7 @@ var init_RetryManager = __esm({
87042
86466
  this.backoffFactor = this._validateNumber(options.backoffFactor, 2, "backoffFactor", 1, 10);
87043
86467
  this.retryableErrors = options.retryableErrors || DEFAULT_RETRYABLE_ERRORS;
87044
86468
  this.debug = options.debug ?? false;
87045
- this.jitter = options.jitter ?? true;
86469
+ this.jitter = typeof options.jitter === "boolean" ? options.jitter : true;
87046
86470
  if (this.maxDelay < this.initialDelay) {
87047
86471
  throw new Error("maxDelay must be greater than or equal to initialDelay");
87048
86472
  }
@@ -88837,16 +88261,38 @@ var require_executor = __commonJS({
88837
88261
  });
88838
88262
  addOps(39, (exec6, done, ticks, a, b, obj, context, scope, bobj, inLoopOrSwitch) => {
88839
88263
  const [exception, catchBody, finallyBody] = b;
88840
- executeTreeWithDone(exec6, (err, res) => {
88841
- executeTreeWithDone(exec6, (e) => {
88842
- if (e)
88843
- done(e);
88844
- else if (err) {
88845
- executeTreeWithDone(exec6, done, ticks, context, catchBody, [new utils.Scope(scope)], inLoopOrSwitch);
88264
+ executeTreeWithDone(exec6, (tryErr, tryRes) => {
88265
+ const afterTryCatch = (resultErr, resultRes) => {
88266
+ executeTreeWithDone(exec6, (finallyErr) => {
88267
+ if (finallyErr)
88268
+ done(finallyErr);
88269
+ else if (resultErr)
88270
+ done(resultErr);
88271
+ else if (resultRes instanceof ExecReturn && (resultRes.returned || resultRes.breakLoop || resultRes.continueLoop)) {
88272
+ done(void 0, resultRes);
88273
+ } else {
88274
+ done();
88275
+ }
88276
+ }, ticks, context, finallyBody, [new utils.Scope(scope, {})]);
88277
+ };
88278
+ if (tryErr) {
88279
+ if (catchBody) {
88280
+ const sc = {};
88281
+ if (exception)
88282
+ sc[exception] = tryErr;
88283
+ executeTreeWithDone(exec6, (catchErr, catchRes) => {
88284
+ if (catchErr) {
88285
+ afterTryCatch(catchErr, void 0);
88286
+ } else {
88287
+ afterTryCatch(void 0, catchRes);
88288
+ }
88289
+ }, ticks, context, catchBody, [new utils.Scope(scope, sc)], inLoopOrSwitch);
88846
88290
  } else {
88847
- done(void 0, res);
88291
+ afterTryCatch(tryErr, void 0);
88848
88292
  }
88849
- }, ticks, context, finallyBody, [new utils.Scope(scope, {})]);
88293
+ } else {
88294
+ afterTryCatch(void 0, tryRes);
88295
+ }
88850
88296
  }, ticks, context, a, [new utils.Scope(scope)], inLoopOrSwitch);
88851
88297
  });
88852
88298
  addOps(88, (exec6, done) => {
@@ -90235,7 +89681,7 @@ var require_parser2 = __commonJS({
90235
89681
  let offset2 = 0;
90236
89682
  if (catchRes[1].startsWith("catch")) {
90237
89683
  catchRes = catchReg.exec(part.substring(res[0].length + body.length + 1).toString());
90238
- exception = catchRes[2];
89684
+ exception = catchRes[3] || "";
90239
89685
  catchBody = restOfExp(constants, part.substring(res[0].length + body.length + 1 + catchRes[0].length), [], "{");
90240
89686
  offset2 = res[0].length + body.length + 1 + catchRes[0].length + catchBody.length + 1;
90241
89687
  if ((catchRes = catchReg.exec(part.substring(offset2).toString())) && catchRes[1].startsWith("finally")) {
@@ -90246,7 +89692,7 @@ var require_parser2 = __commonJS({
90246
89692
  }
90247
89693
  const b = [
90248
89694
  exception,
90249
- lispifyBlock(insertSemicolons(constants, catchBody || emptyString), constants),
89695
+ catchBody !== void 0 ? lispifyBlock(insertSemicolons(constants, catchBody || emptyString), constants) : null,
90250
89696
  lispifyBlock(insertSemicolons(constants, finallyBody || emptyString), constants)
90251
89697
  ];
90252
89698
  ctx.lispTree = createLisp({
@@ -91424,6 +90870,9 @@ var init_acorn = __esm({
91424
90870
  // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
91425
90871
  // strict mode and parsing of `import` and `export` declarations.
91426
90872
  sourceType: "script",
90873
+ // When set to true, enable strict parsing mode even if `sourceType`
90874
+ // is `"script"`.
90875
+ strict: false,
91427
90876
  // `onInsertedSemicolon` can be a callback that will be called when
91428
90877
  // a semicolon is automatically inserted. It will be passed the
91429
90878
  // position of the inserted semicolon as an offset, and if
@@ -91465,6 +90914,11 @@ var init_acorn = __esm({
91465
90914
  // line being 1-based and column 0-based) will be attached to the
91466
90915
  // nodes.
91467
90916
  locations: false,
90917
+ // Pass an optional `{line, column}` object to use for the start of
90918
+ // the parse. This is mostly useful when using `parseExpressionAt`
90919
+ // with `locations: true`, to prevent the parser from having to
90920
+ // determine the line position at the start position.
90921
+ startLocation: null,
91468
90922
  // A function can be passed as `onToken` option, which will
91469
90923
  // cause Acorn to call that function with object in the same
91470
90924
  // format as tokens returned from `tokenizer().getToken()`. Note
@@ -91545,13 +90999,18 @@ var init_acorn = __esm({
91545
90999
  this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
91546
91000
  this.input = String(input);
91547
91001
  this.containsEsc = false;
91548
- if (startPos) {
91549
- this.pos = startPos;
91002
+ this.pos = startPos || 0;
91003
+ this.curLine = 1;
91004
+ if (options.startLocation) {
91005
+ this.lineStart = this.pos - options.startLocation.column;
91006
+ this.curLine = options.startLocation.line;
91007
+ } else if (startPos) {
91550
91008
  this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
91551
- this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
91009
+ if (this.options.locations) {
91010
+ this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;
91011
+ }
91552
91012
  } else {
91553
- this.pos = this.lineStart = 0;
91554
- this.curLine = 1;
91013
+ this.lineStart = 0;
91555
91014
  }
91556
91015
  this.type = types$1.eof;
91557
91016
  this.value = null;
@@ -91562,7 +91021,7 @@ var init_acorn = __esm({
91562
91021
  this.context = this.initialContext();
91563
91022
  this.exprAllowed = true;
91564
91023
  this.inModule = options.sourceType === "module";
91565
- this.strict = this.inModule || this.strictDirective(this.pos);
91024
+ this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);
91566
91025
  this.potentialArrowAt = -1;
91567
91026
  this.potentialArrowInForAwait = false;
91568
91027
  this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
@@ -91580,9 +91039,12 @@ var init_acorn = __esm({
91580
91039
  };
91581
91040
  prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowReturn: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, allowUsing: { configurable: true }, inClassStaticBlock: { configurable: true } };
91582
91041
  Parser2.prototype.parse = function parse8() {
91042
+ var this$1$1 = this;
91583
91043
  var node = this.options.program || this.startNode();
91584
91044
  this.nextToken();
91585
- return this.parseTopLevel(node);
91045
+ return this.catchStackOverflow(function() {
91046
+ return this$1$1.parseTopLevel(node);
91047
+ });
91586
91048
  };
91587
91049
  prototypeAccessors.inFunction.get = function() {
91588
91050
  return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
@@ -91716,6 +91178,17 @@ var init_acorn = __esm({
91716
91178
  this.next();
91717
91179
  return true;
91718
91180
  };
91181
+ pp$9.catchStackOverflow = function(f) {
91182
+ try {
91183
+ return f();
91184
+ } catch (e) {
91185
+ if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) {
91186
+ this.raise(this.start, "Not enough stack space to parse input");
91187
+ } else {
91188
+ throw e;
91189
+ }
91190
+ }
91191
+ };
91719
91192
  pp$9.expectContextual = function(name15) {
91720
91193
  if (!this.eatContextual(name15)) {
91721
91194
  this.unexpected();
@@ -91801,12 +91274,12 @@ var init_acorn = __esm({
91801
91274
  };
91802
91275
  pp$8 = Parser2.prototype;
91803
91276
  pp$8.parseTopLevel = function(node) {
91804
- var exports2 = /* @__PURE__ */ Object.create(null);
91277
+ var exports$1 = /* @__PURE__ */ Object.create(null);
91805
91278
  if (!node.body) {
91806
91279
  node.body = [];
91807
91280
  }
91808
91281
  while (this.type !== types$1.eof) {
91809
- var stmt = this.parseStatement(null, true, exports2);
91282
+ var stmt = this.parseStatement(null, true, exports$1);
91810
91283
  node.body.push(stmt);
91811
91284
  }
91812
91285
  if (this.inModule) {
@@ -91896,9 +91369,18 @@ var init_acorn = __esm({
91896
91369
  return true;
91897
91370
  }
91898
91371
  var id = this.input.slice(idStart, next);
91899
- if (keywordRelationalOperator.test(id) || isFor && id === "of") {
91372
+ if (keywordRelationalOperator.test(id)) {
91900
91373
  return false;
91901
91374
  }
91375
+ if (isFor && !isAwaitUsing && id === "of") {
91376
+ skipWhiteSpace.lastIndex = next;
91377
+ var skipAfterOf = skipWhiteSpace.exec(this.input);
91378
+ next = next + skipAfterOf[0].length;
91379
+ if (this.input.charCodeAt(next) !== 61 || // Check for ==, === and => operators
91380
+ (ch = this.input.charCodeAt(next + 1)) === 61 || ch === 62) {
91381
+ return false;
91382
+ }
91383
+ }
91902
91384
  return true;
91903
91385
  };
91904
91386
  pp$8.isAwaitUsing = function(isFor) {
@@ -91907,7 +91389,7 @@ var init_acorn = __esm({
91907
91389
  pp$8.isUsing = function(isFor) {
91908
91390
  return this.isUsingKeyword(false, isFor);
91909
91391
  };
91910
- pp$8.parseStatement = function(context, topLevel, exports2) {
91392
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
91911
91393
  var starttype = this.type, node = this.startNode(), kind;
91912
91394
  if (this.isLet(context)) {
91913
91395
  starttype = types$1._var;
@@ -91976,7 +91458,7 @@ var init_acorn = __esm({
91976
91458
  this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
91977
91459
  }
91978
91460
  }
91979
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports2);
91461
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
91980
91462
  // If the statement does not start with a statement keyword or a
91981
91463
  // brace, it's an ExpressionStatement or LabeledStatement. We
91982
91464
  // simply start parsing an expression, and afterwards, if the
@@ -91995,6 +91477,9 @@ var init_acorn = __esm({
91995
91477
  if (!this.allowUsing) {
91996
91478
  this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
91997
91479
  }
91480
+ if (context) {
91481
+ this.raise(this.start, "Using declaration is not allowed in single-statement positions");
91482
+ }
91998
91483
  if (usingKind === "await using") {
91999
91484
  if (!this.canAwait) {
92000
91485
  this.raise(this.start, "Await using cannot appear outside of async function");
@@ -92129,14 +91614,15 @@ var init_acorn = __esm({
92129
91614
  };
92130
91615
  pp$8.parseForAfterInit = function(node, init, awaitAt) {
92131
91616
  if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init.declarations.length === 1) {
92132
- if (this.options.ecmaVersion >= 9) {
92133
- if (this.type === types$1._in) {
92134
- if (awaitAt > -1) {
92135
- this.unexpected(awaitAt);
92136
- }
92137
- } else {
92138
- node.await = awaitAt > -1;
91617
+ if (this.type === types$1._in) {
91618
+ if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) {
91619
+ this.raise(this.start, "Using declaration is not allowed in for-in loops");
92139
91620
  }
91621
+ if (this.options.ecmaVersion >= 9 && awaitAt > -1) {
91622
+ this.unexpected(awaitAt);
91623
+ }
91624
+ } else if (this.options.ecmaVersion >= 9) {
91625
+ node.await = awaitAt > -1;
92140
91626
  }
92141
91627
  return this.parseForIn(node, init);
92142
91628
  }
@@ -92632,11 +92118,11 @@ var init_acorn = __esm({
92632
92118
  }
92633
92119
  }
92634
92120
  };
92635
- pp$8.parseExportAllDeclaration = function(node, exports2) {
92121
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
92636
92122
  if (this.options.ecmaVersion >= 11) {
92637
92123
  if (this.eatContextual("as")) {
92638
92124
  node.exported = this.parseModuleExportName();
92639
- this.checkExport(exports2, node.exported, this.lastTokStart);
92125
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
92640
92126
  } else {
92641
92127
  node.exported = null;
92642
92128
  }
@@ -92652,22 +92138,22 @@ var init_acorn = __esm({
92652
92138
  this.semicolon();
92653
92139
  return this.finishNode(node, "ExportAllDeclaration");
92654
92140
  };
92655
- pp$8.parseExport = function(node, exports2) {
92141
+ pp$8.parseExport = function(node, exports$1) {
92656
92142
  this.next();
92657
92143
  if (this.eat(types$1.star)) {
92658
- return this.parseExportAllDeclaration(node, exports2);
92144
+ return this.parseExportAllDeclaration(node, exports$1);
92659
92145
  }
92660
92146
  if (this.eat(types$1._default)) {
92661
- this.checkExport(exports2, "default", this.lastTokStart);
92147
+ this.checkExport(exports$1, "default", this.lastTokStart);
92662
92148
  node.declaration = this.parseExportDefaultDeclaration();
92663
92149
  return this.finishNode(node, "ExportDefaultDeclaration");
92664
92150
  }
92665
92151
  if (this.shouldParseExportStatement()) {
92666
92152
  node.declaration = this.parseExportDeclaration(node);
92667
92153
  if (node.declaration.type === "VariableDeclaration") {
92668
- this.checkVariableExport(exports2, node.declaration.declarations);
92154
+ this.checkVariableExport(exports$1, node.declaration.declarations);
92669
92155
  } else {
92670
- this.checkExport(exports2, node.declaration.id, node.declaration.id.start);
92156
+ this.checkExport(exports$1, node.declaration.id, node.declaration.id.start);
92671
92157
  }
92672
92158
  node.specifiers = [];
92673
92159
  node.source = null;
@@ -92676,7 +92162,7 @@ var init_acorn = __esm({
92676
92162
  }
92677
92163
  } else {
92678
92164
  node.declaration = null;
92679
- node.specifiers = this.parseExportSpecifiers(exports2);
92165
+ node.specifiers = this.parseExportSpecifiers(exports$1);
92680
92166
  if (this.eatContextual("from")) {
92681
92167
  if (this.type !== types$1.string) {
92682
92168
  this.unexpected();
@@ -92724,66 +92210,66 @@ var init_acorn = __esm({
92724
92210
  return declaration;
92725
92211
  }
92726
92212
  };
92727
- pp$8.checkExport = function(exports2, name15, pos) {
92728
- if (!exports2) {
92213
+ pp$8.checkExport = function(exports$1, name15, pos) {
92214
+ if (!exports$1) {
92729
92215
  return;
92730
92216
  }
92731
92217
  if (typeof name15 !== "string") {
92732
92218
  name15 = name15.type === "Identifier" ? name15.name : name15.value;
92733
92219
  }
92734
- if (hasOwn(exports2, name15)) {
92220
+ if (hasOwn(exports$1, name15)) {
92735
92221
  this.raiseRecoverable(pos, "Duplicate export '" + name15 + "'");
92736
92222
  }
92737
- exports2[name15] = true;
92223
+ exports$1[name15] = true;
92738
92224
  };
92739
- pp$8.checkPatternExport = function(exports2, pat) {
92225
+ pp$8.checkPatternExport = function(exports$1, pat) {
92740
92226
  var type = pat.type;
92741
92227
  if (type === "Identifier") {
92742
- this.checkExport(exports2, pat, pat.start);
92228
+ this.checkExport(exports$1, pat, pat.start);
92743
92229
  } else if (type === "ObjectPattern") {
92744
92230
  for (var i = 0, list = pat.properties; i < list.length; i += 1) {
92745
92231
  var prop = list[i];
92746
- this.checkPatternExport(exports2, prop);
92232
+ this.checkPatternExport(exports$1, prop);
92747
92233
  }
92748
92234
  } else if (type === "ArrayPattern") {
92749
92235
  for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
92750
92236
  var elt = list$1[i$1];
92751
92237
  if (elt) {
92752
- this.checkPatternExport(exports2, elt);
92238
+ this.checkPatternExport(exports$1, elt);
92753
92239
  }
92754
92240
  }
92755
92241
  } else if (type === "Property") {
92756
- this.checkPatternExport(exports2, pat.value);
92242
+ this.checkPatternExport(exports$1, pat.value);
92757
92243
  } else if (type === "AssignmentPattern") {
92758
- this.checkPatternExport(exports2, pat.left);
92244
+ this.checkPatternExport(exports$1, pat.left);
92759
92245
  } else if (type === "RestElement") {
92760
- this.checkPatternExport(exports2, pat.argument);
92246
+ this.checkPatternExport(exports$1, pat.argument);
92761
92247
  }
92762
92248
  };
92763
- pp$8.checkVariableExport = function(exports2, decls) {
92764
- if (!exports2) {
92249
+ pp$8.checkVariableExport = function(exports$1, decls) {
92250
+ if (!exports$1) {
92765
92251
  return;
92766
92252
  }
92767
92253
  for (var i = 0, list = decls; i < list.length; i += 1) {
92768
92254
  var decl = list[i];
92769
- this.checkPatternExport(exports2, decl.id);
92255
+ this.checkPatternExport(exports$1, decl.id);
92770
92256
  }
92771
92257
  };
92772
92258
  pp$8.shouldParseExportStatement = function() {
92773
92259
  return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
92774
92260
  };
92775
- pp$8.parseExportSpecifier = function(exports2) {
92261
+ pp$8.parseExportSpecifier = function(exports$1) {
92776
92262
  var node = this.startNode();
92777
92263
  node.local = this.parseModuleExportName();
92778
92264
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
92779
92265
  this.checkExport(
92780
- exports2,
92266
+ exports$1,
92781
92267
  node.exported,
92782
92268
  node.exported.start
92783
92269
  );
92784
92270
  return this.finishNode(node, "ExportSpecifier");
92785
92271
  };
92786
- pp$8.parseExportSpecifiers = function(exports2) {
92272
+ pp$8.parseExportSpecifiers = function(exports$1) {
92787
92273
  var nodes = [], first2 = true;
92788
92274
  this.expect(types$1.braceL);
92789
92275
  while (!this.eat(types$1.braceR)) {
@@ -92795,7 +92281,7 @@ var init_acorn = __esm({
92795
92281
  } else {
92796
92282
  first2 = false;
92797
92283
  }
92798
- nodes.push(this.parseExportSpecifier(exports2));
92284
+ nodes.push(this.parseExportSpecifier(exports$1));
92799
92285
  }
92800
92286
  return nodes;
92801
92287
  };
@@ -93363,17 +92849,20 @@ var init_acorn = __esm({
93363
92849
  other[kind] = true;
93364
92850
  };
93365
92851
  pp$5.parseExpression = function(forInit, refDestructuringErrors) {
93366
- var startPos = this.start, startLoc = this.startLoc;
93367
- var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
93368
- if (this.type === types$1.comma) {
93369
- var node = this.startNodeAt(startPos, startLoc);
93370
- node.expressions = [expr];
93371
- while (this.eat(types$1.comma)) {
93372
- node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
92852
+ var this$1$1 = this;
92853
+ return this.catchStackOverflow(function() {
92854
+ var startPos = this$1$1.start, startLoc = this$1$1.startLoc;
92855
+ var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
92856
+ if (this$1$1.type === types$1.comma) {
92857
+ var node = this$1$1.startNodeAt(startPos, startLoc);
92858
+ node.expressions = [expr];
92859
+ while (this$1$1.eat(types$1.comma)) {
92860
+ node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors));
92861
+ }
92862
+ return this$1$1.finishNode(node, "SequenceExpression");
93373
92863
  }
93374
- return this.finishNode(node, "SequenceExpression");
93375
- }
93376
- return expr;
92864
+ return expr;
92865
+ });
93377
92866
  };
93378
92867
  pp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
93379
92868
  if (this.isContextual("yield")) {
@@ -93445,7 +92934,7 @@ var init_acorn = __esm({
93445
92934
  if (this.checkExpressionErrors(refDestructuringErrors)) {
93446
92935
  return expr;
93447
92936
  }
93448
- if (this.eat(types$1.question)) {
92937
+ if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
93449
92938
  var node = this.startNodeAt(startPos, startLoc);
93450
92939
  node.test = expr;
93451
92940
  node.consequent = this.parseMaybeAssign();
@@ -93540,7 +93029,7 @@ var init_acorn = __esm({
93540
93029
  expr = this.finishNode(node$1, "UpdateExpression");
93541
93030
  }
93542
93031
  }
93543
- if (!incDec && this.eat(types$1.starstar)) {
93032
+ if (!incDec && !(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.starstar)) {
93544
93033
  if (sawUnary) {
93545
93034
  this.unexpected(this.lastTokStart);
93546
93035
  } else {
@@ -93938,6 +93427,9 @@ var init_acorn = __esm({
93938
93427
  }
93939
93428
  var startPos = this.start, startLoc = this.startLoc;
93940
93429
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
93430
+ if (node.callee.type === "Super") {
93431
+ this.raiseRecoverable(startPos, "Invalid use of 'super'");
93432
+ }
93941
93433
  if (this.eat(types$1.parenL)) {
93942
93434
  node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
93943
93435
  } else {
@@ -96590,7 +96082,7 @@ var init_acorn = __esm({
96590
96082
  }
96591
96083
  return this.finishToken(type, word);
96592
96084
  };
96593
- version2 = "8.16.0";
96085
+ version2 = "8.18.0";
96594
96086
  Parser2.acorn = {
96595
96087
  Parser: Parser2,
96596
96088
  version: version2,
@@ -100156,7 +99648,7 @@ var init_executePlan = __esm({
100156
99648
  });
100157
99649
 
100158
99650
  // src/agent/mcp/built-in-server.js
100159
- var import_http, import_events2, import_crypto5, import_server, import_sse2, import_streamableHttp, import_types4, InMemoryEventStore, BuiltInMCPServer;
99651
+ var import_http, import_events2, import_crypto5, import_server, import_sse2, import_streamableHttp, import_types5, InMemoryEventStore, BuiltInMCPServer;
100160
99652
  var init_built_in_server = __esm({
100161
99653
  "src/agent/mcp/built-in-server.js"() {
100162
99654
  "use strict";
@@ -100166,7 +99658,7 @@ var init_built_in_server = __esm({
100166
99658
  import_server = require("@modelcontextprotocol/sdk/server/index.js");
100167
99659
  import_sse2 = require("@modelcontextprotocol/sdk/server/sse.js");
100168
99660
  import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
100169
- import_types4 = require("@modelcontextprotocol/sdk/types.js");
99661
+ import_types5 = require("@modelcontextprotocol/sdk/types.js");
100170
99662
  InMemoryEventStore = class {
100171
99663
  constructor() {
100172
99664
  this.events = /* @__PURE__ */ new Map();
@@ -100400,7 +99892,7 @@ var init_built_in_server = __esm({
100400
99892
  if (this.debug) {
100401
99893
  console.log(`[MCP] Reusing existing transport for session: ${sessionId}`);
100402
99894
  }
100403
- } else if (!sessionId && method === "POST" && body && (0, import_types4.isInitializeRequest)(body)) {
99895
+ } else if (!sessionId && method === "POST" && body && (0, import_types5.isInitializeRequest)(body)) {
100404
99896
  if (this.debug) {
100405
99897
  console.log("[MCP] Creating new Streamable HTTP transport for initialization");
100406
99898
  }
@@ -100612,10 +100104,10 @@ var init_built_in_server = __esm({
100612
100104
  * Register MCP protocol handlers
100613
100105
  */
100614
100106
  registerHandlers() {
100615
- this.mcpServer.setRequestHandler(import_types4.ListToolsRequestSchema, async () => {
100107
+ this.mcpServer.setRequestHandler(import_types5.ListToolsRequestSchema, async () => {
100616
100108
  return this.handleListTools();
100617
100109
  });
100618
- this.mcpServer.setRequestHandler(import_types4.CallToolRequestSchema, async (request) => {
100110
+ this.mcpServer.setRequestHandler(import_types5.CallToolRequestSchema, async (request) => {
100619
100111
  return this.handleCallTool(request.params);
100620
100112
  });
100621
100113
  }
@@ -102761,27 +102253,41 @@ var init_ProbeAgent = __esm({
102761
102253
  timeoutState
102762
102254
  );
102763
102255
  }
102256
+ /**
102257
+ * Create a RetryManager from the agent's retry configuration.
102258
+ * @param {Object} [overrides={}] - Retry option overrides
102259
+ * @returns {RetryManager}
102260
+ * @private
102261
+ */
102262
+ _createRetryManager(overrides = {}) {
102263
+ return new RetryManager({
102264
+ maxRetries: overrides.maxRetries ?? this.retryConfig.maxRetries ?? 3,
102265
+ initialDelay: overrides.initialDelay ?? this.retryConfig.initialDelay ?? 1e3,
102266
+ maxDelay: overrides.maxDelay ?? this.retryConfig.maxDelay ?? 3e4,
102267
+ backoffFactor: overrides.backoffFactor ?? this.retryConfig.backoffFactor ?? 2,
102268
+ retryableErrors: overrides.retryableErrors ?? this.retryConfig.retryableErrors,
102269
+ jitter: overrides.jitter ?? this.retryConfig.jitter,
102270
+ debug: overrides.debug ?? this.debug
102271
+ });
102272
+ }
102764
102273
  /**
102765
102274
  * Execute streamText with Vercel AI SDK using retry/fallback logic
102766
102275
  * @param {Object} options - streamText options
102767
102276
  * @param {AbortController} controller - Abort controller for the operation
102277
+ * @param {Function} [consumeResult] - Optional callback to consume the stream result inside the same retry budget
102768
102278
  * @returns {Promise<Object>} - Stream result
102769
102279
  * @private
102770
102280
  */
102771
- async _executeWithVercelProvider(options, controller) {
102281
+ async _executeWithVercelProvider(options, controller, consumeResult) {
102772
102282
  if (!this.retryManager) {
102773
- this.retryManager = new RetryManager({
102774
- maxRetries: this.retryConfig.maxRetries ?? 3,
102775
- initialDelay: this.retryConfig.initialDelay ?? 1e3,
102776
- maxDelay: this.retryConfig.maxDelay ?? 3e4,
102777
- backoffFactor: this.retryConfig.backoffFactor ?? 2,
102778
- retryableErrors: this.retryConfig.retryableErrors,
102779
- debug: this.debug
102780
- });
102283
+ this.retryManager = this._createRetryManager();
102781
102284
  }
102782
102285
  if (!this.fallbackManager) {
102783
102286
  return await this.retryManager.executeWithRetry(
102784
- () => (0, import_ai4.streamText)({ ...options, abortSignal: controller.signal }),
102287
+ async () => {
102288
+ const result = (0, import_ai4.streamText)({ ...options, abortSignal: controller.signal });
102289
+ return consumeResult ? await consumeResult(result) : result;
102290
+ },
102785
102291
  {
102786
102292
  provider: this.apiType,
102787
102293
  model: this.model,
@@ -102806,16 +102312,14 @@ var init_ProbeAgent = __esm({
102806
102312
  console.error(`[DEBUG] Stripped Gemini built-in tools for fallback to ${config2.provider} provider`);
102807
102313
  }
102808
102314
  }
102809
- const providerRetryManager = new RetryManager({
102810
- maxRetries: config2.maxRetries ?? this.retryConfig.maxRetries ?? 3,
102811
- initialDelay: this.retryConfig.initialDelay ?? 1e3,
102812
- maxDelay: this.retryConfig.maxDelay ?? 3e4,
102813
- backoffFactor: this.retryConfig.backoffFactor ?? 2,
102814
- retryableErrors: this.retryConfig.retryableErrors,
102815
- debug: this.debug
102315
+ const providerRetryManager = this._createRetryManager({
102316
+ maxRetries: config2.maxRetries ?? this.retryConfig.maxRetries
102816
102317
  });
102817
102318
  return await providerRetryManager.executeWithRetry(
102818
- () => (0, import_ai4.streamText)(fallbackOptions),
102319
+ async () => {
102320
+ const result = (0, import_ai4.streamText)(fallbackOptions);
102321
+ return consumeResult ? await consumeResult(result) : result;
102322
+ },
102819
102323
  {
102820
102324
  provider: config2.provider,
102821
102325
  model,
@@ -102954,10 +102458,11 @@ var init_ProbeAgent = __esm({
102954
102458
  /**
102955
102459
  * Execute streamText with retry and fallback support
102956
102460
  * @param {Object} options - streamText options
102957
- * @returns {Promise<Object>} - streamText result
102461
+ * @param {Function} [consumeResult] - Optional callback to consume the result inside the same retry attempt
102462
+ * @returns {Promise<Object>} - streamText result or consumer result
102958
102463
  * @private
102959
102464
  */
102960
- async streamTextWithRetryAndFallback(options) {
102465
+ async streamTextWithRetryAndFallback(options, consumeResult) {
102961
102466
  const limiter = this.concurrencyLimiter;
102962
102467
  if (limiter && options.model) {
102963
102468
  options = { ...options, model: _ProbeAgent._wrapModelWithLimiter(options.model, limiter, this.debug) };
@@ -102989,6 +102494,7 @@ var init_ProbeAgent = __esm({
102989
102494
  const useClaudeCode = this.clientApiProvider === "claude-code" || process.env.USE_CLAUDE_CODE === "true";
102990
102495
  const useCodex = this.clientApiProvider === "codex" || process.env.USE_CODEX === "true";
102991
102496
  let result;
102497
+ let usedVercelProvider = false;
102992
102498
  if (useClaudeCode || useCodex) {
102993
102499
  try {
102994
102500
  result = await this._tryEngineStreamPath(options, controller, timeoutState);
@@ -103003,7 +102509,11 @@ var init_ProbeAgent = __esm({
103003
102509
  }
103004
102510
  }
103005
102511
  if (!result) {
103006
- result = await this._executeWithVercelProvider(options, controller);
102512
+ usedVercelProvider = true;
102513
+ result = await this._executeWithVercelProvider(options, controller, consumeResult);
102514
+ }
102515
+ if (!usedVercelProvider && result && consumeResult) {
102516
+ return await consumeResult(result);
103007
102517
  }
103008
102518
  return result;
103009
102519
  } finally {
@@ -104647,7 +104157,6 @@ You are working with a workspace. Available paths: ${workspaceDesc}
104647
104157
  activeTools.delete(key);
104648
104158
  }
104649
104159
  };
104650
- this.events.on("toolCall", onToolCall);
104651
104160
  const runTimeoutObserver = async () => {
104652
104161
  if (negotiatedTimeoutState.observerRunning) return;
104653
104162
  negotiatedTimeoutState.observerRunning = true;
@@ -105208,60 +104717,68 @@ Double-check your response based on the criteria above. If everything looks good
105208
104717
  streamOptions.providerOptions = providerOpts;
105209
104718
  }
105210
104719
  const executeAIRequest = async () => {
105211
- const result = await this.streamTextWithRetryAndFallback(streamOptions);
105212
- let gracefulTimeoutId = null;
105213
- let hardAbortTimeoutId = null;
105214
- if (this.timeoutBehavior === "graceful" && gracefulTimeoutState && this.maxOperationTimeout > 0) {
105215
- gracefulTimeoutId = setTimeout(() => {
105216
- gracefulTimeoutState.triggered = true;
105217
- if (this.debug) {
105218
- console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 entering wind-down mode (${gracefulTimeoutState.bonusStepsMax} bonus steps)`);
105219
- }
105220
- hardAbortTimeoutId = setTimeout(() => {
105221
- if (this._abortController) {
105222
- this._abortController.abort();
104720
+ return await this.streamTextWithRetryAndFallback(streamOptions, async (result) => {
104721
+ this.events.on("toolCall", onToolCall);
104722
+ let gracefulTimeoutId = null;
104723
+ let hardAbortTimeoutId = null;
104724
+ if (this.timeoutBehavior === "graceful" && gracefulTimeoutState && this.maxOperationTimeout > 0) {
104725
+ gracefulTimeoutId = setTimeout(() => {
104726
+ gracefulTimeoutState.triggered = true;
104727
+ if (this.debug) {
104728
+ console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 entering wind-down mode (${gracefulTimeoutState.bonusStepsMax} bonus steps)`);
105223
104729
  }
104730
+ hardAbortTimeoutId = setTimeout(() => {
104731
+ if (this._abortController) {
104732
+ this._abortController.abort();
104733
+ }
104734
+ if (this.debug) {
104735
+ console.log(`[DEBUG] Hard abort \u2014 wind-down safety net expired after 60s`);
104736
+ }
104737
+ }, 6e4);
104738
+ }, this.maxOperationTimeout);
104739
+ }
104740
+ if (this.timeoutBehavior === "negotiated" && this.maxOperationTimeout > 0) {
104741
+ negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
105224
104742
  if (this.debug) {
105225
- console.log(`[DEBUG] Hard abort \u2014 wind-down safety net expired after 60s`);
104743
+ console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 invoking timeout observer`);
105226
104744
  }
105227
- }, 6e4);
105228
- }, this.maxOperationTimeout);
105229
- }
105230
- if (this.timeoutBehavior === "negotiated" && this.maxOperationTimeout > 0) {
105231
- negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
104745
+ runTimeoutObserver();
104746
+ }, this.maxOperationTimeout);
104747
+ }
104748
+ try {
104749
+ const steps = await result.steps;
104750
+ let finalText;
104751
+ if (steps && steps.length > 1) {
104752
+ const lastStepText = steps[steps.length - 1].text;
104753
+ finalText = lastStepText || await result.text;
104754
+ } else {
104755
+ finalText = await result.text;
104756
+ }
104757
+ if (!options.schema && (!steps || steps.length === 0) && (!finalText || !finalText.trim())) {
104758
+ throw Object.assign(
104759
+ new Error("No output generated. Check the stream for errors."),
104760
+ { name: "AI_NoOutputGeneratedError" }
104761
+ );
104762
+ }
105232
104763
  if (this.debug) {
105233
- console.log(`[DEBUG] Soft timeout after ${this.maxOperationTimeout}ms \u2014 invoking timeout observer`);
104764
+ console.log(`[DEBUG] streamText completed: ${steps?.length || 0} steps, finalText=${finalText?.length || 0} chars`);
105234
104765
  }
105235
- runTimeoutObserver();
105236
- }, this.maxOperationTimeout);
105237
- }
105238
- try {
105239
- const steps = await result.steps;
105240
- let finalText;
105241
- if (steps && steps.length > 1) {
105242
- const lastStepText = steps[steps.length - 1].text;
105243
- finalText = lastStepText || await result.text;
105244
- } else {
105245
- finalText = await result.text;
105246
- }
105247
- if (this.debug) {
105248
- console.log(`[DEBUG] streamText completed: ${steps?.length || 0} steps, finalText=${finalText?.length || 0} chars`);
105249
- }
105250
- const usage = await result.usage;
105251
- if (usage) {
105252
- this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
105253
- }
105254
- return { finalText, result };
105255
- } finally {
105256
- if (gracefulTimeoutId) clearTimeout(gracefulTimeoutId);
105257
- if (hardAbortTimeoutId) clearTimeout(hardAbortTimeoutId);
105258
- if (negotiatedTimeoutState.softTimeoutId) clearTimeout(negotiatedTimeoutState.softTimeoutId);
105259
- if (this._gracefulStopHardAbortId) {
105260
- clearTimeout(this._gracefulStopHardAbortId);
105261
- this._gracefulStopHardAbortId = null;
104766
+ const usage = await result.usage;
104767
+ if (usage) {
104768
+ this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
104769
+ }
104770
+ return { finalText, result };
104771
+ } finally {
104772
+ if (gracefulTimeoutId) clearTimeout(gracefulTimeoutId);
104773
+ if (hardAbortTimeoutId) clearTimeout(hardAbortTimeoutId);
104774
+ if (negotiatedTimeoutState.softTimeoutId) clearTimeout(negotiatedTimeoutState.softTimeoutId);
104775
+ if (this._gracefulStopHardAbortId) {
104776
+ clearTimeout(this._gracefulStopHardAbortId);
104777
+ this._gracefulStopHardAbortId = null;
104778
+ }
104779
+ this.events.removeListener("toolCall", onToolCall);
105262
104780
  }
105263
- this.events.removeListener("toolCall", onToolCall);
105264
- }
104781
+ });
105265
104782
  };
105266
104783
  let aiResult;
105267
104784
  if (this.tracer) {