llmz 0.0.84 → 0.0.85

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 (35) hide show
  1. package/dist/{chunk-NK2NCYSY.js → chunk-2XSXXGXJ.js} +4 -4
  2. package/dist/{chunk-2O3UTPVH.js → chunk-EADBCAE7.js} +2 -2
  3. package/dist/{chunk-D6PU5YAS.cjs → chunk-EC2I4U4G.cjs} +6 -6
  4. package/dist/{chunk-L74UZONX.js → chunk-GEN6TAXY.js} +8 -16
  5. package/dist/{chunk-ZPHRTTQX.cjs → chunk-GFSUTNRM.cjs} +9 -17
  6. package/dist/{chunk-WODK7Y4J.cjs → chunk-H3PZFBJL.cjs} +10 -10
  7. package/dist/{chunk-7LMIOS6H.cjs → chunk-KY27DGTG.cjs} +14 -14
  8. package/dist/{chunk-PQGZQQA6.cjs → chunk-N3XPJTPE.cjs} +18 -18
  9. package/dist/{chunk-FPLSJF4S.cjs → chunk-NFZXJRXS.cjs} +2 -5
  10. package/dist/{chunk-TOGYDN6U.js → chunk-PASYUKW4.js} +1 -1
  11. package/dist/{chunk-XVVYNOTX.js → chunk-TRWUQSEK.js} +1 -1
  12. package/dist/{chunk-IRCB4FRM.js → chunk-YTFNFSDT.js} +2 -2
  13. package/dist/{chunk-YX27XM67.js → chunk-ZHHB3FT4.js} +1 -4
  14. package/dist/{chunk-BBX2LDZE.cjs → chunk-ZVSO527D.cjs} +25 -25
  15. package/dist/{dual-modes-HEXPFVUE.js → dual-modes-5NJMZJTA.js} +3 -3
  16. package/dist/{dual-modes-LLIWZCHC.cjs → dual-modes-WA5TPGJR.cjs} +4 -4
  17. package/dist/{execute-EZXXBWB6.js → execute-2T75URIX.js} +7 -7
  18. package/dist/{execute-2BVFYTJT.cjs → execute-I53OOORH.cjs} +30 -30
  19. package/dist/{exit-VJATJTQI.js → exit-7NHSUR3V.js} +2 -2
  20. package/dist/exit-V3ORIN65.cjs +8 -0
  21. package/dist/index.cjs +33 -33
  22. package/dist/index.js +16 -16
  23. package/dist/{tool-GJ6ZXWS2.cjs → tool-4OPM7QRM.cjs} +4 -4
  24. package/dist/{tool-DNHVW3KC.js → tool-HXXQMDA3.js} +3 -3
  25. package/dist/truncator-ZN7X6OMF.cjs +10 -0
  26. package/dist/{truncator-3U2QUUJJ.js → truncator-ZQYBTVCJ.js} +2 -2
  27. package/dist/{typings-ZTFPPA5W.cjs → typings-QW4427V7.cjs} +3 -3
  28. package/dist/{typings-3YV3RDMP.js → typings-YD2WAQ4A.js} +2 -2
  29. package/dist/utils-NQSM5FBL.cjs +39 -0
  30. package/dist/{utils-ZEZ66X6Q.js → utils-RKUVYFTJ.js} +1 -1
  31. package/dist/utils.d.ts +1 -1
  32. package/package.json +2 -2
  33. package/dist/exit-LUJY7JIG.cjs +0 -8
  34. package/dist/truncator-3ZN7W6NB.cjs +0 -10
  35. package/dist/utils-GLZVMRWO.cjs +0 -39
@@ -2,22 +2,22 @@ import {
2
2
  DualModePrompt,
3
3
  extractType,
4
4
  inspect
5
- } from "./chunk-2O3UTPVH.js";
5
+ } from "./chunk-EADBCAE7.js";
6
6
  import {
7
7
  Tool
8
- } from "./chunk-IRCB4FRM.js";
8
+ } from "./chunk-YTFNFSDT.js";
9
9
  import {
10
10
  LoopExceededError
11
11
  } from "./chunk-WSVDMGMR.js";
12
12
  import {
13
13
  Exit
14
- } from "./chunk-XVVYNOTX.js";
14
+ } from "./chunk-TRWUQSEK.js";
15
15
  import {
16
16
  assertValidComponent
17
17
  } from "./chunk-3T5IU7OU.js";
18
18
  import {
19
19
  wrapContent
20
- } from "./chunk-L74UZONX.js";
20
+ } from "./chunk-GEN6TAXY.js";
21
21
  import {
22
22
  cloneDeep_default,
23
23
  isPlainObject_default,
@@ -6,11 +6,11 @@ import {
6
6
  } from "./chunk-3T5IU7OU.js";
7
7
  import {
8
8
  wrapContent
9
- } from "./chunk-L74UZONX.js";
9
+ } from "./chunk-GEN6TAXY.js";
10
10
  import {
11
11
  escapeString,
12
12
  getTokenizer
13
- } from "./chunk-YX27XM67.js";
13
+ } from "./chunk-ZHHB3FT4.js";
14
14
  import {
15
15
  countBy_default,
16
16
  filter_default,
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
5
+ var _chunkNFZXJRXScjs = require('./chunk-NFZXJRXS.cjs');
6
6
 
7
7
 
8
8
  var _chunkHC2QZTVTcjs = require('./chunk-HC2QZTVT.cjs');
@@ -42,7 +42,7 @@ var Exit = (_class = class _Exit {
42
42
  */
43
43
  rename(name) {
44
44
  const before = this.name;
45
- if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, name)) {
45
+ if (!_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, name)) {
46
46
  throw new Error(
47
47
  `Invalid name for exit ${name}. An exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
48
48
  );
@@ -177,7 +177,7 @@ var Exit = (_class = class _Exit {
177
177
  * ```
178
178
  */
179
179
  constructor(props) {;_class.prototype.__init.call(this);
180
- if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, props.name)) {
180
+ if (!_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, props.name)) {
181
181
  throw new Error(
182
182
  `Invalid name for exit ${props.name}. A exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
183
183
  );
@@ -197,13 +197,13 @@ var Exit = (_class = class _Exit {
197
197
  `Invalid aliases for exit ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
198
198
  );
199
199
  }
200
- if (props.aliases && props.aliases.some((alias) => !_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, alias))) {
200
+ if (props.aliases && props.aliases.some((alias) => !_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, alias))) {
201
201
  throw new Error(`Invalid aliases for exit ${props.name}. Expected an array of valid identifiers.`);
202
202
  }
203
203
  if (typeof props.schema !== "undefined") {
204
- if (_chunkFPLSJF4Scjs.isZuiSchema.call(void 0, props.schema)) {
204
+ if (_chunkNFZXJRXScjs.isZuiSchema.call(void 0, props.schema)) {
205
205
  this.schema = _zui.transforms.toJSONSchemaLegacy(props.schema);
206
- } else if (_chunkFPLSJF4Scjs.isJsonSchema.call(void 0, props.schema)) {
206
+ } else if (_chunkNFZXJRXScjs.isJsonSchema.call(void 0, props.schema)) {
207
207
  this.schema = props.schema;
208
208
  } else {
209
209
  throw new Error(
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTokenizer
3
- } from "./chunk-YX27XM67.js";
3
+ } from "./chunk-ZHHB3FT4.js";
4
4
 
5
5
  // src/truncator.ts
6
6
  var DEFAULT_REMOVE_CHUNK = 250;
@@ -24,7 +24,7 @@ function truncateWrappedContent({
24
24
  tokenLimit,
25
25
  throwOnFailure = true
26
26
  }) {
27
- var _a, _b, _c;
27
+ var _a, _b, _c, _d;
28
28
  const tokenizer = getTokenizer();
29
29
  const parts = [];
30
30
  for (const msg of messages) {
@@ -86,20 +86,12 @@ function truncateWrappedContent({
86
86
  toRemove = biggest.tokens - (((_b = biggest.attributes) == null ? void 0 : _b.minTokens) ?? 0);
87
87
  }
88
88
  const preserve = ((_c = biggest.attributes) == null ? void 0 : _c.preserve) ?? DEFAULT_TRUNCATE_OPTIONS.preserve;
89
- const split = tokenizer.splitAndSlice(biggest.content);
90
- if (preserve === "bottom") {
91
- biggest.content = split.slice(toRemove).join("");
92
- } else if (preserve === "top") {
93
- biggest.content = split.slice(0, -toRemove).join("");
94
- } else {
95
- const anchor = Math.ceil(split.length / 2);
96
- const radius = Math.ceil(toRemove / 2);
97
- const left = anchor - radius;
98
- const right = anchor + radius;
99
- biggest.content = split.slice(0, left).join("") + split.slice(right).join("");
100
- }
101
- biggest.tokens -= toRemove;
102
- currentCount -= toRemove;
89
+ const targetTokens = Math.max(biggest.tokens - toRemove, ((_d = biggest.attributes) == null ? void 0 : _d.minTokens) ?? 0);
90
+ const mode = preserve === "bottom" ? "tail" : preserve === "both" ? "middle" : "head";
91
+ biggest.content = tokenizer.truncate(biggest.content, targetTokens, mode);
92
+ const nextTokens = tokenizer.count(biggest.content);
93
+ currentCount -= biggest.tokens - nextTokens;
94
+ biggest.tokens = nextTokens;
103
95
  }
104
96
  return messages.map((msg, i) => {
105
97
  const p = parts[i];
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
2
 
3
- var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
3
+ var _chunkNFZXJRXScjs = require('./chunk-NFZXJRXS.cjs');
4
4
 
5
5
  // src/truncator.ts
6
6
  var DEFAULT_REMOVE_CHUNK = 250;
@@ -24,8 +24,8 @@ function truncateWrappedContent({
24
24
  tokenLimit,
25
25
  throwOnFailure = true
26
26
  }) {
27
- var _a, _b, _c;
28
- const tokenizer = _chunkFPLSJF4Scjs.getTokenizer.call(void 0, );
27
+ var _a, _b, _c, _d;
28
+ const tokenizer = _chunkNFZXJRXScjs.getTokenizer.call(void 0, );
29
29
  const parts = [];
30
30
  for (const msg of messages) {
31
31
  const current = [];
@@ -86,20 +86,12 @@ function truncateWrappedContent({
86
86
  toRemove = biggest.tokens - (_nullishCoalesce(((_b = biggest.attributes) == null ? void 0 : _b.minTokens), () => ( 0)));
87
87
  }
88
88
  const preserve = _nullishCoalesce(((_c = biggest.attributes) == null ? void 0 : _c.preserve), () => ( DEFAULT_TRUNCATE_OPTIONS.preserve));
89
- const split = tokenizer.splitAndSlice(biggest.content);
90
- if (preserve === "bottom") {
91
- biggest.content = split.slice(toRemove).join("");
92
- } else if (preserve === "top") {
93
- biggest.content = split.slice(0, -toRemove).join("");
94
- } else {
95
- const anchor = Math.ceil(split.length / 2);
96
- const radius = Math.ceil(toRemove / 2);
97
- const left = anchor - radius;
98
- const right = anchor + radius;
99
- biggest.content = split.slice(0, left).join("") + split.slice(right).join("");
100
- }
101
- biggest.tokens -= toRemove;
102
- currentCount -= toRemove;
89
+ const targetTokens = Math.max(biggest.tokens - toRemove, _nullishCoalesce(((_d = biggest.attributes) == null ? void 0 : _d.minTokens), () => ( 0)));
90
+ const mode = preserve === "bottom" ? "tail" : preserve === "both" ? "middle" : "head";
91
+ biggest.content = tokenizer.truncate(biggest.content, targetTokens, mode);
92
+ const nextTokens = tokenizer.count(biggest.content);
93
+ currentCount -= biggest.tokens - nextTokens;
94
+ biggest.tokens = nextTokens;
103
95
  }
104
96
  return messages.map((msg, i) => {
105
97
  const p = parts[i];
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
2
 
3
- var _chunk7LMIOS6Hcjs = require('./chunk-7LMIOS6H.cjs');
3
+ var _chunkKY27DGTGcjs = require('./chunk-KY27DGTG.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
8
+ var _chunkNFZXJRXScjs = require('./chunk-NFZXJRXS.cjs');
9
9
 
10
10
 
11
11
 
@@ -195,7 +195,7 @@ var Tool = (_class = class _Tool {
195
195
  */
196
196
  rename(name) {
197
197
  const before = this.name;
198
- if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, name)) {
198
+ if (!_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, name)) {
199
199
  throw new Error(
200
200
  `Invalid name for tool ${name}. A tool name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
201
201
  );
@@ -371,7 +371,7 @@ var Tool = (_class = class _Tool {
371
371
  * ```
372
372
  */
373
373
  constructor(props) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
374
- if (!_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, props.name)) {
374
+ if (!_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, props.name)) {
375
375
  throw new Error(
376
376
  `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.`
377
377
  );
@@ -396,17 +396,17 @@ var Tool = (_class = class _Tool {
396
396
  `Invalid aliases for tool ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
397
397
  );
398
398
  }
399
- if (props.aliases && props.aliases.some((alias) => !_chunkFPLSJF4Scjs.isValidIdentifier.call(void 0, alias))) {
399
+ if (props.aliases && props.aliases.some((alias) => !_chunkNFZXJRXScjs.isValidIdentifier.call(void 0, alias))) {
400
400
  throw new Error(`Invalid aliases for tool ${props.name}. Expected an array of valid identifiers.`);
401
401
  }
402
402
  if (typeof props.input !== "undefined") {
403
- if (_chunkFPLSJF4Scjs.isZuiSchema.call(void 0, props.input)) {
403
+ if (_chunkNFZXJRXScjs.isZuiSchema.call(void 0, props.input)) {
404
404
  try {
405
405
  this.input = _zui.transforms.toJSONSchema(props.input);
406
406
  } catch (e6) {
407
407
  this.input = _zui.transforms.toJSONSchemaLegacy(props.input);
408
408
  }
409
- } else if (_chunkFPLSJF4Scjs.isJsonSchema.call(void 0, props.input)) {
409
+ } else if (_chunkNFZXJRXScjs.isJsonSchema.call(void 0, props.input)) {
410
410
  this.input = props.input;
411
411
  } else {
412
412
  throw new Error(
@@ -415,13 +415,13 @@ var Tool = (_class = class _Tool {
415
415
  }
416
416
  }
417
417
  if (typeof props.output !== "undefined") {
418
- if (_chunkFPLSJF4Scjs.isZuiSchema.call(void 0, props.output)) {
418
+ if (_chunkNFZXJRXScjs.isZuiSchema.call(void 0, props.output)) {
419
419
  try {
420
420
  this.output = _zui.transforms.toJSONSchema(props.output);
421
421
  } catch (e7) {
422
422
  this.output = _zui.transforms.toJSONSchemaLegacy(props.output);
423
423
  }
424
- } else if (_chunkFPLSJF4Scjs.isJsonSchema.call(void 0, props.output)) {
424
+ } else if (_chunkNFZXJRXScjs.isJsonSchema.call(void 0, props.output)) {
425
425
  this.output = props.output;
426
426
  } else {
427
427
  throw new Error(
@@ -548,7 +548,7 @@ var Tool = (_class = class _Tool {
548
548
  input = convertObjectToZuiLiterals(this._staticInputValues);
549
549
  }
550
550
  const fnType = _zui.z.function(input, _zui.z.promise(output)).title(this.name).describe(_nullishCoalesce(this.description, () => ( "")));
551
- return _chunk7LMIOS6Hcjs.getTypings.call(void 0, fnType, {
551
+ return _chunkKY27DGTGcjs.getTypings.call(void 0, fnType, {
552
552
  declaration: true
553
553
  });
554
554
  }
@@ -5,7 +5,7 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkFPLSJF4Scjs = require('./chunk-FPLSJF4S.cjs');
8
+ var _chunkNFZXJRXScjs = require('./chunk-NFZXJRXS.cjs');
9
9
 
10
10
  // src/typings.ts
11
11
  var _zui = require('@bpinternal/zui');
@@ -111,7 +111,7 @@ async function sUnwrapZod(schema, options) {
111
111
  parent: schema
112
112
  };
113
113
  if (schema instanceof Declaration) {
114
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema.schema.description);
114
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema.schema.description);
115
115
  const withoutDesc = schema.schema.describe("");
116
116
  const typings = await sUnwrapZodRecursive(withoutDesc, { ...newOptions, declaration: true });
117
117
  const isLargeDeclaration = typings.split("\n").length >= LARGE_DECLARATION_LINES;
@@ -132,7 +132,7 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
132
132
  const optionalToken = schema.key.endsWith("?") ? "" : "?";
133
133
  return sUnwrapZodRecursive(new KeyValue(schema.key + optionalToken, innerType), newOptions);
134
134
  }
135
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema.value._def.description || schema.value.description);
135
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema.value._def.description || schema.value.description);
136
136
  const delimiter = (description == null ? void 0 : description.trim().length) > 0 ? "\n" : "";
137
137
  const withoutDesc = schema.value.describe("");
138
138
  return `${delimiter}${description}${delimiter}${schema.key}: ${await sUnwrapZodRecursive(withoutDesc, newOptions)}${delimiter}`;
@@ -143,7 +143,7 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
143
143
  for (let i = 0; i < schema.schema.items.length; i++) {
144
144
  const argName = _nullishCoalesce(((_b = (_a = schema.schema.items[i]) == null ? void 0 : _a.ui) == null ? void 0 : _b.title), () => ( `arg${i}`));
145
145
  const item = schema.schema.items[i];
146
- args += `${await sUnwrapZodRecursive(new KeyValue(_chunkFPLSJF4Scjs.toPropertyKey.call(void 0, argName), item), newOptions)}, `;
146
+ args += `${await sUnwrapZodRecursive(new KeyValue(_chunkNFZXJRXScjs.toPropertyKey.call(void 0, argName), item), newOptions)}, `;
147
147
  }
148
148
  return args;
149
149
  }
@@ -182,7 +182,7 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
182
182
  return `Promise<${await sUnwrapZodRecursive(schema.unwrap(), newOptions)}>`;
183
183
  }
184
184
  if (_zui.z.is.zuiFunction(schema)) {
185
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
185
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
186
186
  const input = await sUnwrapZodRecursive(new FnParameters(schema._def.args), newOptions);
187
187
  const output = await sUnwrapZodRecursive(new FnReturn(schema._def.returns), newOptions);
188
188
  if (options == null ? void 0 : options.declaration) {
@@ -200,7 +200,7 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
200
200
  return `Array<${item}>`;
201
201
  }
202
202
  if (_zui.z.is.zuiEnum(schema)) {
203
- const values = schema._def.values.map(_chunkFPLSJF4Scjs.escapeString);
203
+ const values = schema._def.values.map(_chunkNFZXJRXScjs.escapeString);
204
204
  return values.join(" | ");
205
205
  }
206
206
  if (_zui.z.is.zuiTuple(schema)) {
@@ -225,7 +225,7 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
225
225
  const props = await Promise.all(
226
226
  Object.entries(schema.shape).map(async ([key, value]) => {
227
227
  if (_zui.z.is.zuiType(value)) {
228
- return sUnwrapZodRecursive(new KeyValue(_chunkFPLSJF4Scjs.toPropertyKey.call(void 0, key), value), newOptions);
228
+ return sUnwrapZodRecursive(new KeyValue(_chunkNFZXJRXScjs.toPropertyKey.call(void 0, key), value), newOptions);
229
229
  }
230
230
  return `${key}: unknown`;
231
231
  })
@@ -233,11 +233,11 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
233
233
  return `{ ${props.join("; ")} }`;
234
234
  }
235
235
  if (_zui.z.is.zuiString(schema)) {
236
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
236
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
237
237
  return `${description} string`.trim();
238
238
  }
239
239
  if (_zui.z.is.zuiUnion(schema)) {
240
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
240
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
241
241
  const options2 = await Promise.all(
242
242
  schema.options.map(async (option) => {
243
243
  return sUnwrapZodRecursive(option, newOptions);
@@ -247,16 +247,16 @@ declare const ${schema.identifier}: ${typings};${closingTag}`);
247
247
  ${options2.join(" | ")}`;
248
248
  }
249
249
  if (_zui.z.is.zuiLiteral(schema)) {
250
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
250
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
251
251
  return `${description}
252
- ${typeof schema.value === "string" ? _chunkFPLSJF4Scjs.escapeString.call(void 0, schema.value) : String(schema.value)}`.trim();
252
+ ${typeof schema.value === "string" ? _chunkNFZXJRXScjs.escapeString.call(void 0, schema.value) : String(schema.value)}`.trim();
253
253
  }
254
254
  if (_zui.z.is.zuiNumber(schema)) {
255
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
255
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
256
256
  return `${description} number`.trim();
257
257
  }
258
258
  if (_zui.z.is.zuiBoolean(schema)) {
259
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
259
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
260
260
  return `${description} boolean`.trim();
261
261
  }
262
262
  if (_zui.z.is.zuiCatch(schema)) {
@@ -266,7 +266,7 @@ ${typeof schema.value === "string" ? _chunkFPLSJF4Scjs.escapeString.call(void 0,
266
266
  return sUnwrapZodRecursive(schema._def.getter(), newOptions);
267
267
  }
268
268
  if (_zui.z.is.zuiRecord(schema)) {
269
- const description = _chunkFPLSJF4Scjs.getMultilineComment.call(void 0, schema._def.description);
269
+ const description = _chunkNFZXJRXScjs.getMultilineComment.call(void 0, schema._def.description);
270
270
  const keyType = await sUnwrapZodRecursive(schema._def.keyType, newOptions);
271
271
  const valueType = await sUnwrapZodRecursive(schema._def.valueType, newOptions);
272
272
  return `${description} { [key: (${keyType})]: (${valueType}) }`;
@@ -2,22 +2,22 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkBBX2LDZEcjs = require('./chunk-BBX2LDZE.cjs');
5
+ var _chunkZVSO527Dcjs = require('./chunk-ZVSO527D.cjs');
6
6
 
7
7
 
8
- var _chunkWODK7Y4Jcjs = require('./chunk-WODK7Y4J.cjs');
8
+ var _chunkH3PZFBJLcjs = require('./chunk-H3PZFBJL.cjs');
9
9
 
10
10
 
11
11
  var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
12
12
 
13
13
 
14
- var _chunkD6PU5YAScjs = require('./chunk-D6PU5YAS.cjs');
14
+ var _chunkEC2I4U4Gcjs = require('./chunk-EC2I4U4G.cjs');
15
15
 
16
16
 
17
17
  var _chunkCQ3UJW76cjs = require('./chunk-CQ3UJW76.cjs');
18
18
 
19
19
 
20
- var _chunkZPHRTTQXcjs = require('./chunk-ZPHRTTQX.cjs');
20
+ var _chunkGFSUTNRMcjs = require('./chunk-GFSUTNRM.cjs');
21
21
 
22
22
 
23
23
 
@@ -493,10 +493,10 @@ var Snapshot = class _Snapshot {
493
493
  };
494
494
  function parseVariables(variableMap) {
495
495
  return Object.entries(variableMap).map(([name, value]) => {
496
- const type = _chunkBBX2LDZEcjs.extractType.call(void 0, value);
496
+ const type = _chunkZVSO527Dcjs.extractType.call(void 0, value);
497
497
  const bytes = JSON.stringify(value || "").length;
498
498
  const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
499
- return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunkBBX2LDZEcjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
499
+ return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunkZVSO527Dcjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
500
500
  });
501
501
  }
502
502
 
@@ -507,9 +507,9 @@ function getMessagePreview(message) {
507
507
  return message.content;
508
508
  }
509
509
  if (message.role === "event") {
510
- return _chunkBBX2LDZEcjs.inspect.call(void 0, message.payload, message.name, { tokens: 1e3 });
510
+ return _chunkZVSO527Dcjs.inspect.call(void 0, message.payload, message.name, { tokens: 1e3 });
511
511
  }
512
- return _chunkBBX2LDZEcjs.inspect.call(void 0, message, void 0, { tokens: 1e3 });
512
+ return _chunkZVSO527Dcjs.inspect.call(void 0, message, void 0, { tokens: 1e3 });
513
513
  }
514
514
  function getMessageType(message) {
515
515
  if (message.role === "assistant" || message.role === "user" || message.role === "summary") {
@@ -933,15 +933,15 @@ var HookedArray = class extends Array {
933
933
  };
934
934
 
935
935
  // src/context.ts
936
- var ThinkExit = new (0, _chunkD6PU5YAScjs.Exit)({
936
+ var ThinkExit = new (0, _chunkEC2I4U4Gcjs.Exit)({
937
937
  name: "think",
938
938
  description: "Think about the current situation and provide a response"
939
939
  });
940
- var ListenExit = new (0, _chunkD6PU5YAScjs.Exit)({
940
+ var ListenExit = new (0, _chunkEC2I4U4Gcjs.Exit)({
941
941
  name: "listen",
942
942
  description: "Listen to the user and provide a response"
943
943
  });
944
- var DefaultExit = new (0, _chunkD6PU5YAScjs.Exit)({
944
+ var DefaultExit = new (0, _chunkEC2I4U4Gcjs.Exit)({
945
945
  name: "done",
946
946
  description: "When the execution is sucessfully completed or when error recovery is not possible",
947
947
  schema: _zui.z.discriminatedUnion("success", [
@@ -1103,7 +1103,7 @@ var Context = (_class2 = class {
1103
1103
 
1104
1104
 
1105
1105
 
1106
- __init3() {this.version = _chunkBBX2LDZEcjs.DualModePrompt}
1106
+ __init3() {this.version = _chunkZVSO527Dcjs.DualModePrompt}
1107
1107
  __init4() {this.timeout = 6e4}
1108
1108
  // Default timeout of 60 seconds
1109
1109
 
@@ -1224,7 +1224,7 @@ var Context = (_class2 = class {
1224
1224
  ...lastIterationMessages,
1225
1225
  {
1226
1226
  role: "assistant",
1227
- content: _chunkZPHRTTQXcjs.wrapContent.call(void 0, _nullishCoalesce(((_c = lastIteration.llm) == null ? void 0 : _c.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1227
+ content: _chunkGFSUTNRMcjs.wrapContent.call(void 0, _nullishCoalesce(((_c = lastIteration.llm) == null ? void 0 : _c.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1228
1228
  },
1229
1229
  await this.version.getThinkingMessage({
1230
1230
  reason: lastIteration.status.thinking_requested.reason,
@@ -1237,7 +1237,7 @@ var Context = (_class2 = class {
1237
1237
  ...lastIterationMessages,
1238
1238
  {
1239
1239
  role: "assistant",
1240
- content: _chunkZPHRTTQXcjs.wrapContent.call(void 0, _nullishCoalesce(((_d = lastIteration.llm) == null ? void 0 : _d.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1240
+ content: _chunkGFSUTNRMcjs.wrapContent.call(void 0, _nullishCoalesce(((_d = lastIteration.llm) == null ? void 0 : _d.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1241
1241
  },
1242
1242
  await this.version.getInvalidCodeMessage({
1243
1243
  code: _nullishCoalesce(lastIteration.code, () => ( "// No code generated")),
@@ -1250,7 +1250,7 @@ var Context = (_class2 = class {
1250
1250
  ...lastIterationMessages,
1251
1251
  {
1252
1252
  role: "assistant",
1253
- content: _chunkZPHRTTQXcjs.wrapContent.call(void 0, _nullishCoalesce(((_e = lastIteration.llm) == null ? void 0 : _e.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1253
+ content: _chunkGFSUTNRMcjs.wrapContent.call(void 0, _nullishCoalesce(((_e = lastIteration.llm) == null ? void 0 : _e.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1254
1254
  },
1255
1255
  await this.version.getInvalidCodeMessage({
1256
1256
  code: _nullishCoalesce(lastIteration.code, () => ( "// No code generated")),
@@ -1263,7 +1263,7 @@ var Context = (_class2 = class {
1263
1263
  ...lastIterationMessages,
1264
1264
  {
1265
1265
  role: "assistant",
1266
- content: _chunkZPHRTTQXcjs.wrapContent.call(void 0, _nullishCoalesce(((_f = lastIteration.llm) == null ? void 0 : _f.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1266
+ content: _chunkGFSUTNRMcjs.wrapContent.call(void 0, _nullishCoalesce(((_f = lastIteration.llm) == null ? void 0 : _f.output), () => ( "")), { preserve: "top", flex: 4, minTokens: 25 })
1267
1267
  },
1268
1268
  await this.version.getCodeExecutionErrorMessage({
1269
1269
  message: lastIteration.status.execution_error.message,
@@ -1279,7 +1279,7 @@ var Context = (_class2 = class {
1279
1279
  var _a, _b;
1280
1280
  const instructions = await getValue(this.instructions, this);
1281
1281
  const transcript = new TranscriptArray(await getValue(_nullishCoalesce(((_a = this.chat) == null ? void 0 : _a.transcript), () => ( [])), this));
1282
- const tools = _chunkWODK7Y4Jcjs.Tool.withUniqueNames(await _asyncNullishCoalesce(await getValue(this.tools, this), async () => ( [])));
1282
+ const tools = _chunkH3PZFBJLcjs.Tool.withUniqueNames(await _asyncNullishCoalesce(await getValue(this.tools, this), async () => ( [])));
1283
1283
  const objects = await _asyncNullishCoalesce(await getValue(this.objects, this), async () => ( []));
1284
1284
  const exits = await _asyncNullishCoalesce(await getValue(this.exits, this), async () => ( []));
1285
1285
  const components = await getValue(_nullishCoalesce(((_b = this.chat) == null ? void 0 : _b.components), () => ( [])), this);
@@ -1312,7 +1312,7 @@ var Context = (_class2 = class {
1312
1312
  "boolean",
1313
1313
  "array"
1314
1314
  ];
1315
- const MessageTool = this.chat && components.length ? new (0, _chunkWODK7Y4Jcjs.Tool)({
1315
+ const MessageTool = this.chat && components.length ? new (0, _chunkH3PZFBJLcjs.Tool)({
1316
1316
  name: "Message",
1317
1317
  description: "Send a message to the user",
1318
1318
  aliases: Array.from(
@@ -7,17 +7,14 @@
7
7
  var _chunkHC2QZTVTcjs = require('./chunk-HC2QZTVT.cjs');
8
8
 
9
9
  // src/utils.ts
10
- var _thicktoken = require('@bpinternal/thicktoken');
10
+ var _micro = require('@bpinternal/thicktoken/micro');
11
11
  var _zui = require('@bpinternal/zui');
12
12
  var tokenizer = null;
13
13
  var init = async () => {
14
14
  if (tokenizer) {
15
15
  return;
16
16
  }
17
- while (typeof _thicktoken.getWasmTokenizer !== "function") {
18
- await new Promise((resolve) => setTimeout(resolve, 50));
19
- }
20
- tokenizer = await _thicktoken.getWasmTokenizer.call(void 0, );
17
+ tokenizer = await _micro.getWasmTokenizer.call(void 0, );
21
18
  };
22
19
  var getTokenizer = () => {
23
20
  if (!tokenizer) {
@@ -5,7 +5,7 @@ import {
5
5
  escapeString,
6
6
  getMultilineComment,
7
7
  toPropertyKey
8
- } from "./chunk-YX27XM67.js";
8
+ } from "./chunk-ZHHB3FT4.js";
9
9
 
10
10
  // src/typings.ts
11
11
  import { z } from "@bpinternal/zui";
@@ -2,7 +2,7 @@ import {
2
2
  isJsonSchema,
3
3
  isValidIdentifier,
4
4
  isZuiSchema
5
- } from "./chunk-YX27XM67.js";
5
+ } from "./chunk-ZHHB3FT4.js";
6
6
  import {
7
7
  uniq_default
8
8
  } from "./chunk-34GJUS6U.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getTypings
3
- } from "./chunk-TOGYDN6U.js";
3
+ } from "./chunk-PASYUKW4.js";
4
4
  import {
5
5
  isJsonSchema,
6
6
  isValidIdentifier,
7
7
  isZuiSchema
8
- } from "./chunk-YX27XM67.js";
8
+ } from "./chunk-ZHHB3FT4.js";
9
9
  import {
10
10
  isEmpty_default,
11
11
  uniq_default
@@ -7,16 +7,13 @@ import {
7
7
  } from "./chunk-34GJUS6U.js";
8
8
 
9
9
  // src/utils.ts
10
- import { getWasmTokenizer } from "@bpinternal/thicktoken";
10
+ import { getWasmTokenizer } from "@bpinternal/thicktoken/micro";
11
11
  import { z, transforms } from "@bpinternal/zui";
12
12
  var tokenizer = null;
13
13
  var init = async () => {
14
14
  if (tokenizer) {
15
15
  return;
16
16
  }
17
- while (typeof getWasmTokenizer !== "function") {
18
- await new Promise((resolve) => setTimeout(resolve, 50));
19
- }
20
17
  tokenizer = await getWasmTokenizer();
21
18
  };
22
19
  var getTokenizer = () => {