llmz 0.0.80 → 0.0.82

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 (68) hide show
  1. package/dist/{chunk-W4HLZNF4.js → chunk-22DGAZXC.js} +784 -868
  2. package/dist/{chunk-ESMRQVFC.js → chunk-2UM7PFM3.js} +6 -6
  3. package/dist/{chunk-EKXZXQJB.js → chunk-3NVOHQVY.js} +1 -1
  4. package/dist/{chunk-BSKF4J2E.cjs → chunk-5X5TDCMX.cjs} +51 -51
  5. package/dist/{chunk-BLB44ZDU.cjs → chunk-BXPPMP5X.cjs} +14 -14
  6. package/dist/{chunk-F4OZHUMS.cjs → chunk-DLV5FJ42.cjs} +9 -9
  7. package/dist/{chunk-LR6KTFHO.js → chunk-DO7DN4FZ.js} +1 -1
  8. package/dist/{chunk-UOPTKXLE.js → chunk-E6UFMAW7.js} +1 -1
  9. package/dist/{chunk-E5YW5YQN.js → chunk-E74GBCTT.js} +2 -2
  10. package/dist/{chunk-YTDNCBQW.js → chunk-EQ4JDBE5.js} +1 -1
  11. package/dist/{chunk-4VYDQ3VF.cjs → chunk-FQ4QCUTI.cjs} +7 -7
  12. package/dist/{chunk-5CXOW4DC.cjs → chunk-GFZCNSYW.cjs} +797 -881
  13. package/dist/{chunk-QOM7BK7U.cjs → chunk-H5LCBNN6.cjs} +18 -18
  14. package/dist/{chunk-UI6J4WKQ.js → chunk-HBKQKO3R.js} +3 -3
  15. package/dist/{chunk-2KRDL5AW.js → chunk-HP3T6PF4.js} +4 -4
  16. package/dist/{chunk-54G63644.cjs → chunk-OX3Y2Z5K.cjs} +3 -3
  17. package/dist/{chunk-UCXQ4U7P.cjs → chunk-TB6TCWEB.cjs} +2 -2
  18. package/dist/{chunk-WDYTCDIK.cjs → chunk-VXQ2CZ7B.cjs} +4 -4
  19. package/dist/{chunk-XLUYPCCY.cjs → chunk-X24YFCFY.cjs} +28 -28
  20. package/dist/{chunk-M4WTTARE.js → chunk-YFG53MRF.js} +1 -1
  21. package/dist/{component-DWFDDH5N.js → component-GVCCL5XU.js} +3 -3
  22. package/dist/component-YMPMWSTU.cjs +18 -0
  23. package/dist/dual-modes-KOU5YJ3Q.cjs +12 -0
  24. package/dist/dual-modes-X7YHJBFJ.js +12 -0
  25. package/dist/exit-A34GODDB.cjs +8 -0
  26. package/dist/exit-J55SREDL.js +8 -0
  27. package/dist/index.cjs +49 -49
  28. package/dist/index.js +22 -22
  29. package/dist/{jsx-PCXQVMLU.js → jsx-RIPUQSAU.js} +2 -2
  30. package/dist/jsx-XEUSAKAK.cjs +13 -0
  31. package/dist/{llmz-XRURR7Z5.cjs → llmz-2HD6WKIP.cjs} +34 -30
  32. package/dist/{llmz-F227HVGB.js → llmz-JTZUIYRP.js} +17 -13
  33. package/dist/llmz.d.ts +2 -2
  34. package/dist/quickjs-variant.d.ts +7 -1
  35. package/dist/tool-B3DJ3D2F.js +11 -0
  36. package/dist/tool-IWPZD5OY.cjs +11 -0
  37. package/dist/{truncator-2FSONJM2.js → truncator-HCWH5MJ3.js} +3 -3
  38. package/dist/truncator-SOO6NHLD.cjs +10 -0
  39. package/dist/{typings-DVMU3KVB.js → typings-FPFJ5D5R.js} +3 -3
  40. package/dist/typings-O2FLZGQN.cjs +10 -0
  41. package/dist/{utils-D3J443FA.js → utils-M5KFPSNZ.js} +2 -2
  42. package/dist/utils-PWX3JPCF.cjs +39 -0
  43. package/dist/vm/drivers/node.d.ts +5 -0
  44. package/dist/vm/drivers/quickjs.d.ts +6 -0
  45. package/dist/vm/errors.d.ts +21 -0
  46. package/dist/vm/index.d.ts +3 -0
  47. package/dist/vm/instrument.d.ts +11 -0
  48. package/dist/vm/types.d.ts +20 -0
  49. package/dist/{vm-GDB4GW4S.js → vm-KBBQ7U5L.js} +3 -3
  50. package/dist/vm-R2XBIWE4.cjs +10 -0
  51. package/package.json +3 -3
  52. package/dist/component-RVYDIBUM.cjs +0 -18
  53. package/dist/dual-modes-A4SC4APN.cjs +0 -12
  54. package/dist/dual-modes-FNC3BGK3.js +0 -12
  55. package/dist/exit-56DISPLS.js +0 -8
  56. package/dist/exit-OOGJ3TAS.cjs +0 -8
  57. package/dist/jsx-ENFGHP6S.cjs +0 -13
  58. package/dist/tool-A7EOCUQG.cjs +0 -11
  59. package/dist/tool-FNWHZGDU.js +0 -11
  60. package/dist/truncator-6M2EP2NZ.cjs +0 -10
  61. package/dist/typings-54UIN7ZR.cjs +0 -10
  62. package/dist/utils-BZUEJT4W.cjs +0 -39
  63. package/dist/vm-CR5NE6NS.cjs +0 -10
  64. package/dist/vm.d.ts +0 -9
  65. package/dist/{chunk-RKKRSBX3.cjs → chunk-7XVBJQ53.cjs} +432 -432
  66. package/dist/{chunk-5XC6ZMS5.js → chunk-BJMZIH3M.js} +432 -432
  67. /package/dist/{vm-jsx.test.d.ts → vm/vm-jsx.test.d.ts} +0 -0
  68. /package/dist/{vm.test.d.ts → vm/vm.test.d.ts} +0 -0
package/dist/index.cjs CHANGED
@@ -9,15 +9,15 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkXLUYPCCYcjs = require('./chunk-XLUYPCCY.cjs');
13
- require('./chunk-BSKF4J2E.cjs');
12
+ var _chunkX24YFCFYcjs = require('./chunk-X24YFCFY.cjs');
13
+ require('./chunk-5X5TDCMX.cjs');
14
14
 
15
15
 
16
- var _chunkQOM7BK7Ucjs = require('./chunk-QOM7BK7U.cjs');
16
+ var _chunkH5LCBNN6cjs = require('./chunk-H5LCBNN6.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkBLB44ZDUcjs = require('./chunk-BLB44ZDU.cjs');
20
+ var _chunkBXPPMP5Xcjs = require('./chunk-BXPPMP5X.cjs');
21
21
 
22
22
 
23
23
 
@@ -27,33 +27,33 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
27
27
  require('./chunk-KIN7Y247.cjs');
28
28
 
29
29
 
30
- var _chunkF4OZHUMScjs = require('./chunk-F4OZHUMS.cjs');
30
+ var _chunkDLV5FJ42cjs = require('./chunk-DLV5FJ42.cjs');
31
31
 
32
32
 
33
33
 
34
34
 
35
35
 
36
36
 
37
- var _chunkWDYTCDIKcjs = require('./chunk-WDYTCDIK.cjs');
38
- require('./chunk-54G63644.cjs');
37
+ var _chunkVXQ2CZ7Bcjs = require('./chunk-VXQ2CZ7B.cjs');
38
+ require('./chunk-OX3Y2Z5K.cjs');
39
39
 
40
40
 
41
41
 
42
- var _chunkUCXQ4U7Pcjs = require('./chunk-UCXQ4U7P.cjs');
42
+ var _chunkTB6TCWEBcjs = require('./chunk-TB6TCWEB.cjs');
43
43
 
44
44
 
45
45
 
46
46
 
47
47
 
48
48
 
49
- var _chunk4VYDQ3VFcjs = require('./chunk-4VYDQ3VF.cjs');
49
+ var _chunkFQ4QCUTIcjs = require('./chunk-FQ4QCUTI.cjs');
50
50
 
51
51
 
52
52
 
53
- var _chunkRKKRSBX3cjs = require('./chunk-RKKRSBX3.cjs');
53
+ var _chunk7XVBJQ53cjs = require('./chunk-7XVBJQ53.cjs');
54
54
 
55
55
  // package.json
56
- var version = "0.0.80";
56
+ var version = "0.0.82";
57
57
 
58
58
  // src/objects.ts
59
59
  var _zui = require('@bpinternal/zui');
@@ -65,7 +65,7 @@ var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefa
65
65
  var _types = require('@babel/types'); var t = _interopRequireWildcard(_types);
66
66
  var traverse = _traverse2.default;
67
67
  function getTypingsWithoutComments(type) {
68
- const typeClone = _chunkRKKRSBX3cjs.cloneDeep_default.call(void 0, type);
68
+ const typeClone = _chunk7XVBJQ53cjs.cloneDeep_default.call(void 0, type);
69
69
  removeBabelComments(typeClone);
70
70
  return new (0, _generator.CodeGenerator)(typeClone, { comments: false }).generate().code;
71
71
  }
@@ -133,7 +133,7 @@ function extractAndHoistTypes(ast) {
133
133
  }
134
134
  currPath = parentPath;
135
135
  }
136
- return parts.size ? Array.from(parts).reverse().map(_chunkRKKRSBX3cjs.upperFirst_default) : ["UnnamedType"];
136
+ return parts.size ? Array.from(parts).reverse().map(_chunk7XVBJQ53cjs.upperFirst_default) : ["UnnamedType"];
137
137
  }
138
138
  function generateTypeName(path) {
139
139
  return getTypePaths(path).join("");
@@ -305,7 +305,7 @@ async function hoistTypings(code, formatOptions) {
305
305
  break;
306
306
  }
307
307
  }
308
- return _chunkBLB44ZDUcjs.formatTypings.call(void 0, code, formatOptions);
308
+ return _chunkBXPPMP5Xcjs.formatTypings.call(void 0, code, formatOptions);
309
309
  }
310
310
 
311
311
  // src/objects.ts
@@ -374,7 +374,7 @@ var ObjectInstance = class {
374
374
  */
375
375
  constructor(props) {
376
376
  var _a;
377
- if (!_chunk4VYDQ3VFcjs.isValidIdentifier.call(void 0, props.name)) {
377
+ if (!_chunkFQ4QCUTIcjs.isValidIdentifier.call(void 0, props.name)) {
378
378
  throw new Error(
379
379
  `Invalid name for tool ${props.name}. A tool name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
380
380
  );
@@ -407,7 +407,7 @@ var ObjectInstance = class {
407
407
  if (props.properties.filter((p) => p.name === prop.name).length > 1) {
408
408
  throw new Error(`Duplicate property name "${prop.name}" in tool ${props.name}`);
409
409
  }
410
- if (!_chunk4VYDQ3VFcjs.isValidIdentifier.call(void 0, prop.name)) {
410
+ if (!_chunkFQ4QCUTIcjs.isValidIdentifier.call(void 0, prop.name)) {
411
411
  throw new Error(
412
412
  `Invalid name for property ${prop.name}. A property name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
413
413
  );
@@ -431,7 +431,7 @@ var ObjectInstance = class {
431
431
  this.description = props.description;
432
432
  this.metadata = _nullishCoalesce(props.metadata, () => ( {}));
433
433
  this.properties = props.properties;
434
- this.tools = _chunkQOM7BK7Ucjs.Tool.withUniqueNames(_nullishCoalesce(props.tools, () => ( [])));
434
+ this.tools = _chunkH5LCBNN6cjs.Tool.withUniqueNames(_nullishCoalesce(props.tools, () => ( [])));
435
435
  }
436
436
  /**
437
437
  * Generates TypeScript namespace declarations for this object.
@@ -508,11 +508,11 @@ function getObjectTypings(obj) {
508
508
  for (const prop of _nullishCoalesce(obj.properties, () => ( []))) {
509
509
  const description = _nullishCoalesce(prop.description, () => ( ""));
510
510
  if (description == null ? void 0 : description.trim().length) {
511
- typings.push(_chunk4VYDQ3VFcjs.getMultilineComment.call(void 0, description));
511
+ typings.push(_chunkFQ4QCUTIcjs.getMultilineComment.call(void 0, description));
512
512
  }
513
513
  let type = "unknown";
514
514
  if (prop.type) {
515
- type = await _chunkBLB44ZDUcjs.getTypings.call(void 0, prop.type, {});
515
+ type = await _chunkBXPPMP5Xcjs.getTypings.call(void 0, prop.type, {});
516
516
  } else if (prop.value !== void 0) {
517
517
  type = typeof prop.value;
518
518
  }
@@ -532,7 +532,7 @@ function getObjectTypings(obj) {
532
532
  typings.push("");
533
533
  for (const tool of obj.tools) {
534
534
  const fnType = _zui.z.function(tool.zInput, tool.zOutput).title(tool.name).describe(_nullishCoalesce(tool.description, () => ( "")));
535
- let temp = await _chunkBLB44ZDUcjs.getTypings.call(void 0, fnType, {
535
+ let temp = await _chunkBXPPMP5Xcjs.getTypings.call(void 0, fnType, {
536
536
  declaration: true
537
537
  });
538
538
  temp = temp.replace("declare function ", "function ");
@@ -553,9 +553,9 @@ function getObjectTypings(obj) {
553
553
  typings.push("}" + closingBracket);
554
554
  let header = "";
555
555
  if ((_a = obj.description) == null ? void 0 : _a.trim().length) {
556
- header = _chunk4VYDQ3VFcjs.getMultilineComment.call(void 0, obj.description);
556
+ header = _chunkFQ4QCUTIcjs.getMultilineComment.call(void 0, obj.description);
557
557
  }
558
- return _chunkBLB44ZDUcjs.formatTypings.call(void 0,
558
+ return _chunkBXPPMP5Xcjs.formatTypings.call(void 0,
559
559
  `${header}
560
560
  export namespace ${obj.name} {
561
561
  ${body}
@@ -586,7 +586,7 @@ function getObjectTypings(obj) {
586
586
  }
587
587
  function embedPropertyValue(property) {
588
588
  if (typeof property.value === "string") {
589
- return _chunk4VYDQ3VFcjs.escapeString.call(void 0, property.value);
589
+ return _chunkFQ4QCUTIcjs.escapeString.call(void 0, property.value);
590
590
  }
591
591
  if (Number.isNaN(property.value)) {
592
592
  return "NaN";
@@ -604,7 +604,7 @@ function embedPropertyValue(property) {
604
604
  return `new Date('${property.value.toISOString()}')`;
605
605
  }
606
606
  if (property.value instanceof RegExp) {
607
- return `new RegExp(${_chunk4VYDQ3VFcjs.escapeString.call(void 0, property.value.source)}, ${_chunk4VYDQ3VFcjs.escapeString.call(void 0, property.value.flags)})`;
607
+ return `new RegExp(${_chunkFQ4QCUTIcjs.escapeString.call(void 0, property.value.source)}, ${_chunkFQ4QCUTIcjs.escapeString.call(void 0, property.value.flags)})`;
608
608
  }
609
609
  if (property.value === null) {
610
610
  return "null";
@@ -622,7 +622,7 @@ function embedPropertyValue(property) {
622
622
  return `${property.value}n`;
623
623
  }
624
624
  if (property.value instanceof Error) {
625
- return `Error(${_chunk4VYDQ3VFcjs.escapeString.call(void 0, property.value.message)})`;
625
+ return `Error(${_chunkFQ4QCUTIcjs.escapeString.call(void 0, property.value.message)})`;
626
626
  }
627
627
  if (property.value instanceof Map) {
628
628
  return `new Map(${JSON.stringify(Array.from(property.value.entries()))})`;
@@ -769,7 +769,7 @@ var CitationsManager = (_class = class {constructor() { _class.prototype.__init.
769
769
 
770
770
  // src/component.default.ts
771
771
 
772
- var Button = new (0, _chunkWDYTCDIKcjs.Component)({
772
+ var Button = new (0, _chunkVXQ2CZ7Bcjs.Component)({
773
773
  type: "leaf",
774
774
  description: "A button component that can perform actions when clicked",
775
775
  name: "Button",
@@ -801,7 +801,7 @@ var Button = new (0, _chunkWDYTCDIKcjs.Component)({
801
801
  })
802
802
  }
803
803
  });
804
- var Image = new (0, _chunkWDYTCDIKcjs.Component)({
804
+ var Image = new (0, _chunkVXQ2CZ7Bcjs.Component)({
805
805
  type: "leaf",
806
806
  name: "Image",
807
807
  description: "Displays an image from a URL.",
@@ -823,7 +823,7 @@ var Image = new (0, _chunkWDYTCDIKcjs.Component)({
823
823
  })
824
824
  }
825
825
  });
826
- var File = new (0, _chunkWDYTCDIKcjs.Component)({
826
+ var File = new (0, _chunkVXQ2CZ7Bcjs.Component)({
827
827
  type: "leaf",
828
828
  name: "File",
829
829
  description: "Sends a downloadable file to the user.",
@@ -845,7 +845,7 @@ var File = new (0, _chunkWDYTCDIKcjs.Component)({
845
845
  })
846
846
  }
847
847
  });
848
- var Video = new (0, _chunkWDYTCDIKcjs.Component)({
848
+ var Video = new (0, _chunkVXQ2CZ7Bcjs.Component)({
849
849
  type: "leaf",
850
850
  name: "Video",
851
851
  description: "Embeds a video from a URL.",
@@ -867,7 +867,7 @@ var Video = new (0, _chunkWDYTCDIKcjs.Component)({
867
867
  })
868
868
  }
869
869
  });
870
- var Audio = new (0, _chunkWDYTCDIKcjs.Component)({
870
+ var Audio = new (0, _chunkVXQ2CZ7Bcjs.Component)({
871
871
  type: "leaf",
872
872
  name: "Audio",
873
873
  description: "Plays an audio clip from a URL.",
@@ -889,7 +889,7 @@ var Audio = new (0, _chunkWDYTCDIKcjs.Component)({
889
889
  })
890
890
  }
891
891
  });
892
- var Card = new (0, _chunkWDYTCDIKcjs.Component)({
892
+ var Card = new (0, _chunkVXQ2CZ7Bcjs.Component)({
893
893
  type: "container",
894
894
  name: "Card",
895
895
  description: "A visual card component that can include an image and buttons.",
@@ -925,7 +925,7 @@ var Card = new (0, _chunkWDYTCDIKcjs.Component)({
925
925
  ]
926
926
  }
927
927
  });
928
- var Carousel = new (0, _chunkWDYTCDIKcjs.Component)({
928
+ var Carousel = new (0, _chunkVXQ2CZ7Bcjs.Component)({
929
929
  type: "container",
930
930
  name: "Carousel",
931
931
  description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
@@ -959,7 +959,7 @@ var Carousel = new (0, _chunkWDYTCDIKcjs.Component)({
959
959
  ]
960
960
  }
961
961
  });
962
- var Text = new (0, _chunkWDYTCDIKcjs.Component)({
962
+ var Text = new (0, _chunkVXQ2CZ7Bcjs.Component)({
963
963
  type: "default",
964
964
  name: "Message",
965
965
  aliases: ["Text", "Markdown"],
@@ -1109,26 +1109,26 @@ var Chat = class {
1109
1109
 
1110
1110
  // src/index.ts
1111
1111
  var utils = {
1112
- toValidObjectName: _chunk4VYDQ3VFcjs.toValidObjectName,
1113
- toValidFunctionName: _chunk4VYDQ3VFcjs.toValidFunctionName,
1114
- wrapContent: _chunkUCXQ4U7Pcjs.wrapContent,
1115
- truncateWrappedContent: _chunkUCXQ4U7Pcjs.truncateWrappedContent
1112
+ toValidObjectName: _chunkFQ4QCUTIcjs.toValidObjectName,
1113
+ toValidFunctionName: _chunkFQ4QCUTIcjs.toValidFunctionName,
1114
+ wrapContent: _chunkTB6TCWEBcjs.wrapContent,
1115
+ truncateWrappedContent: _chunkTB6TCWEBcjs.truncateWrappedContent
1116
1116
  };
1117
1117
  var execute = async (props) => {
1118
- const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-XRURR7Z5.cjs")));
1118
+ const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-2HD6WKIP.cjs")));
1119
1119
  return executeContext(props);
1120
1120
  };
1121
1121
  var init = async () => {
1122
- await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-XRURR7Z5.cjs")));
1123
- await Promise.resolve().then(() => _interopRequireWildcard(require("./component-RVYDIBUM.cjs")));
1124
- await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-A7EOCUQG.cjs")));
1125
- await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-OOGJ3TAS.cjs")));
1126
- await Promise.resolve().then(() => _interopRequireWildcard(require("./jsx-ENFGHP6S.cjs")));
1127
- await Promise.resolve().then(() => _interopRequireWildcard(require("./vm-CR5NE6NS.cjs")));
1128
- await Promise.resolve().then(() => _interopRequireWildcard(require("./utils-BZUEJT4W.cjs")));
1129
- await Promise.resolve().then(() => _interopRequireWildcard(require("./truncator-6M2EP2NZ.cjs")));
1130
- await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-54UIN7ZR.cjs")));
1131
- await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-A4SC4APN.cjs")));
1122
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-2HD6WKIP.cjs")));
1123
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./component-YMPMWSTU.cjs")));
1124
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-IWPZD5OY.cjs")));
1125
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-A34GODDB.cjs")));
1126
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./jsx-XEUSAKAK.cjs")));
1127
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./vm-R2XBIWE4.cjs")));
1128
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./utils-PWX3JPCF.cjs")));
1129
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./truncator-SOO6NHLD.cjs")));
1130
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-O2FLZGQN.cjs")));
1131
+ await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-KOU5YJ3Q.cjs")));
1132
1132
  };
1133
1133
 
1134
1134
 
@@ -1159,4 +1159,4 @@ var init = async () => {
1159
1159
 
1160
1160
 
1161
1161
 
1162
- exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkWDYTCDIKcjs.Component; exports.DefaultComponents = DefaultComponents; exports.DefaultExit = _chunkXLUYPCCYcjs.DefaultExit; exports.ErrorExecutionResult = _chunkXLUYPCCYcjs.ErrorExecutionResult; exports.ExecutionResult = _chunkXLUYPCCYcjs.ExecutionResult; exports.Exit = _chunkF4OZHUMScjs.Exit; exports.ListenExit = _chunkXLUYPCCYcjs.ListenExit; exports.LoopExceededError = _chunkPK72FAKDcjs.LoopExceededError; exports.ObjectInstance = ObjectInstance; exports.PartialExecutionResult = _chunkXLUYPCCYcjs.PartialExecutionResult; exports.Snapshot = _chunkXLUYPCCYcjs.Snapshot; exports.SnapshotSignal = _chunkPK72FAKDcjs.SnapshotSignal; exports.SuccessExecutionResult = _chunkXLUYPCCYcjs.SuccessExecutionResult; exports.ThinkExit = _chunkXLUYPCCYcjs.ThinkExit; exports.ThinkSignal = _chunkPK72FAKDcjs.ThinkSignal; exports.Tool = _chunkQOM7BK7Ucjs.Tool; exports.assertValidComponent = _chunkWDYTCDIKcjs.assertValidComponent; exports.execute = execute; exports.getValue = _chunkXLUYPCCYcjs.getValue; exports.init = init; exports.isAnyComponent = _chunkWDYTCDIKcjs.isAnyComponent; exports.isComponent = _chunkWDYTCDIKcjs.isComponent; exports.parseExit = _chunkXLUYPCCYcjs.parseExit; exports.renderToTsx = _chunkWDYTCDIKcjs.renderToTsx; exports.utils = utils; exports.version = version;
1162
+ exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkVXQ2CZ7Bcjs.Component; exports.DefaultComponents = DefaultComponents; exports.DefaultExit = _chunkX24YFCFYcjs.DefaultExit; exports.ErrorExecutionResult = _chunkX24YFCFYcjs.ErrorExecutionResult; exports.ExecutionResult = _chunkX24YFCFYcjs.ExecutionResult; exports.Exit = _chunkDLV5FJ42cjs.Exit; exports.ListenExit = _chunkX24YFCFYcjs.ListenExit; exports.LoopExceededError = _chunkPK72FAKDcjs.LoopExceededError; exports.ObjectInstance = ObjectInstance; exports.PartialExecutionResult = _chunkX24YFCFYcjs.PartialExecutionResult; exports.Snapshot = _chunkX24YFCFYcjs.Snapshot; exports.SnapshotSignal = _chunkPK72FAKDcjs.SnapshotSignal; exports.SuccessExecutionResult = _chunkX24YFCFYcjs.SuccessExecutionResult; exports.ThinkExit = _chunkX24YFCFYcjs.ThinkExit; exports.ThinkSignal = _chunkPK72FAKDcjs.ThinkSignal; exports.Tool = _chunkH5LCBNN6cjs.Tool; exports.assertValidComponent = _chunkVXQ2CZ7Bcjs.assertValidComponent; exports.execute = execute; exports.getValue = _chunkX24YFCFYcjs.getValue; exports.init = init; exports.isAnyComponent = _chunkVXQ2CZ7Bcjs.isAnyComponent; exports.isComponent = _chunkVXQ2CZ7Bcjs.isComponent; exports.parseExit = _chunkX24YFCFYcjs.parseExit; exports.renderToTsx = _chunkVXQ2CZ7Bcjs.renderToTsx; exports.utils = utils; exports.version = version;
package/dist/index.js CHANGED
@@ -9,15 +9,15 @@ import {
9
9
  ThinkExit,
10
10
  getValue,
11
11
  parseExit
12
- } from "./chunk-ESMRQVFC.js";
13
- import "./chunk-2KRDL5AW.js";
12
+ } from "./chunk-2UM7PFM3.js";
13
+ import "./chunk-HP3T6PF4.js";
14
14
  import {
15
15
  Tool
16
- } from "./chunk-UI6J4WKQ.js";
16
+ } from "./chunk-HBKQKO3R.js";
17
17
  import {
18
18
  formatTypings,
19
19
  getTypings
20
- } from "./chunk-LR6KTFHO.js";
20
+ } from "./chunk-DO7DN4FZ.js";
21
21
  import {
22
22
  CodeFormattingError,
23
23
  LoopExceededError,
@@ -27,33 +27,33 @@ import {
27
27
  import "./chunk-YEAWWJSJ.js";
28
28
  import {
29
29
  Exit
30
- } from "./chunk-E5YW5YQN.js";
30
+ } from "./chunk-E74GBCTT.js";
31
31
  import {
32
32
  Component,
33
33
  assertValidComponent,
34
34
  isAnyComponent,
35
35
  isComponent,
36
36
  renderToTsx
37
- } from "./chunk-YTDNCBQW.js";
38
- import "./chunk-UOPTKXLE.js";
37
+ } from "./chunk-EQ4JDBE5.js";
38
+ import "./chunk-E6UFMAW7.js";
39
39
  import {
40
40
  truncateWrappedContent,
41
41
  wrapContent
42
- } from "./chunk-M4WTTARE.js";
42
+ } from "./chunk-YFG53MRF.js";
43
43
  import {
44
44
  escapeString,
45
45
  getMultilineComment,
46
46
  isValidIdentifier,
47
47
  toValidFunctionName,
48
48
  toValidObjectName
49
- } from "./chunk-EKXZXQJB.js";
49
+ } from "./chunk-3NVOHQVY.js";
50
50
  import {
51
51
  cloneDeep_default,
52
52
  upperFirst_default
53
- } from "./chunk-5XC6ZMS5.js";
53
+ } from "./chunk-BJMZIH3M.js";
54
54
 
55
55
  // package.json
56
- var version = "0.0.80";
56
+ var version = "0.0.82";
57
57
 
58
58
  // src/objects.ts
59
59
  import { z } from "@bpinternal/zui";
@@ -1115,20 +1115,20 @@ var utils = {
1115
1115
  truncateWrappedContent
1116
1116
  };
1117
1117
  var execute = async (props) => {
1118
- const { executeContext } = await import("./llmz-F227HVGB.js");
1118
+ const { executeContext } = await import("./llmz-JTZUIYRP.js");
1119
1119
  return executeContext(props);
1120
1120
  };
1121
1121
  var init = async () => {
1122
- await import("./llmz-F227HVGB.js");
1123
- await import("./component-DWFDDH5N.js");
1124
- await import("./tool-FNWHZGDU.js");
1125
- await import("./exit-56DISPLS.js");
1126
- await import("./jsx-PCXQVMLU.js");
1127
- await import("./vm-GDB4GW4S.js");
1128
- await import("./utils-D3J443FA.js");
1129
- await import("./truncator-2FSONJM2.js");
1130
- await import("./typings-DVMU3KVB.js");
1131
- await import("./dual-modes-FNC3BGK3.js");
1122
+ await import("./llmz-JTZUIYRP.js");
1123
+ await import("./component-GVCCL5XU.js");
1124
+ await import("./tool-B3DJ3D2F.js");
1125
+ await import("./exit-J55SREDL.js");
1126
+ await import("./jsx-RIPUQSAU.js");
1127
+ await import("./vm-KBBQ7U5L.js");
1128
+ await import("./utils-M5KFPSNZ.js");
1129
+ await import("./truncator-HCWH5MJ3.js");
1130
+ await import("./typings-FPFJ5D5R.js");
1131
+ await import("./dual-modes-X7YHJBFJ.js");
1132
1132
  };
1133
1133
  export {
1134
1134
  Chat,
@@ -3,8 +3,8 @@ import {
3
3
  createJsxComponent,
4
4
  isAnyJsxComponent,
5
5
  isJsxComponent
6
- } from "./chunk-UOPTKXLE.js";
7
- import "./chunk-5XC6ZMS5.js";
6
+ } from "./chunk-E6UFMAW7.js";
7
+ import "./chunk-BJMZIH3M.js";
8
8
  export {
9
9
  Jsx,
10
10
  createJsxComponent,
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkOX3Y2Z5Kcjs = require('./chunk-OX3Y2Z5K.cjs');
7
+ require('./chunk-7XVBJQ53.cjs');
8
+
9
+
10
+
11
+
12
+
13
+ exports.Jsx = _chunkOX3Y2Z5Kcjs.Jsx; exports.createJsxComponent = _chunkOX3Y2Z5Kcjs.createJsxComponent; exports.isAnyJsxComponent = _chunkOX3Y2Z5Kcjs.isAnyJsxComponent; exports.isJsxComponent = _chunkOX3Y2Z5Kcjs.isJsxComponent;
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunk5CXOW4DCcjs = require('./chunk-5CXOW4DC.cjs');
3
+ var _chunkGFZCNSYWcjs = require('./chunk-GFZCNSYW.cjs');
4
4
 
5
5
 
6
6
 
@@ -8,10 +8,10 @@ var _chunk5CXOW4DCcjs = require('./chunk-5CXOW4DC.cjs');
8
8
 
9
9
 
10
10
 
11
- var _chunkXLUYPCCYcjs = require('./chunk-XLUYPCCY.cjs');
12
- require('./chunk-BSKF4J2E.cjs');
13
- require('./chunk-QOM7BK7U.cjs');
14
- require('./chunk-BLB44ZDU.cjs');
11
+ var _chunkX24YFCFYcjs = require('./chunk-X24YFCFY.cjs');
12
+ require('./chunk-5X5TDCMX.cjs');
13
+ require('./chunk-H5LCBNN6.cjs');
14
+ require('./chunk-BXPPMP5X.cjs');
15
15
 
16
16
 
17
17
 
@@ -26,25 +26,29 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
26
26
 
27
27
 
28
28
  var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
29
- require('./chunk-F4OZHUMS.cjs');
30
- require('./chunk-WDYTCDIK.cjs');
31
- require('./chunk-54G63644.cjs');
29
+ require('./chunk-DLV5FJ42.cjs');
30
+ require('./chunk-VXQ2CZ7B.cjs');
31
+ require('./chunk-OX3Y2Z5K.cjs');
32
32
 
33
33
 
34
- var _chunkUCXQ4U7Pcjs = require('./chunk-UCXQ4U7P.cjs');
34
+ var _chunkTB6TCWEBcjs = require('./chunk-TB6TCWEB.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunk4VYDQ3VFcjs = require('./chunk-4VYDQ3VF.cjs');
38
+ var _chunkFQ4QCUTIcjs = require('./chunk-FQ4QCUTI.cjs');
39
39
 
40
40
 
41
41
 
42
42
 
43
43
 
44
- var _chunkRKKRSBX3cjs = require('./chunk-RKKRSBX3.cjs');
44
+ var _chunk7XVBJQ53cjs = require('./chunk-7XVBJQ53.cjs');
45
45
 
46
46
  // src/llmz.ts
47
47
  var _client = require('@botpress/client');
48
+
49
+
50
+
51
+
48
52
  var _cognitive = require('@botpress/cognitive');
49
53
  var _zui = require('@bpinternal/zui');
50
54
  var _ms = require('ms'); var _ms2 = _interopRequireDefault(_ms);
@@ -87,14 +91,14 @@ var RESPONSE_LENGTH_BUFFER = {
87
91
  MAX_TOKENS: 16e3,
88
92
  PERCENTAGE: 0.1
89
93
  };
90
- var getModelOutputLimit = (inputLength) => _chunkRKKRSBX3cjs.clamp_default.call(void 0,
94
+ var getModelOutputLimit = (inputLength) => _chunk7XVBJQ53cjs.clamp_default.call(void 0,
91
95
  RESPONSE_LENGTH_BUFFER.PERCENTAGE * inputLength,
92
96
  RESPONSE_LENGTH_BUFFER.MIN_TOKENS,
93
97
  RESPONSE_LENGTH_BUFFER.MAX_TOKENS
94
98
  );
95
99
  var executeContext = async (props) => {
96
100
  var _a, _b;
97
- await _chunk4VYDQ3VFcjs.init.call(void 0, );
101
+ await _chunkFQ4QCUTIcjs.init.call(void 0, );
98
102
  const result = await _executeContext(props);
99
103
  try {
100
104
  (_b = (_a = result.context.chat) == null ? void 0 : _a.onExecutionDone) == null ? void 0 : _b.call(_a, result);
@@ -107,9 +111,9 @@ var _executeContext = async (props) => {
107
111
  const controller = createJoinedAbortController([props.signal]);
108
112
  const { onIterationStart, onIterationEnd, onTrace, onExit, onBeforeExecution, onAfterTool, onBeforeTool } = props;
109
113
  const client = _nullishCoalesce(props.client, () => ( new (0, _client.Client)()));
110
- const cognitive = _cognitive.Cognitive.isCognitiveClient(client) ? client : new (0, _cognitive.Cognitive)({ client, __experimental_beta: true });
114
+ const cognitive = _cognitive.Cognitive.isCognitiveClient(client) ? client : _cognitive.CognitiveBeta.isBetaClient(client) ? _cognitive.cognitiveFromBeta.call(void 0, client) : new (0, _cognitive.Cognitive)({ client, __experimental_beta: true });
111
115
  const cleanups = [];
112
- const ctx = new (0, _chunkXLUYPCCYcjs.Context)({
116
+ const ctx = new (0, _chunkX24YFCFYcjs.Context)({
113
117
  chat: props.chat,
114
118
  instructions: props.instructions,
115
119
  objects: props.objects,
@@ -125,7 +129,7 @@ var _executeContext = async (props) => {
125
129
  try {
126
130
  while (true) {
127
131
  if (ctx.iterations.length >= ctx.loop) {
128
- return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
132
+ return new (0, _chunkX24YFCFYcjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
129
133
  }
130
134
  const iteration = await ctx.nextIteration();
131
135
  try {
@@ -148,7 +152,7 @@ var _executeContext = async (props) => {
148
152
  reason: _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted"))
149
153
  }
150
154
  });
151
- return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
155
+ return new (0, _chunkX24YFCFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
152
156
  }
153
157
  cleanups.push(
154
158
  iteration.traces.onPush((traces) => {
@@ -170,7 +174,7 @@ var _executeContext = async (props) => {
170
174
  });
171
175
  } catch (err) {
172
176
  if (err instanceof _chunkPK72FAKDcjs.CognitiveError) {
173
- return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, err);
177
+ return new (0, _chunkX24YFCFYcjs.ErrorExecutionResult)(ctx, err);
174
178
  }
175
179
  iteration.end({
176
180
  type: "execution_error",
@@ -187,25 +191,25 @@ var _executeContext = async (props) => {
187
191
  }
188
192
  if (iteration.status.type === "exit_success") {
189
193
  const exitName = iteration.status.exit_success.exit_name;
190
- return new (0, _chunkXLUYPCCYcjs.SuccessExecutionResult)(ctx, {
194
+ return new (0, _chunkX24YFCFYcjs.SuccessExecutionResult)(ctx, {
191
195
  exit: iteration.exits.find((x) => x.name === exitName),
192
196
  result: iteration.status.exit_success.return_value
193
197
  });
194
198
  }
195
199
  if (iteration.status.type === "callback_requested") {
196
- return new (0, _chunkXLUYPCCYcjs.PartialExecutionResult)(
200
+ return new (0, _chunkX24YFCFYcjs.PartialExecutionResult)(
197
201
  ctx,
198
202
  iteration.status.callback_requested.signal,
199
- _chunkXLUYPCCYcjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
203
+ _chunkX24YFCFYcjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
200
204
  );
201
205
  }
202
206
  if (iteration.status.type === "thinking_requested" || iteration.status.type === "exit_error" || iteration.status.type === "execution_error" || iteration.status.type === "invalid_code_error") {
203
207
  continue;
204
208
  }
205
- return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)));
209
+ return new (0, _chunkX24YFCFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)));
206
210
  }
207
211
  } catch (error) {
208
- return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
212
+ return new (0, _chunkX24YFCFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
209
213
  } finally {
210
214
  for (const cleanup of cleanups) {
211
215
  try {
@@ -234,7 +238,7 @@ var executeIteration = async ({
234
238
  });
235
239
  const modelLimit = Math.max(model.input.maxTokens, 8e3);
236
240
  const responseLengthBuffer = getModelOutputLimit(modelLimit);
237
- const messages = _chunkUCXQ4U7Pcjs.truncateWrappedContent.call(void 0, {
241
+ const messages = _chunkTB6TCWEBcjs.truncateWrappedContent.call(void 0, {
238
242
  messages: iteration.messages,
239
243
  tokenLimit: modelLimit - responseLengthBuffer,
240
244
  throwOnFailure: true
@@ -315,7 +319,7 @@ var executeIteration = async ({
315
319
  model: model.ref,
316
320
  code: iteration.code
317
321
  });
318
- const vmContext = { ..._chunk4VYDQ3VFcjs.stripInvalidIdentifiers.call(void 0, iteration.variables) };
322
+ const vmContext = { ..._chunkFQ4QCUTIcjs.stripInvalidIdentifiers.call(void 0, iteration.variables) };
319
323
  for (const obj of iteration.objects) {
320
324
  const internalValues = {};
321
325
  const instance = {};
@@ -330,7 +334,7 @@ var executeIteration = async ({
330
334
  return internalValues[name];
331
335
  },
332
336
  set(value2) {
333
- if (_chunkRKKRSBX3cjs.isEqual_default.call(void 0, value2, internalValues[name])) {
337
+ if (_chunk7XVBJQ53cjs.isEqual_default.call(void 0, value2, internalValues[name])) {
334
338
  return;
335
339
  }
336
340
  if (!writable) {
@@ -401,7 +405,7 @@ var executeIteration = async ({
401
405
  });
402
406
  }
403
407
  startedAt = Date.now();
404
- const result = await _chunk5CXOW4DCcjs.runAsyncFunction.call(void 0,
408
+ const result = await _chunkGFZCNSYWcjs.runAsyncFunction.call(void 0,
405
409
  vmContext,
406
410
  iteration.code,
407
411
  traces,
@@ -477,8 +481,8 @@ var executeIteration = async ({
477
481
  let returnValue = result.success && result.return_value ? result.return_value : null;
478
482
  const returnAction = returnValue == null ? void 0 : returnValue.action;
479
483
  if (returnAction === "think") {
480
- const variables = _chunkRKKRSBX3cjs.omit_default.call(void 0, _nullishCoalesce(returnValue, () => ( {})), "action");
481
- if (_chunkRKKRSBX3cjs.isPlainObject_default.call(void 0, variables) && Object.keys(variables).length > 0) {
484
+ const variables = _chunk7XVBJQ53cjs.omit_default.call(void 0, _nullishCoalesce(returnValue, () => ( {})), "action");
485
+ if (_chunk7XVBJQ53cjs.isPlainObject_default.call(void 0, variables) && Object.keys(variables).length > 0) {
482
486
  return iteration.end({
483
487
  type: "thinking_requested",
484
488
  thinking_requested: {
@@ -495,7 +499,7 @@ var executeIteration = async ({
495
499
  }
496
500
  });
497
501
  }
498
- const parsedExit = _chunkXLUYPCCYcjs.parseExit.call(void 0, returnValue, iteration.exits);
502
+ const parsedExit = _chunkX24YFCFYcjs.parseExit.call(void 0, returnValue, iteration.exits);
499
503
  if (!parsedExit.success) {
500
504
  return iteration.end({
501
505
  type: "exit_error",