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.
- package/dist/{chunk-W4HLZNF4.js → chunk-22DGAZXC.js} +784 -868
- package/dist/{chunk-ESMRQVFC.js → chunk-2UM7PFM3.js} +6 -6
- package/dist/{chunk-EKXZXQJB.js → chunk-3NVOHQVY.js} +1 -1
- package/dist/{chunk-BSKF4J2E.cjs → chunk-5X5TDCMX.cjs} +51 -51
- package/dist/{chunk-BLB44ZDU.cjs → chunk-BXPPMP5X.cjs} +14 -14
- package/dist/{chunk-F4OZHUMS.cjs → chunk-DLV5FJ42.cjs} +9 -9
- package/dist/{chunk-LR6KTFHO.js → chunk-DO7DN4FZ.js} +1 -1
- package/dist/{chunk-UOPTKXLE.js → chunk-E6UFMAW7.js} +1 -1
- package/dist/{chunk-E5YW5YQN.js → chunk-E74GBCTT.js} +2 -2
- package/dist/{chunk-YTDNCBQW.js → chunk-EQ4JDBE5.js} +1 -1
- package/dist/{chunk-4VYDQ3VF.cjs → chunk-FQ4QCUTI.cjs} +7 -7
- package/dist/{chunk-5CXOW4DC.cjs → chunk-GFZCNSYW.cjs} +797 -881
- package/dist/{chunk-QOM7BK7U.cjs → chunk-H5LCBNN6.cjs} +18 -18
- package/dist/{chunk-UI6J4WKQ.js → chunk-HBKQKO3R.js} +3 -3
- package/dist/{chunk-2KRDL5AW.js → chunk-HP3T6PF4.js} +4 -4
- package/dist/{chunk-54G63644.cjs → chunk-OX3Y2Z5K.cjs} +3 -3
- package/dist/{chunk-UCXQ4U7P.cjs → chunk-TB6TCWEB.cjs} +2 -2
- package/dist/{chunk-WDYTCDIK.cjs → chunk-VXQ2CZ7B.cjs} +4 -4
- package/dist/{chunk-XLUYPCCY.cjs → chunk-X24YFCFY.cjs} +28 -28
- package/dist/{chunk-M4WTTARE.js → chunk-YFG53MRF.js} +1 -1
- package/dist/{component-DWFDDH5N.js → component-GVCCL5XU.js} +3 -3
- package/dist/component-YMPMWSTU.cjs +18 -0
- package/dist/dual-modes-KOU5YJ3Q.cjs +12 -0
- package/dist/dual-modes-X7YHJBFJ.js +12 -0
- package/dist/exit-A34GODDB.cjs +8 -0
- package/dist/exit-J55SREDL.js +8 -0
- package/dist/index.cjs +49 -49
- package/dist/index.js +22 -22
- package/dist/{jsx-PCXQVMLU.js → jsx-RIPUQSAU.js} +2 -2
- package/dist/jsx-XEUSAKAK.cjs +13 -0
- package/dist/{llmz-XRURR7Z5.cjs → llmz-2HD6WKIP.cjs} +34 -30
- package/dist/{llmz-F227HVGB.js → llmz-JTZUIYRP.js} +17 -13
- package/dist/llmz.d.ts +2 -2
- package/dist/quickjs-variant.d.ts +7 -1
- package/dist/tool-B3DJ3D2F.js +11 -0
- package/dist/tool-IWPZD5OY.cjs +11 -0
- package/dist/{truncator-2FSONJM2.js → truncator-HCWH5MJ3.js} +3 -3
- package/dist/truncator-SOO6NHLD.cjs +10 -0
- package/dist/{typings-DVMU3KVB.js → typings-FPFJ5D5R.js} +3 -3
- package/dist/typings-O2FLZGQN.cjs +10 -0
- package/dist/{utils-D3J443FA.js → utils-M5KFPSNZ.js} +2 -2
- package/dist/utils-PWX3JPCF.cjs +39 -0
- package/dist/vm/drivers/node.d.ts +5 -0
- package/dist/vm/drivers/quickjs.d.ts +6 -0
- package/dist/vm/errors.d.ts +21 -0
- package/dist/vm/index.d.ts +3 -0
- package/dist/vm/instrument.d.ts +11 -0
- package/dist/vm/types.d.ts +20 -0
- package/dist/{vm-GDB4GW4S.js → vm-KBBQ7U5L.js} +3 -3
- package/dist/vm-R2XBIWE4.cjs +10 -0
- package/package.json +3 -3
- package/dist/component-RVYDIBUM.cjs +0 -18
- package/dist/dual-modes-A4SC4APN.cjs +0 -12
- package/dist/dual-modes-FNC3BGK3.js +0 -12
- package/dist/exit-56DISPLS.js +0 -8
- package/dist/exit-OOGJ3TAS.cjs +0 -8
- package/dist/jsx-ENFGHP6S.cjs +0 -13
- package/dist/tool-A7EOCUQG.cjs +0 -11
- package/dist/tool-FNWHZGDU.js +0 -11
- package/dist/truncator-6M2EP2NZ.cjs +0 -10
- package/dist/typings-54UIN7ZR.cjs +0 -10
- package/dist/utils-BZUEJT4W.cjs +0 -39
- package/dist/vm-CR5NE6NS.cjs +0 -10
- package/dist/vm.d.ts +0 -9
- package/dist/{chunk-RKKRSBX3.cjs → chunk-7XVBJQ53.cjs} +432 -432
- package/dist/{chunk-5XC6ZMS5.js → chunk-BJMZIH3M.js} +432 -432
- /package/dist/{vm-jsx.test.d.ts → vm/vm-jsx.test.d.ts} +0 -0
- /package/dist/{vm.test.d.ts → vm/vm.test.d.ts} +0 -0
|
@@ -2,27 +2,27 @@ import {
|
|
|
2
2
|
DualModePrompt,
|
|
3
3
|
extractType,
|
|
4
4
|
inspect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HP3T6PF4.js";
|
|
6
6
|
import {
|
|
7
7
|
Tool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HBKQKO3R.js";
|
|
9
9
|
import {
|
|
10
10
|
LoopExceededError
|
|
11
11
|
} from "./chunk-WSVDMGMR.js";
|
|
12
12
|
import {
|
|
13
13
|
Exit
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-E74GBCTT.js";
|
|
15
15
|
import {
|
|
16
16
|
assertValidComponent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-EQ4JDBE5.js";
|
|
18
18
|
import {
|
|
19
19
|
wrapContent
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YFG53MRF.js";
|
|
21
21
|
import {
|
|
22
22
|
cloneDeep_default,
|
|
23
23
|
isPlainObject_default,
|
|
24
24
|
omit_default
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-BJMZIH3M.js";
|
|
26
26
|
|
|
27
27
|
// src/exit-parser.ts
|
|
28
28
|
function isValuePrimitive(value) {
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkVXQ2CZ7Bcjs = require('./chunk-VXQ2CZ7B.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkTB6TCWEBcjs = require('./chunk-TB6TCWEB.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkFQ4QCUTIcjs = require('./chunk-FQ4QCUTI.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ var _chunk4VYDQ3VFcjs = require('./chunk-4VYDQ3VF.cjs');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunk7XVBJQ53cjs = require('./chunk-7XVBJQ53.cjs');
|
|
31
31
|
|
|
32
32
|
// src/inspect.ts
|
|
33
33
|
var _bytes = require('bytes'); var _bytes2 = _interopRequireDefault(_bytes);
|
|
@@ -57,7 +57,7 @@ function printLimitedJson(obj, maxDepth, maxLength, maxKeys) {
|
|
|
57
57
|
}
|
|
58
58
|
if (typeof currentObj !== "object" || currentObj === null) {
|
|
59
59
|
const value = JSON.stringify(currentObj);
|
|
60
|
-
currentLength +=
|
|
60
|
+
currentLength += _chunkFQ4QCUTIcjs.getTokenizer.call(void 0, ).count(value);
|
|
61
61
|
return value;
|
|
62
62
|
}
|
|
63
63
|
const indentation = " ".repeat(currentIndent);
|
|
@@ -70,7 +70,7 @@ function printLimitedJson(obj, maxDepth, maxLength, maxKeys) {
|
|
|
70
70
|
result += indentation + " ".repeat(indent) + recurse(currentObj[i], depth + 1, currentIndent + indent);
|
|
71
71
|
}
|
|
72
72
|
result += "\n" + indentation + "]";
|
|
73
|
-
currentLength +=
|
|
73
|
+
currentLength += _chunkFQ4QCUTIcjs.getTokenizer.call(void 0, ).count(result);
|
|
74
74
|
return result;
|
|
75
75
|
} else {
|
|
76
76
|
let result = "{\n";
|
|
@@ -89,11 +89,11 @@ function printLimitedJson(obj, maxDepth, maxLength, maxKeys) {
|
|
|
89
89
|
result += ",\n" + indentation + `... (${numKeys - maxKeys} more keys)`;
|
|
90
90
|
}
|
|
91
91
|
result += "\n" + indentation + "}";
|
|
92
|
-
currentLength +=
|
|
92
|
+
currentLength += _chunkFQ4QCUTIcjs.getTokenizer.call(void 0, ).count(result);
|
|
93
93
|
return result;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
const output =
|
|
96
|
+
const output = _chunkFQ4QCUTIcjs.getTokenizer.call(void 0, ).truncate(recurse(obj, 0, 0), maxLength);
|
|
97
97
|
return { output, truncated: wasTruncated };
|
|
98
98
|
}
|
|
99
99
|
function extractType(value, generic = true) {
|
|
@@ -158,12 +158,12 @@ function previewValue(value, length = LONG_TEXT_LENGTH) {
|
|
|
158
158
|
}
|
|
159
159
|
const previewStr = (str) => {
|
|
160
160
|
if (str.length > length) {
|
|
161
|
-
return
|
|
161
|
+
return _chunkFQ4QCUTIcjs.escapeString.call(void 0, str.slice(0, length)) + " ... <truncated>";
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return _chunkFQ4QCUTIcjs.escapeString.call(void 0, str);
|
|
164
164
|
};
|
|
165
165
|
const previewObj = (obj) => {
|
|
166
|
-
const mapped =
|
|
166
|
+
const mapped = _chunk7XVBJQ53cjs.mapKeys_default.call(void 0, obj, (_value, key) => previewStr(key));
|
|
167
167
|
return JSON.stringify(mapped);
|
|
168
168
|
};
|
|
169
169
|
if (typeof value === "string") {
|
|
@@ -230,16 +230,16 @@ function previewArray(arr) {
|
|
|
230
230
|
}
|
|
231
231
|
lines.push("// Analysis Summary");
|
|
232
232
|
lines.push(SUBTITLE_LN);
|
|
233
|
-
const typesCount =
|
|
234
|
-
const ordered =
|
|
235
|
-
arr.filter((item) => !
|
|
233
|
+
const typesCount = _chunk7XVBJQ53cjs.countBy_default.call(void 0, arr, (item) => extractType(item, false));
|
|
234
|
+
const ordered = _chunk7XVBJQ53cjs.orderBy_default.call(void 0,
|
|
235
|
+
arr.filter((item) => !_chunk7XVBJQ53cjs.isNil_default.call(void 0, item) && JSON.stringify(item).length < 100),
|
|
236
236
|
(item) => JSON.stringify(item),
|
|
237
237
|
"asc"
|
|
238
238
|
);
|
|
239
239
|
const minValues = ordered.slice(0, 3).map((item) => previewValue(item, 10));
|
|
240
240
|
const maxValues = ordered.slice(-3).map((item) => previewValue(item, 10));
|
|
241
|
-
const uniqueItems =
|
|
242
|
-
const nullValues =
|
|
241
|
+
const uniqueItems = _chunk7XVBJQ53cjs.uniqWith_default.call(void 0, arr, _chunk7XVBJQ53cjs.isEqual_default);
|
|
242
|
+
const nullValues = _chunk7XVBJQ53cjs.filter_default.call(void 0, arr, _chunk7XVBJQ53cjs.isNil_default).length;
|
|
243
243
|
const memoryUsage = _bytes2.default.call(void 0, JSON.stringify(arr).length);
|
|
244
244
|
lines.push(`Total Items: ${arr.length}`);
|
|
245
245
|
lines.push(`Unique Items: ${uniqueItems.length}`);
|
|
@@ -264,17 +264,17 @@ function previewObject(obj, options) {
|
|
|
264
264
|
lines.push("// Analysis Summary");
|
|
265
265
|
lines.push(SUBTITLE_LN);
|
|
266
266
|
const entries = Object.entries(obj);
|
|
267
|
-
const typesCount =
|
|
268
|
-
(e) =>
|
|
269
|
-
|
|
270
|
-
(p) =>
|
|
267
|
+
const typesCount = _chunk7XVBJQ53cjs.flow_default.call(void 0,
|
|
268
|
+
(e) => _chunk7XVBJQ53cjs.countBy_default.call(void 0, e, ([, value]) => extractType(value, false)),
|
|
269
|
+
_chunk7XVBJQ53cjs.toPairs_default,
|
|
270
|
+
(p) => _chunk7XVBJQ53cjs.orderBy_default.call(void 0, p, ([, count]) => count, "desc"),
|
|
271
271
|
(p) => p.filter(([, count]) => count > 1),
|
|
272
272
|
(p) => p.slice(0, 3),
|
|
273
|
-
(0,
|
|
273
|
+
(0, _chunk7XVBJQ53cjs.fromPairs_default)
|
|
274
274
|
)(entries);
|
|
275
275
|
const keys = Object.keys(obj);
|
|
276
|
-
const uniqueEntries =
|
|
277
|
-
const nilValues =
|
|
276
|
+
const uniqueEntries = _chunk7XVBJQ53cjs.uniq_default.call(void 0, Object.values(obj));
|
|
277
|
+
const nilValues = _chunk7XVBJQ53cjs.filter_default.call(void 0, entries, ([, value]) => _chunk7XVBJQ53cjs.isNil_default.call(void 0, value)).length;
|
|
278
278
|
const memoryUsage = _bytes2.default.call(void 0, JSON.stringify(obj).length);
|
|
279
279
|
lines.push(`Total Entries: ${NUMBER_LOCALE.format(entries.length)}`);
|
|
280
280
|
lines.push(`Keys: ${previewValue(keys)}`);
|
|
@@ -283,7 +283,7 @@ function previewObject(obj, options) {
|
|
|
283
283
|
lines.push(`Nil Values: ${NUMBER_LOCALE.format(nilValues)}`);
|
|
284
284
|
lines.push(`Memory Usage: ${memoryUsage}`);
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
286
|
+
if (_chunk7XVBJQ53cjs.isEmpty_default.call(void 0, obj)) {
|
|
287
287
|
lines.push("// Empty Object {}");
|
|
288
288
|
} else {
|
|
289
289
|
lines.push(truncated ? "// Object Preview (truncated)" : "// Full Object Preview");
|
|
@@ -309,14 +309,14 @@ function previewLongText(text, length = LONG_TEXT_LENGTH) {
|
|
|
309
309
|
lines.push(SUBTITLE_LN);
|
|
310
310
|
const words = text.split(/\s+/);
|
|
311
311
|
const wordCount = words.length;
|
|
312
|
-
const uniqueWords =
|
|
313
|
-
const wordFrequency =
|
|
314
|
-
const mostCommonWords =
|
|
315
|
-
|
|
316
|
-
(p) =>
|
|
317
|
-
(p) =>
|
|
318
|
-
(p) =>
|
|
319
|
-
(p) =>
|
|
312
|
+
const uniqueWords = _chunk7XVBJQ53cjs.uniq_default.call(void 0, words).length;
|
|
313
|
+
const wordFrequency = _chunk7XVBJQ53cjs.countBy_default.call(void 0, words);
|
|
314
|
+
const mostCommonWords = _chunk7XVBJQ53cjs.flow_default.call(void 0,
|
|
315
|
+
_chunk7XVBJQ53cjs.toPairs_default,
|
|
316
|
+
(p) => _chunk7XVBJQ53cjs.orderBy_default.call(void 0, p, ([, count]) => count, "desc"),
|
|
317
|
+
(p) => _chunk7XVBJQ53cjs.filter_default.call(void 0, p, ([, count]) => count > 1),
|
|
318
|
+
(p) => _chunk7XVBJQ53cjs.take_default.call(void 0, p, 20),
|
|
319
|
+
(p) => _chunk7XVBJQ53cjs.map_default.call(void 0, p, ([word, count]) => `"${word}" ${count} times`)
|
|
320
320
|
)(wordFrequency).join("\n" + " ".repeat(22));
|
|
321
321
|
const urls = text.match(urlPattern) || [];
|
|
322
322
|
const emails = text.match(emailPattern) || [];
|
|
@@ -353,7 +353,7 @@ var inspect = (value, name, options = DEFAULT_OPTIONS) => {
|
|
|
353
353
|
} else if (genericType === "boolean") {
|
|
354
354
|
return header + previewValue(value);
|
|
355
355
|
} else if (typeof value === "string") {
|
|
356
|
-
if (
|
|
356
|
+
if (_chunkFQ4QCUTIcjs.getTokenizer.call(void 0, ).count(value) < options.tokens) {
|
|
357
357
|
return header + previewValue(value);
|
|
358
358
|
} else {
|
|
359
359
|
return header + previewLongText(value);
|
|
@@ -508,15 +508,15 @@ ${variables_example}
|
|
|
508
508
|
role: "system",
|
|
509
509
|
content: replacePlaceholders(canTalk ? system_md_default : system_md_default2, {
|
|
510
510
|
is_message_enabled: canTalk,
|
|
511
|
-
"tools.d.ts":
|
|
511
|
+
"tools.d.ts": _chunkTB6TCWEBcjs.wrapContent.call(void 0, dts, {
|
|
512
512
|
preserve: "both",
|
|
513
513
|
minTokens: 500
|
|
514
514
|
}),
|
|
515
|
-
identity:
|
|
515
|
+
identity: _chunkTB6TCWEBcjs.wrapContent.call(void 0, ((_a = props.instructions) == null ? void 0 : _a.length) ? props.instructions : "No specific instructions provided", {
|
|
516
516
|
preserve: "both",
|
|
517
517
|
minTokens: 1e3
|
|
518
518
|
}),
|
|
519
|
-
transcript:
|
|
519
|
+
transcript: _chunkTB6TCWEBcjs.wrapContent.call(void 0, props.transcript.toString(), {
|
|
520
520
|
preserve: "bottom",
|
|
521
521
|
minTokens: 500
|
|
522
522
|
}),
|
|
@@ -525,8 +525,8 @@ ${variables_example}
|
|
|
525
525
|
writeable_vars: writeable_vars.join(", "),
|
|
526
526
|
variables_example,
|
|
527
527
|
exits,
|
|
528
|
-
components:
|
|
529
|
-
props.components.map((component) =>
|
|
528
|
+
components: _chunkTB6TCWEBcjs.wrapContent.call(void 0,
|
|
529
|
+
props.components.map((component) => _chunkVXQ2CZ7Bcjs.getComponentReference.call(void 0, component.definition)).join("\n\n"),
|
|
530
530
|
{
|
|
531
531
|
preserve: "top",
|
|
532
532
|
minTokens: 500
|
|
@@ -603,13 +603,13 @@ Code:
|
|
|
603
603
|
|
|
604
604
|
\`\`\`tsx
|
|
605
605
|
\u25A0fn_start
|
|
606
|
-
${
|
|
606
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, props.code)}
|
|
607
607
|
\u25A0fn_end
|
|
608
608
|
\`\`\`
|
|
609
609
|
|
|
610
610
|
Error:
|
|
611
611
|
\`\`\`
|
|
612
|
-
${
|
|
612
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, props.message, { flex: 4 })}
|
|
613
613
|
\`\`\`
|
|
614
614
|
|
|
615
615
|
Please fix the error and try again.
|
|
@@ -632,11 +632,11 @@ var getCodeExecutionErrorMessage = async (props) => {
|
|
|
632
632
|
|
|
633
633
|
An error occurred while executing the code.
|
|
634
634
|
|
|
635
|
-
${
|
|
635
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, props.message, { preserve: "top", flex: 4 })}
|
|
636
636
|
|
|
637
637
|
Stack Trace:
|
|
638
638
|
\`\`\`
|
|
639
|
-
${
|
|
639
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, _chunkKIN7Y247cjs.cleanStackTrace.call(void 0, props.stacktrace), { flex: 6, preserve: "top" })}
|
|
640
640
|
\`\`\`
|
|
641
641
|
|
|
642
642
|
Let the user know that an error occurred, and if possible, try something else. Do not repeat yourself in the message.
|
|
@@ -653,13 +653,13 @@ Expected output:
|
|
|
653
653
|
};
|
|
654
654
|
var getThinkingMessage = async (props) => {
|
|
655
655
|
let context = "";
|
|
656
|
-
if (
|
|
656
|
+
if (_chunk7XVBJQ53cjs.isPlainObject_default.call(void 0, props.variables)) {
|
|
657
657
|
const mapped = Object.entries(_nullishCoalesce(props.variables, () => ( {}))).reduce((acc, [key, value]) => {
|
|
658
658
|
const inspected = inspect(value, key);
|
|
659
659
|
if (inspected) {
|
|
660
660
|
acc.push(inspected);
|
|
661
661
|
} else {
|
|
662
|
-
acc.push(`Value of ${key} is ${
|
|
662
|
+
acc.push(`Value of ${key} is ${_chunkTB6TCWEBcjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`);
|
|
663
663
|
}
|
|
664
664
|
return acc;
|
|
665
665
|
}, []);
|
|
@@ -670,7 +670,7 @@ var getThinkingMessage = async (props) => {
|
|
|
670
670
|
if (inspected) {
|
|
671
671
|
return inspected;
|
|
672
672
|
} else {
|
|
673
|
-
return `Value at index ${index} is ${
|
|
673
|
+
return `Value at index ${index} is ${_chunkTB6TCWEBcjs.wrapContent.call(void 0, JSON.stringify(value, null, 2))}`;
|
|
674
674
|
}
|
|
675
675
|
});
|
|
676
676
|
context = mapped.join("\n\n");
|
|
@@ -688,7 +688,7 @@ The assistant requested to think. Here's the context:
|
|
|
688
688
|
-------------------
|
|
689
689
|
Reason: ${props.reason || "Thinking requested"}
|
|
690
690
|
Context:
|
|
691
|
-
${
|
|
691
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, context, { preserve: "top" })}
|
|
692
692
|
-------------------
|
|
693
693
|
|
|
694
694
|
Please continue with the conversation (\u25A0fn_start).
|
|
@@ -707,19 +707,19 @@ var getSnapshotResolvedMessage = (props) => {
|
|
|
707
707
|
injectedVariables[variable.name] = variable.value;
|
|
708
708
|
variablesMessage += `
|
|
709
709
|
// Variable "${variable.name}" restored with its full value:
|
|
710
|
-
// ${
|
|
710
|
+
// ${_chunkTB6TCWEBcjs.wrapContent.call(void 0, _nullishCoalesce(((_a = inspect(variable.value)) == null ? void 0 : _a.split("\n").join("\n// ")), () => ( "")))}
|
|
711
711
|
declare const ${variable.name}: ${variable.type}
|
|
712
712
|
`;
|
|
713
713
|
} else {
|
|
714
714
|
variablesMessage += `
|
|
715
715
|
// The variable "${variable.name}" was too large to be restored with its full value, here's a preview of its last known value:
|
|
716
|
-
// ${
|
|
716
|
+
// ${_chunkTB6TCWEBcjs.wrapContent.call(void 0, variable.preview.split("\n").join("\n// "))}
|
|
717
717
|
// Important: To restore the full value, please re-run the code that generated this variable in the first place.
|
|
718
718
|
let ${variable.name}: undefined | ${variable.type} = undefined;
|
|
719
719
|
`;
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
const output =
|
|
722
|
+
const output = _chunkTB6TCWEBcjs.wrapContent.call(void 0, _nullishCoalesce(((_b = inspect(props.snapshot.status.value)) == null ? void 0 : _b.split("\n").join("\n * ")), () => ( "")), {
|
|
723
723
|
preserve: "top",
|
|
724
724
|
flex: 4
|
|
725
725
|
});
|
|
@@ -741,7 +741,7 @@ ${_chunkKIN7Y247cjs.cleanStackTrace.call(void 0, props.snapshot.stack).split("\n
|
|
|
741
741
|
Continue the conversation from here, without repeating the above code, as it has already been executed. Here's the variables you can rely on:
|
|
742
742
|
|
|
743
743
|
\`\`\`tsx
|
|
744
|
-
${
|
|
744
|
+
${_chunkTB6TCWEBcjs.wrapContent.call(void 0, variablesMessage)}
|
|
745
745
|
\`\`\`
|
|
746
746
|
|
|
747
747
|
You can now assume that the code you about to generate can rely on the variables "${Object.keys(injectedVariables).join('", "')}" being available.
|
|
@@ -764,7 +764,7 @@ var getSnapshotRejectedMessage = (props) => {
|
|
|
764
764
|
throw new Error("Snapshot is not resolved");
|
|
765
765
|
}
|
|
766
766
|
const errorMessage = _nullishCoalesce(inspect(props.snapshot.status.error), () => ( "Unknown Error"));
|
|
767
|
-
const output =
|
|
767
|
+
const output = _chunkTB6TCWEBcjs.wrapContent.call(void 0, _nullishCoalesce(errorMessage.split("\n").join("\n * "), () => ( "Unknown Error")), {
|
|
768
768
|
preserve: "both",
|
|
769
769
|
minTokens: 100
|
|
770
770
|
});
|
|
@@ -5,7 +5,7 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkFQ4QCUTIcjs = require('./chunk-FQ4QCUTI.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 =
|
|
114
|
+
const description = _chunkFQ4QCUTIcjs.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 =
|
|
135
|
+
const description = _chunkFQ4QCUTIcjs.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(
|
|
146
|
+
args += `${await sUnwrapZodRecursive(new KeyValue(_chunkFQ4QCUTIcjs.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 =
|
|
185
|
+
const description = _chunkFQ4QCUTIcjs.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(
|
|
203
|
+
const values = schema._def.values.map(_chunkFQ4QCUTIcjs.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(
|
|
228
|
+
return sUnwrapZodRecursive(new KeyValue(_chunkFQ4QCUTIcjs.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 =
|
|
236
|
+
const description = _chunkFQ4QCUTIcjs.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 =
|
|
240
|
+
const description = _chunkFQ4QCUTIcjs.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 =
|
|
250
|
+
const description = _chunkFQ4QCUTIcjs.getMultilineComment.call(void 0, schema._def.description);
|
|
251
251
|
return `${description}
|
|
252
|
-
${typeof schema.value === "string" ?
|
|
252
|
+
${typeof schema.value === "string" ? _chunkFQ4QCUTIcjs.escapeString.call(void 0, schema.value) : String(schema.value)}`.trim();
|
|
253
253
|
}
|
|
254
254
|
if (_zui.z.is.zuiNumber(schema)) {
|
|
255
|
-
const description =
|
|
255
|
+
const description = _chunkFQ4QCUTIcjs.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 =
|
|
259
|
+
const description = _chunkFQ4QCUTIcjs.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" ? _chunk4VYDQ3VFcjs.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 =
|
|
269
|
+
const description = _chunkFQ4QCUTIcjs.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,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkFQ4QCUTIcjs = require('./chunk-FQ4QCUTI.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk7XVBJQ53cjs = require('./chunk-7XVBJQ53.cjs');
|
|
9
9
|
|
|
10
10
|
// src/exit.ts
|
|
11
11
|
var _zui = require('@bpinternal/zui');
|
|
@@ -42,13 +42,13 @@ var Exit = (_class = class _Exit {
|
|
|
42
42
|
*/
|
|
43
43
|
rename(name) {
|
|
44
44
|
const before = this.name;
|
|
45
|
-
if (!
|
|
45
|
+
if (!_chunkFQ4QCUTIcjs.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
|
);
|
|
49
49
|
}
|
|
50
50
|
this.name = name;
|
|
51
|
-
this.aliases =
|
|
51
|
+
this.aliases = _chunk7XVBJQ53cjs.uniq_default.call(void 0, [name, ...this.aliases.map((alias) => alias === before ? name : alias)]);
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -177,7 +177,7 @@ var Exit = (_class = class _Exit {
|
|
|
177
177
|
* ```
|
|
178
178
|
*/
|
|
179
179
|
constructor(props) {;_class.prototype.__init.call(this);
|
|
180
|
-
if (!
|
|
180
|
+
if (!_chunkFQ4QCUTIcjs.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) => !
|
|
200
|
+
if (props.aliases && props.aliases.some((alias) => !_chunkFQ4QCUTIcjs.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 (
|
|
204
|
+
if (_chunkFQ4QCUTIcjs.isZuiSchema.call(void 0, props.schema)) {
|
|
205
205
|
this.schema = _zui.transforms.toJSONSchemaLegacy(props.schema);
|
|
206
|
-
} else if (
|
|
206
|
+
} else if (_chunkFQ4QCUTIcjs.isJsonSchema.call(void 0, props.schema)) {
|
|
207
207
|
this.schema = props.schema;
|
|
208
208
|
} else {
|
|
209
209
|
throw new Error(
|
|
@@ -212,7 +212,7 @@ var Exit = (_class = class _Exit {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
this.name = props.name;
|
|
215
|
-
this.aliases =
|
|
215
|
+
this.aliases = _chunk7XVBJQ53cjs.uniq_default.call(void 0, [props.name, ..._nullishCoalesce(props.aliases, () => ( []))]);
|
|
216
216
|
this.description = props.description;
|
|
217
217
|
this.metadata = _nullishCoalesce(props.metadata, () => ( {}));
|
|
218
218
|
}
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
isJsonSchema,
|
|
3
3
|
isValidIdentifier,
|
|
4
4
|
isZuiSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3NVOHQVY.js";
|
|
6
6
|
import {
|
|
7
7
|
uniq_default
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BJMZIH3M.js";
|
|
9
9
|
|
|
10
10
|
// src/exit.ts
|
|
11
11
|
import { transforms } from "@bpinternal/zui";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk7XVBJQ53cjs = require('./chunk-7XVBJQ53.cjs');
|
|
8
8
|
|
|
9
9
|
// src/utils.ts
|
|
10
10
|
var _thicktoken = require('@bpinternal/thicktoken');
|
|
@@ -98,12 +98,12 @@ ${descLines.map(ensureLineStartsWithAsterisk).map(escapeCommentEnd).join("\n")}
|
|
|
98
98
|
*/`;
|
|
99
99
|
};
|
|
100
100
|
var toValidFunctionName = (str) => {
|
|
101
|
-
let name =
|
|
101
|
+
let name = _chunk7XVBJQ53cjs.deburr_default.call(void 0, str);
|
|
102
102
|
name = name.replace(/[^a-zA-Z0-9_$]/g, "");
|
|
103
103
|
if (!/^[a-zA-Z_$]/.test(name)) {
|
|
104
104
|
name = `_${name}`;
|
|
105
105
|
}
|
|
106
|
-
return
|
|
106
|
+
return _chunk7XVBJQ53cjs.camelCase_default.call(void 0, name);
|
|
107
107
|
};
|
|
108
108
|
var awaitObject = async (obj) => {
|
|
109
109
|
const newObj = { ...obj };
|
|
@@ -114,7 +114,7 @@ var awaitObject = async (obj) => {
|
|
|
114
114
|
for (const [key, value] of Object.entries(obj)) {
|
|
115
115
|
if (value instanceof Promise) {
|
|
116
116
|
promises.push(setProp(key, value));
|
|
117
|
-
} else if (
|
|
117
|
+
} else if (_chunk7XVBJQ53cjs.isPlainObject_default.call(void 0, value)) {
|
|
118
118
|
promises.push(setProp(key, await awaitObject(value)));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -122,8 +122,8 @@ var awaitObject = async (obj) => {
|
|
|
122
122
|
return newObj;
|
|
123
123
|
};
|
|
124
124
|
var toValidObjectName = (str) => {
|
|
125
|
-
let name =
|
|
126
|
-
name = name.split(/[^a-zA-Z0-9_$]/g).map(
|
|
125
|
+
let name = _chunk7XVBJQ53cjs.deburr_default.call(void 0, str);
|
|
126
|
+
name = name.split(/[^a-zA-Z0-9_$]/g).map(_chunk7XVBJQ53cjs.startCase_default).join("");
|
|
127
127
|
if (!/^[a-zA-Z_$]/.test(name)) {
|
|
128
128
|
name = `_${name}`;
|
|
129
129
|
}
|
|
@@ -136,7 +136,7 @@ var stripInvalidIdentifiers = (object) => {
|
|
|
136
136
|
if (Array.isArray(object)) {
|
|
137
137
|
return object.map(stripInvalidIdentifiers);
|
|
138
138
|
}
|
|
139
|
-
return
|
|
139
|
+
return _chunk7XVBJQ53cjs.pickBy_default.call(void 0, object, (__, key) => Identifier.safeParse(key).success);
|
|
140
140
|
};
|
|
141
141
|
var convertObjectToZuiLiterals = (obj, nested = false) => {
|
|
142
142
|
if (typeof obj === "string") {
|