@elizaos/core 1.7.1-alpha.3 → 1.7.1-alpha.5

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.
@@ -5053,11 +5053,11 @@ var require_ast = __commonJS((exports, module) => {
5053
5053
  helperExpression: function helperExpression(node) {
5054
5054
  return node.type === "SubExpression" || (node.type === "MustacheStatement" || node.type === "BlockStatement") && !!(node.params && node.params.length || node.hash);
5055
5055
  },
5056
- scopedId: function scopedId(path2) {
5057
- return /^\.|this\b/.test(path2.original);
5056
+ scopedId: function scopedId(path) {
5057
+ return /^\.|this\b/.test(path.original);
5058
5058
  },
5059
- simpleId: function simpleId(path2) {
5060
- return path2.parts.length === 1 && !AST.helpers.scopedId(path2) && !path2.depth;
5059
+ simpleId: function simpleId(path) {
5060
+ return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
5061
5061
  }
5062
5062
  }
5063
5063
  };
@@ -6117,12 +6117,12 @@ var require_helpers2 = __commonJS((exports) => {
6117
6117
  loc
6118
6118
  };
6119
6119
  }
6120
- function prepareMustache(path2, params, hash, open, strip, locInfo) {
6120
+ function prepareMustache(path, params, hash, open, strip, locInfo) {
6121
6121
  var escapeFlag = open.charAt(3) || open.charAt(2), escaped = escapeFlag !== "{" && escapeFlag !== "&";
6122
6122
  var decorator = /\*/.test(open);
6123
6123
  return {
6124
6124
  type: decorator ? "Decorator" : "MustacheStatement",
6125
- path: path2,
6125
+ path,
6126
6126
  params,
6127
6127
  hash,
6128
6128
  escaped,
@@ -6386,9 +6386,9 @@ var require_compiler = __commonJS((exports) => {
6386
6386
  },
6387
6387
  DecoratorBlock: function DecoratorBlock(decorator) {
6388
6388
  var program = decorator.program && this.compileProgram(decorator.program);
6389
- var params = this.setupFullMustacheParams(decorator, program, undefined), path2 = decorator.path;
6389
+ var params = this.setupFullMustacheParams(decorator, program, undefined), path = decorator.path;
6390
6390
  this.useDecorators = true;
6391
- this.opcode("registerDecorator", params.length, path2.original);
6391
+ this.opcode("registerDecorator", params.length, path.original);
6392
6392
  },
6393
6393
  PartialStatement: function PartialStatement(partial) {
6394
6394
  this.usePartial = true;
@@ -6451,46 +6451,46 @@ var require_compiler = __commonJS((exports) => {
6451
6451
  }
6452
6452
  },
6453
6453
  ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
6454
- var path2 = sexpr.path, name = path2.parts[0], isBlock = program != null || inverse != null;
6455
- this.opcode("getContext", path2.depth);
6454
+ var path = sexpr.path, name = path.parts[0], isBlock = program != null || inverse != null;
6455
+ this.opcode("getContext", path.depth);
6456
6456
  this.opcode("pushProgram", program);
6457
6457
  this.opcode("pushProgram", inverse);
6458
- path2.strict = true;
6459
- this.accept(path2);
6458
+ path.strict = true;
6459
+ this.accept(path);
6460
6460
  this.opcode("invokeAmbiguous", name, isBlock);
6461
6461
  },
6462
6462
  simpleSexpr: function simpleSexpr(sexpr) {
6463
- var path2 = sexpr.path;
6464
- path2.strict = true;
6465
- this.accept(path2);
6463
+ var path = sexpr.path;
6464
+ path.strict = true;
6465
+ this.accept(path);
6466
6466
  this.opcode("resolvePossibleLambda");
6467
6467
  },
6468
6468
  helperSexpr: function helperSexpr(sexpr, program, inverse) {
6469
- var params = this.setupFullMustacheParams(sexpr, program, inverse), path2 = sexpr.path, name = path2.parts[0];
6469
+ var params = this.setupFullMustacheParams(sexpr, program, inverse), path = sexpr.path, name = path.parts[0];
6470
6470
  if (this.options.knownHelpers[name]) {
6471
6471
  this.opcode("invokeKnownHelper", params.length, name);
6472
6472
  } else if (this.options.knownHelpersOnly) {
6473
6473
  throw new _exception2["default"]("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
6474
6474
  } else {
6475
- path2.strict = true;
6476
- path2.falsy = true;
6477
- this.accept(path2);
6478
- this.opcode("invokeHelper", params.length, path2.original, _ast2["default"].helpers.simpleId(path2));
6475
+ path.strict = true;
6476
+ path.falsy = true;
6477
+ this.accept(path);
6478
+ this.opcode("invokeHelper", params.length, path.original, _ast2["default"].helpers.simpleId(path));
6479
6479
  }
6480
6480
  },
6481
- PathExpression: function PathExpression(path2) {
6482
- this.addDepth(path2.depth);
6483
- this.opcode("getContext", path2.depth);
6484
- var name = path2.parts[0], scoped = _ast2["default"].helpers.scopedId(path2), blockParamId = !path2.depth && !scoped && this.blockParamIndex(name);
6481
+ PathExpression: function PathExpression(path) {
6482
+ this.addDepth(path.depth);
6483
+ this.opcode("getContext", path.depth);
6484
+ var name = path.parts[0], scoped = _ast2["default"].helpers.scopedId(path), blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
6485
6485
  if (blockParamId) {
6486
- this.opcode("lookupBlockParam", blockParamId, path2.parts);
6486
+ this.opcode("lookupBlockParam", blockParamId, path.parts);
6487
6487
  } else if (!name) {
6488
6488
  this.opcode("pushContext");
6489
- } else if (path2.data) {
6489
+ } else if (path.data) {
6490
6490
  this.options.data = true;
6491
- this.opcode("lookupData", path2.depth, path2.parts, path2.strict);
6491
+ this.opcode("lookupData", path.depth, path.parts, path.strict);
6492
6492
  } else {
6493
- this.opcode("lookupOnContext", path2.parts, path2.falsy, path2.strict, scoped);
6493
+ this.opcode("lookupOnContext", path.parts, path.falsy, path.strict, scoped);
6494
6494
  }
6495
6495
  },
6496
6496
  StringLiteral: function StringLiteral(string) {
@@ -6834,16 +6834,16 @@ var require_util = __commonJS((exports) => {
6834
6834
  }
6835
6835
  exports.urlGenerate = urlGenerate;
6836
6836
  function normalize(aPath) {
6837
- var path2 = aPath;
6837
+ var path = aPath;
6838
6838
  var url = urlParse(aPath);
6839
6839
  if (url) {
6840
6840
  if (!url.path) {
6841
6841
  return aPath;
6842
6842
  }
6843
- path2 = url.path;
6843
+ path = url.path;
6844
6844
  }
6845
- var isAbsolute = exports.isAbsolute(path2);
6846
- var parts = path2.split(/\/+/);
6845
+ var isAbsolute = exports.isAbsolute(path);
6846
+ var parts = path.split(/\/+/);
6847
6847
  for (var part, up = 0, i = parts.length - 1;i >= 0; i--) {
6848
6848
  part = parts[i];
6849
6849
  if (part === ".") {
@@ -6860,15 +6860,15 @@ var require_util = __commonJS((exports) => {
6860
6860
  }
6861
6861
  }
6862
6862
  }
6863
- path2 = parts.join("/");
6864
- if (path2 === "") {
6865
- path2 = isAbsolute ? "/" : ".";
6863
+ path = parts.join("/");
6864
+ if (path === "") {
6865
+ path = isAbsolute ? "/" : ".";
6866
6866
  }
6867
6867
  if (url) {
6868
- url.path = path2;
6868
+ url.path = path;
6869
6869
  return urlGenerate(url);
6870
6870
  }
6871
- return path2;
6871
+ return path;
6872
6872
  }
6873
6873
  exports.normalize = normalize;
6874
6874
  function join(aRoot, aPath) {
@@ -9425,8 +9425,8 @@ var require_printer = __commonJS((exports) => {
9425
9425
  return this.accept(sexpr.path) + " " + params + hash;
9426
9426
  };
9427
9427
  PrintVisitor.prototype.PathExpression = function(id) {
9428
- var path2 = id.parts.join("/");
9429
- return (id.data ? "@" : "") + "PATH:" + path2;
9428
+ var path = id.parts.join("/");
9429
+ return (id.data ? "@" : "") + "PATH:" + path;
9430
9430
  };
9431
9431
  PrintVisitor.prototype.StringLiteral = function(string) {
9432
9432
  return '"' + string.value + '"';
@@ -9463,8 +9463,8 @@ var require_lib = __commonJS((exports, module) => {
9463
9463
  handlebars.print = printer.print;
9464
9464
  module.exports = handlebars;
9465
9465
  function extension(module2, filename) {
9466
- var fs2 = __require("fs");
9467
- var templateString = fs2.readFileSync(filename, "utf8");
9466
+ var fs = __require("fs");
9467
+ var templateString = fs.readFileSync(filename, "utf8");
9468
9468
  module2.exports = handlebars.compile(templateString);
9469
9469
  }
9470
9470
  if (__require.extensions) {
@@ -9653,19 +9653,19 @@ var require_parse4 = __commonJS((exports, module) => {
9653
9653
  const wildcards = [];
9654
9654
  var wcLen = 0;
9655
9655
  const secret = paths.reduce(function(o, strPath, ix) {
9656
- var path2 = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
9656
+ var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
9657
9657
  const leadingBracket = strPath[0] === "[";
9658
- path2 = path2.map((p) => {
9658
+ path = path.map((p) => {
9659
9659
  if (p[0] === "[")
9660
9660
  return p.substr(1, p.length - 2);
9661
9661
  else
9662
9662
  return p;
9663
9663
  });
9664
- const star = path2.indexOf("*");
9664
+ const star = path.indexOf("*");
9665
9665
  if (star > -1) {
9666
- const before = path2.slice(0, star);
9666
+ const before = path.slice(0, star);
9667
9667
  const beforeStr = before.join(".");
9668
- const after = path2.slice(star + 1, path2.length);
9668
+ const after = path.slice(star + 1, path.length);
9669
9669
  const nested = after.length > 0;
9670
9670
  wcLen++;
9671
9671
  wildcards.push({
@@ -9676,7 +9676,7 @@ var require_parse4 = __commonJS((exports, module) => {
9676
9676
  });
9677
9677
  } else {
9678
9678
  o[strPath] = {
9679
- path: path2,
9679
+ path,
9680
9680
  val: undefined,
9681
9681
  precensored: false,
9682
9682
  circle: "",
@@ -9719,13 +9719,13 @@ var require_redactor = __commonJS((exports, module) => {
9719
9719
  return redact;
9720
9720
  }
9721
9721
  function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
9722
- return Object.keys(secret).map((path2) => {
9723
- const { escPath, leadingBracket, path: arrPath } = secret[path2];
9722
+ return Object.keys(secret).map((path) => {
9723
+ const { escPath, leadingBracket, path: arrPath } = secret[path];
9724
9724
  const skip = leadingBracket ? 1 : 0;
9725
9725
  const delim = leadingBracket ? "" : ".";
9726
9726
  const hops = [];
9727
9727
  var match;
9728
- while ((match = rx.exec(path2)) !== null) {
9728
+ while ((match = rx.exec(path)) !== null) {
9729
9729
  const [, ix] = match;
9730
9730
  const { index, input } = match;
9731
9731
  if (index > skip)
@@ -9733,9 +9733,9 @@ var require_redactor = __commonJS((exports, module) => {
9733
9733
  }
9734
9734
  var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
9735
9735
  if (existence.length === 0)
9736
- existence += `o${delim}${path2} != null`;
9736
+ existence += `o${delim}${path} != null`;
9737
9737
  else
9738
- existence += ` && o${delim}${path2} != null`;
9738
+ existence += ` && o${delim}${path} != null`;
9739
9739
  const circularDetection = `
9740
9740
  switch (true) {
9741
9741
  ${hops.reverse().map((p) => `
@@ -9749,12 +9749,12 @@ var require_redactor = __commonJS((exports, module) => {
9749
9749
  const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
9750
9750
  return `
9751
9751
  if (${existence}) {
9752
- const val = o${delim}${path2}
9752
+ const val = o${delim}${path}
9753
9753
  if (val === censor) {
9754
9754
  secret[${escPath}].precensored = true
9755
9755
  } else {
9756
9756
  secret[${escPath}].val = val
9757
- o${delim}${path2} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
9757
+ o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
9758
9758
  ${circularDetection}
9759
9759
  }
9760
9760
  }
@@ -9805,14 +9805,14 @@ var require_modifiers = __commonJS((exports, module) => {
9805
9805
  target[k] = values[i];
9806
9806
  }
9807
9807
  }
9808
- function groupRedact(o, path2, censor, isCensorFct, censorFctTakesPath) {
9809
- const target = get(o, path2);
9808
+ function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
9809
+ const target = get(o, path);
9810
9810
  if (target == null || typeof target === "string")
9811
9811
  return { keys: null, values: null, target, flat: true };
9812
9812
  const keys2 = Object.keys(target);
9813
9813
  const keysLength = keys2.length;
9814
- const pathLength = path2.length;
9815
- const pathWithKey = censorFctTakesPath ? [...path2] : undefined;
9814
+ const pathLength = path.length;
9815
+ const pathWithKey = censorFctTakesPath ? [...path] : undefined;
9816
9816
  const values = new Array(keysLength);
9817
9817
  for (var i = 0;i < keysLength; i++) {
9818
9818
  const key = keys2[i];
@@ -9830,30 +9830,30 @@ var require_modifiers = __commonJS((exports, module) => {
9830
9830
  }
9831
9831
  function nestedRestore(instructions) {
9832
9832
  for (let i = 0;i < instructions.length; i++) {
9833
- const { target, path: path2, value } = instructions[i];
9833
+ const { target, path, value } = instructions[i];
9834
9834
  let current = target;
9835
- for (let i2 = path2.length - 1;i2 > 0; i2--) {
9836
- current = current[path2[i2]];
9835
+ for (let i2 = path.length - 1;i2 > 0; i2--) {
9836
+ current = current[path[i2]];
9837
9837
  }
9838
- current[path2[0]] = value;
9838
+ current[path[0]] = value;
9839
9839
  }
9840
9840
  }
9841
- function nestedRedact(store, o, path2, ns, censor, isCensorFct, censorFctTakesPath) {
9842
- const target = get(o, path2);
9841
+ function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
9842
+ const target = get(o, path);
9843
9843
  if (target == null)
9844
9844
  return;
9845
9845
  const keys2 = Object.keys(target);
9846
9846
  const keysLength = keys2.length;
9847
9847
  for (var i = 0;i < keysLength; i++) {
9848
9848
  const key = keys2[i];
9849
- specialSet(store, target, key, path2, ns, censor, isCensorFct, censorFctTakesPath);
9849
+ specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
9850
9850
  }
9851
9851
  return store;
9852
9852
  }
9853
9853
  function has(obj, prop) {
9854
9854
  return obj !== undefined && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
9855
9855
  }
9856
- function specialSet(store, o, k, path2, afterPath, censor, isCensorFct, censorFctTakesPath) {
9856
+ function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
9857
9857
  const afterPathLen = afterPath.length;
9858
9858
  const lastPathIndex = afterPathLen - 1;
9859
9859
  const originalKey = k;
@@ -9897,7 +9897,7 @@ var require_modifiers = __commonJS((exports, module) => {
9897
9897
  if (consecutive) {
9898
9898
  redactPathCurrent = node(redactPathCurrent, wck, depth);
9899
9899
  level = i;
9900
- ov = iterateNthLevel(wcov, level - 1, k, path2, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1);
9900
+ ov = iterateNthLevel(wcov, level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1);
9901
9901
  } else {
9902
9902
  if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
9903
9903
  if (kIsWc) {
@@ -9905,7 +9905,7 @@ var require_modifiers = __commonJS((exports, module) => {
9905
9905
  } else {
9906
9906
  ov = wcov[k];
9907
9907
  }
9908
- nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path2, originalKey, ...afterPath]) : censor(ov) : censor;
9908
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
9909
9909
  if (kIsWc) {
9910
9910
  const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
9911
9911
  store.push(rv);
@@ -9927,7 +9927,7 @@ var require_modifiers = __commonJS((exports, module) => {
9927
9927
  } else {
9928
9928
  ov = n[k];
9929
9929
  redactPathCurrent = node(redactPathCurrent, k, depth);
9930
- nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path2, originalKey, ...afterPath]) : censor(ov) : censor;
9930
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
9931
9931
  if (has(n, k) && nv === ov || nv === undefined && censor !== undefined) {} else {
9932
9932
  const rv = restoreInstr(redactPathCurrent, ov, o[originalKey]);
9933
9933
  store.push(rv);
@@ -9949,7 +9949,7 @@ var require_modifiers = __commonJS((exports, module) => {
9949
9949
  }
9950
9950
  return n;
9951
9951
  }
9952
- function iterateNthLevel(wcov, level, k, path2, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) {
9952
+ function iterateNthLevel(wcov, level, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) {
9953
9953
  if (level === 0) {
9954
9954
  if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
9955
9955
  if (kIsWc) {
@@ -9957,7 +9957,7 @@ var require_modifiers = __commonJS((exports, module) => {
9957
9957
  } else {
9958
9958
  ov = wcov[k];
9959
9959
  }
9960
- nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path2, originalKey, ...afterPath]) : censor(ov) : censor;
9960
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
9961
9961
  if (kIsWc) {
9962
9962
  const rv = restoreInstr(redactPathCurrent, ov, parent);
9963
9963
  store.push(rv);
@@ -9974,7 +9974,7 @@ var require_modifiers = __commonJS((exports, module) => {
9974
9974
  for (const key in wcov) {
9975
9975
  if (typeof wcov[key] === "object") {
9976
9976
  redactPathCurrent = node(redactPathCurrent, key, depth);
9977
- iterateNthLevel(wcov[key], level - 1, k, path2, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1);
9977
+ iterateNthLevel(wcov[key], level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1);
9978
9978
  }
9979
9979
  }
9980
9980
  }
@@ -9996,12 +9996,12 @@ var require_modifiers = __commonJS((exports, module) => {
9996
9996
  }
9997
9997
  function restoreInstr(node2, value, target) {
9998
9998
  let current = node2;
9999
- const path2 = [];
9999
+ const path = [];
10000
10000
  do {
10001
- path2.push(current.key);
10001
+ path.push(current.key);
10002
10002
  current = current.parent;
10003
10003
  } while (current.parent != null);
10004
- return { path: path2, value, target };
10004
+ return { path, value, target };
10005
10005
  }
10006
10006
  });
10007
10007
 
@@ -10025,10 +10025,10 @@ var require_restorer = __commonJS((exports, module) => {
10025
10025
  };
10026
10026
  }
10027
10027
  function resetTmpl(secret, paths) {
10028
- return paths.map((path2) => {
10029
- const { circle, escPath, leadingBracket } = secret[path2];
10028
+ return paths.map((path) => {
10029
+ const { circle, escPath, leadingBracket } = secret[path];
10030
10030
  const delim = leadingBracket ? "" : ".";
10031
- const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path2} = secret[${escPath}].val`;
10031
+ const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
10032
10032
  const clear = `secret[${escPath}].val = undefined`;
10033
10033
  return `
10034
10034
  if (secret[${escPath}].val !== undefined) {
@@ -19932,8 +19932,8 @@ var require_reporter = __commonJS((exports) => {
19932
19932
  errors: state.errors
19933
19933
  };
19934
19934
  };
19935
- function ReporterError(path2, msg) {
19936
- this.path = path2;
19935
+ function ReporterError(path, msg) {
19936
+ this.path = path;
19937
19937
  this.rethrow(msg);
19938
19938
  }
19939
19939
  inherits(ReporterError, Error);
@@ -21746,7 +21746,7 @@ var require_parse_asn1 = __commonJS((exports, module) => {
21746
21746
 
21747
21747
  // ../../node_modules/public-encrypt/mgf.js
21748
21748
  var require_mgf = __commonJS((exports, module) => {
21749
- var createHash2 = require_create_hash();
21749
+ var createHash = require_create_hash();
21750
21750
  var Buffer2 = require_safe_buffer().Buffer;
21751
21751
  module.exports = function(seed, len) {
21752
21752
  var t = Buffer2.alloc(0);
@@ -21754,7 +21754,7 @@ var require_mgf = __commonJS((exports, module) => {
21754
21754
  var c;
21755
21755
  while (t.length < len) {
21756
21756
  c = i2ops(i++);
21757
- t = Buffer2.concat([t, createHash2("sha1").update(seed).update(c).digest()]);
21757
+ t = Buffer2.concat([t, createHash("sha1").update(seed).update(c).digest()]);
21758
21758
  }
21759
21759
  return t.slice(0, len);
21760
21760
  };
@@ -24739,7 +24739,7 @@ var require_browserify_rsa = __commonJS((exports, module) => {
24739
24739
  var require_publicEncrypt = __commonJS((exports, module) => {
24740
24740
  var parseKeys = require_parse_asn1();
24741
24741
  var randomBytes2 = require_randombytes();
24742
- var createHash2 = require_create_hash();
24742
+ var createHash = require_create_hash();
24743
24743
  var mgf = require_mgf();
24744
24744
  var xor = require_xor();
24745
24745
  var BN = require_bn();
@@ -24778,7 +24778,7 @@ var require_publicEncrypt = __commonJS((exports, module) => {
24778
24778
  function oaep(key, msg) {
24779
24779
  var k = key.modulus.byteLength();
24780
24780
  var mLen = msg.length;
24781
- var iHash = createHash2("sha1").update(Buffer2.alloc(0)).digest();
24781
+ var iHash = createHash("sha1").update(Buffer2.alloc(0)).digest();
24782
24782
  var hLen = iHash.length;
24783
24783
  var hLen2 = 2 * hLen;
24784
24784
  if (mLen > k - hLen2 - 2) {
@@ -24832,7 +24832,7 @@ var require_privateDecrypt = __commonJS((exports, module) => {
24832
24832
  var xor = require_xor();
24833
24833
  var BN = require_bn();
24834
24834
  var crt = require_browserify_rsa();
24835
- var createHash2 = require_create_hash();
24835
+ var createHash = require_create_hash();
24836
24836
  var withPublic = require_withPublic();
24837
24837
  var Buffer2 = require_safe_buffer().Buffer;
24838
24838
  module.exports = function privateDecrypt(privateKey, enc, reverse) {
@@ -24869,7 +24869,7 @@ var require_privateDecrypt = __commonJS((exports, module) => {
24869
24869
  };
24870
24870
  function oaep(key, msg) {
24871
24871
  var k = key.modulus.byteLength();
24872
- var iHash = createHash2("sha1").update(Buffer2.alloc(0)).digest();
24872
+ var iHash = createHash("sha1").update(Buffer2.alloc(0)).digest();
24873
24873
  var hLen = iHash.length;
24874
24874
  if (msg[0] !== 0) {
24875
24875
  throw new Error("decryption error");
@@ -27980,9 +27980,6 @@ var _getFetchImplementation = (debug) => {
27980
27980
  var getDefaultProjectName = () => {
27981
27981
  return getLangSmithEnvironmentVariable("PROJECT") ?? getEnvironmentVariable2("LANGCHAIN_SESSION") ?? "default";
27982
27982
  };
27983
- // ../../node_modules/langsmith/dist/utils/_uuid.js
27984
- import { createHash } from "crypto";
27985
-
27986
27983
  // ../../node_modules/langsmith/dist/utils/warn.js
27987
27984
  var warnedMessages = {};
27988
27985
  function warnOnce(message) {
@@ -28005,46 +28002,8 @@ function uuid7FromTime(timestamp) {
28005
28002
  const msecs = typeof timestamp === "string" ? Date.parse(timestamp) : timestamp;
28006
28003
  return v72({ msecs, seq: 0 });
28007
28004
  }
28008
- function getUuidVersion(uuidStr) {
28009
- if (!UUID_REGEX.test(uuidStr)) {
28010
- return null;
28011
- }
28012
- const versionChar = uuidStr[14];
28013
- return parseInt(versionChar, 16);
28014
- }
28015
- function uuidToBytes(uuidStr) {
28016
- const hex = uuidStr.replace(/-/g, "");
28017
- return Buffer.from(hex, "hex");
28018
- }
28019
- function bytesToUuid(bytes) {
28020
- const hex = bytes.toString("hex");
28021
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
28022
- }
28023
- function uuid7Deterministic(originalId, key) {
28024
- const hashInput = `${originalId}:${key}`;
28025
- const h = createHash("sha256").update(hashInput).digest();
28026
- const b = Buffer.alloc(16);
28027
- const version3 = getUuidVersion(originalId);
28028
- if (version3 === 7) {
28029
- const originalBytes = uuidToBytes(originalId);
28030
- originalBytes.copy(b, 0, 0, 6);
28031
- } else {
28032
- const msecs = Date.now();
28033
- b[0] = msecs / 1099511627776 & 255;
28034
- b[1] = msecs / 4294967296 & 255;
28035
- b[2] = msecs / 16777216 & 255;
28036
- b[3] = msecs / 65536 & 255;
28037
- b[4] = msecs / 256 & 255;
28038
- b[5] = msecs & 255;
28039
- }
28040
- b[6] = 112 | h[0] & 15;
28041
- b[7] = h[1];
28042
- b[8] = 128 | h[2] & 63;
28043
- h.copy(b, 9, 3, 10);
28044
- return bytesToUuid(b);
28045
- }
28046
28005
  // ../../node_modules/langsmith/dist/index.js
28047
- var __version__ = "0.4.3";
28006
+ var __version__ = "0.4.4";
28048
28007
 
28049
28008
  // ../../node_modules/langsmith/dist/utils/env.js
28050
28009
  var globalEnv;
@@ -29082,220 +29041,6 @@ function isConflictingEndpointsError(err) {
29082
29041
  return typeof err === "object" && err !== null && err.code === ERR_CONFLICTING_ENDPOINTS;
29083
29042
  }
29084
29043
 
29085
- // ../../node_modules/langsmith/dist/utils/prompts_cache.js
29086
- import * as fs from "node:fs";
29087
- import * as path from "node:path";
29088
- function isStale(entry, ttlSeconds) {
29089
- if (ttlSeconds === null) {
29090
- return false;
29091
- }
29092
- const ageMs = Date.now() - entry.createdAt;
29093
- return ageMs > ttlSeconds * 1000;
29094
- }
29095
-
29096
- class PromptCache {
29097
- constructor(config = {}) {
29098
- Object.defineProperty(this, "cache", {
29099
- enumerable: true,
29100
- configurable: true,
29101
- writable: true,
29102
- value: new Map
29103
- });
29104
- Object.defineProperty(this, "maxSize", {
29105
- enumerable: true,
29106
- configurable: true,
29107
- writable: true,
29108
- value: undefined
29109
- });
29110
- Object.defineProperty(this, "ttlSeconds", {
29111
- enumerable: true,
29112
- configurable: true,
29113
- writable: true,
29114
- value: undefined
29115
- });
29116
- Object.defineProperty(this, "refreshIntervalSeconds", {
29117
- enumerable: true,
29118
- configurable: true,
29119
- writable: true,
29120
- value: undefined
29121
- });
29122
- Object.defineProperty(this, "fetchFunc", {
29123
- enumerable: true,
29124
- configurable: true,
29125
- writable: true,
29126
- value: undefined
29127
- });
29128
- Object.defineProperty(this, "refreshTimer", {
29129
- enumerable: true,
29130
- configurable: true,
29131
- writable: true,
29132
- value: undefined
29133
- });
29134
- Object.defineProperty(this, "_metrics", {
29135
- enumerable: true,
29136
- configurable: true,
29137
- writable: true,
29138
- value: {
29139
- hits: 0,
29140
- misses: 0,
29141
- refreshes: 0,
29142
- refreshErrors: 0
29143
- }
29144
- });
29145
- this.maxSize = config.maxSize ?? 100;
29146
- this.ttlSeconds = config.ttlSeconds ?? 3600;
29147
- this.refreshIntervalSeconds = config.refreshIntervalSeconds ?? 60;
29148
- this.fetchFunc = config.fetchFunc;
29149
- if (this.fetchFunc && this.ttlSeconds !== null) {
29150
- this.startRefreshLoop();
29151
- }
29152
- }
29153
- get metrics() {
29154
- return { ...this._metrics };
29155
- }
29156
- get totalRequests() {
29157
- return this._metrics.hits + this._metrics.misses;
29158
- }
29159
- get hitRate() {
29160
- const total = this.totalRequests;
29161
- return total > 0 ? this._metrics.hits / total : 0;
29162
- }
29163
- resetMetrics() {
29164
- this._metrics = {
29165
- hits: 0,
29166
- misses: 0,
29167
- refreshes: 0,
29168
- refreshErrors: 0
29169
- };
29170
- }
29171
- get(key) {
29172
- const entry = this.cache.get(key);
29173
- if (!entry) {
29174
- this._metrics.misses += 1;
29175
- return;
29176
- }
29177
- this.cache.delete(key);
29178
- this.cache.set(key, entry);
29179
- this._metrics.hits += 1;
29180
- return entry.value;
29181
- }
29182
- set(key, value) {
29183
- if (!this.cache.has(key) && this.cache.size >= this.maxSize) {
29184
- const oldestKey = this.cache.keys().next().value;
29185
- if (oldestKey !== undefined) {
29186
- this.cache.delete(oldestKey);
29187
- }
29188
- }
29189
- const entry = {
29190
- value,
29191
- createdAt: Date.now()
29192
- };
29193
- this.cache.delete(key);
29194
- this.cache.set(key, entry);
29195
- }
29196
- invalidate(key) {
29197
- this.cache.delete(key);
29198
- }
29199
- clear() {
29200
- this.cache.clear();
29201
- }
29202
- get size() {
29203
- return this.cache.size;
29204
- }
29205
- stop() {
29206
- if (this.refreshTimer) {
29207
- clearInterval(this.refreshTimer);
29208
- this.refreshTimer = undefined;
29209
- }
29210
- }
29211
- dump(filePath) {
29212
- const dir = path.dirname(filePath);
29213
- if (!fs.existsSync(dir)) {
29214
- fs.mkdirSync(dir, { recursive: true });
29215
- }
29216
- const entries = {};
29217
- for (const [key, entry] of this.cache.entries()) {
29218
- entries[key] = entry.value;
29219
- }
29220
- const data = { entries };
29221
- const tempPath = `${filePath}.tmp`;
29222
- try {
29223
- fs.writeFileSync(tempPath, JSON.stringify(data, null, 2));
29224
- fs.renameSync(tempPath, filePath);
29225
- } catch (e) {
29226
- if (fs.existsSync(tempPath)) {
29227
- fs.unlinkSync(tempPath);
29228
- }
29229
- throw e;
29230
- }
29231
- }
29232
- load(filePath) {
29233
- if (!fs.existsSync(filePath)) {
29234
- return 0;
29235
- }
29236
- let data;
29237
- try {
29238
- const content = fs.readFileSync(filePath, "utf-8");
29239
- data = JSON.parse(content);
29240
- } catch {
29241
- return 0;
29242
- }
29243
- const entries = data.entries ?? {};
29244
- let loaded = 0;
29245
- const now = Date.now();
29246
- for (const [key, value] of Object.entries(entries)) {
29247
- if (this.cache.size >= this.maxSize) {
29248
- break;
29249
- }
29250
- const entry = {
29251
- value,
29252
- createdAt: now
29253
- };
29254
- this.cache.set(key, entry);
29255
- loaded += 1;
29256
- }
29257
- return loaded;
29258
- }
29259
- startRefreshLoop() {
29260
- this.refreshTimer = setInterval(() => {
29261
- this.refreshStaleEntries().catch((e) => {
29262
- console.warn("Unexpected error in cache refresh loop:", e);
29263
- });
29264
- }, this.refreshIntervalSeconds * 1000);
29265
- if (this.refreshTimer.unref) {
29266
- this.refreshTimer.unref();
29267
- }
29268
- }
29269
- getStaleKeys() {
29270
- const staleKeys = [];
29271
- for (const [key, entry] of this.cache.entries()) {
29272
- if (isStale(entry, this.ttlSeconds)) {
29273
- staleKeys.push(key);
29274
- }
29275
- }
29276
- return staleKeys;
29277
- }
29278
- async refreshStaleEntries() {
29279
- if (!this.fetchFunc) {
29280
- return;
29281
- }
29282
- const staleKeys = this.getStaleKeys();
29283
- if (staleKeys.length === 0) {
29284
- return;
29285
- }
29286
- for (const key of staleKeys) {
29287
- try {
29288
- const newValue = await this.fetchFunc(key);
29289
- this.set(key, newValue);
29290
- this._metrics.refreshes += 1;
29291
- } catch (e) {
29292
- this._metrics.refreshErrors += 1;
29293
- console.warn(`Failed to refresh cache entry ${key}:`, e);
29294
- }
29295
- }
29296
- }
29297
- }
29298
-
29299
29044
  // ../../node_modules/langsmith/dist/utils/fast-safe-stringify/index.js
29300
29045
  var LIMIT_REPLACE_NODE = "[...]";
29301
29046
  var CIRCULAR_REPLACE_NODE = { result: "[Circular]" };
@@ -29786,12 +29531,6 @@ class Client {
29786
29531
  writable: true,
29787
29532
  value: undefined
29788
29533
  });
29789
- Object.defineProperty(this, "_promptCache", {
29790
- enumerable: true,
29791
- configurable: true,
29792
- writable: true,
29793
- value: undefined
29794
- });
29795
29534
  Object.defineProperty(this, "multipartStreamingDisabled", {
29796
29535
  enumerable: true,
29797
29536
  configurable: true,
@@ -29857,19 +29596,6 @@ class Client {
29857
29596
  this.langSmithToOTELTranslator = new LangSmithToOTELTranslator;
29858
29597
  }
29859
29598
  this.cachedLSEnvVarsForMetadata = getLangSmithEnvVarsMetadata();
29860
- const cacheEnabled = config.promptCacheEnabled ?? getLangSmithEnvironmentVariable("PROMPT_CACHE_ENABLED") === "true";
29861
- if (cacheEnabled) {
29862
- this._promptCache = new PromptCache({
29863
- maxSize: config.promptCacheMaxSize ?? parseInt(getLangSmithEnvironmentVariable("PROMPT_CACHE_MAX_SIZE") ?? "100", 10),
29864
- ttlSeconds: config.promptCacheTtlSeconds ?? parseFloat(getLangSmithEnvironmentVariable("PROMPT_CACHE_TTL_SECONDS") ?? "3600"),
29865
- refreshIntervalSeconds: config.promptCacheRefreshIntervalSeconds ?? parseFloat(getLangSmithEnvironmentVariable("PROMPT_CACHE_REFRESH_INTERVAL_SECONDS") ?? "60"),
29866
- fetchFunc: this._makeFetchPromptFunc()
29867
- });
29868
- const cachePath = config.promptCachePath ?? getLangSmithEnvironmentVariable("PROMPT_CACHE_PATH");
29869
- if (cachePath) {
29870
- this._promptCache.load(cachePath);
29871
- }
29872
- }
29873
29599
  }
29874
29600
  static getDefaultClientConfig() {
29875
29601
  const apiKey = getLangSmithEnvironmentVariable("API_KEY");
@@ -29922,9 +29648,9 @@ class Client {
29922
29648
  }
29923
29649
  return headers;
29924
29650
  }
29925
- _getPlatformEndpointPath(path2) {
29651
+ _getPlatformEndpointPath(path) {
29926
29652
  const needsV1Prefix = this.apiUrl.slice(-3) !== "/v1" && this.apiUrl.slice(-4) !== "/v1/";
29927
- return needsV1Prefix ? `/v1/platform/${path2}` : `/platform/${path2}`;
29653
+ return needsV1Prefix ? `/v1/platform/${path}` : `/platform/${path}`;
29928
29654
  }
29929
29655
  async processInputs(inputs) {
29930
29656
  if (this.hideInputs === false) {
@@ -29960,9 +29686,9 @@ class Client {
29960
29686
  }
29961
29687
  return runParams;
29962
29688
  }
29963
- async _getResponse(path2, queryParams) {
29689
+ async _getResponse(path, queryParams) {
29964
29690
  const paramsString = queryParams?.toString() ?? "";
29965
- const url = `${this.apiUrl}${path2}?${paramsString}`;
29691
+ const url = `${this.apiUrl}${path}?${paramsString}`;
29966
29692
  const response = await this.caller.call(async () => {
29967
29693
  const res = await this._fetch(url, {
29968
29694
  method: "GET",
@@ -29970,22 +29696,22 @@ class Client {
29970
29696
  signal: AbortSignal.timeout(this.timeout_ms),
29971
29697
  ...this.fetchOptions
29972
29698
  });
29973
- await raiseForStatus(res, `fetch ${path2}`);
29699
+ await raiseForStatus(res, `fetch ${path}`);
29974
29700
  return res;
29975
29701
  });
29976
29702
  return response;
29977
29703
  }
29978
- async _get(path2, queryParams) {
29979
- const response = await this._getResponse(path2, queryParams);
29704
+ async _get(path, queryParams) {
29705
+ const response = await this._getResponse(path, queryParams);
29980
29706
  return response.json();
29981
29707
  }
29982
- async* _getPaginated(path2, queryParams = new URLSearchParams, transform) {
29708
+ async* _getPaginated(path, queryParams = new URLSearchParams, transform) {
29983
29709
  let offset = Number(queryParams.get("offset")) || 0;
29984
29710
  const limit = Number(queryParams.get("limit")) || 100;
29985
29711
  while (true) {
29986
29712
  queryParams.set("offset", String(offset));
29987
29713
  queryParams.set("limit", String(limit));
29988
- const url = `${this.apiUrl}${path2}?${queryParams}`;
29714
+ const url = `${this.apiUrl}${path}?${queryParams}`;
29989
29715
  const response = await this.caller.call(async () => {
29990
29716
  const res = await this._fetch(url, {
29991
29717
  method: "GET",
@@ -29993,7 +29719,7 @@ class Client {
29993
29719
  signal: AbortSignal.timeout(this.timeout_ms),
29994
29720
  ...this.fetchOptions
29995
29721
  });
29996
- await raiseForStatus(res, `fetch ${path2}`);
29722
+ await raiseForStatus(res, `fetch ${path}`);
29997
29723
  return res;
29998
29724
  });
29999
29725
  const items = transform ? transform(await response.json()) : await response.json();
@@ -30007,19 +29733,19 @@ class Client {
30007
29733
  offset += items.length;
30008
29734
  }
30009
29735
  }
30010
- async* _getCursorPaginatedList(path2, body = null, requestMethod = "POST", dataKey = "runs") {
29736
+ async* _getCursorPaginatedList(path, body = null, requestMethod = "POST", dataKey = "runs") {
30011
29737
  const bodyParams = body ? { ...body } : {};
30012
29738
  while (true) {
30013
29739
  const body2 = JSON.stringify(bodyParams);
30014
29740
  const response = await this.caller.call(async () => {
30015
- const res = await this._fetch(`${this.apiUrl}${path2}`, {
29741
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
30016
29742
  method: requestMethod,
30017
29743
  headers: { ...this.headers, "Content-Type": "application/json" },
30018
29744
  signal: AbortSignal.timeout(this.timeout_ms),
30019
29745
  ...this.fetchOptions,
30020
29746
  body: body2
30021
29747
  });
30022
- await raiseForStatus(res, `fetch ${path2}`);
29748
+ await raiseForStatus(res, `fetch ${path}`);
30023
29749
  return res;
30024
29750
  });
30025
29751
  const responseBody = await response.json();
@@ -30855,8 +30581,8 @@ Context: ${context}`);
30855
30581
  limit: Number(limit) || 100
30856
30582
  };
30857
30583
  let currentOffset = Number(offset) || 0;
30858
- const path2 = "/runs/group";
30859
- const url = `${this.apiUrl}${path2}`;
30584
+ const path = "/runs/group";
30585
+ const url = `${this.apiUrl}${path}`;
30860
30586
  while (true) {
30861
30587
  const currentBody = {
30862
30588
  ...baseBody,
@@ -30872,7 +30598,7 @@ Context: ${context}`);
30872
30598
  ...this.fetchOptions,
30873
30599
  body
30874
30600
  });
30875
- await raiseForStatus(res, `Failed to fetch ${path2}`);
30601
+ await raiseForStatus(res, `Failed to fetch ${path}`);
30876
30602
  return res;
30877
30603
  });
30878
30604
  const items = await response.json();
@@ -31182,20 +30908,20 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31182
30908
  return result;
31183
30909
  }
31184
30910
  async hasProject({ projectId, projectName }) {
31185
- let path2 = "/sessions";
30911
+ let path = "/sessions";
31186
30912
  const params = new URLSearchParams;
31187
30913
  if (projectId !== undefined && projectName !== undefined) {
31188
30914
  throw new Error("Must provide either projectName or projectId, not both");
31189
30915
  } else if (projectId !== undefined) {
31190
30916
  assertUuid(projectId);
31191
- path2 += `/${projectId}`;
30917
+ path += `/${projectId}`;
31192
30918
  } else if (projectName !== undefined) {
31193
30919
  params.append("name", projectName);
31194
30920
  } else {
31195
30921
  throw new Error("Must provide projectName or projectId");
31196
30922
  }
31197
30923
  const response = await this.caller.call(async () => {
31198
- const res = await this._fetch(`${this.apiUrl}${path2}?${params}`, {
30924
+ const res = await this._fetch(`${this.apiUrl}${path}?${params}`, {
31199
30925
  method: "GET",
31200
30926
  headers: this.headers,
31201
30927
  signal: AbortSignal.timeout(this.timeout_ms),
@@ -31218,13 +30944,13 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31218
30944
  }
31219
30945
  }
31220
30946
  async readProject({ projectId, projectName, includeStats }) {
31221
- let path2 = "/sessions";
30947
+ let path = "/sessions";
31222
30948
  const params = new URLSearchParams;
31223
30949
  if (projectId !== undefined && projectName !== undefined) {
31224
30950
  throw new Error("Must provide either projectName or projectId, not both");
31225
30951
  } else if (projectId !== undefined) {
31226
30952
  assertUuid(projectId);
31227
- path2 += `/${projectId}`;
30953
+ path += `/${projectId}`;
31228
30954
  } else if (projectName !== undefined) {
31229
30955
  params.append("name", projectName);
31230
30956
  } else {
@@ -31233,7 +30959,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31233
30959
  if (includeStats !== undefined) {
31234
30960
  params.append("include_stats", includeStats.toString());
31235
30961
  }
31236
- const response = await this._get(path2, params);
30962
+ const response = await this._get(path, params);
31237
30963
  let result;
31238
30964
  if (Array.isArray(response)) {
31239
30965
  if (response.length === 0) {
@@ -31396,19 +31122,19 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31396
31122
  return result;
31397
31123
  }
31398
31124
  async readDataset({ datasetId, datasetName }) {
31399
- let path2 = "/datasets";
31125
+ let path = "/datasets";
31400
31126
  const params = new URLSearchParams({ limit: "1" });
31401
31127
  if (datasetId && datasetName) {
31402
31128
  throw new Error("Must provide either datasetName or datasetId, not both");
31403
31129
  } else if (datasetId) {
31404
31130
  assertUuid(datasetId);
31405
- path2 += `/${datasetId}`;
31131
+ path += `/${datasetId}`;
31406
31132
  } else if (datasetName) {
31407
31133
  params.append("name", datasetName);
31408
31134
  } else {
31409
31135
  throw new Error("Must provide datasetName or datasetId");
31410
31136
  }
31411
- const response = await this._get(path2, params);
31137
+ const response = await this._get(path, params);
31412
31138
  let result;
31413
31139
  if (Array.isArray(response)) {
31414
31140
  if (response.length === 0) {
@@ -31449,20 +31175,20 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31449
31175
  return response;
31450
31176
  }
31451
31177
  async readDatasetOpenaiFinetuning({ datasetId, datasetName }) {
31452
- const path2 = "/datasets";
31178
+ const path = "/datasets";
31453
31179
  if (datasetId !== undefined) {} else if (datasetName !== undefined) {
31454
31180
  datasetId = (await this.readDataset({ datasetName })).id;
31455
31181
  } else {
31456
31182
  throw new Error("Must provide either datasetName or datasetId");
31457
31183
  }
31458
- const response = await this._getResponse(`${path2}/${datasetId}/openai_ft`);
31184
+ const response = await this._getResponse(`${path}/${datasetId}/openai_ft`);
31459
31185
  const datasetText = await response.text();
31460
31186
  const dataset = datasetText.trim().split(`
31461
31187
  `).map((line) => JSON.parse(line));
31462
31188
  return dataset;
31463
31189
  }
31464
31190
  async* listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, metadata } = {}) {
31465
- const path2 = "/datasets";
31191
+ const path = "/datasets";
31466
31192
  const params = new URLSearchParams({
31467
31193
  limit: limit.toString(),
31468
31194
  offset: offset.toString()
@@ -31481,7 +31207,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31481
31207
  if (metadata !== undefined) {
31482
31208
  params.append("metadata", JSON.stringify(metadata));
31483
31209
  }
31484
- for await (const datasets of this._getPaginated(path2, params)) {
31210
+ for await (const datasets of this._getPaginated(path, params)) {
31485
31211
  yield* datasets;
31486
31212
  }
31487
31213
  }
@@ -31530,7 +31256,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31530
31256
  });
31531
31257
  }
31532
31258
  async deleteDataset({ datasetId, datasetName }) {
31533
- let path2 = "/datasets";
31259
+ let path = "/datasets";
31534
31260
  let datasetId_ = datasetId;
31535
31261
  if (datasetId !== undefined && datasetName !== undefined) {
31536
31262
  throw new Error("Must provide either datasetName or datasetId, not both");
@@ -31540,18 +31266,18 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31540
31266
  }
31541
31267
  if (datasetId_ !== undefined) {
31542
31268
  assertUuid(datasetId_);
31543
- path2 += `/${datasetId_}`;
31269
+ path += `/${datasetId_}`;
31544
31270
  } else {
31545
31271
  throw new Error("Must provide datasetName or datasetId");
31546
31272
  }
31547
31273
  await this.caller.call(async () => {
31548
- const res = await this._fetch(this.apiUrl + path2, {
31274
+ const res = await this._fetch(this.apiUrl + path, {
31549
31275
  method: "DELETE",
31550
31276
  headers: this.headers,
31551
31277
  signal: AbortSignal.timeout(this.timeout_ms),
31552
31278
  ...this.fetchOptions
31553
31279
  });
31554
- await raiseForStatus(res, `delete ${path2}`, true);
31280
+ await raiseForStatus(res, `delete ${path}`, true);
31555
31281
  return res;
31556
31282
  });
31557
31283
  }
@@ -31712,8 +31438,8 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31712
31438
  }
31713
31439
  async readExample(exampleId) {
31714
31440
  assertUuid(exampleId);
31715
- const path2 = `/examples/${exampleId}`;
31716
- const rawExample = await this._get(path2);
31441
+ const path = `/examples/${exampleId}`;
31442
+ const rawExample = await this._get(path);
31717
31443
  const { attachment_urls, ...rest } = rawExample;
31718
31444
  const example = rest;
31719
31445
  if (attachment_urls) {
@@ -31796,24 +31522,24 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
31796
31522
  }
31797
31523
  async deleteExample(exampleId) {
31798
31524
  assertUuid(exampleId);
31799
- const path2 = `/examples/${exampleId}`;
31525
+ const path = `/examples/${exampleId}`;
31800
31526
  await this.caller.call(async () => {
31801
- const res = await this._fetch(this.apiUrl + path2, {
31527
+ const res = await this._fetch(this.apiUrl + path, {
31802
31528
  method: "DELETE",
31803
31529
  headers: this.headers,
31804
31530
  signal: AbortSignal.timeout(this.timeout_ms),
31805
31531
  ...this.fetchOptions
31806
31532
  });
31807
- await raiseForStatus(res, `delete ${path2}`, true);
31533
+ await raiseForStatus(res, `delete ${path}`, true);
31808
31534
  return res;
31809
31535
  });
31810
31536
  }
31811
31537
  async deleteExamples(exampleIds, options) {
31812
31538
  exampleIds.forEach((id) => assertUuid(id));
31813
31539
  if (options?.hardDelete) {
31814
- const path2 = this._getPlatformEndpointPath("datasets/examples/delete");
31540
+ const path = this._getPlatformEndpointPath("datasets/examples/delete");
31815
31541
  await this.caller.call(async () => {
31816
- const res = await this._fetch(`${this.apiUrl}${path2}`, {
31542
+ const res = await this._fetch(`${this.apiUrl}${path}`, {
31817
31543
  method: "POST",
31818
31544
  headers: { ...this.headers, "Content-Type": "application/json" },
31819
31545
  body: JSON.stringify({
@@ -32035,21 +31761,21 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
32035
31761
  }
32036
31762
  async readFeedback(feedbackId) {
32037
31763
  assertUuid(feedbackId);
32038
- const path2 = `/feedback/${feedbackId}`;
32039
- const response = await this._get(path2);
31764
+ const path = `/feedback/${feedbackId}`;
31765
+ const response = await this._get(path);
32040
31766
  return response;
32041
31767
  }
32042
31768
  async deleteFeedback(feedbackId) {
32043
31769
  assertUuid(feedbackId);
32044
- const path2 = `/feedback/${feedbackId}`;
31770
+ const path = `/feedback/${feedbackId}`;
32045
31771
  await this.caller.call(async () => {
32046
- const res = await this._fetch(this.apiUrl + path2, {
31772
+ const res = await this._fetch(this.apiUrl + path, {
32047
31773
  method: "DELETE",
32048
31774
  headers: this.headers,
32049
31775
  signal: AbortSignal.timeout(this.timeout_ms),
32050
31776
  ...this.fetchOptions
32051
31777
  });
32052
- await raiseForStatus(res, `delete ${path2}`, true);
31778
+ await raiseForStatus(res, `delete ${path}`, true);
32053
31779
  return res;
32054
31780
  });
32055
31781
  }
@@ -32709,18 +32435,7 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
32709
32435
  });
32710
32436
  return response.json();
32711
32437
  }
32712
- _getPromptCacheKey(promptIdentifier, includeModel) {
32713
- const suffix = includeModel ? ":with_model" : "";
32714
- return `${promptIdentifier}${suffix}`;
32715
- }
32716
- _makeFetchPromptFunc() {
32717
- return async (key) => {
32718
- const includeModel = key.endsWith(":with_model");
32719
- const identifier = includeModel ? key.slice(0, -11) : key;
32720
- return this._fetchPromptFromApi(identifier, { includeModel });
32721
- };
32722
- }
32723
- async _fetchPromptFromApi(promptIdentifier, options) {
32438
+ async pullPromptCommit(promptIdentifier, options) {
32724
32439
  const [owner, promptName, commitHash] = parsePromptIdentifier(promptIdentifier);
32725
32440
  const response = await this.caller.call(async () => {
32726
32441
  const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}/${commitHash}${options?.includeModel ? "?include_model=true" : ""}`, {
@@ -32741,23 +32456,9 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
32741
32456
  examples: result.examples
32742
32457
  };
32743
32458
  }
32744
- async pullPromptCommit(promptIdentifier, options) {
32745
- if (!options?.skipCache && this._promptCache) {
32746
- const cacheKey = this._getPromptCacheKey(promptIdentifier, options?.includeModel);
32747
- const cached = this._promptCache.get(cacheKey);
32748
- if (cached) {
32749
- return cached;
32750
- }
32751
- const result = await this._fetchPromptFromApi(promptIdentifier, options);
32752
- this._promptCache.set(cacheKey, result);
32753
- return result;
32754
- }
32755
- return this._fetchPromptFromApi(promptIdentifier, options);
32756
- }
32757
32459
  async _pullPrompt(promptIdentifier, options) {
32758
32460
  const promptObject = await this.pullPromptCommit(promptIdentifier, {
32759
- includeModel: options?.includeModel,
32760
- skipCache: options?.skipCache
32461
+ includeModel: options?.includeModel
32761
32462
  });
32762
32463
  const prompt = JSON.stringify(promptObject.manifest);
32763
32464
  return prompt;
@@ -32839,14 +32540,6 @@ Message: ${Array.isArray(result.detail) ? result.detail.join(`
32839
32540
  throw new Error(`Invalid public ${kind} URL or token: ${urlOrToken}`);
32840
32541
  }
32841
32542
  }
32842
- get promptCache() {
32843
- return this._promptCache;
32844
- }
32845
- cleanup() {
32846
- if (this._promptCache) {
32847
- this._promptCache.stop();
32848
- }
32849
- }
32850
32543
  async awaitPendingTraceBatches() {
32851
32544
  if (this.manualFlushMode) {
32852
32545
  console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches.");
@@ -33416,23 +33109,23 @@ class RunTree {
33416
33109
  }
33417
33110
  }
33418
33111
  const oldId = baseRun.id;
33419
- const newId = uuid7Deterministic(oldId, projectName);
33112
+ const newId = v52(`${oldId}:${projectName}`, UUID_NAMESPACE_DNS);
33420
33113
  let newTraceId;
33421
33114
  if (baseRun.trace_id) {
33422
- newTraceId = uuid7Deterministic(baseRun.trace_id, projectName);
33115
+ newTraceId = v52(`${baseRun.trace_id}:${projectName}`, UUID_NAMESPACE_DNS);
33423
33116
  } else {
33424
33117
  newTraceId = newId;
33425
33118
  }
33426
33119
  let newParentId;
33427
33120
  if (baseRun.parent_run_id) {
33428
- newParentId = uuid7Deterministic(baseRun.parent_run_id, projectName);
33121
+ newParentId = v52(`${baseRun.parent_run_id}:${projectName}`, UUID_NAMESPACE_DNS);
33429
33122
  }
33430
33123
  let newDottedOrder;
33431
33124
  if (baseRun.dotted_order) {
33432
33125
  const segs = baseRun.dotted_order.split(".");
33433
33126
  const remappedSegs = segs.map((seg) => {
33434
33127
  const segId = seg.slice(-TIMESTAMP_LENGTH);
33435
- const remappedId = uuid7Deterministic(segId, projectName);
33128
+ const remappedId = v52(`${segId}:${projectName}`, UUID_NAMESPACE_DNS);
33436
33129
  return seg.slice(0, -TIMESTAMP_LENGTH) + remappedId;
33437
33130
  });
33438
33131
  newDottedOrder = remappedSegs.join(".");
@@ -35568,13 +35261,13 @@ function isInteger(str) {
35568
35261
  }
35569
35262
  return true;
35570
35263
  }
35571
- function escapePathComponent(path2) {
35572
- if (path2.indexOf("/") === -1 && path2.indexOf("~") === -1)
35573
- return path2;
35574
- return path2.replace(/~/g, "~0").replace(/\//g, "~1");
35264
+ function escapePathComponent(path) {
35265
+ if (path.indexOf("/") === -1 && path.indexOf("~") === -1)
35266
+ return path;
35267
+ return path.replace(/~/g, "~0").replace(/\//g, "~1");
35575
35268
  }
35576
- function unescapePathComponent(path2) {
35577
- return path2.replace(/~1/g, "/").replace(/~0/g, "~");
35269
+ function unescapePathComponent(path) {
35270
+ return path.replace(/~1/g, "/").replace(/~0/g, "~");
35578
35271
  }
35579
35272
  function hasUndefined(obj) {
35580
35273
  if (obj === undefined)
@@ -35790,8 +35483,8 @@ function applyOperation(document2, operation, validateOperation = false, mutateD
35790
35483
  } else {
35791
35484
  if (!mutateDocument)
35792
35485
  document2 = _deepClone(document2);
35793
- const path2 = operation.path || "";
35794
- const keys = path2.split("/");
35486
+ const path = operation.path || "";
35487
+ const keys = path.split("/");
35795
35488
  let obj = document2;
35796
35489
  let t = 1;
35797
35490
  let len = keys.length;
@@ -40270,10 +39963,10 @@ var Runnable = class extends Serializable {
40270
39963
  }
40271
39964
  const paths = log.ops.filter((op) => op.path.startsWith("/logs/")).map((op) => op.path.split("/")[2]);
40272
39965
  const dedupedPaths = [...new Set(paths)];
40273
- for (const path2 of dedupedPaths) {
39966
+ for (const path of dedupedPaths) {
40274
39967
  let eventType;
40275
39968
  let data = {};
40276
- const logEntry = runLog.state.logs[path2];
39969
+ const logEntry = runLog.state.logs[path];
40277
39970
  if (logEntry.end_time === undefined)
40278
39971
  if (logEntry.streamed_output.length > 0)
40279
39972
  eventType = "stream";
@@ -42371,17 +42064,17 @@ function findEnvFile(startDir, filenames = [".env", ".env.local"]) {
42371
42064
  if (typeof process === "undefined" || !process.cwd) {
42372
42065
  return null;
42373
42066
  }
42374
- const fs2 = __require("node:fs");
42375
- const path2 = __require("node:path");
42067
+ const fs = __require("node:fs");
42068
+ const path = __require("node:path");
42376
42069
  let currentDir = startDir || process.cwd();
42377
42070
  while (true) {
42378
42071
  for (const filename of filenames) {
42379
- const candidate = path2.join(currentDir, filename);
42380
- if (fs2.existsSync(candidate)) {
42072
+ const candidate = path.join(currentDir, filename);
42073
+ if (fs.existsSync(candidate)) {
42381
42074
  return candidate;
42382
42075
  }
42383
42076
  }
42384
- const parentDir = path2.dirname(currentDir);
42077
+ const parentDir = path.dirname(currentDir);
42385
42078
  if (parentDir === currentDir) {
42386
42079
  break;
42387
42080
  }
@@ -45103,7 +44796,7 @@ function stringToUuid(target) {
45103
44796
  const bytes = digest.slice(0, 16);
45104
44797
  bytes[8] = bytes[8] & 63 | 128;
45105
44798
  bytes[6] = bytes[6] & 15 | 0;
45106
- return bytesToUuid2(bytes);
44799
+ return bytesToUuid(bytes);
45107
44800
  }
45108
44801
  async function prewarmUuidCache(values) {
45109
44802
  if (!checkWebCrypto())
@@ -45241,7 +44934,7 @@ function utf8Encode(str) {
45241
44934
  }
45242
44935
  return new Uint8Array(utf8);
45243
44936
  }
45244
- function bytesToUuid2(bytes) {
44937
+ function bytesToUuid(bytes) {
45245
44938
  const hex = [];
45246
44939
  for (let i = 0;i < bytes.length; i++) {
45247
44940
  const h = bytes[i].toString(16).padStart(2, "0");
@@ -45261,9 +44954,9 @@ var getContentTypeFromMimeType = (mimeType) => {
45261
44954
  }
45262
44955
  return;
45263
44956
  };
45264
- function getLocalServerUrl(path2) {
44957
+ function getLocalServerUrl(path) {
45265
44958
  const port = getEnv3("SERVER_PORT", "3000");
45266
- return `http://localhost:${port}${path2}`;
44959
+ return `http://localhost:${port}${path}`;
45267
44960
  }
45268
44961
  // src/schemas/character.ts
45269
44962
  import { z as z3 } from "zod";
@@ -45780,8 +45473,8 @@ class ActionStreamFilter {
45780
45473
  // src/utils/paths.ts
45781
45474
  var pathJoin = (...parts) => {
45782
45475
  if (typeof process !== "undefined" && process.platform) {
45783
- const path2 = __require("node:path");
45784
- return path2.join(...parts);
45476
+ const path = __require("node:path");
45477
+ return path.join(...parts);
45785
45478
  }
45786
45479
  return parts.filter((part) => part).join("/").replace(/\/+/g, "/").replace(/\/$/, "");
45787
45480
  };
@@ -47120,42 +46813,80 @@ class DefaultMessageService {
47120
46813
  runtime.logger.warn({ src: "service:message", iteration: iterationCount }, "No providers or action specified, forcing completion");
47121
46814
  break;
47122
46815
  }
47123
- for (const providerName of providersArray) {
47124
- if (typeof providerName !== "string")
47125
- continue;
46816
+ const PROVIDERS_TOTAL_TIMEOUT_MS = parseInt(String(runtime.getSetting("PROVIDERS_TOTAL_TIMEOUT_MS") || "1000"));
46817
+ const completedProviders = new Set;
46818
+ const providerPromises = providersArray.filter((name) => typeof name === "string").map(async (providerName) => {
47126
46819
  const provider = runtime.providers.find((p) => p.name === providerName);
47127
46820
  if (!provider) {
47128
46821
  runtime.logger.warn({ src: "service:message", providerName }, "Provider not found");
47129
- traceActionResult.push({
47130
- data: { actionName: providerName },
47131
- success: false,
47132
- error: `Provider not found: ${providerName}`
47133
- });
47134
- continue;
46822
+ completedProviders.add(providerName);
46823
+ return { providerName, success: false, error: `Provider not found: ${providerName}` };
47135
46824
  }
47136
- const providerResult = await provider.get(runtime, message, state);
47137
- if (!providerResult) {
47138
- runtime.logger.warn({ src: "service:message", providerName }, "Provider returned no result");
47139
- traceActionResult.push({
47140
- data: { actionName: providerName },
47141
- success: false,
47142
- error: `Provider returned no result`
47143
- });
47144
- continue;
46825
+ try {
46826
+ const providerResult = await provider.get(runtime, message, state);
46827
+ completedProviders.add(providerName);
46828
+ if (!providerResult) {
46829
+ runtime.logger.warn({ src: "service:message", providerName }, "Provider returned no result");
46830
+ return { providerName, success: false, error: "Provider returned no result" };
46831
+ }
46832
+ const success = !!providerResult.text;
46833
+ return {
46834
+ providerName,
46835
+ success,
46836
+ text: success ? providerResult.text : undefined,
46837
+ error: success ? undefined : "Provider returned no result"
46838
+ };
46839
+ } catch (err) {
46840
+ completedProviders.add(providerName);
46841
+ const errorMsg = err instanceof Error ? err.message : String(err);
46842
+ runtime.logger.error({ src: "service:message", providerName, error: errorMsg }, "Provider execution failed");
46843
+ return { providerName, success: false, error: errorMsg };
47145
46844
  }
47146
- const success = !!providerResult.text;
47147
- traceActionResult.push({
47148
- data: { actionName: providerName },
47149
- success,
47150
- text: success ? providerResult.text : undefined,
47151
- error: success ? undefined : "Provider returned no result"
47152
- });
46845
+ });
46846
+ let timeoutId;
46847
+ const timeoutPromise = new Promise((resolve) => {
46848
+ timeoutId = setTimeout(() => resolve("timeout"), PROVIDERS_TOTAL_TIMEOUT_MS);
46849
+ });
46850
+ const allProvidersPromise = Promise.allSettled(providerPromises);
46851
+ const raceResult = await Promise.race([allProvidersPromise, timeoutPromise]);
46852
+ clearTimeout(timeoutId);
46853
+ if (raceResult === "timeout") {
46854
+ const allProviderNames = providersArray.filter((name) => typeof name === "string");
46855
+ const pendingProviders = allProviderNames.filter((name) => !completedProviders.has(name));
46856
+ runtime.logger.error({
46857
+ src: "service:message",
46858
+ timeoutMs: PROVIDERS_TOTAL_TIMEOUT_MS,
46859
+ pendingProviders,
46860
+ completedProviders: Array.from(completedProviders)
46861
+ }, `Providers took too long (>${PROVIDERS_TOTAL_TIMEOUT_MS}ms) - slow providers: ${pendingProviders.join(", ")}`);
47153
46862
  if (callback) {
47154
46863
  await callback({
47155
- text: `\uD83D\uDD0E Provider executed: ${providerName}`,
47156
- actions: [providerName],
47157
- thought: typeof thought === "string" ? thought : ""
46864
+ text: "Providers took too long to respond. Please optimize your providers or use caching.",
46865
+ actions: [],
46866
+ thought: "Provider timeout - pipeline aborted"
46867
+ });
46868
+ }
46869
+ return { responseContent: null, responseMessages: [], state, mode: "none" };
46870
+ }
46871
+ const providerResults = raceResult;
46872
+ for (const result of providerResults) {
46873
+ if (result.status === "fulfilled") {
46874
+ const { providerName, success, text, error } = result.value;
46875
+ traceActionResult.push({
46876
+ data: { actionName: providerName },
46877
+ success,
46878
+ text,
46879
+ error
47158
46880
  });
46881
+ if (callback) {
46882
+ await callback({
46883
+ text: `\uD83D\uDD0E Provider executed: ${providerName}`,
46884
+ actions: [providerName],
46885
+ thought: typeof thought === "string" ? thought : ""
46886
+ });
46887
+ }
46888
+ } else {
46889
+ runtime.logger.error({ src: "service:message", error: result.reason || "Unknown provider failure" }, "Unexpected provider promise rejection");
47159
46890
  }
47160
46891
  }
47161
46892
  if (action) {
@@ -50198,7 +49929,7 @@ function getCryptoModule() {
50198
49929
  }
50199
49930
  return require_crypto_browserify();
50200
49931
  }
50201
- function createHash2(algorithm) {
49932
+ function createHash(algorithm) {
50202
49933
  const crypto2 = getCryptoModule();
50203
49934
  const hash = crypto2.createHash(algorithm);
50204
49935
  return {
@@ -50307,7 +50038,7 @@ function encryptStringValue(value, salt) {
50307
50038
  }
50308
50039
  } catch {}
50309
50040
  }
50310
- const key = createHash2("sha256").update(salt).digest().slice(0, 32);
50041
+ const key = createHash("sha256").update(salt).digest().slice(0, 32);
50311
50042
  const iv = BufferUtils.randomBytes(16);
50312
50043
  const cipher = createCipheriv("aes-256-cbc", key, iv);
50313
50044
  let encrypted = cipher.update(value, "utf8", "hex");
@@ -50325,7 +50056,7 @@ function decryptStringValue(value, salt) {
50325
50056
  if (iv.length !== 16) {
50326
50057
  return value;
50327
50058
  }
50328
- const key = createHash2("sha256").update(salt).digest().slice(0, 32);
50059
+ const key = createHash("sha256").update(salt).digest().slice(0, 32);
50329
50060
  const decipher = createDecipheriv("aes-256-cbc", key, iv);
50330
50061
  let decrypted = decipher.update(encrypted, "hex", "utf8");
50331
50062
  decrypted += decipher.final("utf8");
@@ -51534,5 +51265,5 @@ export {
51534
51265
  ActionStreamFilter
51535
51266
  };
51536
51267
 
51537
- //# debugId=0EA8CF3BFF9CF58964756E2164756E21
51268
+ //# debugId=B5101D8C783AC7F864756E2164756E21
51538
51269
  //# sourceMappingURL=index.node.js.map