llmz 0.0.2 → 0.0.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.
Files changed (87) hide show
  1. package/dist/chat.d.ts +17 -0
  2. package/dist/chunk-3U57H7GT.js +608 -0
  3. package/dist/{chunk-RB2L33ZR.js → chunk-4EWY34YA.js} +24 -24
  4. package/dist/{chunk-R2N2UUKC.cjs → chunk-4I7UPBLN.cjs} +14 -8
  5. package/dist/{chunk-YPOOKE3A.cjs → chunk-4QTK5ALH.cjs} +59 -28
  6. package/dist/{chunk-BKGPO722.cjs → chunk-5NVNEEYW.cjs} +55 -55
  7. package/dist/{chunk-DFZ6GX5C.js → chunk-5TRUJES5.js} +1 -1
  8. package/dist/{chunk-E2B5DRIC.cjs → chunk-6WT5VZBG.cjs} +362 -26
  9. package/dist/{chunk-7S3UY52U.js → chunk-7WRN4E42.js} +36 -8
  10. package/dist/{chunk-E5W3P7EO.cjs → chunk-EJRCDWBA.cjs} +64 -7
  11. package/dist/{chunk-VP6WWAE2.cjs → chunk-FIVFS4HG.cjs} +2 -2
  12. package/dist/{chunk-3T465BEW.js → chunk-HP7RKM25.js} +63 -6
  13. package/dist/{chunk-YUDUY7XW.cjs → chunk-HYVKY3W6.cjs} +23 -24
  14. package/dist/{chunk-PQN6HW7A.cjs → chunk-IKSIOIIP.cjs} +3 -3
  15. package/dist/{chunk-ZUAFUOUR.cjs → chunk-JDABP4SD.cjs} +3 -3
  16. package/dist/{chunk-RJHDQL4C.js → chunk-JKVVQN2P.js} +1 -1
  17. package/dist/{chunk-MSTBEKOQ.js → chunk-JQBT7UWN.js} +3 -3
  18. package/dist/{chunk-BOLDQGES.cjs → chunk-KMZDFWYZ.cjs} +3 -3
  19. package/dist/chunk-MU4LFVY7.cjs +608 -0
  20. package/dist/{chunk-7FIPXMZR.js → chunk-ORQP26SZ.js} +1 -1
  21. package/dist/{chunk-ENFB45AI.cjs → chunk-P7J2WCBB.cjs} +7 -7
  22. package/dist/{chunk-DILHJIMP.js → chunk-QBXIE6EY.js} +49 -18
  23. package/dist/{chunk-UVSOAH2H.js → chunk-QT4QF3YA.js} +1 -1
  24. package/dist/{chunk-6QDFMQHA.js → chunk-S6FOL2HY.js} +8 -2
  25. package/dist/{chunk-ZSRC3TN4.js → chunk-UNMKB2DA.js} +9 -10
  26. package/dist/{chunk-3CGLDS5T.cjs → chunk-UQOBUJIQ.cjs} +38 -10
  27. package/dist/{chunk-QPSUMPLP.js → chunk-WLUVY5QU.js} +345 -9
  28. package/dist/citations.d.ts +63 -0
  29. package/dist/component-R2Y74VUI.js +16 -0
  30. package/dist/component-TSNW3SC7.cjs +16 -0
  31. package/dist/component.d.ts +26 -17
  32. package/dist/component.default.d.ts +314 -8
  33. package/dist/context.d.ts +9 -6
  34. package/dist/dual-modes-UHNDHNIF.cjs +12 -0
  35. package/dist/dual-modes-ZUQKPJFH.js +12 -0
  36. package/dist/exit-KJ4COC5N.cjs +8 -0
  37. package/dist/exit-OIYZLBVJ.js +8 -0
  38. package/dist/exit.d.ts +6 -0
  39. package/dist/getter.d.ts +1 -1
  40. package/dist/index.cjs +256 -160
  41. package/dist/index.d.ts +7 -4
  42. package/dist/index.js +242 -146
  43. package/dist/{jsx-CJ2RBODH.js → jsx-AEHVFB3L.js} +2 -3
  44. package/dist/jsx-AJAXBWFE.cjs +13 -0
  45. package/dist/llmz-VDA4M42R.cjs +604 -0
  46. package/dist/llmz-YE5N54IU.js +604 -0
  47. package/dist/llmz.d.ts +8 -10
  48. package/dist/snapshots.d.ts +9 -1
  49. package/dist/tool-LY77IWV2.js +11 -0
  50. package/dist/tool-SWJYOR2Z.cjs +11 -0
  51. package/dist/tool.d.ts +34 -9
  52. package/dist/truncator-NYN7BGKJ.cjs +10 -0
  53. package/dist/truncator-WAL2GCUY.js +10 -0
  54. package/dist/types.d.ts +9 -1
  55. package/dist/typings-AIV2OASX.js +10 -0
  56. package/dist/typings-XR6CYHW4.cjs +10 -0
  57. package/dist/{utils-TS23YJPE.js → utils-L5GLCS3C.js} +2 -3
  58. package/dist/utils-QC4I2L6R.cjs +37 -0
  59. package/dist/vm-GJ5R72AP.cjs +12 -0
  60. package/dist/vm-ZUQOSRRM.js +12 -0
  61. package/dist/vm.d.ts +1 -1
  62. package/package.json +8 -6
  63. package/dist/chunk-A7BDFLAE.cjs +0 -30
  64. package/dist/chunk-C2TSWGYC.cjs +0 -91
  65. package/dist/chunk-Q4DEJGXD.js +0 -344
  66. package/dist/chunk-QZGFCB4T.cjs +0 -344
  67. package/dist/chunk-UG2GCPHF.js +0 -91
  68. package/dist/chunk-YSQDPG26.js +0 -30
  69. package/dist/component-DWBRHLEN.cjs +0 -9
  70. package/dist/component-R3ZAVXUC.js +0 -9
  71. package/dist/dual-modes-2VDEOJ5D.js +0 -13
  72. package/dist/dual-modes-3MH5N6RY.cjs +0 -13
  73. package/dist/exit-GYMXZZ4I.js +0 -9
  74. package/dist/exit-PQHMJEOG.cjs +0 -9
  75. package/dist/jsx-PPLE5YTB.cjs +0 -14
  76. package/dist/llmz-EGTGPSTX.cjs +0 -1049
  77. package/dist/llmz-WY74UVE3.js +0 -1049
  78. package/dist/tool-AY47ML65.cjs +0 -12
  79. package/dist/tool-WVIPESKN.js +0 -12
  80. package/dist/truncator-MTONQESU.js +0 -11
  81. package/dist/truncator-ZKPOW2I3.cjs +0 -11
  82. package/dist/typings-HTYLRNIC.js +0 -11
  83. package/dist/typings-QRJGGNUM.cjs +0 -11
  84. package/dist/utils-UR4IMUHC.cjs +0 -38
  85. package/dist/vm-4JFSZAMR.cjs +0 -13
  86. package/dist/vm-SMMA664M.js +0 -13
  87. package/patches/source-map-js@1.2.1.patch +0 -16
@@ -1,18 +1,352 @@
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 _chunkQZGFCB4Tcjs = require('./chunk-QZGFCB4T.cjs');
3
+ var _chunkIKSIOIIPcjs = require('./chunk-IKSIOIIP.cjs');
4
4
 
5
5
 
6
- var _chunkPQN6HW7Acjs = require('./chunk-PQN6HW7A.cjs');
6
+ var _chunkEJRCDWBAcjs = require('./chunk-EJRCDWBA.cjs');
7
7
 
8
8
 
9
- var _chunkE5W3P7EOcjs = require('./chunk-E5W3P7EO.cjs');
9
+ var _chunkFIVFS4HGcjs = require('./chunk-FIVFS4HG.cjs');
10
10
 
11
11
 
12
- var _chunkVP6WWAE2cjs = require('./chunk-VP6WWAE2.cjs');
13
12
 
13
+ var _chunkP7J2WCBBcjs = require('./chunk-P7J2WCBB.cjs');
14
14
 
15
- var _chunk3CGLDS5Tcjs = require('./chunk-3CGLDS5T.cjs');
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ var _chunkUQOBUJIQcjs = require('./chunk-UQOBUJIQ.cjs');
27
+
28
+ // src/inspect.ts
29
+ var _bytes = require('bytes'); var _bytes2 = _interopRequireDefault(_bytes);
30
+ var SUBTITLE_LN = "--------------";
31
+ var SECTION_SEP = "\n";
32
+ var NUMBER_LOCALE = new Intl.NumberFormat("en-US");
33
+ var LONG_TEXT_LENGTH = 4096;
34
+ var DEFAULT_OPTIONS = {
35
+ tokens: 1e5
36
+ };
37
+ function printLimitedJson(obj, maxDepth, maxLength, maxKeys) {
38
+ const indent = 2;
39
+ let currentLength = 0;
40
+ let wasTruncated = false;
41
+ function recurse(currentObj, depth, currentIndent) {
42
+ if (depth > maxDepth || currentLength >= maxLength) {
43
+ wasTruncated = true;
44
+ return "...";
45
+ }
46
+ if (typeof currentObj === "object" && currentObj instanceof Date) {
47
+ currentIndent += 3;
48
+ try {
49
+ return currentObj.toISOString();
50
+ } catch (err) {
51
+ return `<Date: ${_nullishCoalesce((err == null ? void 0 : err.message), () => ( "Invalid Date"))}>`;
52
+ }
53
+ }
54
+ if (typeof currentObj !== "object" || currentObj === null) {
55
+ const value = JSON.stringify(currentObj);
56
+ currentLength += _chunkP7J2WCBBcjs.getTokenizer.call(void 0, ).count(value);
57
+ return value;
58
+ }
59
+ const indentation = " ".repeat(currentIndent);
60
+ if (Array.isArray(currentObj)) {
61
+ let result = "[\n";
62
+ for (let i = 0; i < currentObj.length && currentLength < maxLength; i++) {
63
+ if (i > 0) {
64
+ result += ",\n";
65
+ }
66
+ result += indentation + " ".repeat(indent) + recurse(currentObj[i], depth + 1, currentIndent + indent);
67
+ }
68
+ result += "\n" + indentation + "]";
69
+ currentLength += _chunkP7J2WCBBcjs.getTokenizer.call(void 0, ).count(result);
70
+ return result;
71
+ } else {
72
+ let result = "{\n";
73
+ const keys = Object.keys(currentObj);
74
+ const numKeys = keys.length;
75
+ for (let i = 0; i < Math.min(numKeys, maxKeys) && currentLength < maxLength; i++) {
76
+ const key = keys[i];
77
+ if (i > 0) {
78
+ result += ",\n";
79
+ }
80
+ const value = recurse(currentObj[key], depth + 1, currentIndent + indent);
81
+ result += indentation + " ".repeat(indent) + `"${key}": ${value}`;
82
+ }
83
+ if (numKeys > maxKeys) {
84
+ wasTruncated = true;
85
+ result += ",\n" + indentation + `... (${numKeys - maxKeys} more keys)`;
86
+ }
87
+ result += "\n" + indentation + "}";
88
+ currentLength += _chunkP7J2WCBBcjs.getTokenizer.call(void 0, ).count(result);
89
+ return result;
90
+ }
91
+ }
92
+ const output = _chunkP7J2WCBBcjs.getTokenizer.call(void 0, ).truncate(recurse(obj, 0, 0), maxLength);
93
+ return { output, truncated: wasTruncated };
94
+ }
95
+ function extractType(value, generic = true) {
96
+ if (value === null) {
97
+ return "null";
98
+ }
99
+ if (value === void 0 || typeof value === "undefined") {
100
+ return "undefined";
101
+ }
102
+ if (typeof value === "object" && Array.isArray(value)) {
103
+ if (!generic) {
104
+ return "Array";
105
+ }
106
+ if (value.length === 0) {
107
+ return "Array (empty)";
108
+ }
109
+ if (value.length === 1) {
110
+ return `Array<${extractType(value[0])}>`;
111
+ }
112
+ const types = /* @__PURE__ */ new Map();
113
+ for (const element of value) {
114
+ const type = extractType(element, false);
115
+ types.set(type, (types.get(type) || 0) + 1);
116
+ }
117
+ if (types.size <= 3) {
118
+ return `Array<${Array.from(types.keys()).join(" | ")}>`;
119
+ }
120
+ return "Array";
121
+ }
122
+ if (typeof value === "number") {
123
+ return "number";
124
+ }
125
+ if (typeof value === "boolean") {
126
+ return "boolean";
127
+ }
128
+ if (typeof value === "bigint") {
129
+ return "bigint";
130
+ }
131
+ if (typeof value === "function") {
132
+ return "function";
133
+ }
134
+ if (typeof value === "object" && value instanceof Date) {
135
+ return "date";
136
+ }
137
+ if (typeof value === "object" && value instanceof RegExp) {
138
+ return "regexp";
139
+ }
140
+ if (value instanceof Error) {
141
+ return "error";
142
+ }
143
+ if (typeof value === "string" && value.trim().length === 0) {
144
+ return "<empty string>";
145
+ }
146
+ return typeof value;
147
+ }
148
+ function previewValue(value, length = LONG_TEXT_LENGTH) {
149
+ if (value === null) {
150
+ return "<nil>";
151
+ }
152
+ if (value === void 0) {
153
+ return "<undefined>";
154
+ }
155
+ const previewStr = (str) => {
156
+ if (str.length > length) {
157
+ return _chunkP7J2WCBBcjs.escapeString.call(void 0, str.slice(0, length)) + " ... <truncated>";
158
+ }
159
+ return _chunkP7J2WCBBcjs.escapeString.call(void 0, str);
160
+ };
161
+ const previewObj = (obj) => {
162
+ const mapped = _chunkUQOBUJIQcjs.mapKeys_default.call(void 0, obj, (_value, key) => previewStr(key));
163
+ return JSON.stringify(mapped);
164
+ };
165
+ if (typeof value === "string") {
166
+ return "<string> " + previewStr(value);
167
+ }
168
+ if (typeof value === "object" && Array.isArray(value)) {
169
+ return "<array> " + previewStr(JSON.stringify(value));
170
+ }
171
+ if (typeof value === "object" && value instanceof Date) {
172
+ return "<date> " + value.toISOString();
173
+ }
174
+ if (typeof value === "object" && value instanceof RegExp) {
175
+ return "<regexp> " + value.toString();
176
+ }
177
+ if (typeof value === "object") {
178
+ return "<object> " + previewObj(value);
179
+ }
180
+ if (typeof value === "bigint") {
181
+ return "<bigint> " + value.toString();
182
+ }
183
+ if (typeof value === "function") {
184
+ return "<function> " + value.toString();
185
+ }
186
+ if (typeof value === "boolean") {
187
+ return "<boolean> " + value.toString();
188
+ }
189
+ if (value instanceof Error) {
190
+ return "<error> " + previewError(value);
191
+ }
192
+ if (typeof value === "number") {
193
+ return "<number> " + value.toString();
194
+ }
195
+ if (typeof value === "symbol") {
196
+ return "<symbol> " + value.toString();
197
+ }
198
+ return `${typeof value} ` + (_nullishCoalesce((value == null ? void 0 : value.toString()), () => ( "<unknown>")));
199
+ }
200
+ function previewError(err) {
201
+ const lines = [];
202
+ lines.push("Error: " + err.name);
203
+ lines.push(SUBTITLE_LN);
204
+ lines.push(previewValue(err.message));
205
+ lines.push(SECTION_SEP);
206
+ lines.push("Stack Trace:");
207
+ lines.push(SUBTITLE_LN);
208
+ lines.push(previewValue(_nullishCoalesce(err.stack, () => ( "<no stack trace>"))));
209
+ return lines.join("\n");
210
+ }
211
+ function previewArray(arr) {
212
+ if (!Array.isArray(arr)) {
213
+ throw new Error("Expected an array");
214
+ }
215
+ const lines = [];
216
+ const getItemPreview = (value, index) => `[${index}]`.padEnd(15) + ` ${previewValue(value)}`;
217
+ if (arr.length === 0) {
218
+ lines.push("// Array Is Empty (0 element)");
219
+ return lines.join("\n").replace(/\n{2,}/g, SECTION_SEP);
220
+ }
221
+ if (arr.length <= 10) {
222
+ lines.push("// Full Array Preview");
223
+ lines.push(SUBTITLE_LN);
224
+ lines.push(...arr.map(getItemPreview));
225
+ return lines.join("\n").replace(/\n{2,}/g, SECTION_SEP);
226
+ }
227
+ lines.push("// Analysis Summary");
228
+ lines.push(SUBTITLE_LN);
229
+ const typesCount = _chunkUQOBUJIQcjs.countBy_default.call(void 0, arr, (item) => extractType(item, false));
230
+ const ordered = _chunkUQOBUJIQcjs.orderBy_default.call(void 0,
231
+ arr.filter((item) => !_chunkUQOBUJIQcjs.isNil_default.call(void 0, item) && JSON.stringify(item).length < 100),
232
+ (item) => JSON.stringify(item),
233
+ "asc"
234
+ );
235
+ const minValues = ordered.slice(0, 3).map((item) => previewValue(item, 10));
236
+ const maxValues = ordered.slice(-3).map((item) => previewValue(item, 10));
237
+ const uniqueItems = _chunkUQOBUJIQcjs.uniqWith_default.call(void 0, arr, _chunkUQOBUJIQcjs.isEqual_default);
238
+ const nullValues = _chunkUQOBUJIQcjs.filter_default.call(void 0, arr, _chunkUQOBUJIQcjs.isNil_default).length;
239
+ const memoryUsage = _bytes2.default.call(void 0, JSON.stringify(arr).length);
240
+ lines.push(`Total Items: ${arr.length}`);
241
+ lines.push(`Unique Items: ${uniqueItems.length}`);
242
+ lines.push(`Types: ${JSON.stringify(typesCount)}`);
243
+ lines.push(`Minimum Values: [${minValues.join(", ")}]`);
244
+ lines.push(`Maximum Values: [${maxValues.join(", ")}]`);
245
+ lines.push(`Memory Usage: ${memoryUsage}`);
246
+ lines.push(`Nil Values: ${nullValues}`);
247
+ lines.push("// Array Preview (truncated)");
248
+ lines.push(SUBTITLE_LN);
249
+ lines.push(...arr.map(getItemPreview));
250
+ return lines.join("\n").replace(/\n{2,}/g, SECTION_SEP);
251
+ }
252
+ function previewObject(obj, options) {
253
+ if (typeof obj !== "object" || Array.isArray(obj) || obj === null) {
254
+ throw new Error("Expected an object");
255
+ }
256
+ const lines = [];
257
+ const { output, truncated } = printLimitedJson(obj, 10, options.tokens, 20);
258
+ if (truncated) {
259
+ lines.push(SECTION_SEP);
260
+ lines.push("// Analysis Summary");
261
+ lines.push(SUBTITLE_LN);
262
+ const entries = Object.entries(obj);
263
+ const typesCount = _chunkUQOBUJIQcjs.chain_default.call(void 0, entries).countBy(([, value]) => extractType(value, false)).entries().orderBy(1, "desc").filter(([, count]) => count > 1).slice(0, 3).fromPairs().value();
264
+ const keys = Object.keys(obj);
265
+ const uniqueEntries = _chunkUQOBUJIQcjs.uniq_default.call(void 0, Object.values(obj));
266
+ const nilValues = _chunkUQOBUJIQcjs.filter_default.call(void 0, entries, ([, value]) => _chunkUQOBUJIQcjs.isNil_default.call(void 0, value)).length;
267
+ const memoryUsage = _bytes2.default.call(void 0, JSON.stringify(obj).length);
268
+ lines.push(`Total Entries: ${NUMBER_LOCALE.format(entries.length)}`);
269
+ lines.push(`Keys: ${previewValue(keys)}`);
270
+ lines.push(`Popular Types: ${previewValue(typesCount)}`);
271
+ lines.push(`Unique Values: ${NUMBER_LOCALE.format(uniqueEntries.length)}`);
272
+ lines.push(`Nil Values: ${NUMBER_LOCALE.format(nilValues)}`);
273
+ lines.push(`Memory Usage: ${memoryUsage}`);
274
+ }
275
+ if (_chunkUQOBUJIQcjs.isEmpty_default.call(void 0, obj)) {
276
+ lines.push("// Empty Object {}");
277
+ } else {
278
+ lines.push(truncated ? "// Object Preview (truncated)" : "// Full Object Preview");
279
+ lines.push(SUBTITLE_LN);
280
+ lines.push(output);
281
+ }
282
+ return lines.join("\n").replace(/\n{2,}/g, SECTION_SEP);
283
+ }
284
+ function previewLongText(text, length = LONG_TEXT_LENGTH) {
285
+ const lines = [];
286
+ const urlPattern = /https?:\/\/[^\s]+/g;
287
+ const emailPattern = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
288
+ lines.push("// The string is too long to fully display, here is a preview:");
289
+ const previewStr = (str) => {
290
+ if (str.length > length) {
291
+ return str.slice(0, length) + " ... <truncated>";
292
+ }
293
+ return str;
294
+ };
295
+ lines.push(previewStr(text));
296
+ lines.push(SUBTITLE_LN);
297
+ lines.push("// Analysis Summary");
298
+ lines.push(SUBTITLE_LN);
299
+ const words = text.split(/\s+/);
300
+ const wordCount = words.length;
301
+ const uniqueWords = _chunkUQOBUJIQcjs.uniq_default.call(void 0, words).length;
302
+ const wordFrequency = _chunkUQOBUJIQcjs.countBy_default.call(void 0, words);
303
+ const mostCommonWords = _chunkUQOBUJIQcjs.chain_default.call(void 0, wordFrequency).toPairs().orderBy(1, "desc").filter(([, count]) => count > 1).take(20).map(([word, count]) => `"${word}" ${count} times`).value().join("\n" + " ".repeat(22));
304
+ const urls = text.match(urlPattern) || [];
305
+ const emails = text.match(emailPattern) || [];
306
+ if (urls.length > 0) {
307
+ lines.push(`Found URLs: ${urls.length}`);
308
+ lines.push(`URLs: ${urls.join(", ")}`);
309
+ }
310
+ if (emails.length > 0) {
311
+ lines.push(`Found Emails: ${emails.length}`);
312
+ lines.push(`Emails: ${emails.join(", ")}`);
313
+ }
314
+ lines.push(`Length: ${NUMBER_LOCALE.format(text.length)} chars`);
315
+ lines.push(`Word Count: ${NUMBER_LOCALE.format(wordCount)} words`);
316
+ lines.push(`Unique Words: ${NUMBER_LOCALE.format(uniqueWords)}`);
317
+ lines.push(`Most Common Words: ${mostCommonWords}`);
318
+ return lines.join("\n").replace(/\n{2,}/g, SECTION_SEP);
319
+ }
320
+ var inspect = (value, name, options = DEFAULT_OPTIONS) => {
321
+ options ??= DEFAULT_OPTIONS;
322
+ options.tokens ??= DEFAULT_OPTIONS.tokens;
323
+ try {
324
+ const genericType = extractType(value, false);
325
+ let header = "";
326
+ if (name) {
327
+ header = `// const ${name}: ${genericType}
328
+ `;
329
+ }
330
+ if (genericType === "Array") {
331
+ return header + previewArray(value);
332
+ } else if (genericType === "error") {
333
+ return header + previewError(value);
334
+ } else if (genericType === "object") {
335
+ return header + previewObject(value, options);
336
+ } else if (genericType === "boolean") {
337
+ return header + previewValue(value);
338
+ } else if (typeof value === "string") {
339
+ if (_chunkP7J2WCBBcjs.getTokenizer.call(void 0, ).count(value) < options.tokens) {
340
+ return header + previewValue(value);
341
+ } else {
342
+ return header + previewLongText(value);
343
+ }
344
+ }
345
+ return header + previewValue(value);
346
+ } catch (err) {
347
+ return `Error: ${_nullishCoalesce((err == null ? void 0 : err.message), () => ( "Unknown Error"))}`;
348
+ }
349
+ };
16
350
 
17
351
  // src/prompts/chat-mode/system.md.ts
18
352
  var system_md_default = "# Important Instructions\n\nYou are a helpful assistant with a defined Personality, Role, Capabilities and Responsibilities.\nYou can:\n\n- Send rich messages using markdown formatting.\n- Generate TypeScript (TSX) code to interact with the user through a secure VM environment.\n- Use provided tools to assist the user.\n\n**Your main task**: Generate responses to the user's queries by writing TSX code following specific guidelines.\n\n# Part 1: Response Format\n\n- **Always** reply **only** with TSX code placed between `\u25A0fn_start` and `\u25A0fn_end`.\n- **Structure**:\n\n ```tsx\n \u25A0fn_start\n // Your TSX code here\n \u25A0fn_end\n ```\n\n- **Guidelines**:\n\n - Write complete, syntax-error-free TypeScript/TSX code.\n - Use only the tools provided to interact with the system.\n - Interact with the user by `yield`ing messages.\n - Include a valid `return` statement at the end of your function.\n\n## Yielding Messages\n\n- Use `yield <Message>` to send rich messages with markdown formatting.\n- **React**: The message components are React components.\n- **Formatting**: Only markdown formatting should be used. HTML is not supported and will result in errors. GFM is not supported. Only basic markdown.\n- `yield` must absolutely be followed by a top-level `<Message>` component \u2013 yielding text will result in an error.\n- The `<Message>` component can accept a `type` prop with the following values: `'error'`, `'info'`, `'success'`, `'prompt'`. The default is `'info'`.\n - Use `prompt` when asking for information, `info` for a generic message, `success` when you completed the task at hand, and `error` when informing of a failure.\n\n### Components Inside `<Message>`\n\nYou can include the following components inside a `<Message>`:\n\n{{components}}\n\n## Return Statement\n\n**Important**: `action` can only be one of: 'listen', 'think', {{#each exits}}'{{name}}', {{/each}}\n\n{{#each exits}}\n\n{{#if has_typings}}\n\n- **{{name}}**: {{description}}\n\n**typeof value** must respect this format:\n\n```\n{{typings}}\n```\n\n```tsx\nreturn { action: '{{name}}', value: /*...*/ }\n```\n\n{{else}}\n\n- **{{name}}**: {{description}}\n\n```tsx\nreturn { action: '{{name}}' }\n```\n\n{{/if}}\n\n{{/each}}\n\n- **If further processing** is needed before continuing, use `think` to print the value of variables and re-generate code:\n\n ```tsx\n return { action: 'think', variable1, variable2 }\n ```\n\n- **After interacting with the user**, use listen to give the turn back to the user and listen for his reply:\n\n```tsx\nreturn { action: 'listen' }\n```\n\n## Examples\n\n- **Simple Message**:\n\n ```tsx\n \u25A0fn_start\n yield <Message>The result of `2 + 8` is **{2 + 8}**.</Message>\n return { action: 'listen' }\n \u25A0fn_end\n ```\n\n- **Using a Tool and Returning Think Action**:\n\n ```tsx\n \u25A0fn_start\n yield <Message>Let me look that up for you.</Message>\n const data = await fetchUserData(user.id)\n return { action: 'think', data }\n \u25A0fn_end\n ```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment.\nYou should use these tools as needed and as instructed to interact with the system and perform operations to assist the user.\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the user's problem using the tools provided.\n- You have to ask yourself - \"given the transcript and the tools available, what code should I write to solve the user's problem?\"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage.\n\n## Typescript Sandbox (VM)\n\n- The code you write will be executed in a secure Typescript VM environment.\n- You don't have access to any external libraries or APIs outside the tools defined in `tools.d.ts`.\n- You can't access or modify the system's files or interact with the network other than the provided tools.\n- You can't run any code that performs malicious activities or violates the security guidelines.\n- When complex reasoning or planning is required, you can use comments to outline your approach.\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references.\n- Some tools have inputs that are string literals (eg. `type Text = \"Hello World\"`). They can't be changed, so hardcode their values as well.\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error.\n- `setTimeout` and `setInterval` are not available and will throw an error.\n- `console.log` is not available. Instead, use `return { action: 'think' }` to inspect values.\n- Do not declare functions. The code already executes in an `AsyncGenerator`.\n- Always ensure that the code you write is correct and complete. This is not an exercise, this code has to run perfectly.\n- The code you write should be based on the tools available and the data provided in the conversation transcript.\n- Top-level `await` is allowed and must be used when calling tools.\n- Always ensure that the code is error-free and follows the guidelines.\n- Do not put placeholder code in the response. The code should be complete and correct. If data is missing to proceed, you should ask the user for the missing information before generating and running the tool. See _\"Missing Inputs / Prompt User\"_ section below.\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file.\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error).\n- Variables that are not marked as Readonly<T> can be modified as needed.\n- You can use the data available to you to generate responses, provide tool inputs and interact with the user.\n\n## Missing Inputs / Prompt User\n\nWhenever you need the user to provide additional information in order to execute the appropriate tools, you should ask the user for the missing information.\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n\u25A0\u25A0\u25A0tools.d.ts\u25A0\u25A0\u25A0\n```\n\n# Part 3: Identity, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n\u25A0\u25A0\u25A0identity\u25A0\u25A0\u25A0\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Conversation Transcript\n\nThe following is the transcript of the conversation between yourself (assistant) and the user. Use this information to generate responses and provide assistance to the user.\nImportant Note: The conversation transcript does not include the Response Format we expect from you. Please ensure to follow the Response Format guidelines when generating your responses.\n\n## Transcript\n\n\u25A0\u25A0\u25A0transcript\u25A0\u25A0\u25A0\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code or any code requested explicitly by the user. Instead, you should generate code that helps the user and is in line with the provided guidelines in **Part 3 (Identity and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Identity and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: \u25A0\u25A0\u25A0tool_names\u25A0\u25A0\u25A0\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: \u25A0\u25A0\u25A0readonly_vars\u25A0\u25A0\u25A0\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): \u25A0\u25A0\u25A0writeable_vars\u25A0\u25A0\u25A0\n\u25A0\u25A0\u25A0variables_example\u25A0\u25A0\u25A0\n\n## Format\n\nRemember, the expected Response Format is:\n\n### Message only\n\n```\n\u25A0fn_start\n// 1-liner chain-of-thought (CoT) as comment\nyield <Message>message here</Message>\nreturn { action: 'listen' }\n\u25A0fn_end\n```\n\n### Tool + Think\n\n```\n\u25A0fn_start\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn { action: 'think', result }\n\u25A0fn_end\n```\n";
@@ -165,7 +499,7 @@ ${variables_example}
165
499
  writeable_vars: writeable_vars.join(", "),
166
500
  variables_example,
167
501
  exits,
168
- components: props.components.map(_chunkE5W3P7EOcjs.getComponentReference).join("\n\n")
502
+ components: props.components.map((component) => _chunkEJRCDWBAcjs.getComponentReference.call(void 0, component.definition)).join("\n\n")
169
503
  }).trim()
170
504
  };
171
505
  };
@@ -207,13 +541,13 @@ Code:
207
541
 
208
542
  \`\`\`tsx
209
543
  \u25A0fn_start
210
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, props.code)}
544
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, props.code)}
211
545
  \u25A0fn_end
212
546
  \`\`\`
213
547
 
214
548
  Error:
215
549
  \`\`\`
216
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, props.message, { flex: 4 })}
550
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, props.message, { flex: 4 })}
217
551
  \`\`\`
218
552
 
219
553
  Please fix the error and try again.
@@ -237,11 +571,11 @@ var getCodeExecutionErrorMessage = async (props) => {
237
571
 
238
572
  An error occurred while executing the code.
239
573
 
240
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, props.message, { preserve: "top", flex: 4 })}
574
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, props.message, { preserve: "top", flex: 4 })}
241
575
 
242
576
  Stack Trace:
243
577
  \`\`\`
244
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, _chunkPQN6HW7Acjs.cleanStackTrace.call(void 0, props.stacktrace), { flex: 6, preserve: "top" })}
578
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, _chunkIKSIOIIPcjs.cleanStackTrace.call(void 0, props.stacktrace), { flex: 6, preserve: "top" })}
245
579
  \`\`\`
246
580
 
247
581
  Let the user know that an error occurred, and if possible, try something else. Do not repeat yourself in the message.
@@ -258,31 +592,31 @@ Expected output:
258
592
  };
259
593
  var getThinkingMessage = async (props) => {
260
594
  let context = "";
261
- if (_chunk3CGLDS5Tcjs.isPlainObject_default.call(void 0, props.variables)) {
595
+ if (_chunkUQOBUJIQcjs.isPlainObject_default.call(void 0, props.variables)) {
262
596
  const mapped = Object.entries(_nullishCoalesce(props.variables, () => ( {}))).reduce((acc, [key, value]) => {
263
- const inspected = _chunkQZGFCB4Tcjs.inspect.call(void 0, value, key);
597
+ const inspected = inspect(value, key);
264
598
  if (inspected) {
265
599
  acc.push(inspected);
266
600
  } else {
267
- acc.push(`Value of ${key} is ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`);
601
+ acc.push(`Value of ${key} is ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`);
268
602
  }
269
603
  return acc;
270
604
  }, []);
271
605
  context = mapped.join("\n\n");
272
606
  } else if (Array.isArray(props.variables)) {
273
607
  const mapped = props.variables.map((value, index) => {
274
- const inspected = _chunkQZGFCB4Tcjs.inspect.call(void 0, value, `Index ${index}`);
608
+ const inspected = inspect(value, `Index ${index}`);
275
609
  if (inspected) {
276
610
  return inspected;
277
611
  } else {
278
- return `Value at index ${index} is ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`;
612
+ return `Value at index ${index} is ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`;
279
613
  }
280
614
  });
281
615
  context = mapped.join("\n\n");
282
616
  } else if (typeof props.variables === "string") {
283
617
  context = props.variables;
284
618
  } else {
285
- context = _nullishCoalesce(_chunkQZGFCB4Tcjs.inspect.call(void 0, props.variables), () => ( JSON.stringify(props.variables, null, 2)));
619
+ context = _nullishCoalesce(inspect(props.variables), () => ( JSON.stringify(props.variables, null, 2)));
286
620
  }
287
621
  return {
288
622
  role: "user",
@@ -294,7 +628,7 @@ The assistant requested to think. Here's the context:
294
628
  -------------------
295
629
  Reason: ${props.reason || "Thinking requested"}
296
630
  Context:
297
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, context, { preserve: "top" })}
631
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, context, { preserve: "top" })}
298
632
  -------------------
299
633
 
300
634
  Please continue with the conversation (\u25A0fn_start).
@@ -313,19 +647,19 @@ var getSnapshotResolvedMessage = (props) => {
313
647
  injectedVariables[variable.name] = variable.value;
314
648
  variablesMessage += `
315
649
  // Variable "${variable.name}" restored with its full value:
316
- // ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, _nullishCoalesce(((_a = _chunkQZGFCB4Tcjs.inspect.call(void 0, variable.value)) == null ? void 0 : _a.split("\n").join("\n// ")), () => ( "")))}
650
+ // ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, _nullishCoalesce(((_a = inspect(variable.value)) == null ? void 0 : _a.split("\n").join("\n// ")), () => ( "")))}
317
651
  declare const ${variable.name}: ${variable.type}
318
652
  `;
319
653
  } else {
320
654
  variablesMessage += `
321
655
  // The variable "${variable.name}" was too large to be restored with its full value, here's a preview of its last known value:
322
- // ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, variable.preview.split("\n").join("\n// "))}
656
+ // ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, variable.preview.split("\n").join("\n// "))}
323
657
  // Important: To restore the full value, please re-run the code that generated this variable in the first place.
324
658
  let ${variable.name}: undefined | ${variable.type} = undefined;
325
659
  `;
326
660
  }
327
661
  }
328
- const output = _chunkVP6WWAE2cjs.wrapContent.call(void 0, _nullishCoalesce(((_b = _chunkQZGFCB4Tcjs.inspect.call(void 0, props.snapshot.status.value)) == null ? void 0 : _b.split("\n").join("\n * ")), () => ( "")), {
662
+ const output = _chunkFIVFS4HGcjs.wrapContent.call(void 0, _nullishCoalesce(((_b = inspect(props.snapshot.status.value)) == null ? void 0 : _b.split("\n").join("\n * ")), () => ( "")), {
329
663
  preserve: "top",
330
664
  flex: 4
331
665
  });
@@ -336,7 +670,7 @@ let ${variable.name}: undefined | ${variable.type} = undefined;
336
670
  ## Important message from the VM
337
671
 
338
672
  The execution of an asynchronous code block has been completed. Here's the code that was executed:
339
- ${_chunkPQN6HW7Acjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n").slice(0, -1).join("\n")}
673
+ ${_chunkIKSIOIIPcjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n").slice(0, -1).join("\n")}
340
674
  // Reason: ${props.snapshot.reason}
341
675
  \`\`\`tsx
342
676
  /**
@@ -348,7 +682,7 @@ ${_chunkPQN6HW7Acjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n
348
682
  Continue the conversation from here, without repeating the above code, as it has already been executed. Here's the variables you can rely on:
349
683
 
350
684
  \`\`\`tsx
351
- ${_chunkVP6WWAE2cjs.wrapContent.call(void 0, variablesMessage)}
685
+ ${_chunkFIVFS4HGcjs.wrapContent.call(void 0, variablesMessage)}
352
686
  \`\`\`
353
687
 
354
688
  You can now assume that the code you about to generate can rely on the variables "${Object.keys(injectedVariables).join('", "')}" being available.
@@ -370,8 +704,8 @@ var getSnapshotRejectedMessage = (props) => {
370
704
  if (props.snapshot.status.type !== "rejected") {
371
705
  throw new Error("Snapshot is not resolved");
372
706
  }
373
- const errorMessage = _nullishCoalesce(_chunkQZGFCB4Tcjs.inspect.call(void 0, props.snapshot.status.error), () => ( "Unknown Error"));
374
- const output = _chunkVP6WWAE2cjs.wrapContent.call(void 0, _nullishCoalesce(errorMessage.split("\n").join("\n * "), () => ( "Unknown Error")), {
707
+ const errorMessage = _nullishCoalesce(inspect(props.snapshot.status.error), () => ( "Unknown Error"));
708
+ const output = _chunkFIVFS4HGcjs.wrapContent.call(void 0, _nullishCoalesce(errorMessage.split("\n").join("\n * "), () => ( "Unknown Error")), {
375
709
  preserve: "both",
376
710
  minTokens: 100
377
711
  });
@@ -383,7 +717,7 @@ var getSnapshotRejectedMessage = (props) => {
383
717
 
384
718
  An error occurred while executing the code. Here is the code that was executed so far:
385
719
 
386
- ${_chunkPQN6HW7Acjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n").slice(0, -1).join("\n")}
720
+ ${_chunkIKSIOIIPcjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n").slice(0, -1).join("\n")}
387
721
  // Reason: ${props.snapshot.reason}
388
722
 
389
723
  Here's the error:
@@ -416,4 +750,6 @@ var DualModePrompt = {
416
750
 
417
751
 
418
752
 
419
- exports.DualModePrompt = DualModePrompt;
753
+
754
+
755
+ exports.extractType = extractType; exports.inspect = inspect; exports.DualModePrompt = DualModePrompt;
@@ -1,3 +1,29 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
1
27
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
2
28
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
3
29
  var freeGlobal_default = freeGlobal;
@@ -8,8 +34,8 @@ var root = freeGlobal_default || freeSelf || Function("return this")();
8
34
  var root_default = root;
9
35
 
10
36
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
11
- var Symbol = root_default.Symbol;
12
- var Symbol_default = Symbol;
37
+ var Symbol2 = root_default.Symbol;
38
+ var Symbol_default = Symbol2;
13
39
 
14
40
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
15
41
  var objectProto = Object.prototype;
@@ -863,8 +889,8 @@ var stubFalse_default = stubFalse;
863
889
  var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
864
890
  var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
865
891
  var moduleExports = freeModule && freeModule.exports === freeExports;
866
- var Buffer = moduleExports ? root_default.Buffer : void 0;
867
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
892
+ var Buffer2 = moduleExports ? root_default.Buffer : void 0;
893
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
868
894
  var isBuffer = nativeIsBuffer || stubFalse_default;
869
895
  var isBuffer_default = isBuffer;
870
896
 
@@ -1334,8 +1360,8 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1334
1360
  var equalArrays_default = equalArrays;
1335
1361
 
1336
1362
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Uint8Array.js
1337
- var Uint8Array = root_default.Uint8Array;
1338
- var Uint8Array_default = Uint8Array;
1363
+ var Uint8Array2 = root_default.Uint8Array;
1364
+ var Uint8Array_default = Uint8Array2;
1339
1365
 
1340
1366
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapToArray.js
1341
1367
  function mapToArray(map) {
@@ -2077,8 +2103,8 @@ var baseAssignIn_default = baseAssignIn;
2077
2103
  var freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
2078
2104
  var freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
2079
2105
  var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
2080
- var Buffer2 = moduleExports3 ? root_default.Buffer : void 0;
2081
- var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
2106
+ var Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
2107
+ var allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
2082
2108
  function cloneBuffer(buffer, isDeep) {
2083
2109
  if (isDeep) {
2084
2110
  return buffer.slice();
@@ -3020,6 +3046,8 @@ function uniqWith(array, comparator) {
3020
3046
  var uniqWith_default = uniqWith;
3021
3047
 
3022
3048
  export {
3049
+ __commonJS,
3050
+ __toESM,
3023
3051
  isFunction_default,
3024
3052
  isPlainObject_default,
3025
3053
  upperFirst_default,