@digipair/skill-llm 0.42.0 → 0.43.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs2.js +553 -217
  2. package/index.esm2.js +1710 -887
  3. package/package.json +1 -1
package/index.cjs2.js CHANGED
@@ -256,7 +256,7 @@ function _array_like_to_array$L(arr, len) {
256
256
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
257
257
  return arr2;
258
258
  }
259
- function _array_with_holes$p(arr) {
259
+ function _array_with_holes$o(arr) {
260
260
  if (Array.isArray(arr)) return arr;
261
261
  }
262
262
  function _array_without_holes$A(arr) {
@@ -304,7 +304,7 @@ function _instanceof$j(left, right) {
304
304
  function _iterable_to_array$B(iter) {
305
305
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
306
306
  }
307
- function _iterable_to_array_limit$o(arr, i) {
307
+ function _iterable_to_array_limit$n(arr, i) {
308
308
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
309
309
  if (_i == null) return;
310
310
  var _arr = [];
@@ -328,7 +328,7 @@ function _iterable_to_array_limit$o(arr, i) {
328
328
  }
329
329
  return _arr;
330
330
  }
331
- function _non_iterable_rest$p() {
331
+ function _non_iterable_rest$o() {
332
332
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
333
333
  }
334
334
  function _non_iterable_spread$A() {
@@ -349,11 +349,11 @@ function _object_spread$N(target) {
349
349
  }
350
350
  return target;
351
351
  }
352
- function _sliced_to_array$o(arr, i) {
353
- return _array_with_holes$p(arr) || _iterable_to_array_limit$o(arr, i) || _unsupported_iterable_to_array$L(arr, i) || _non_iterable_rest$p();
352
+ function _sliced_to_array$n(arr, i) {
353
+ return _array_with_holes$o(arr) || _iterable_to_array_limit$n(arr, i) || _unsupported_iterable_to_array$L(arr, i) || _non_iterable_rest$o();
354
354
  }
355
355
  function _to_array$3(arr) {
356
- return _array_with_holes$p(arr) || _iterable_to_array$B(arr) || _unsupported_iterable_to_array$L(arr) || _non_iterable_rest$p();
356
+ return _array_with_holes$o(arr) || _iterable_to_array$B(arr) || _unsupported_iterable_to_array$L(arr) || _non_iterable_rest$o();
357
357
  }
358
358
  function _to_consumable_array$A(arr) {
359
359
  return _array_without_holes$A(arr) || _iterable_to_array$B(arr) || _unsupported_iterable_to_array$L(arr) || _non_iterable_spread$A();
@@ -374,7 +374,7 @@ function replaceSecrets(root, secretsMap) {
374
374
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
375
375
  try {
376
376
  for(var _iterator = Object.entries(secretsMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
377
- var _step_value = _sliced_to_array$o(_step.value, 2), path = _step_value[0], secretId = _step_value[1];
377
+ var _step_value = _sliced_to_array$n(_step.value, 2), path = _step_value[0], secretId = _step_value[1];
378
378
  var _path_split_reverse = _to_array$3(path.split(".").reverse()), last = _path_split_reverse[0], partsReverse = _path_split_reverse.slice(1);
379
379
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
380
380
  var current = result;
@@ -612,7 +612,7 @@ function _array_like_to_array$K(arr, len) {
612
612
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
613
613
  return arr2;
614
614
  }
615
- function _array_with_holes$o(arr) {
615
+ function _array_with_holes$n(arr) {
616
616
  if (Array.isArray(arr)) return arr;
617
617
  }
618
618
  function _array_without_holes$z(arr) {
@@ -678,7 +678,7 @@ function _inherits$z(subClass, superClass) {
678
678
  function _iterable_to_array$A(iter) {
679
679
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
680
680
  }
681
- function _iterable_to_array_limit$n(arr, i) {
681
+ function _iterable_to_array_limit$m(arr, i) {
682
682
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
683
683
  if (_i == null) return;
684
684
  var _arr = [];
@@ -702,7 +702,7 @@ function _iterable_to_array_limit$n(arr, i) {
702
702
  }
703
703
  return _arr;
704
704
  }
705
- function _non_iterable_rest$o() {
705
+ function _non_iterable_rest$n() {
706
706
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
707
707
  }
708
708
  function _non_iterable_spread$z() {
@@ -736,8 +736,8 @@ function _set_prototype_of$z(o, p) {
736
736
  };
737
737
  return _set_prototype_of$z(o, p);
738
738
  }
739
- function _sliced_to_array$n(arr, i) {
740
- return _array_with_holes$o(arr) || _iterable_to_array_limit$n(arr, i) || _unsupported_iterable_to_array$K(arr, i) || _non_iterable_rest$o();
739
+ function _sliced_to_array$m(arr, i) {
740
+ return _array_with_holes$n(arr) || _iterable_to_array_limit$m(arr, i) || _unsupported_iterable_to_array$K(arr, i) || _non_iterable_rest$n();
741
741
  }
742
742
  function _to_consumable_array$z(arr) {
743
743
  return _array_without_holes$z(arr) || _iterable_to_array$A(arr) || _unsupported_iterable_to_array$K(arr) || _non_iterable_spread$z();
@@ -1026,7 +1026,7 @@ right) {
1026
1026
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1027
1027
  try {
1028
1028
  for(var _iterator = Object.entries(right)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1029
- var _step_value = _sliced_to_array$n(_step.value, 2), key = _step_value[0], value = _step_value[1];
1029
+ var _step_value = _sliced_to_array$m(_step.value, 2), key = _step_value[0], value = _step_value[1];
1030
1030
  if (merged[key] == null) {
1031
1031
  merged[key] = value;
1032
1032
  } else if (value == null) {
@@ -1438,7 +1438,7 @@ function _array_like_to_array$J(arr, len) {
1438
1438
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1439
1439
  return arr2;
1440
1440
  }
1441
- function _array_with_holes$n(arr) {
1441
+ function _array_with_holes$m(arr) {
1442
1442
  if (Array.isArray(arr)) return arr;
1443
1443
  }
1444
1444
  function _assert_this_initialized$x(self) {
@@ -1514,7 +1514,7 @@ function _inherits$x(subClass, superClass) {
1514
1514
  });
1515
1515
  if (superClass) _set_prototype_of$x(subClass, superClass);
1516
1516
  }
1517
- function _iterable_to_array_limit$m(arr, i) {
1517
+ function _iterable_to_array_limit$l(arr, i) {
1518
1518
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1519
1519
  if (_i == null) return;
1520
1520
  var _arr = [];
@@ -1538,7 +1538,7 @@ function _iterable_to_array_limit$m(arr, i) {
1538
1538
  }
1539
1539
  return _arr;
1540
1540
  }
1541
- function _non_iterable_rest$n() {
1541
+ function _non_iterable_rest$m() {
1542
1542
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1543
1543
  }
1544
1544
  function _object_spread$K(target) {
@@ -1593,8 +1593,8 @@ function _set_prototype_of$x(o, p) {
1593
1593
  };
1594
1594
  return _set_prototype_of$x(o, p);
1595
1595
  }
1596
- function _sliced_to_array$m(arr, i) {
1597
- return _array_with_holes$n(arr) || _iterable_to_array_limit$m(arr, i) || _unsupported_iterable_to_array$J(arr, i) || _non_iterable_rest$n();
1596
+ function _sliced_to_array$l(arr, i) {
1597
+ return _array_with_holes$m(arr) || _iterable_to_array_limit$l(arr, i) || _unsupported_iterable_to_array$J(arr, i) || _non_iterable_rest$m();
1598
1598
  }
1599
1599
  function _super_prop_base$2(object, property) {
1600
1600
  while(!Object.prototype.hasOwnProperty.call(object, property)){
@@ -1670,7 +1670,7 @@ function _create_super$x(Derived) {
1670
1670
  }
1671
1671
  try {
1672
1672
  if (!(rawToolCalls == null) && toolCalls === undefined) {
1673
- var _defaultToolCallParser = _sliced_to_array$m(defaultToolCallParser(rawToolCalls), 2), toolCalls1 = _defaultToolCallParser[0], invalidToolCalls = _defaultToolCallParser[1];
1673
+ var _defaultToolCallParser = _sliced_to_array$l(defaultToolCallParser(rawToolCalls), 2), toolCalls1 = _defaultToolCallParser[0], invalidToolCalls = _defaultToolCallParser[1];
1674
1674
  initParams.tool_calls = toolCalls1 !== null && toolCalls1 !== void 0 ? toolCalls1 : [];
1675
1675
  initParams.invalid_tool_calls = invalidToolCalls !== null && invalidToolCalls !== void 0 ? invalidToolCalls : [];
1676
1676
  } else {
@@ -2349,7 +2349,7 @@ function _array_like_to_array$I(arr, len) {
2349
2349
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2350
2350
  return arr2;
2351
2351
  }
2352
- function _array_with_holes$m(arr) {
2352
+ function _array_with_holes$l(arr) {
2353
2353
  if (Array.isArray(arr)) return arr;
2354
2354
  }
2355
2355
  function _define_property$K(obj, key, value) {
@@ -2365,7 +2365,7 @@ function _define_property$K(obj, key, value) {
2365
2365
  }
2366
2366
  return obj;
2367
2367
  }
2368
- function _iterable_to_array_limit$l(arr, i) {
2368
+ function _iterable_to_array_limit$k(arr, i) {
2369
2369
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2370
2370
  if (_i == null) return;
2371
2371
  var _arr = [];
@@ -2389,7 +2389,7 @@ function _iterable_to_array_limit$l(arr, i) {
2389
2389
  }
2390
2390
  return _arr;
2391
2391
  }
2392
- function _non_iterable_rest$m() {
2392
+ function _non_iterable_rest$l() {
2393
2393
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2394
2394
  }
2395
2395
  function _object_spread$J(target) {
@@ -2431,9 +2431,9 @@ function _object_spread_props$y(target, source) {
2431
2431
  }
2432
2432
  return target;
2433
2433
  }
2434
- function _object_without_properties$9(source, excluded) {
2434
+ function _object_without_properties$a(source, excluded) {
2435
2435
  if (source == null) return {};
2436
- var target = _object_without_properties_loose$9(source, excluded);
2436
+ var target = _object_without_properties_loose$a(source, excluded);
2437
2437
  var key, i;
2438
2438
  if (Object.getOwnPropertySymbols) {
2439
2439
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -2446,7 +2446,7 @@ function _object_without_properties$9(source, excluded) {
2446
2446
  }
2447
2447
  return target;
2448
2448
  }
2449
- function _object_without_properties_loose$9(source, excluded) {
2449
+ function _object_without_properties_loose$a(source, excluded) {
2450
2450
  if (source == null) return {};
2451
2451
  var target = {};
2452
2452
  var sourceKeys = Object.keys(source);
@@ -2458,8 +2458,8 @@ function _object_without_properties_loose$9(source, excluded) {
2458
2458
  }
2459
2459
  return target;
2460
2460
  }
2461
- function _sliced_to_array$l(arr, i) {
2462
- return _array_with_holes$m(arr) || _iterable_to_array_limit$l(arr, i) || _unsupported_iterable_to_array$I(arr, i) || _non_iterable_rest$m();
2461
+ function _sliced_to_array$k(arr, i) {
2462
+ return _array_with_holes$l(arr) || _iterable_to_array_limit$k(arr, i) || _unsupported_iterable_to_array$I(arr, i) || _non_iterable_rest$l();
2463
2463
  }
2464
2464
  function _unsupported_iterable_to_array$I(o, minLen) {
2465
2465
  if (!o) return;
@@ -2505,7 +2505,7 @@ function _constructMessageFromParams(params) {
2505
2505
  }
2506
2506
  rest = params.kwargs;
2507
2507
  } else {
2508
- var extractedType = params.type, otherParams = _object_without_properties$9(params, [
2508
+ var extractedType = params.type, otherParams = _object_without_properties$a(params, [
2509
2509
  "type"
2510
2510
  ]);
2511
2511
  type = extractedType;
@@ -2514,7 +2514,7 @@ function _constructMessageFromParams(params) {
2514
2514
  if (type === "human" || type === "user") {
2515
2515
  return new HumanMessage(rest);
2516
2516
  } else if (type === "ai" || type === "assistant") {
2517
- var rawToolCalls = rest.tool_calls, other = _object_without_properties$9(rest, [
2517
+ var rawToolCalls = rest.tool_calls, other = _object_without_properties$a(rest, [
2518
2518
  "tool_calls"
2519
2519
  ]);
2520
2520
  if (!Array.isArray(rawToolCalls)) {
@@ -2544,13 +2544,13 @@ function coerceMessageLikeToMessage(messageLike) {
2544
2544
  return messageLike;
2545
2545
  }
2546
2546
  if (Array.isArray(messageLike)) {
2547
- var _messageLike = _sliced_to_array$l(messageLike, 2), type = _messageLike[0], content = _messageLike[1];
2547
+ var _messageLike = _sliced_to_array$k(messageLike, 2), type = _messageLike[0], content = _messageLike[1];
2548
2548
  return _constructMessageFromParams({
2549
2549
  type: type,
2550
2550
  content: content
2551
2551
  });
2552
2552
  } else if (_isMessageFieldWithRole(messageLike)) {
2553
- var type1 = messageLike.role, rest = _object_without_properties$9(messageLike, [
2553
+ var type1 = messageLike.role, rest = _object_without_properties$a(messageLike, [
2554
2554
  "role"
2555
2555
  ]);
2556
2556
  return _constructMessageFromParams(_object_spread_props$y(_object_spread$J({}, rest), {
@@ -2612,7 +2612,7 @@ function _array_like_to_array$H(arr, len) {
2612
2612
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2613
2613
  return arr2;
2614
2614
  }
2615
- function _array_with_holes$l(arr) {
2615
+ function _array_with_holes$k(arr) {
2616
2616
  if (Array.isArray(arr)) return arr;
2617
2617
  }
2618
2618
  function _array_without_holes$y(arr) {
@@ -2734,7 +2734,7 @@ function _is_native_function$6(fn) {
2734
2734
  function _iterable_to_array$z(iter) {
2735
2735
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2736
2736
  }
2737
- function _iterable_to_array_limit$k(arr, i) {
2737
+ function _iterable_to_array_limit$j(arr, i) {
2738
2738
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2739
2739
  if (_i == null) return;
2740
2740
  var _arr = [];
@@ -2758,7 +2758,7 @@ function _iterable_to_array_limit$k(arr, i) {
2758
2758
  }
2759
2759
  return _arr;
2760
2760
  }
2761
- function _non_iterable_rest$l() {
2761
+ function _non_iterable_rest$k() {
2762
2762
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2763
2763
  }
2764
2764
  function _non_iterable_spread$y() {
@@ -2816,8 +2816,8 @@ function _set_prototype_of$t(o, p) {
2816
2816
  };
2817
2817
  return _set_prototype_of$t(o, p);
2818
2818
  }
2819
- function _sliced_to_array$k(arr, i) {
2820
- return _array_with_holes$l(arr) || _iterable_to_array_limit$k(arr, i) || _unsupported_iterable_to_array$H(arr, i) || _non_iterable_rest$l();
2819
+ function _sliced_to_array$j(arr, i) {
2820
+ return _array_with_holes$k(arr) || _iterable_to_array_limit$j(arr, i) || _unsupported_iterable_to_array$H(arr, i) || _non_iterable_rest$k();
2821
2821
  }
2822
2822
  function _to_consumable_array$y(arr) {
2823
2823
  return _array_without_holes$y(arr) || _iterable_to_array$z(arr) || _unsupported_iterable_to_array$H(arr) || _non_iterable_spread$y();
@@ -4276,7 +4276,7 @@ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-
4276
4276
  // /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
4277
4277
  // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
4278
4278
  var _emojiRegex = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
4279
- var emojiRegex;
4279
+ var emojiRegex$1;
4280
4280
  // faster, simpler, safer
4281
4281
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
4282
4282
  var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
@@ -4413,10 +4413,10 @@ var ZodString = /*#__PURE__*/ function(ZodType) {
4413
4413
  status.dirty();
4414
4414
  }
4415
4415
  } else if (check.kind === "emoji") {
4416
- if (!emojiRegex) {
4417
- emojiRegex = new RegExp(_emojiRegex, "u");
4416
+ if (!emojiRegex$1) {
4417
+ emojiRegex$1 = new RegExp(_emojiRegex, "u");
4418
4418
  }
4419
- if (!emojiRegex.test(input.data)) {
4419
+ if (!emojiRegex$1.test(input.data)) {
4420
4420
  ctx1 = this._getOrReturnCtx(input, ctx1);
4421
4421
  addIssueToContext(ctx1, {
4422
4422
  validation: "emoji",
@@ -7365,7 +7365,7 @@ var ZodIntersection = /*#__PURE__*/ function(ZodType) {
7365
7365
  parent: ctx
7366
7366
  })
7367
7367
  ]).then(function(param) {
7368
- var _param = _sliced_to_array$k(param, 2), left = _param[0], right = _param[1];
7368
+ var _param = _sliced_to_array$j(param, 2), left = _param[0], right = _param[1];
7369
7369
  return handleParsed(left, right);
7370
7370
  });
7371
7371
  } else {
@@ -7587,7 +7587,7 @@ var ZodMap = /*#__PURE__*/ function(ZodType) {
7587
7587
  var keyType = this._def.keyType;
7588
7588
  var valueType = this._def.valueType;
7589
7589
  var pairs = _to_consumable_array$y(ctx.data.entries()).map(function(param, index) {
7590
- var _param = _sliced_to_array$k(param, 2), key = _param[0], value = _param[1];
7590
+ var _param = _sliced_to_array$j(param, 2), key = _param[0], value = _param[1];
7591
7591
  return {
7592
7592
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
7593
7593
  index,
@@ -13673,10 +13673,10 @@ function _array_like_to_array$C(arr, len) {
13673
13673
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
13674
13674
  return arr2;
13675
13675
  }
13676
- function _array_with_holes$k(arr) {
13676
+ function _array_with_holes$j(arr) {
13677
13677
  if (Array.isArray(arr)) return arr;
13678
13678
  }
13679
- function _iterable_to_array_limit$j(arr, i) {
13679
+ function _iterable_to_array_limit$i(arr, i) {
13680
13680
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
13681
13681
  if (_i == null) return;
13682
13682
  var _arr = [];
@@ -13700,11 +13700,11 @@ function _iterable_to_array_limit$j(arr, i) {
13700
13700
  }
13701
13701
  return _arr;
13702
13702
  }
13703
- function _non_iterable_rest$k() {
13703
+ function _non_iterable_rest$j() {
13704
13704
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13705
13705
  }
13706
- function _sliced_to_array$j(arr, i) {
13707
- return _array_with_holes$k(arr) || _iterable_to_array_limit$j(arr, i) || _unsupported_iterable_to_array$C(arr, i) || _non_iterable_rest$k();
13706
+ function _sliced_to_array$i(arr, i) {
13707
+ return _array_with_holes$j(arr) || _iterable_to_array_limit$i(arr, i) || _unsupported_iterable_to_array$C(arr, i) || _non_iterable_rest$j();
13708
13708
  }
13709
13709
  function _unsupported_iterable_to_array$C(o, minLen) {
13710
13710
  if (!o) return;
@@ -13768,7 +13768,7 @@ var simplify = function(versions, range, options) {
13768
13768
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
13769
13769
  try {
13770
13770
  for(var _iterator1 = set[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
13771
- var _step_value = _sliced_to_array$j(_step1.value, 2), min = _step_value[0], max = _step_value[1];
13771
+ var _step_value = _sliced_to_array$i(_step1.value, 2), min = _step_value[0], max = _step_value[1];
13772
13772
  if (min === max) {
13773
13773
  ranges.push(min);
13774
13774
  } else if (!max && min === v[0]) {
@@ -14209,10 +14209,10 @@ function _array_like_to_array$B(arr, len) {
14209
14209
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14210
14210
  return arr2;
14211
14211
  }
14212
- function _array_with_holes$j(arr) {
14212
+ function _array_with_holes$i(arr) {
14213
14213
  if (Array.isArray(arr)) return arr;
14214
14214
  }
14215
- function _iterable_to_array_limit$i(arr, i) {
14215
+ function _iterable_to_array_limit$h(arr, i) {
14216
14216
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
14217
14217
  if (_i == null) return;
14218
14218
  var _arr = [];
@@ -14236,11 +14236,11 @@ function _iterable_to_array_limit$i(arr, i) {
14236
14236
  }
14237
14237
  return _arr;
14238
14238
  }
14239
- function _non_iterable_rest$j() {
14239
+ function _non_iterable_rest$i() {
14240
14240
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14241
14241
  }
14242
- function _sliced_to_array$i(arr, i) {
14243
- return _array_with_holes$j(arr) || _iterable_to_array_limit$i(arr, i) || _unsupported_iterable_to_array$B(arr, i) || _non_iterable_rest$j();
14242
+ function _sliced_to_array$h(arr, i) {
14243
+ return _array_with_holes$i(arr) || _iterable_to_array_limit$h(arr, i) || _unsupported_iterable_to_array$B(arr, i) || _non_iterable_rest$i();
14244
14244
  }
14245
14245
  function _unsupported_iterable_to_array$B(o, minLen) {
14246
14246
  if (!o) return;
@@ -14262,10 +14262,10 @@ function parsePromptIdentifier(identifier) {
14262
14262
  if (!identifier || identifier.split("/").length > 2 || identifier.startsWith("/") || identifier.endsWith("/") || identifier.split(":").length > 2) {
14263
14263
  throw new Error("Invalid identifier format: ".concat(identifier));
14264
14264
  }
14265
- var _identifier_split = _sliced_to_array$i(identifier.split(":"), 2), ownerNamePart = _identifier_split[0], commitPart = _identifier_split[1];
14265
+ var _identifier_split = _sliced_to_array$h(identifier.split(":"), 2), ownerNamePart = _identifier_split[0], commitPart = _identifier_split[1];
14266
14266
  var commit = commitPart || "latest";
14267
14267
  if (ownerNamePart.includes("/")) {
14268
- var _ownerNamePart_split = _sliced_to_array$i(ownerNamePart.split("/", 2), 2), owner = _ownerNamePart_split[0], name = _ownerNamePart_split[1];
14268
+ var _ownerNamePart_split = _sliced_to_array$h(ownerNamePart.split("/", 2), 2), owner = _ownerNamePart_split[0], name = _ownerNamePart_split[1];
14269
14269
  if (!owner || !name) {
14270
14270
  throw new Error("Invalid identifier format: ".concat(identifier));
14271
14271
  }
@@ -14762,7 +14762,7 @@ function _array_like_to_array$A(arr, len) {
14762
14762
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14763
14763
  return arr2;
14764
14764
  }
14765
- function _array_with_holes$i(arr) {
14765
+ function _array_with_holes$h(arr) {
14766
14766
  if (Array.isArray(arr)) return arr;
14767
14767
  }
14768
14768
  function _array_without_holes$t(arr) {
@@ -15007,7 +15007,7 @@ function _instanceof$8(left, right) {
15007
15007
  function _iterable_to_array$u(iter) {
15008
15008
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
15009
15009
  }
15010
- function _iterable_to_array_limit$h(arr, i) {
15010
+ function _iterable_to_array_limit$g(arr, i) {
15011
15011
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
15012
15012
  if (_i == null) return;
15013
15013
  var _arr = [];
@@ -15031,7 +15031,7 @@ function _iterable_to_array_limit$h(arr, i) {
15031
15031
  }
15032
15032
  return _arr;
15033
15033
  }
15034
- function _non_iterable_rest$i() {
15034
+ function _non_iterable_rest$h() {
15035
15035
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15036
15036
  }
15037
15037
  function _non_iterable_spread$t() {
@@ -15076,9 +15076,9 @@ function _object_spread_props$w(target, source) {
15076
15076
  }
15077
15077
  return target;
15078
15078
  }
15079
- function _object_without_properties$8(source, excluded) {
15079
+ function _object_without_properties$9(source, excluded) {
15080
15080
  if (source == null) return {};
15081
- var target = _object_without_properties_loose$8(source, excluded);
15081
+ var target = _object_without_properties_loose$9(source, excluded);
15082
15082
  var key, i;
15083
15083
  if (Object.getOwnPropertySymbols) {
15084
15084
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -15091,7 +15091,7 @@ function _object_without_properties$8(source, excluded) {
15091
15091
  }
15092
15092
  return target;
15093
15093
  }
15094
- function _object_without_properties_loose$8(source, excluded) {
15094
+ function _object_without_properties_loose$9(source, excluded) {
15095
15095
  if (source == null) return {};
15096
15096
  var target = {};
15097
15097
  var sourceKeys = Object.keys(source);
@@ -15103,8 +15103,8 @@ function _object_without_properties_loose$8(source, excluded) {
15103
15103
  }
15104
15104
  return target;
15105
15105
  }
15106
- function _sliced_to_array$h(arr, i) {
15107
- return _array_with_holes$i(arr) || _iterable_to_array_limit$h(arr, i) || _unsupported_iterable_to_array$A(arr, i) || _non_iterable_rest$i();
15106
+ function _sliced_to_array$g(arr, i) {
15107
+ return _array_with_holes$h(arr) || _iterable_to_array_limit$g(arr, i) || _unsupported_iterable_to_array$A(arr, i) || _non_iterable_rest$h();
15108
15108
  }
15109
15109
  function _to_consumable_array$t(arr) {
15110
15110
  return _array_without_holes$t(arr) || _iterable_to_array$u(arr) || _unsupported_iterable_to_array$A(arr) || _non_iterable_spread$t();
@@ -15594,17 +15594,11 @@ var Client = /*#__PURE__*/ function() {
15594
15594
  writable: true,
15595
15595
  value: void 0
15596
15596
  });
15597
- Object.defineProperty(this, "autoBatchInitialDelayMs", {
15598
- enumerable: true,
15599
- configurable: true,
15600
- writable: true,
15601
- value: 250
15602
- });
15603
15597
  Object.defineProperty(this, "autoBatchAggregationDelayMs", {
15604
15598
  enumerable: true,
15605
15599
  configurable: true,
15606
15600
  writable: true,
15607
- value: 50
15601
+ value: 250
15608
15602
  });
15609
15603
  Object.defineProperty(this, "batchSizeBytesLimit", {
15610
15604
  enumerable: true,
@@ -16090,7 +16084,7 @@ var Client = /*#__PURE__*/ function() {
16090
16084
  key: "drainAutoBatchQueue",
16091
16085
  value: function drainAutoBatchQueue(batchSizeLimit) {
16092
16086
  while(this.autoBatchQueue.items.length > 0){
16093
- var _this_autoBatchQueue_pop = _sliced_to_array$h(this.autoBatchQueue.pop(batchSizeLimit), 2), batch = _this_autoBatchQueue_pop[0], done = _this_autoBatchQueue_pop[1];
16087
+ var _this_autoBatchQueue_pop = _sliced_to_array$g(this.autoBatchQueue.pop(batchSizeLimit), 2), batch = _this_autoBatchQueue_pop[0], done = _this_autoBatchQueue_pop[1];
16094
16088
  if (!batch.length) {
16095
16089
  done();
16096
16090
  break;
@@ -16186,11 +16180,10 @@ var Client = /*#__PURE__*/ function() {
16186
16180
  value: function processRunOperation(item) {
16187
16181
  var _this = this;
16188
16182
  return _async_to_generator$s(function() {
16189
- var oldTimeout, itemPromise, sizeLimitBytes;
16183
+ var itemPromise, sizeLimitBytes;
16190
16184
  return _ts_generator$t(this, function(_state) {
16191
16185
  switch(_state.label){
16192
16186
  case 0:
16193
- oldTimeout = _this.autoBatchTimeout;
16194
16187
  clearTimeout(_this.autoBatchTimeout);
16195
16188
  _this.autoBatchTimeout = undefined;
16196
16189
  if (item.action === "create") {
@@ -16210,7 +16203,7 @@ var Client = /*#__PURE__*/ function() {
16210
16203
  _this.autoBatchTimeout = setTimeout(function() {
16211
16204
  _this.autoBatchTimeout = undefined;
16212
16205
  _this.drainAutoBatchQueue(sizeLimitBytes);
16213
- }, oldTimeout ? _this.autoBatchAggregationDelayMs : _this.autoBatchInitialDelayMs);
16206
+ }, _this.autoBatchAggregationDelayMs);
16214
16207
  }
16215
16208
  return [
16216
16209
  2,
@@ -16692,7 +16685,7 @@ var Client = /*#__PURE__*/ function() {
16692
16685
  var runCreates = param.runCreates, runUpdates = param.runUpdates;
16693
16686
  var _this = this;
16694
16687
  return _async_to_generator$s(function() {
16695
- var allAttachments, preparedCreateParams, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, create, preparedCreate, preparedUpdateParams, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, update, invalidRunCreate, invalidRunUpdate, createById, standaloneUpdates, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, updateParam, accumulatedContext, accumulatedParts, _i, _iter, _ref, _ref1, method, payloads, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _ref2, originalPayload, inputs, outputs, events, payload, fields, stringifiedPayload, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _step_value, key, value, stringifiedValue, attachments, _iteratorNormalCompletion5, _didIteratorError5, _iteratorError5, _iterator5, _step5, _step_value1, name, _step_value_, contentType, content;
16688
+ var allAttachments, preparedCreateParams, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, create, preparedCreate, preparedUpdateParams, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, update, invalidRunCreate, invalidRunUpdate, createById, standaloneUpdates, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, updateParam, accumulatedContext, accumulatedParts, _i, _iter, _ref, _ref1, method, payloads, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _ref2, originalPayload, inputs, outputs, events, attachments, payload, fields, stringifiedPayload, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _step_value, key, value, stringifiedValue, attachments1, _iteratorNormalCompletion5, _didIteratorError5, _iteratorError5, _iterator5, _step5, _step_value1, name, _step_value_, contentType, content;
16696
16689
  return _ts_generator$t(this, function(_state) {
16697
16690
  switch(_state.label){
16698
16691
  case 0:
@@ -16819,17 +16812,18 @@ var Client = /*#__PURE__*/ function() {
16819
16812
  ]
16820
16813
  ]; _i < _iter.length; _i++){
16821
16814
  _ref = _iter[_i];
16822
- _ref1 = _sliced_to_array$h(_ref, 2), method = _ref1[0], payloads = _ref1[1];
16815
+ _ref1 = _sliced_to_array$g(_ref, 2), method = _ref1[0], payloads = _ref1[1];
16823
16816
  _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
16824
16817
  try {
16825
16818
  for(_iterator3 = payloads[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
16826
16819
  _ref2 = _step3.value;
16827
16820
  originalPayload = _ref2;
16828
16821
  // collect fields to be sent as separate parts
16829
- inputs = originalPayload.inputs, outputs = originalPayload.outputs, events = originalPayload.events, payload = _object_without_properties$8(originalPayload, [
16822
+ inputs = originalPayload.inputs, outputs = originalPayload.outputs, events = originalPayload.events, attachments = originalPayload.attachments, payload = _object_without_properties$9(originalPayload, [
16830
16823
  "inputs",
16831
16824
  "outputs",
16832
- "events"
16825
+ "events",
16826
+ "attachments"
16833
16827
  ]);
16834
16828
  fields = {
16835
16829
  inputs: inputs,
@@ -16850,7 +16844,7 @@ var Client = /*#__PURE__*/ function() {
16850
16844
  try {
16851
16845
  // encode the fields we collected
16852
16846
  for(_iterator4 = Object.entries(fields)[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){
16853
- _step_value = _sliced_to_array$h(_step4.value, 2), key = _step_value[0], value = _step_value[1];
16847
+ _step_value = _sliced_to_array$g(_step4.value, 2), key = _step_value[0], value = _step_value[1];
16854
16848
  if (value === undefined) {
16855
16849
  continue;
16856
16850
  }
@@ -16880,19 +16874,24 @@ var Client = /*#__PURE__*/ function() {
16880
16874
  }
16881
16875
  // encode the attachments
16882
16876
  if (payload.id !== undefined) {
16883
- attachments = allAttachments[payload.id];
16884
- if (attachments) {
16877
+ attachments1 = allAttachments[payload.id];
16878
+ if (attachments1) {
16885
16879
  delete allAttachments[payload.id];
16886
16880
  _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = undefined;
16887
16881
  try {
16888
- for(_iterator5 = Object.entries(attachments)[Symbol.iterator](); !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true){
16889
- _step_value1 = _sliced_to_array$h(_step5.value, 2), name = _step_value1[0], _step_value_ = _sliced_to_array$h(_step_value1[1], 2), contentType = _step_value_[0], content = _step_value_[1];
16882
+ for(_iterator5 = Object.entries(attachments1)[Symbol.iterator](); !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true){
16883
+ _step_value1 = _sliced_to_array$g(_step5.value, 2), name = _step_value1[0], _step_value_ = _sliced_to_array$g(_step_value1[1], 2), contentType = _step_value_[0], content = _step_value_[1];
16884
+ // Validate that the attachment name doesn't contain a '.'
16885
+ if (name.includes(".")) {
16886
+ console.warn("Skipping attachment '".concat(name, "' for run ").concat(payload.id, ": Invalid attachment name. ") + "Attachment names must not contain periods ('.'). Please rename the attachment and try again.");
16887
+ continue;
16888
+ }
16890
16889
  accumulatedParts.push({
16891
16890
  name: "attachment.".concat(payload.id, ".").concat(name),
16892
16891
  payload: new Blob([
16893
16892
  content
16894
16893
  ], {
16895
- type: "".concat(contentType, "; length=").concat(content.length)
16894
+ type: "".concat(contentType, "; length=").concat(content.byteLength)
16896
16895
  })
16897
16896
  });
16898
16897
  }
@@ -16980,6 +16979,7 @@ var Client = /*#__PURE__*/ function() {
16980
16979
  }
16981
16980
  }
16982
16981
  }
16982
+ // Log the form data
16983
16983
  return [
16984
16984
  4,
16985
16985
  _this.batchIngestCaller.call(_getFetchImplementation(), "".concat(_this.apiUrl, "/runs/multipart"), _object_spread$F({
@@ -17664,7 +17664,7 @@ var Client = /*#__PURE__*/ function() {
17664
17664
  };
17665
17665
  // Remove undefined values from the payload
17666
17666
  filteredPayload = Object.fromEntries(Object.entries(payload).filter(function(param) {
17667
- var _param = _sliced_to_array$h(param, 2); _param[0]; var value = _param[1];
17667
+ var _param = _sliced_to_array$g(param, 2); _param[0]; var value = _param[1];
17668
17668
  return value !== undefined;
17669
17669
  }));
17670
17670
  return [
@@ -18076,7 +18076,7 @@ var Client = /*#__PURE__*/ function() {
18076
18076
  }
18077
18077
  urlParams = new URLSearchParams();
18078
18078
  Object.entries(params).forEach(function(param) {
18079
- var _param = _sliced_to_array$h(param, 2), key = _param[0], value = _param[1];
18079
+ var _param = _sliced_to_array$g(param, 2), key = _param[0], value = _param[1];
18080
18080
  if (Array.isArray(value)) {
18081
18081
  value.forEach(function(v) {
18082
18082
  return urlParams.append(key, v);
@@ -19259,7 +19259,7 @@ var Client = /*#__PURE__*/ function() {
19259
19259
  return _ts_generator$t(this, function(_state) {
19260
19260
  switch(_state.label){
19261
19261
  case 0:
19262
- datasetId = props.datasetId, datasetName = props.datasetName, update = _object_without_properties$8(props, [
19262
+ datasetId = props.datasetId, datasetName = props.datasetName, update = _object_without_properties$9(props, [
19263
19263
  "datasetId",
19264
19264
  "datasetName"
19265
19265
  ]);
@@ -20377,7 +20377,7 @@ var Client = /*#__PURE__*/ function() {
20377
20377
  _this._logEvaluationFeedback(feedbackResult, run_, sourceInfo)
20378
20378
  ];
20379
20379
  case 7:
20380
- _ref = _sliced_to_array$h.apply(void 0, [
20380
+ _ref = _sliced_to_array$g.apply(void 0, [
20381
20381
  _state.sent(),
20382
20382
  2
20383
20383
  ]), _ref[0], feedbacks = _ref[1];
@@ -21102,7 +21102,7 @@ var Client = /*#__PURE__*/ function() {
21102
21102
  _this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo)
21103
21103
  ];
21104
21104
  case 1:
21105
- _ref = _sliced_to_array$h.apply(void 0, [
21105
+ _ref = _sliced_to_array$g.apply(void 0, [
21106
21106
  _state.sent(),
21107
21107
  1
21108
21108
  ]), results = _ref[0];
@@ -21274,7 +21274,7 @@ var Client = /*#__PURE__*/ function() {
21274
21274
  "Content-Type": "application/json"
21275
21275
  }),
21276
21276
  body: JSON.stringify(Object.fromEntries(Object.entries(body).filter(function(param) {
21277
- var _param = _sliced_to_array$h(param, 2); _param[0]; var v = _param[1];
21277
+ var _param = _sliced_to_array$g(param, 2); _param[0]; var v = _param[1];
21278
21278
  return v !== undefined;
21279
21279
  }))),
21280
21280
  signal: AbortSignal.timeout(_this.timeout_ms)
@@ -21614,7 +21614,7 @@ var Client = /*#__PURE__*/ function() {
21614
21614
  return _ts_generator$t(this, function(_state) {
21615
21615
  switch(_state.label){
21616
21616
  case 0:
21617
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
21617
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
21618
21618
  return [
21619
21619
  4,
21620
21620
  _this.caller.call(_getFetchImplementation(), "".concat(_this.apiUrl, "/likes/").concat(owner, "/").concat(promptName), _object_spread$F({
@@ -21659,7 +21659,7 @@ var Client = /*#__PURE__*/ function() {
21659
21659
  return _ts_generator$t(this, function(_state) {
21660
21660
  switch(_state.label){
21661
21661
  case 0:
21662
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], commitHash = _parsePromptIdentifier[2];
21662
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], commitHash = _parsePromptIdentifier[2];
21663
21663
  return [
21664
21664
  4,
21665
21665
  _this._currentTenantIsOwner(owner)
@@ -21984,7 +21984,7 @@ var Client = /*#__PURE__*/ function() {
21984
21984
  return _ts_generator$t(this, function(_state) {
21985
21985
  switch(_state.label){
21986
21986
  case 0:
21987
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
21987
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
21988
21988
  return [
21989
21989
  4,
21990
21990
  _this.caller.call(_getFetchImplementation(), "".concat(_this.apiUrl, "/repos/").concat(owner, "/").concat(promptName), _object_spread$F({
@@ -22047,7 +22047,7 @@ var Client = /*#__PURE__*/ function() {
22047
22047
  if ((options === null || options === void 0 ? void 0 : options.isPublic) && !settings.tenant_handle) {
22048
22048
  throw new Error("Cannot create a public prompt without first\n\n creating a LangChain Hub handle. \n You can add a handle by creating a public prompt at:\n\n https://smith.langchain.com/prompts");
22049
22049
  }
22050
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22050
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22051
22051
  return [
22052
22052
  4,
22053
22053
  _this._currentTenantIsOwner(owner)
@@ -22126,7 +22126,7 @@ var Client = /*#__PURE__*/ function() {
22126
22126
  if (!_state.sent()) {
22127
22127
  throw new Error("Prompt does not exist, you must create it first.");
22128
22128
  }
22129
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22129
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22130
22130
  if (!((options === null || options === void 0 ? void 0 : options.parentCommitHash) === "latest" || !(options === null || options === void 0 ? void 0 : options.parentCommitHash))) return [
22131
22131
  3,
22132
22132
  3
@@ -22201,7 +22201,7 @@ var Client = /*#__PURE__*/ function() {
22201
22201
  if (!_state.sent()) {
22202
22202
  throw new Error("Prompt does not exist, you must create it first.");
22203
22203
  }
22204
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 2), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1];
22204
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 2), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1];
22205
22205
  return [
22206
22206
  4,
22207
22207
  _this._currentTenantIsOwner(owner)
@@ -22273,7 +22273,7 @@ var Client = /*#__PURE__*/ function() {
22273
22273
  if (!_state.sent()) {
22274
22274
  throw new Error("Prompt does not exist, you must create it first.");
22275
22275
  }
22276
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22276
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], _parsePromptIdentifier[2];
22277
22277
  return [
22278
22278
  4,
22279
22279
  _this._currentTenantIsOwner(owner)
@@ -22323,7 +22323,7 @@ var Client = /*#__PURE__*/ function() {
22323
22323
  return _ts_generator$t(this, function(_state) {
22324
22324
  switch(_state.label){
22325
22325
  case 0:
22326
- _parsePromptIdentifier = _sliced_to_array$h(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], commitHash = _parsePromptIdentifier[2];
22326
+ _parsePromptIdentifier = _sliced_to_array$g(parsePromptIdentifier(promptIdentifier), 3), owner = _parsePromptIdentifier[0], promptName = _parsePromptIdentifier[1], commitHash = _parsePromptIdentifier[2];
22327
22327
  return [
22328
22328
  4,
22329
22329
  _this._getServerInfo()
@@ -22524,7 +22524,7 @@ var Client = /*#__PURE__*/ function() {
22524
22524
  switch(_state.label){
22525
22525
  case 0:
22526
22526
  _options_sourceApiUrl = options.sourceApiUrl, sourceApiUrl = _options_sourceApiUrl === void 0 ? _this.apiUrl : _options_sourceApiUrl, datasetName = options.datasetName;
22527
- _this_parseTokenOrUrl = _sliced_to_array$h(_this.parseTokenOrUrl(tokenOrUrl, sourceApiUrl), 2), parsedApiUrl = _this_parseTokenOrUrl[0], tokenUuid = _this_parseTokenOrUrl[1];
22527
+ _this_parseTokenOrUrl = _sliced_to_array$g(_this.parseTokenOrUrl(tokenOrUrl, sourceApiUrl), 2), parsedApiUrl = _this_parseTokenOrUrl[0], tokenUuid = _this_parseTokenOrUrl[1];
22528
22528
  sourceClient = new Client({
22529
22529
  apiUrl: parsedApiUrl,
22530
22530
  // Placeholder API key not needed anymore in most cases, but
@@ -22717,7 +22717,7 @@ var Client = /*#__PURE__*/ function() {
22717
22717
  }();
22718
22718
 
22719
22719
  // Update using yarn bump-version
22720
- var __version__ = "0.2.2";
22720
+ var __version__ = "0.2.4";
22721
22721
 
22722
22722
  // Inlined from https://github.com/flexdinesh/browser-or-node
22723
22723
  function _array_like_to_array$z(arr, len) {
@@ -22725,7 +22725,7 @@ function _array_like_to_array$z(arr, len) {
22725
22725
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
22726
22726
  return arr2;
22727
22727
  }
22728
- function _array_with_holes$h(arr) {
22728
+ function _array_with_holes$g(arr) {
22729
22729
  if (Array.isArray(arr)) return arr;
22730
22730
  }
22731
22731
  function _define_property$F(obj, key, value) {
@@ -22741,7 +22741,7 @@ function _define_property$F(obj, key, value) {
22741
22741
  }
22742
22742
  return obj;
22743
22743
  }
22744
- function _iterable_to_array_limit$g(arr, i) {
22744
+ function _iterable_to_array_limit$f(arr, i) {
22745
22745
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
22746
22746
  if (_i == null) return;
22747
22747
  var _arr = [];
@@ -22765,7 +22765,7 @@ function _iterable_to_array_limit$g(arr, i) {
22765
22765
  }
22766
22766
  return _arr;
22767
22767
  }
22768
- function _non_iterable_rest$h() {
22768
+ function _non_iterable_rest$g() {
22769
22769
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22770
22770
  }
22771
22771
  function _object_spread$E(target) {
@@ -22783,8 +22783,8 @@ function _object_spread$E(target) {
22783
22783
  }
22784
22784
  return target;
22785
22785
  }
22786
- function _sliced_to_array$g(arr, i) {
22787
- return _array_with_holes$h(arr) || _iterable_to_array_limit$g(arr, i) || _unsupported_iterable_to_array$z(arr, i) || _non_iterable_rest$h();
22786
+ function _sliced_to_array$f(arr, i) {
22787
+ return _array_with_holes$g(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$z(arr, i) || _non_iterable_rest$g();
22788
22788
  }
22789
22789
  function _unsupported_iterable_to_array$z(o, minLen) {
22790
22790
  if (!o) return;
@@ -22864,7 +22864,7 @@ function getRuntimeEnvironment$1() {
22864
22864
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
22865
22865
  try {
22866
22866
  for(var _iterator = Object.entries(allEnvVars)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
22867
- var _step_value = _sliced_to_array$g(_step.value, 2), key = _step_value[0], value = _step_value[1];
22867
+ var _step_value = _sliced_to_array$f(_step.value, 2), key = _step_value[0], value = _step_value[1];
22868
22868
  if (key.startsWith("LANGCHAIN_") && typeof value === "string" && !excluded.includes(key) && !key.toLowerCase().includes("key") && !key.toLowerCase().includes("secret") && !key.toLowerCase().includes("token")) {
22869
22869
  if (key === "LANGCHAIN_REVISION_ID") {
22870
22870
  envVars["revision_id"] = value;
@@ -22905,7 +22905,7 @@ function getRuntimeEnvironment$1() {
22905
22905
  if (typeof process !== "undefined" && process.env) {
22906
22906
  // eslint-disable-next-line no-process-env
22907
22907
  return Object.entries(process.env).reduce(function(acc, param) {
22908
- var _param = _sliced_to_array$g(param, 2), key = _param[0], value = _param[1];
22908
+ var _param = _sliced_to_array$f(param, 2), key = _param[0], value = _param[1];
22909
22909
  acc[key] = String(value);
22910
22910
  return acc;
22911
22911
  }, {});
@@ -23009,7 +23009,7 @@ function _array_like_to_array$y(arr, len) {
23009
23009
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
23010
23010
  return arr2;
23011
23011
  }
23012
- function _array_with_holes$g(arr) {
23012
+ function _array_with_holes$f(arr) {
23013
23013
  if (Array.isArray(arr)) return arr;
23014
23014
  }
23015
23015
  function _array_without_holes$s(arr) {
@@ -23079,7 +23079,7 @@ function _define_property$E(obj, key, value) {
23079
23079
  function _iterable_to_array$t(iter) {
23080
23080
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
23081
23081
  }
23082
- function _iterable_to_array_limit$f(arr, i) {
23082
+ function _iterable_to_array_limit$e(arr, i) {
23083
23083
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
23084
23084
  if (_i == null) return;
23085
23085
  var _arr = [];
@@ -23103,7 +23103,7 @@ function _iterable_to_array_limit$f(arr, i) {
23103
23103
  }
23104
23104
  return _arr;
23105
23105
  }
23106
- function _non_iterable_rest$g() {
23106
+ function _non_iterable_rest$f() {
23107
23107
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
23108
23108
  }
23109
23109
  function _non_iterable_spread$s() {
@@ -23148,9 +23148,9 @@ function _object_spread_props$v(target, source) {
23148
23148
  }
23149
23149
  return target;
23150
23150
  }
23151
- function _object_without_properties$7(source, excluded) {
23151
+ function _object_without_properties$8(source, excluded) {
23152
23152
  if (source == null) return {};
23153
- var target = _object_without_properties_loose$7(source, excluded);
23153
+ var target = _object_without_properties_loose$8(source, excluded);
23154
23154
  var key, i;
23155
23155
  if (Object.getOwnPropertySymbols) {
23156
23156
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -23163,7 +23163,7 @@ function _object_without_properties$7(source, excluded) {
23163
23163
  }
23164
23164
  return target;
23165
23165
  }
23166
- function _object_without_properties_loose$7(source, excluded) {
23166
+ function _object_without_properties_loose$8(source, excluded) {
23167
23167
  if (source == null) return {};
23168
23168
  var target = {};
23169
23169
  var sourceKeys = Object.keys(source);
@@ -23175,8 +23175,8 @@ function _object_without_properties_loose$7(source, excluded) {
23175
23175
  }
23176
23176
  return target;
23177
23177
  }
23178
- function _sliced_to_array$f(arr, i) {
23179
- return _array_with_holes$g(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$y(arr, i) || _non_iterable_rest$g();
23178
+ function _sliced_to_array$e(arr, i) {
23179
+ return _array_with_holes$f(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$y(arr, i) || _non_iterable_rest$f();
23180
23180
  }
23181
23181
  function _to_consumable_array$s(arr) {
23182
23182
  return _array_without_holes$s(arr) || _iterable_to_array$t(arr) || _unsupported_iterable_to_array$y(arr) || _non_iterable_spread$s();
@@ -23339,7 +23339,7 @@ function convertToDottedOrderFormat$1(epoch, runId) {
23339
23339
  try {
23340
23340
  for(var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
23341
23341
  var item = _step.value;
23342
- var _item_split = _sliced_to_array$f(item.split("="), 2), key = _item_split[0], uriValue = _item_split[1];
23342
+ var _item_split = _sliced_to_array$e(item.split("="), 2), key = _item_split[0], uriValue = _item_split[1];
23343
23343
  var _$value = decodeURIComponent(uriValue);
23344
23344
  if (key === "langsmith-metadata") {
23345
23345
  metadata = JSON.parse(_$value);
@@ -23503,13 +23503,22 @@ var RunTree = /*#__PURE__*/ function() {
23503
23503
  writable: true,
23504
23504
  value: void 0
23505
23505
  });
23506
+ /**
23507
+ * Attachments associated with the run.
23508
+ * Each entry is a tuple of [mime_type, bytes]
23509
+ */ Object.defineProperty(this, "attachments", {
23510
+ enumerable: true,
23511
+ configurable: true,
23512
+ writable: true,
23513
+ value: void 0
23514
+ });
23506
23515
  // If you pass in a run tree directly, return a shallow clone
23507
23516
  if (isRunTree(originalConfig)) {
23508
23517
  Object.assign(this, _object_spread$D({}, originalConfig));
23509
23518
  return;
23510
23519
  }
23511
23520
  var defaultConfig = RunTree.getDefaultConfig();
23512
- var metadata = originalConfig.metadata, config = _object_without_properties$7(originalConfig, [
23521
+ var metadata = originalConfig.metadata, config = _object_without_properties$8(originalConfig, [
23513
23522
  "metadata"
23514
23523
  ]);
23515
23524
  var _config_client;
@@ -23632,7 +23641,7 @@ var RunTree = /*#__PURE__*/ function() {
23632
23641
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
23633
23642
  try {
23634
23643
  for(var _iterator = Object.entries(runtimeEnv)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
23635
- var _step_value = _sliced_to_array$f(_step.value, 2), k = _step_value[0], v = _step_value[1];
23644
+ var _step_value = _sliced_to_array$e(_step.value, 2), k = _step_value[0], v = _step_value[1];
23636
23645
  if (!runExtra.runtime[k]) {
23637
23646
  runExtra.runtime[k] = v;
23638
23647
  }
@@ -23681,7 +23690,8 @@ var RunTree = /*#__PURE__*/ function() {
23681
23690
  parent_run_id: parent_run_id,
23682
23691
  trace_id: run.trace_id,
23683
23692
  dotted_order: run.dotted_order,
23684
- tags: run.tags
23693
+ tags: run.tags,
23694
+ attachments: run.attachments
23685
23695
  };
23686
23696
  return persistedRun;
23687
23697
  }
@@ -23823,7 +23833,8 @@ var RunTree = /*#__PURE__*/ function() {
23823
23833
  events: _this.events,
23824
23834
  dotted_order: _this.dotted_order,
23825
23835
  trace_id: _this.trace_id,
23826
- tags: _this.tags
23836
+ tags: _this.tags,
23837
+ attachments: _this.attachments
23827
23838
  };
23828
23839
  return [
23829
23840
  4,
@@ -23869,7 +23880,7 @@ var RunTree = /*#__PURE__*/ function() {
23869
23880
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
23870
23881
  try {
23871
23882
  for(var _iterator = Object.entries(result)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
23872
- var _step_value = _sliced_to_array$f(_step.value, 2), key = _step_value[0], value = _step_value[1];
23883
+ var _step_value = _sliced_to_array$e(_step.value, 2), key = _step_value[0], value = _step_value[1];
23873
23884
  headers.set(key, value);
23874
23885
  }
23875
23886
  } catch (err) {
@@ -23986,7 +23997,7 @@ var RunTree = /*#__PURE__*/ function() {
23986
23997
  if (!headerTrace || typeof headerTrace !== "string") return undefined;
23987
23998
  var parentDottedOrder = headerTrace.trim();
23988
23999
  var parsedDottedOrder = parentDottedOrder.split(".").map(function(part) {
23989
- var _part_split = _sliced_to_array$f(part.split("Z"), 2), strTime = _part_split[0], uuid = _part_split[1];
24000
+ var _part_split = _sliced_to_array$e(part.split("Z"), 2), strTime = _part_split[0], uuid = _part_split[1];
23990
24001
  return {
23991
24002
  strTime: strTime,
23992
24003
  time: Date.parse(strTime + "Z"),
@@ -26646,6 +26657,14 @@ var BaseTracer = /*#__PURE__*/ function(BaseCallbackHandler) {
26646
26657
  return BaseTracer;
26647
26658
  }(BaseCallbackHandler);
26648
26659
 
26660
+ var TRACING_ALS_KEY = Symbol.for("ls:tracing_async_local_storage");
26661
+ var setGlobalAsyncLocalStorageInstance = function(instance) {
26662
+ globalThis[TRACING_ALS_KEY] = instance;
26663
+ };
26664
+ var getGlobalAsyncLocalStorageInstance = function() {
26665
+ return globalThis[TRACING_ALS_KEY];
26666
+ };
26667
+
26649
26668
  var ansiStyles = {
26650
26669
  exports: {}
26651
26670
  };
@@ -27401,12 +27420,24 @@ var color = styles.color;
27401
27420
  return ConsoleCallbackHandler;
27402
27421
  }(BaseTracer);
27403
27422
 
27423
+ var client;
27424
+ var getDefaultLangChainClientSingleton = function() {
27425
+ if (client === undefined) {
27426
+ var clientParams = getEnvironmentVariable("LANGCHAIN_CALLBACKS_BACKGROUND") === "false" ? {
27427
+ // LangSmith has its own backgrounding system
27428
+ blockOnRootRunFinalization: true
27429
+ } : {};
27430
+ client = new Client(clientParams);
27431
+ }
27432
+ return client;
27433
+ };
27434
+
27404
27435
  function _array_like_to_array$v(arr, len) {
27405
27436
  if (len == null || len > arr.length) len = arr.length;
27406
27437
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
27407
27438
  return arr2;
27408
27439
  }
27409
- function _array_with_holes$f(arr) {
27440
+ function _array_with_holes$e(arr) {
27410
27441
  if (Array.isArray(arr)) return arr;
27411
27442
  }
27412
27443
  function _array_without_holes$p(arr) {
@@ -27501,7 +27532,7 @@ function _inherits$k(subClass, superClass) {
27501
27532
  function _iterable_to_array$q(iter) {
27502
27533
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
27503
27534
  }
27504
- function _iterable_to_array_limit$e(arr, i) {
27535
+ function _iterable_to_array_limit$d(arr, i) {
27505
27536
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
27506
27537
  if (_i == null) return;
27507
27538
  var _arr = [];
@@ -27525,7 +27556,7 @@ function _iterable_to_array_limit$e(arr, i) {
27525
27556
  }
27526
27557
  return _arr;
27527
27558
  }
27528
- function _non_iterable_rest$f() {
27559
+ function _non_iterable_rest$e() {
27529
27560
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27530
27561
  }
27531
27562
  function _non_iterable_spread$p() {
@@ -27583,8 +27614,8 @@ function _set_prototype_of$k(o, p) {
27583
27614
  };
27584
27615
  return _set_prototype_of$k(o, p);
27585
27616
  }
27586
- function _sliced_to_array$e(arr, i) {
27587
- return _array_with_holes$f(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$v(arr, i) || _non_iterable_rest$f();
27617
+ function _sliced_to_array$d(arr, i) {
27618
+ return _array_with_holes$e(arr) || _iterable_to_array_limit$d(arr, i) || _unsupported_iterable_to_array$v(arr, i) || _non_iterable_rest$e();
27588
27619
  }
27589
27620
  function _to_consumable_array$p(arr) {
27590
27621
  return _array_without_holes$p(arr) || _iterable_to_array$q(arr) || _unsupported_iterable_to_array$v(arr) || _non_iterable_spread$p();
@@ -27756,10 +27787,7 @@ var LangChainTracer = /*#__PURE__*/ function(BaseTracer) {
27756
27787
  var _ref;
27757
27788
  _this.projectName = (_ref = projectName !== null && projectName !== void 0 ? projectName : getEnvironmentVariable("LANGCHAIN_PROJECT")) !== null && _ref !== void 0 ? _ref : getEnvironmentVariable("LANGCHAIN_SESSION");
27758
27789
  _this.exampleId = exampleId;
27759
- _this.client = client !== null && client !== void 0 ? client : new Client({
27760
- // LangChain has its own backgrounding system
27761
- blockOnRootRunFinalization: true
27762
- });
27790
+ _this.client = client !== null && client !== void 0 ? client : getDefaultLangChainClientSingleton();
27763
27791
  var traceableTree = LangChainTracer.getTraceableRunTree();
27764
27792
  if (traceableTree) {
27765
27793
  _this.updateFromRunTree(traceableTree);
@@ -27925,7 +27953,7 @@ var LangChainTracer = /*#__PURE__*/ function(BaseTracer) {
27925
27953
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
27926
27954
  try {
27927
27955
  for(var _iterator = this.runMap[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
27928
- var _step_value = _sliced_to_array$e(_step.value, 2), _$id = _step_value[0], run = _step_value[1];
27956
+ var _step_value = _sliced_to_array$d(_step.value, 2), _$id = _step_value[0], run = _step_value[1];
27929
27957
  // by converting the run map to a run tree, we are doing a copy
27930
27958
  // thus, any mutation performed on the run tree will not be reflected
27931
27959
  // back in the run map
@@ -27966,7 +27994,7 @@ var LangChainTracer = /*#__PURE__*/ function(BaseTracer) {
27966
27994
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
27967
27995
  try {
27968
27996
  for(var _iterator1 = runTreeList[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
27969
- var _step_value1 = _sliced_to_array$e(_step1.value, 1), _$id1 = _step_value1[0];
27997
+ var _step_value1 = _sliced_to_array$d(_step1.value, 1), _$id1 = _step_value1[0];
27970
27998
  var run1 = this.runMap.get(_$id1);
27971
27999
  var runTree1 = runTreeMap[_$id1];
27972
28000
  if (!run1 || !runTree1) continue;
@@ -28010,7 +28038,7 @@ var LangChainTracer = /*#__PURE__*/ function(BaseTracer) {
28010
28038
  return LangChainTracer;
28011
28039
  }(BaseTracer);
28012
28040
 
28013
- function asyncGeneratorStep$n(gen, resolve, reject, _next, _throw, key, arg) {
28041
+ /* eslint-disable @typescript-eslint/no-explicit-any */ function asyncGeneratorStep$n(gen, resolve, reject, _next, _throw, key, arg) {
28014
28042
  try {
28015
28043
  var info = gen[key](arg);
28016
28044
  var value = info.value;
@@ -28146,6 +28174,12 @@ var queue;
28146
28174
  concurrency: 1
28147
28175
  });
28148
28176
  }
28177
+ function getQueue() {
28178
+ if (typeof queue === "undefined") {
28179
+ queue = createQueue();
28180
+ }
28181
+ return queue;
28182
+ }
28149
28183
  /**
28150
28184
  * Consume a promise, either adding it to the queue or waiting for it to resolve
28151
28185
  * @param promiseFn Promise to consume
@@ -28159,26 +28193,87 @@ function _consumeCallback() {
28159
28193
  switch(_state.label){
28160
28194
  case 0:
28161
28195
  if (!(wait === true)) return [
28196
+ 3,
28197
+ 5
28198
+ ];
28199
+ if (!(getGlobalAsyncLocalStorageInstance() !== undefined)) return [
28162
28200
  3,
28163
28201
  2
28164
28202
  ];
28165
28203
  return [
28166
28204
  4,
28167
- promiseFn()
28205
+ getGlobalAsyncLocalStorageInstance().run(undefined, /*#__PURE__*/ _async_to_generator$n(function() {
28206
+ return _ts_generator$o(this, function(_state) {
28207
+ return [
28208
+ 2,
28209
+ promiseFn()
28210
+ ];
28211
+ });
28212
+ }))
28168
28213
  ];
28169
28214
  case 1:
28170
28215
  _state.sent();
28171
28216
  return [
28172
28217
  3,
28173
- 3
28218
+ 4
28174
28219
  ];
28175
28220
  case 2:
28176
- if (typeof queue === "undefined") {
28177
- queue = createQueue();
28178
- }
28179
- void queue.add(promiseFn);
28180
- _state.label = 3;
28221
+ return [
28222
+ 4,
28223
+ promiseFn()
28224
+ ];
28181
28225
  case 3:
28226
+ _state.sent();
28227
+ _state.label = 4;
28228
+ case 4:
28229
+ return [
28230
+ 3,
28231
+ 6
28232
+ ];
28233
+ case 5:
28234
+ queue = getQueue();
28235
+ void queue.add(/*#__PURE__*/ _async_to_generator$n(function() {
28236
+ return _ts_generator$o(this, function(_state) {
28237
+ switch(_state.label){
28238
+ case 0:
28239
+ if (!(getGlobalAsyncLocalStorageInstance() !== undefined)) return [
28240
+ 3,
28241
+ 2
28242
+ ];
28243
+ return [
28244
+ 4,
28245
+ getGlobalAsyncLocalStorageInstance().run(undefined, /*#__PURE__*/ _async_to_generator$n(function() {
28246
+ return _ts_generator$o(this, function(_state) {
28247
+ return [
28248
+ 2,
28249
+ promiseFn()
28250
+ ];
28251
+ });
28252
+ }))
28253
+ ];
28254
+ case 1:
28255
+ _state.sent();
28256
+ return [
28257
+ 3,
28258
+ 4
28259
+ ];
28260
+ case 2:
28261
+ return [
28262
+ 4,
28263
+ promiseFn()
28264
+ ];
28265
+ case 3:
28266
+ _state.sent();
28267
+ _state.label = 4;
28268
+ case 4:
28269
+ return [
28270
+ 2
28271
+ ];
28272
+ }
28273
+ });
28274
+ }));
28275
+ _state.label = 6;
28276
+ case 6:
28182
28277
  return [
28183
28278
  2
28184
28279
  ];
@@ -30536,7 +30631,6 @@ var MockAsyncLocalStorage = /*#__PURE__*/ function() {
30536
30631
  return MockAsyncLocalStorage;
30537
30632
  }();
30538
30633
  var mockAsyncLocalStorage = new MockAsyncLocalStorage();
30539
- var TRACING_ALS_KEY = Symbol.for("ls:tracing_async_local_storage");
30540
30634
  var LC_CHILD_KEY = Symbol.for("lc:child_config");
30541
30635
  var _CONTEXT_VARIABLES_KEY = Symbol.for("lc:context_variables");
30542
30636
  var AsyncLocalStorageProvider = /*#__PURE__*/ function() {
@@ -30547,8 +30641,8 @@ var AsyncLocalStorageProvider = /*#__PURE__*/ function() {
30547
30641
  {
30548
30642
  key: "getInstance",
30549
30643
  value: function getInstance() {
30550
- var _globalThis_TRACING_ALS_KEY;
30551
- return (_globalThis_TRACING_ALS_KEY = globalThis[TRACING_ALS_KEY]) !== null && _globalThis_TRACING_ALS_KEY !== void 0 ? _globalThis_TRACING_ALS_KEY : mockAsyncLocalStorage;
30644
+ var _getGlobalAsyncLocalStorageInstance;
30645
+ return (_getGlobalAsyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance()) !== null && _getGlobalAsyncLocalStorageInstance !== void 0 ? _getGlobalAsyncLocalStorageInstance : mockAsyncLocalStorage;
30552
30646
  }
30553
30647
  },
30554
30648
  {
@@ -30594,8 +30688,8 @@ var AsyncLocalStorageProvider = /*#__PURE__*/ function() {
30594
30688
  {
30595
30689
  key: "initializeGlobalInstance",
30596
30690
  value: function initializeGlobalInstance(instance) {
30597
- if (globalThis[TRACING_ALS_KEY] === undefined) {
30598
- globalThis[TRACING_ALS_KEY] = instance;
30691
+ if (getGlobalAsyncLocalStorageInstance() === undefined) {
30692
+ setGlobalAsyncLocalStorageInstance(instance);
30599
30693
  }
30600
30694
  }
30601
30695
  }
@@ -30775,7 +30869,7 @@ function _array_like_to_array$t(arr, len) {
30775
30869
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
30776
30870
  return arr2;
30777
30871
  }
30778
- function _array_with_holes$e(arr) {
30872
+ function _array_with_holes$d(arr) {
30779
30873
  if (Array.isArray(arr)) return arr;
30780
30874
  }
30781
30875
  function _array_without_holes$n(arr) {
@@ -30977,7 +31071,7 @@ function _is_native_function$1(fn) {
30977
31071
  function _iterable_to_array$o(iter) {
30978
31072
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
30979
31073
  }
30980
- function _iterable_to_array_limit$d(arr, i) {
31074
+ function _iterable_to_array_limit$c(arr, i) {
30981
31075
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
30982
31076
  if (_i == null) return;
30983
31077
  var _arr = [];
@@ -31001,7 +31095,7 @@ function _iterable_to_array_limit$d(arr, i) {
31001
31095
  }
31002
31096
  return _arr;
31003
31097
  }
31004
- function _non_iterable_rest$e() {
31098
+ function _non_iterable_rest$d() {
31005
31099
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
31006
31100
  }
31007
31101
  function _non_iterable_spread$n() {
@@ -31035,8 +31129,8 @@ function _set_prototype_of$i(o, p) {
31035
31129
  };
31036
31130
  return _set_prototype_of$i(o, p);
31037
31131
  }
31038
- function _sliced_to_array$d(arr, i) {
31039
- return _array_with_holes$e(arr) || _iterable_to_array_limit$d(arr, i) || _unsupported_iterable_to_array$t(arr, i) || _non_iterable_rest$e();
31132
+ function _sliced_to_array$c(arr, i) {
31133
+ return _array_with_holes$d(arr) || _iterable_to_array_limit$c(arr, i) || _unsupported_iterable_to_array$t(arr, i) || _non_iterable_rest$d();
31040
31134
  }
31041
31135
  function _to_consumable_array$n(arr) {
31042
31136
  return _array_without_holes$n(arr) || _iterable_to_array$o(arr) || _unsupported_iterable_to_array$t(arr) || _non_iterable_spread$n();
@@ -31567,7 +31661,7 @@ function concat(first, second) {
31567
31661
  try {
31568
31662
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31569
31663
  for(var _iterator = Object.entries(second)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
31570
- var _step_value = _sliced_to_array$d(_step.value, 2), key = _step_value[0], value = _step_value[1];
31664
+ var _step_value = _sliced_to_array$c(_step.value, 2), key = _step_value[0], value = _step_value[1];
31571
31665
  if (key in chunk && !Array.isArray(chunk[key])) {
31572
31666
  chunk[key] = concat(chunk[key], value);
31573
31667
  } else {
@@ -34495,7 +34589,7 @@ function _array_like_to_array$r(arr, len) {
34495
34589
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
34496
34590
  return arr2;
34497
34591
  }
34498
- function _array_with_holes$d(arr) {
34592
+ function _array_with_holes$c(arr) {
34499
34593
  if (Array.isArray(arr)) return arr;
34500
34594
  }
34501
34595
  function _array_without_holes$l(arr) {
@@ -34546,7 +34640,7 @@ function _define_property$u(obj, key, value) {
34546
34640
  function _iterable_to_array$m(iter) {
34547
34641
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
34548
34642
  }
34549
- function _iterable_to_array_limit$c(arr, i) {
34643
+ function _iterable_to_array_limit$b(arr, i) {
34550
34644
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
34551
34645
  if (_i == null) return;
34552
34646
  var _arr = [];
@@ -34570,7 +34664,7 @@ function _iterable_to_array_limit$c(arr, i) {
34570
34664
  }
34571
34665
  return _arr;
34572
34666
  }
34573
- function _non_iterable_rest$d() {
34667
+ function _non_iterable_rest$c() {
34574
34668
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
34575
34669
  }
34576
34670
  function _non_iterable_spread$l() {
@@ -34591,9 +34685,9 @@ function _object_spread$t(target) {
34591
34685
  }
34592
34686
  return target;
34593
34687
  }
34594
- function _object_without_properties$6(source, excluded) {
34688
+ function _object_without_properties$7(source, excluded) {
34595
34689
  if (source == null) return {};
34596
- var target = _object_without_properties_loose$6(source, excluded);
34690
+ var target = _object_without_properties_loose$7(source, excluded);
34597
34691
  var key, i;
34598
34692
  if (Object.getOwnPropertySymbols) {
34599
34693
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -34606,7 +34700,7 @@ function _object_without_properties$6(source, excluded) {
34606
34700
  }
34607
34701
  return target;
34608
34702
  }
34609
- function _object_without_properties_loose$6(source, excluded) {
34703
+ function _object_without_properties_loose$7(source, excluded) {
34610
34704
  if (source == null) return {};
34611
34705
  var target = {};
34612
34706
  var sourceKeys = Object.keys(source);
@@ -34618,8 +34712,8 @@ function _object_without_properties_loose$6(source, excluded) {
34618
34712
  }
34619
34713
  return target;
34620
34714
  }
34621
- function _sliced_to_array$c(arr, i) {
34622
- return _array_with_holes$d(arr) || _iterable_to_array_limit$c(arr, i) || _unsupported_iterable_to_array$r(arr, i) || _non_iterable_rest$d();
34715
+ function _sliced_to_array$b(arr, i) {
34716
+ return _array_with_holes$c(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$r(arr, i) || _non_iterable_rest$c();
34623
34717
  }
34624
34718
  function _to_consumable_array$l(arr) {
34625
34719
  return _array_without_holes$l(arr) || _iterable_to_array$m(arr) || _unsupported_iterable_to_array$r(arr) || _non_iterable_spread$l();
@@ -34921,13 +35015,13 @@ var PRIMITIVES = new Set([
34921
35015
  // Don't allow runId and runName to be loaded implicitly, as this can cause
34922
35016
  // child runs to improperly inherit their parents' run ids.
34923
35017
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
34924
- implicitConfig.runId; implicitConfig.runName; var rest = _object_without_properties$6(implicitConfig, [
35018
+ implicitConfig.runId; implicitConfig.runName; var rest = _object_without_properties$7(implicitConfig, [
34925
35019
  "runId",
34926
35020
  "runName"
34927
35021
  ]);
34928
35022
  empty = Object.entries(rest).reduce(// eslint-disable-next-line @typescript-eslint/no-explicit-any
34929
35023
  function(currentConfig, param) {
34930
- var _param = _sliced_to_array$c(param, 2), key = _param[0], value = _param[1];
35024
+ var _param = _sliced_to_array$b(param, 2), key = _param[0], value = _param[1];
34931
35025
  if (value !== undefined) {
34932
35026
  // eslint-disable-next-line no-param-reassign
34933
35027
  currentConfig[key] = value;
@@ -34938,7 +35032,7 @@ var PRIMITIVES = new Set([
34938
35032
  if (config) {
34939
35033
  empty = Object.entries(config).reduce(// eslint-disable-next-line @typescript-eslint/no-explicit-any
34940
35034
  function(currentConfig, param) {
34941
- var _param = _sliced_to_array$c(param, 2), key = _param[0], value = _param[1];
35035
+ var _param = _sliced_to_array$b(param, 2), key = _param[0], value = _param[1];
34942
35036
  if (value !== undefined) {
34943
35037
  // eslint-disable-next-line no-param-reassign
34944
35038
  currentConfig[key] = value;
@@ -35797,7 +35891,7 @@ function _array_like_to_array$p(arr, len) {
35797
35891
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
35798
35892
  return arr2;
35799
35893
  }
35800
- function _array_with_holes$c(arr) {
35894
+ function _array_with_holes$b(arr) {
35801
35895
  if (Array.isArray(arr)) return arr;
35802
35896
  }
35803
35897
  function _array_without_holes$j(arr) {
@@ -35819,7 +35913,7 @@ function _define_property$s(obj, key, value) {
35819
35913
  function _iterable_to_array$k(iter) {
35820
35914
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
35821
35915
  }
35822
- function _iterable_to_array_limit$b(arr, i) {
35916
+ function _iterable_to_array_limit$a(arr, i) {
35823
35917
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
35824
35918
  if (_i == null) return;
35825
35919
  var _arr = [];
@@ -35843,7 +35937,7 @@ function _iterable_to_array_limit$b(arr, i) {
35843
35937
  }
35844
35938
  return _arr;
35845
35939
  }
35846
- function _non_iterable_rest$c() {
35940
+ function _non_iterable_rest$b() {
35847
35941
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35848
35942
  }
35849
35943
  function _non_iterable_spread$j() {
@@ -35888,8 +35982,8 @@ function _object_spread_props$o(target, source) {
35888
35982
  }
35889
35983
  return target;
35890
35984
  }
35891
- function _sliced_to_array$b(arr, i) {
35892
- return _array_with_holes$c(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$p(arr, i) || _non_iterable_rest$c();
35985
+ function _sliced_to_array$a(arr, i) {
35986
+ return _array_with_holes$b(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$p(arr, i) || _non_iterable_rest$b();
35893
35987
  }
35894
35988
  function _to_consumable_array$j(arr) {
35895
35989
  return _array_without_holes$j(arr) || _iterable_to_array$k(arr) || _unsupported_iterable_to_array$p(arr) || _non_iterable_spread$j();
@@ -35912,7 +36006,7 @@ var getRefs = function(options) {
35912
36006
  currentPath: currentPath,
35913
36007
  propertyPath: undefined,
35914
36008
  seen: new Map(Object.entries(_options.definitions).map(function(param) {
35915
- var _param = _sliced_to_array$b(param, 2), name = _param[0], def = _param[1];
36009
+ var _param = _sliced_to_array$a(param, 2), name = _param[0], def = _param[1];
35916
36010
  return [
35917
36011
  def._def,
35918
36012
  {
@@ -36074,11 +36168,11 @@ function _unsupported_iterable_to_array$o(o, minLen) {
36074
36168
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$o(o, minLen);
36075
36169
  }
36076
36170
  function parseArrayDef(def, refs) {
36077
- var _def_type__def, _def_type;
36171
+ var _def_type, _def_type__def, _def_type1;
36078
36172
  var res = {
36079
36173
  type: "array"
36080
36174
  };
36081
- if (((_def_type = def.type) === null || _def_type === void 0 ? void 0 : (_def_type__def = _def_type._def) === null || _def_type__def === void 0 ? void 0 : _def_type__def.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
36175
+ if (((_def_type = def.type) === null || _def_type === void 0 ? void 0 : _def_type._def) && ((_def_type1 = def.type) === null || _def_type1 === void 0 ? void 0 : (_def_type__def = _def_type1._def) === null || _def_type__def === void 0 ? void 0 : _def_type__def.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
36082
36176
  res.items = parseDef(def.type._def, _object_spread_props$m(_object_spread$p({}, refs), {
36083
36177
  currentPath: _to_consumable_array$i(refs.currentPath).concat([
36084
36178
  "items"
@@ -36371,9 +36465,9 @@ function _object_spread_props$k(target, source) {
36371
36465
  }
36372
36466
  return target;
36373
36467
  }
36374
- function _object_without_properties$5(source, excluded) {
36468
+ function _object_without_properties$6(source, excluded) {
36375
36469
  if (source == null) return {};
36376
- var target = _object_without_properties_loose$5(source, excluded);
36470
+ var target = _object_without_properties_loose$6(source, excluded);
36377
36471
  var key, i;
36378
36472
  if (Object.getOwnPropertySymbols) {
36379
36473
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -36386,7 +36480,7 @@ function _object_without_properties$5(source, excluded) {
36386
36480
  }
36387
36481
  return target;
36388
36482
  }
36389
- function _object_without_properties_loose$5(source, excluded) {
36483
+ function _object_without_properties_loose$6(source, excluded) {
36390
36484
  if (source == null) return {};
36391
36485
  var target = {};
36392
36486
  var sourceKeys = Object.keys(source);
@@ -36447,7 +36541,7 @@ function parseIntersectionDef(def, refs) {
36447
36541
  } else {
36448
36542
  var nestedSchema = schema;
36449
36543
  if ("additionalProperties" in schema && schema.additionalProperties === false) {
36450
- schema.additionalProperties; var rest = _object_without_properties$5(schema, [
36544
+ schema.additionalProperties; var rest = _object_without_properties$6(schema, [
36451
36545
  "additionalProperties"
36452
36546
  ]);
36453
36547
  nestedSchema = rest;
@@ -36516,6 +36610,7 @@ function _object_spread$m(target) {
36516
36610
  }
36517
36611
  return target;
36518
36612
  }
36613
+ var emojiRegex;
36519
36614
  /**
36520
36615
  * Generated from the regular expressions found here as of 2024-05-22:
36521
36616
  * https://github.com/colinhacks/zod/blob/master/src/types.ts.
@@ -36532,7 +36627,20 @@ function _object_spread$m(target) {
36532
36627
  */ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
36533
36628
  /**
36534
36629
  * Constructed a valid Unicode RegExp
36535
- */ emoji: RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"),
36630
+ *
36631
+ * Lazily instantiate since this type of regex isn't supported
36632
+ * in all envs (e.g. React Native).
36633
+ *
36634
+ * See:
36635
+ * https://github.com/colinhacks/zod/issues/2433
36636
+ * Fix in Zod:
36637
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
36638
+ */ emoji: function() {
36639
+ if (emojiRegex === undefined) {
36640
+ emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
36641
+ }
36642
+ return emojiRegex;
36643
+ },
36536
36644
  /**
36537
36645
  * Unused
36538
36646
  */ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
@@ -36667,7 +36775,7 @@ function parseStringDef(def, refs) {
36667
36775
  case "trim":
36668
36776
  break;
36669
36777
  default:
36670
- (function(_) {})(check);
36778
+ /* c8 ignore next */ (function(_) {})(check);
36671
36779
  }
36672
36780
  }
36673
36781
  } catch (err) {
@@ -36763,7 +36871,8 @@ var addPattern = function(schema, regex, message, refs) {
36763
36871
  }
36764
36872
  };
36765
36873
  // Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true
36766
- var processRegExp = function(regex, refs) {
36874
+ var processRegExp = function(regexOrFunction, refs) {
36875
+ var regex = typeof regexOrFunction === "function" ? regexOrFunction() : regexOrFunction;
36767
36876
  if (!refs.applyRegexFlags || !regex.flags) return regex.source;
36768
36877
  // Currently handled flags
36769
36878
  var flags = {
@@ -36840,9 +36949,6 @@ function _array_like_to_array$m(arr, len) {
36840
36949
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
36841
36950
  return arr2;
36842
36951
  }
36843
- function _array_with_holes$b(arr) {
36844
- if (Array.isArray(arr)) return arr;
36845
- }
36846
36952
  function _array_without_holes$g(arr) {
36847
36953
  if (Array.isArray(arr)) return _array_like_to_array$m(arr);
36848
36954
  }
@@ -36862,33 +36968,6 @@ function _define_property$m(obj, key, value) {
36862
36968
  function _iterable_to_array$h(iter) {
36863
36969
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
36864
36970
  }
36865
- function _iterable_to_array_limit$a(arr, i) {
36866
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
36867
- if (_i == null) return;
36868
- var _arr = [];
36869
- var _n = true;
36870
- var _d = false;
36871
- var _s, _e;
36872
- try {
36873
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
36874
- _arr.push(_s.value);
36875
- if (i && _arr.length === i) break;
36876
- }
36877
- } catch (err) {
36878
- _d = true;
36879
- _e = err;
36880
- } finally{
36881
- try {
36882
- if (!_n && _i["return"] != null) _i["return"]();
36883
- } finally{
36884
- if (_d) throw _e;
36885
- }
36886
- }
36887
- return _arr;
36888
- }
36889
- function _non_iterable_rest$b() {
36890
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
36891
- }
36892
36971
  function _non_iterable_spread$g() {
36893
36972
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
36894
36973
  }
@@ -36931,8 +37010,32 @@ function _object_spread_props$j(target, source) {
36931
37010
  }
36932
37011
  return target;
36933
37012
  }
36934
- function _sliced_to_array$a(arr, i) {
36935
- return _array_with_holes$b(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$m(arr, i) || _non_iterable_rest$b();
37013
+ function _object_without_properties$5(source, excluded) {
37014
+ if (source == null) return {};
37015
+ var target = _object_without_properties_loose$5(source, excluded);
37016
+ var key, i;
37017
+ if (Object.getOwnPropertySymbols) {
37018
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
37019
+ for(i = 0; i < sourceSymbolKeys.length; i++){
37020
+ key = sourceSymbolKeys[i];
37021
+ if (excluded.indexOf(key) >= 0) continue;
37022
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
37023
+ target[key] = source[key];
37024
+ }
37025
+ }
37026
+ return target;
37027
+ }
37028
+ function _object_without_properties_loose$5(source, excluded) {
37029
+ if (source == null) return {};
37030
+ var target = {};
37031
+ var sourceKeys = Object.keys(source);
37032
+ var key, i;
37033
+ for(i = 0; i < sourceKeys.length; i++){
37034
+ key = sourceKeys[i];
37035
+ if (excluded.indexOf(key) >= 0) continue;
37036
+ target[key] = source[key];
37037
+ }
37038
+ return target;
36936
37039
  }
36937
37040
  function _to_consumable_array$g(arr) {
36938
37041
  return _array_without_holes$g(arr) || _iterable_to_array$h(arr) || _unsupported_iterable_to_array$m(arr) || _non_iterable_spread$g();
@@ -36946,7 +37049,7 @@ function _unsupported_iterable_to_array$m(o, minLen) {
36946
37049
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$m(o, minLen);
36947
37050
  }
36948
37051
  function parseRecordDef(def, refs) {
36949
- var _def_keyType, _def_keyType1, _def_keyType__def_checks, _def_keyType2;
37052
+ var _def_keyType, _def_keyType1, _def_keyType__def_checks, _def_keyType2, _def_keyType3, _def_keyType__def_type__def_checks;
36950
37053
  if (refs.target === "openApi3" && ((_def_keyType = def.keyType) === null || _def_keyType === void 0 ? void 0 : _def_keyType._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
36951
37054
  return {
36952
37055
  type: "object",
@@ -36976,10 +37079,9 @@ function parseRecordDef(def, refs) {
36976
37079
  return schema;
36977
37080
  }
36978
37081
  if (((_def_keyType1 = def.keyType) === null || _def_keyType1 === void 0 ? void 0 : _def_keyType1._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_def_keyType__def_checks = def.keyType._def.checks) === null || _def_keyType__def_checks === void 0 ? void 0 : _def_keyType__def_checks.length)) {
36979
- var keyType = Object.entries(parseStringDef(def.keyType._def, refs)).reduce(function(acc, param) {
36980
- var _param = _sliced_to_array$a(param, 2), key = _param[0], value = _param[1];
36981
- return key === "type" ? acc : _object_spread_props$j(_object_spread$l({}, acc), _define_property$m({}, key, value));
36982
- }, {});
37082
+ var _parseStringDef = parseStringDef(def.keyType._def, refs); _parseStringDef.type; var keyType = _object_without_properties$5(_parseStringDef, [
37083
+ "type"
37084
+ ]);
36983
37085
  return _object_spread_props$j(_object_spread$l({}, schema), {
36984
37086
  propertyNames: keyType
36985
37087
  });
@@ -36989,6 +37091,13 @@ function parseRecordDef(def, refs) {
36989
37091
  enum: def.keyType._def.values
36990
37092
  }
36991
37093
  });
37094
+ } else if (((_def_keyType3 = def.keyType) === null || _def_keyType3 === void 0 ? void 0 : _def_keyType3._def.typeName) === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && ((_def_keyType__def_type__def_checks = def.keyType._def.type._def.checks) === null || _def_keyType__def_type__def_checks === void 0 ? void 0 : _def_keyType__def_type__def_checks.length)) {
37095
+ var _parseBrandedDef = parseBrandedDef(def.keyType._def, refs); _parseBrandedDef.type; var keyType1 = _object_without_properties$5(_parseBrandedDef, [
37096
+ "type"
37097
+ ]);
37098
+ return _object_spread_props$j(_object_spread$l({}, schema), {
37099
+ propertyNames: keyType1
37100
+ });
36992
37101
  }
36993
37102
  return schema;
36994
37103
  }
@@ -38276,7 +38385,7 @@ var selectParser = function(def, typeName, refs) {
38276
38385
  case ZodFirstPartyTypeKind.ZodSymbol:
38277
38386
  return undefined;
38278
38387
  default:
38279
- return function(_) {
38388
+ /* c8 ignore next */ return function(_) {
38280
38389
  return undefined;
38281
38390
  }();
38282
38391
  }
@@ -42558,6 +42667,43 @@ function _coerceToDict(value, defaultKey) {
42558
42667
  }(Serializable);
42559
42668
  /**
42560
42669
  * A runnable that delegates calls to another runnable with a set of kwargs.
42670
+ * @example
42671
+ * ```typescript
42672
+ * import {
42673
+ * type RunnableConfig,
42674
+ * RunnableLambda,
42675
+ * } from "@langchain/core/runnables";
42676
+ *
42677
+ * const enhanceProfile = (
42678
+ * profile: Record<string, any>,
42679
+ * config?: RunnableConfig
42680
+ * ) => {
42681
+ * if (config?.configurable?.role) {
42682
+ * return { ...profile, role: config.configurable.role };
42683
+ * }
42684
+ * return profile;
42685
+ * };
42686
+ *
42687
+ * const runnable = RunnableLambda.from(enhanceProfile);
42688
+ *
42689
+ * // Bind configuration to the runnable to set the user's role dynamically
42690
+ * const adminRunnable = runnable.bind({ configurable: { role: "Admin" } });
42691
+ * const userRunnable = runnable.bind({ configurable: { role: "User" } });
42692
+ *
42693
+ * const result1 = await adminRunnable.invoke({
42694
+ * name: "Alice",
42695
+ * email: "alice@example.com"
42696
+ * });
42697
+ *
42698
+ * // { name: "Alice", email: "alice@example.com", role: "Admin" }
42699
+ *
42700
+ * const result2 = await userRunnable.invoke({
42701
+ * name: "Bob",
42702
+ * email: "bob@example.com"
42703
+ * });
42704
+ *
42705
+ * // { name: "Bob", email: "bob@example.com", role: "User" }
42706
+ * ```
42561
42707
  */ var RunnableBinding = /*#__PURE__*/ function(Runnable1) {
42562
42708
  _inherits$e(RunnableBinding, Runnable1);
42563
42709
  var _super = _create_super$e(RunnableBinding);
@@ -43027,6 +43173,24 @@ function _coerceToDict(value, defaultKey) {
43027
43173
  /**
43028
43174
  * A runnable that delegates calls to another runnable
43029
43175
  * with each element of the input sequence.
43176
+ * @example
43177
+ * ```typescript
43178
+ * import { RunnableEach, RunnableLambda } from "@langchain/core/runnables";
43179
+ *
43180
+ * const toUpperCase = (input: string): string => input.toUpperCase();
43181
+ * const addGreeting = (input: string): string => `Hello, ${input}!`;
43182
+ *
43183
+ * const upperCaseLambda = RunnableLambda.from(toUpperCase);
43184
+ * const greetingLambda = RunnableLambda.from(addGreeting);
43185
+ *
43186
+ * const chain = new RunnableEach({
43187
+ * bound: upperCaseLambda.pipe(greetingLambda),
43188
+ * });
43189
+ *
43190
+ * const result = await chain.invoke(["alice", "bob", "carol"])
43191
+ *
43192
+ * // ["Hello, ALICE!", "Hello, BOB!", "Hello, CAROL!"]
43193
+ * ```
43030
43194
  */ var RunnableEach = /*#__PURE__*/ function(Runnable) {
43031
43195
  _inherits$e(RunnableEach, Runnable);
43032
43196
  var _super = _create_super$e(RunnableEach);
@@ -43147,6 +43311,45 @@ function _coerceToDict(value, defaultKey) {
43147
43311
  /**
43148
43312
  * Base class for runnables that can be retried a
43149
43313
  * specified number of times.
43314
+ * @example
43315
+ * ```typescript
43316
+ * import {
43317
+ * RunnableLambda,
43318
+ * RunnableRetry,
43319
+ * } from "@langchain/core/runnables";
43320
+ *
43321
+ * // Simulate an API call that fails
43322
+ * const simulateApiCall = (input: string): string => {
43323
+ * console.log(`Attempting API call with input: ${input}`);
43324
+ * throw new Error("API call failed due to network issue");
43325
+ * };
43326
+ *
43327
+ * const apiCallLambda = RunnableLambda.from(simulateApiCall);
43328
+ *
43329
+ * // Apply retry logic using the .withRetry() method
43330
+ * const apiCallWithRetry = apiCallLambda.withRetry({ stopAfterAttempt: 3 });
43331
+ *
43332
+ * // Alternatively, create a RunnableRetry instance manually
43333
+ * const manualRetry = new RunnableRetry({
43334
+ * bound: apiCallLambda,
43335
+ * maxAttemptNumber: 3,
43336
+ * config: {},
43337
+ * });
43338
+ *
43339
+ * // Example invocation using the .withRetry() method
43340
+ * const res = await apiCallWithRetry
43341
+ * .invoke("Request 1")
43342
+ * .catch((error) => {
43343
+ * console.error("Failed after multiple retries:", error.message);
43344
+ * });
43345
+ *
43346
+ * // Example invocation using the manual retry instance
43347
+ * const res2 = await manualRetry
43348
+ * .invoke("Request 2")
43349
+ * .catch((error) => {
43350
+ * console.error("Failed after multiple retries:", error.message);
43351
+ * });
43352
+ * ```
43150
43353
  */ var RunnableRetry = /*#__PURE__*/ function(RunnableBinding) {
43151
43354
  _inherits$e(RunnableRetry, RunnableBinding);
43152
43355
  var _super = _create_super$e(RunnableRetry);
@@ -44560,7 +44763,30 @@ function assertNonTraceableFunction(func) {
44560
44763
  }
44561
44764
  }
44562
44765
  /**
44563
- * A runnable that runs a callable.
44766
+ * A runnable that wraps an arbitrary function that takes a single argument.
44767
+ * @example
44768
+ * ```typescript
44769
+ * import { RunnableLambda } from "@langchain/core/runnables";
44770
+ *
44771
+ * const add = (input: { x: number; y: number }) => input.x + input.y;
44772
+ *
44773
+ * const multiply = (input: { value: number; multiplier: number }) =>
44774
+ * input.value * input.multiplier;
44775
+ *
44776
+ * // Create runnables for the functions
44777
+ * const addLambda = RunnableLambda.from(add);
44778
+ * const multiplyLambda = RunnableLambda.from(multiply);
44779
+ *
44780
+ * // Chain the lambdas for a mathematical operation
44781
+ * const chainedLambda = addLambda.pipe((result) =>
44782
+ * multiplyLambda.invoke({ value: result, multiplier: 2 })
44783
+ * );
44784
+ *
44785
+ * // Example invocation of the chainedLambda
44786
+ * const result = await chainedLambda.invoke({ x: 2, y: 3 });
44787
+ *
44788
+ * // Will log "10" (since (2 + 3) * 2 = 10)
44789
+ * ```
44564
44790
  */ var RunnableLambda = /*#__PURE__*/ function(Runnable1) {
44565
44791
  _inherits$e(RunnableLambda, Runnable1);
44566
44792
  var _super = _create_super$e(RunnableLambda);
@@ -45338,6 +45564,55 @@ function assertNonTraceableFunction(func) {
45338
45564
  * When streaming, fallbacks will only be called on failures during the initial
45339
45565
  * stream creation. Errors that occur after a stream starts will not fallback
45340
45566
  * to the next Runnable.
45567
+ *
45568
+ * @example
45569
+ * ```typescript
45570
+ * import {
45571
+ * RunnableLambda,
45572
+ * RunnableWithFallbacks,
45573
+ * } from "@langchain/core/runnables";
45574
+ *
45575
+ * const primaryOperation = (input: string): string => {
45576
+ * if (input !== "safe") {
45577
+ * throw new Error("Primary operation failed due to unsafe input");
45578
+ * }
45579
+ * return `Processed: ${input}`;
45580
+ * };
45581
+ *
45582
+ * // Define a fallback operation that processes the input differently
45583
+ * const fallbackOperation = (input: string): string =>
45584
+ * `Fallback processed: ${input}`;
45585
+ *
45586
+ * const primaryRunnable = RunnableLambda.from(primaryOperation);
45587
+ * const fallbackRunnable = RunnableLambda.from(fallbackOperation);
45588
+ *
45589
+ * // Apply the fallback logic using the .withFallbacks() method
45590
+ * const runnableWithFallback = primaryRunnable.withFallbacks([fallbackRunnable]);
45591
+ *
45592
+ * // Alternatively, create a RunnableWithFallbacks instance manually
45593
+ * const manualFallbackChain = new RunnableWithFallbacks({
45594
+ * runnable: primaryRunnable,
45595
+ * fallbacks: [fallbackRunnable],
45596
+ * });
45597
+ *
45598
+ * // Example invocation using .withFallbacks()
45599
+ * const res = await runnableWithFallback
45600
+ * .invoke("unsafe input")
45601
+ * .catch((error) => {
45602
+ * console.error("Failed after all attempts:", error.message);
45603
+ * });
45604
+ *
45605
+ * // "Fallback processed: unsafe input"
45606
+ *
45607
+ * // Example invocation using manual instantiation
45608
+ * const res = await manualFallbackChain
45609
+ * .invoke("safe")
45610
+ * .catch((error) => {
45611
+ * console.error("Failed after all attempts:", error.message);
45612
+ * });
45613
+ *
45614
+ * // "Processed: safe"
45615
+ * ```
45341
45616
  */ var RunnableWithFallbacks = /*#__PURE__*/ function(Runnable) {
45342
45617
  _inherits$e(RunnableWithFallbacks, Runnable);
45343
45618
  var _super = _create_super$e(RunnableWithFallbacks);
@@ -46053,6 +46328,34 @@ function _coerceToRunnable(coerceable) {
46053
46328
  }
46054
46329
  /**
46055
46330
  * A runnable that assigns key-value pairs to inputs of type `Record<string, unknown>`.
46331
+ * @example
46332
+ * ```typescript
46333
+ * import {
46334
+ * RunnableAssign,
46335
+ * RunnableLambda,
46336
+ * RunnableParallel,
46337
+ * } from "@langchain/core/runnables";
46338
+ *
46339
+ * const calculateAge = (x: { birthYear: number }): { age: number } => {
46340
+ * const currentYear = new Date().getFullYear();
46341
+ * return { age: currentYear - x.birthYear };
46342
+ * };
46343
+ *
46344
+ * const createGreeting = (x: { name: string }): { greeting: string } => {
46345
+ * return { greeting: `Hello, ${x.name}!` };
46346
+ * };
46347
+ *
46348
+ * const mapper = RunnableParallel.from({
46349
+ * age_step: RunnableLambda.from(calculateAge),
46350
+ * greeting_step: RunnableLambda.from(createGreeting),
46351
+ * });
46352
+ *
46353
+ * const runnableAssign = new RunnableAssign({ mapper });
46354
+ *
46355
+ * const res = await runnableAssign.invoke({ name: "Alice", birthYear: 1990 });
46356
+ *
46357
+ * // { name: "Alice", birthYear: 1990, age_step: { age: 34 }, greeting_step: { greeting: "Hello, Alice!" } }
46358
+ * ```
46056
46359
  */ var RunnableAssign = /*#__PURE__*/ function(Runnable) {
46057
46360
  _inherits$e(RunnableAssign, Runnable);
46058
46361
  var _super = _create_super$e(RunnableAssign);
@@ -46403,6 +46706,27 @@ function _coerceToRunnable(coerceable) {
46403
46706
  }(Runnable);
46404
46707
  /**
46405
46708
  * A runnable that assigns key-value pairs to inputs of type `Record<string, unknown>`.
46709
+ * Useful for streaming, can be automatically created and chained by calling `runnable.pick();`.
46710
+ * @example
46711
+ * ```typescript
46712
+ * import { RunnablePick } from "@langchain/core/runnables";
46713
+ *
46714
+ * const inputData = {
46715
+ * name: "John",
46716
+ * age: 30,
46717
+ * city: "New York",
46718
+ * country: "USA",
46719
+ * email: "john.doe@example.com",
46720
+ * phone: "+1234567890",
46721
+ * };
46722
+ *
46723
+ * const basicInfoRunnable = new RunnablePick(["name", "city"]);
46724
+ *
46725
+ * // Example invocation
46726
+ * const res = await basicInfoRunnable.invoke(inputData);
46727
+ *
46728
+ * // { name: 'John', city: 'New York' }
46729
+ * ```
46406
46730
  */ var RunnablePick = /*#__PURE__*/ function(Runnable) {
46407
46731
  _inherits$e(RunnablePick, Runnable);
46408
46732
  var _super = _create_super$e(RunnablePick);
@@ -50371,11 +50695,23 @@ function getEncodingNameForModel(model) {
50371
50695
  case "gpt-4-turbo-preview":
50372
50696
  case "gpt-4-0125-preview":
50373
50697
  case "text-embedding-ada-002":
50698
+ case "text-embedding-3-small":
50699
+ case "text-embedding-3-large":
50374
50700
  {
50375
50701
  return "cl100k_base";
50376
50702
  }
50377
50703
  case "gpt-4o":
50378
50704
  case "gpt-4o-2024-05-13":
50705
+ case "gpt-4o-2024-08-06":
50706
+ case "gpt-4o-mini-2024-07-18":
50707
+ case "gpt-4o-mini":
50708
+ case "o1-mini":
50709
+ case "o1-preview":
50710
+ case "o1-preview-2024-09-12":
50711
+ case "o1-mini-2024-09-12":
50712
+ case "chatgpt-4o-latest":
50713
+ case "gpt-4o-realtime":
50714
+ case "gpt-4o-realtime-preview-2024-10-01":
50379
50715
  {
50380
50716
  return "o200k_base";
50381
50717
  }