llmz 0.0.83 → 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.
- package/dist/{chunk-VDTORFBP.js → chunk-2XSXXGXJ.js} +4 -4
- package/dist/{chunk-I2CZYEMH.js → chunk-EADBCAE7.js} +2 -2
- package/dist/{chunk-RLUTWFAA.cjs → chunk-EC2I4U4G.cjs} +6 -6
- package/dist/{chunk-MM2FLD3J.js → chunk-GEN6TAXY.js} +8 -16
- package/dist/{chunk-6KR6VRA6.cjs → chunk-GFSUTNRM.cjs} +9 -17
- package/dist/{chunk-52QTFQOB.cjs → chunk-H3PZFBJL.cjs} +60 -14
- package/dist/{chunk-73XYX76S.cjs → chunk-KY27DGTG.cjs} +14 -14
- package/dist/{chunk-YCLKXXSF.cjs → chunk-N3XPJTPE.cjs} +18 -18
- package/dist/{chunk-NWTG73QR.cjs → chunk-NFZXJRXS.cjs} +3 -48
- package/dist/{chunk-NPVV3PHY.js → chunk-PASYUKW4.js} +1 -1
- package/dist/{chunk-VLJA22PB.js → chunk-TRWUQSEK.js} +1 -1
- package/dist/{chunk-5Z2SJOGS.js → chunk-YTFNFSDT.js} +65 -19
- package/dist/{chunk-5MAFEI2A.js → chunk-ZHHB3FT4.js} +1 -46
- package/dist/{chunk-NQBIU5VM.cjs → chunk-ZVSO527D.cjs} +25 -25
- package/dist/convert.d.ts +11 -0
- package/dist/{dual-modes-VDFZH4YM.js → dual-modes-5NJMZJTA.js} +3 -3
- package/dist/{dual-modes-E5HGE35E.cjs → dual-modes-WA5TPGJR.cjs} +4 -4
- package/dist/{execute-CJVHUFYI.js → execute-2T75URIX.js} +7 -7
- package/dist/{execute-R6R3A42S.cjs → execute-I53OOORH.cjs} +30 -30
- package/dist/{exit-GKF4EEMZ.js → exit-7NHSUR3V.js} +2 -2
- package/dist/exit-V3ORIN65.cjs +8 -0
- package/dist/index.cjs +33 -33
- package/dist/index.js +16 -16
- package/dist/{tool-4VK7TZV2.cjs → tool-4OPM7QRM.cjs} +4 -4
- package/dist/{tool-JZP3UN2F.js → tool-HXXQMDA3.js} +3 -3
- package/dist/truncator-ZN7X6OMF.cjs +10 -0
- package/dist/{truncator-IIRX3MB2.js → truncator-ZQYBTVCJ.js} +2 -2
- package/dist/{typings-SHVPZ5AR.cjs → typings-QW4427V7.cjs} +3 -3
- package/dist/{typings-SKZSSL2M.js → typings-YD2WAQ4A.js} +2 -2
- package/dist/utils-NQSM5FBL.cjs +39 -0
- package/dist/{utils-SYJGSVFW.js → utils-RKUVYFTJ.js} +1 -3
- package/dist/utils.d.ts +1 -5
- package/package.json +2 -2
- package/dist/exit-VZASQELZ.cjs +0 -8
- package/dist/truncator-NWENJXMR.cjs +0 -10
- package/dist/utils-6MFSS4AT.cjs +0 -41
|
@@ -1,19 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTypings
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PASYUKW4.js";
|
|
4
4
|
import {
|
|
5
|
-
convertObjectToZuiLiterals,
|
|
6
5
|
isJsonSchema,
|
|
7
6
|
isValidIdentifier,
|
|
8
7
|
isZuiSchema
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZHHB3FT4.js";
|
|
10
9
|
import {
|
|
11
10
|
isEmpty_default,
|
|
12
11
|
uniq_default
|
|
13
12
|
} from "./chunk-34GJUS6U.js";
|
|
14
13
|
|
|
15
14
|
// src/tool.ts
|
|
16
|
-
import { z, transforms } from "@bpinternal/zui";
|
|
15
|
+
import { z as z2, transforms } from "@bpinternal/zui";
|
|
16
|
+
|
|
17
|
+
// src/convert.ts
|
|
18
|
+
import { z } from "@bpinternal/zui";
|
|
19
|
+
function convertObjectToZuiLiterals(obj, nested = false) {
|
|
20
|
+
if (typeof obj === "string") {
|
|
21
|
+
return z.literal(obj).catch(() => obj);
|
|
22
|
+
}
|
|
23
|
+
if (typeof obj === "number") {
|
|
24
|
+
return z.literal(obj).catch(() => obj);
|
|
25
|
+
}
|
|
26
|
+
if (typeof obj === "boolean") {
|
|
27
|
+
return z.literal(obj).catch(() => obj);
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(obj)) {
|
|
30
|
+
if (obj.length === 0) {
|
|
31
|
+
return z.tuple([]).catch(() => obj);
|
|
32
|
+
}
|
|
33
|
+
const items = obj.map((child) => convertObjectToZuiLiterals(child, true));
|
|
34
|
+
return z.tuple(items).catch(() => obj);
|
|
35
|
+
}
|
|
36
|
+
if (obj !== null && typeof obj === "object") {
|
|
37
|
+
const shape = {};
|
|
38
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
39
|
+
shape[key] = convertObjectToZuiLiterals(value, true);
|
|
40
|
+
}
|
|
41
|
+
if (nested) {
|
|
42
|
+
return z.object(shape).catch(() => obj);
|
|
43
|
+
}
|
|
44
|
+
if (Object.keys(shape).length === 0) {
|
|
45
|
+
return z.object({}).catch(() => obj);
|
|
46
|
+
}
|
|
47
|
+
return shape;
|
|
48
|
+
}
|
|
49
|
+
if (obj === void 0) {
|
|
50
|
+
return z.undefined().catch(() => void 0);
|
|
51
|
+
}
|
|
52
|
+
if (obj === null) {
|
|
53
|
+
return z.null().catch(() => null);
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Unsupported object type ${typeof obj}, ${obj})`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/tool.ts
|
|
17
59
|
var Tool = class _Tool {
|
|
18
60
|
_staticInputValues;
|
|
19
61
|
name;
|
|
@@ -70,13 +112,13 @@ var Tool = class _Tool {
|
|
|
70
112
|
this._staticInputValues = void 0;
|
|
71
113
|
return this;
|
|
72
114
|
}
|
|
73
|
-
const input = this.input ? transforms.fromJSONSchemaLegacy(this.input) :
|
|
74
|
-
if (
|
|
115
|
+
const input = this.input ? transforms.fromJSONSchemaLegacy(this.input) : z2.any();
|
|
116
|
+
if (z2.is.zuiObject(input) && typeof values !== "object") {
|
|
75
117
|
throw new Error(
|
|
76
118
|
`Invalid static input values for tool ${this.name}. Expected an object, but got type "${typeof values}"`
|
|
77
119
|
);
|
|
78
120
|
}
|
|
79
|
-
if (
|
|
121
|
+
if (z2.is.zuiArray(input) && !Array.isArray(values)) {
|
|
80
122
|
throw new Error(
|
|
81
123
|
`Invalid static input values for tool ${this.name}. Expected an array, but got type "${typeof values}"`
|
|
82
124
|
);
|
|
@@ -102,15 +144,19 @@ var Tool = class _Tool {
|
|
|
102
144
|
input = transforms.fromJSONSchemaLegacy(this.input);
|
|
103
145
|
}
|
|
104
146
|
} else {
|
|
105
|
-
input =
|
|
147
|
+
input = z2.any();
|
|
106
148
|
}
|
|
107
149
|
if (!isEmpty_default(this._staticInputValues)) {
|
|
108
|
-
|
|
109
|
-
|
|
150
|
+
if (z2.is.zuiObject(input)) {
|
|
151
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
110
152
|
input = input.extend(inputExtensions);
|
|
111
|
-
} else if (
|
|
112
|
-
|
|
153
|
+
} else if (z2.is.zuiArray(input)) {
|
|
154
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
155
|
+
input = z2.array(input.element.extend(inputExtensions));
|
|
113
156
|
} else {
|
|
157
|
+
const inputExtensions = convertObjectToZuiLiterals(
|
|
158
|
+
this._staticInputValues
|
|
159
|
+
);
|
|
114
160
|
input = inputExtensions;
|
|
115
161
|
}
|
|
116
162
|
}
|
|
@@ -123,7 +169,7 @@ var Tool = class _Tool {
|
|
|
123
169
|
* @internal
|
|
124
170
|
*/
|
|
125
171
|
get zOutput() {
|
|
126
|
-
let output =
|
|
172
|
+
let output = z2.void();
|
|
127
173
|
if (this.output) {
|
|
128
174
|
try {
|
|
129
175
|
output = transforms.fromJSONSchema(this.output);
|
|
@@ -131,7 +177,7 @@ var Tool = class _Tool {
|
|
|
131
177
|
output = transforms.fromJSONSchemaLegacy(this.output);
|
|
132
178
|
}
|
|
133
179
|
}
|
|
134
|
-
return
|
|
180
|
+
return z2.promise(output);
|
|
135
181
|
}
|
|
136
182
|
/**
|
|
137
183
|
* Renames the tool and updates its aliases.
|
|
@@ -238,8 +284,8 @@ var Tool = class _Tool {
|
|
|
238
284
|
aliases: props.aliases ?? [...this.aliases],
|
|
239
285
|
description: props.description ?? this.description,
|
|
240
286
|
metadata: JSON.parse(JSON.stringify(props.metadata ?? this.metadata)),
|
|
241
|
-
input: typeof props.input === "function" ? (_a = props.input) == null ? void 0 : _a.call(props, zInput) :
|
|
242
|
-
output: typeof props.output === "function" ? (_b = props.output) == null ? void 0 : _b.call(props, zOutput) :
|
|
287
|
+
input: typeof props.input === "function" ? (_a = props.input) == null ? void 0 : _a.call(props, zInput) : z2.is.zuiType(props.input) ? props.input : zInput,
|
|
288
|
+
output: typeof props.output === "function" ? (_b = props.output) == null ? void 0 : _b.call(props, zOutput) : z2.is.zuiType(props.output) ? props.output : zOutput,
|
|
243
289
|
handler: props.handler ?? this._handler,
|
|
244
290
|
retry: props.retry ?? this.retry
|
|
245
291
|
}).setStaticInputValues(props.staticInputValues ?? this._staticInputValues);
|
|
@@ -487,7 +533,7 @@ var Tool = class _Tool {
|
|
|
487
533
|
}
|
|
488
534
|
let output;
|
|
489
535
|
if (!this.output || Object.keys(this.output).length === 0) {
|
|
490
|
-
output =
|
|
536
|
+
output = z2.void();
|
|
491
537
|
} else {
|
|
492
538
|
try {
|
|
493
539
|
output = transforms.fromJSONSchema(this.output);
|
|
@@ -495,13 +541,13 @@ var Tool = class _Tool {
|
|
|
495
541
|
output = transforms.fromJSONSchemaLegacy(this.output);
|
|
496
542
|
}
|
|
497
543
|
}
|
|
498
|
-
if (input &&
|
|
544
|
+
if (input && z2.is.zuiObject(input.naked()) && typeof this._staticInputValues === "object" && !isEmpty_default(this._staticInputValues)) {
|
|
499
545
|
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
500
546
|
input = input.extend(inputExtensions);
|
|
501
547
|
} else if (this._staticInputValues !== void 0) {
|
|
502
548
|
input = convertObjectToZuiLiterals(this._staticInputValues);
|
|
503
549
|
}
|
|
504
|
-
const fnType =
|
|
550
|
+
const fnType = z2.function(input, z2.promise(output)).title(this.name).describe(this.description ?? "");
|
|
505
551
|
return getTypings(fnType, {
|
|
506
552
|
declaration: true
|
|
507
553
|
});
|
|
@@ -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 = () => {
|
|
@@ -138,47 +135,6 @@ var stripInvalidIdentifiers = (object) => {
|
|
|
138
135
|
}
|
|
139
136
|
return pickBy_default(object, (__, key) => Identifier.safeParse(key).success);
|
|
140
137
|
};
|
|
141
|
-
var convertObjectToZuiLiterals = (obj, nested = false) => {
|
|
142
|
-
if (typeof obj === "string") {
|
|
143
|
-
return z.literal(obj).catch(() => obj);
|
|
144
|
-
}
|
|
145
|
-
if (typeof obj === "number") {
|
|
146
|
-
return z.literal(obj).catch(() => obj);
|
|
147
|
-
}
|
|
148
|
-
if (typeof obj === "boolean") {
|
|
149
|
-
return z.literal(obj).catch(() => obj);
|
|
150
|
-
}
|
|
151
|
-
if (Array.isArray(obj)) {
|
|
152
|
-
if (obj.length === 0) {
|
|
153
|
-
return z.tuple([]).catch(() => obj);
|
|
154
|
-
}
|
|
155
|
-
return z.tuple([
|
|
156
|
-
// the tuple needs to have at least one element
|
|
157
|
-
convertObjectToZuiLiterals(obj[0]),
|
|
158
|
-
...obj.slice(1).map((child) => convertObjectToZuiLiterals(child))
|
|
159
|
-
]).catch(() => obj);
|
|
160
|
-
}
|
|
161
|
-
if (obj !== null && typeof obj === "object") {
|
|
162
|
-
const shape = {};
|
|
163
|
-
for (const key in obj) {
|
|
164
|
-
shape[key] = convertObjectToZuiLiterals(obj[key], true);
|
|
165
|
-
}
|
|
166
|
-
if (nested) {
|
|
167
|
-
return z.object(shape).catch(() => shape);
|
|
168
|
-
}
|
|
169
|
-
if (Object.keys(shape).length === 0) {
|
|
170
|
-
return z.object({}).catch(() => shape);
|
|
171
|
-
}
|
|
172
|
-
return shape;
|
|
173
|
-
}
|
|
174
|
-
if (obj === void 0) {
|
|
175
|
-
return z.undefined().catch(() => void 0);
|
|
176
|
-
}
|
|
177
|
-
if (obj === null) {
|
|
178
|
-
return z.null().catch(() => null);
|
|
179
|
-
}
|
|
180
|
-
throw new Error(`Unsupported object type ${typeof obj}, ${obj})`);
|
|
181
|
-
};
|
|
182
138
|
var isValidSchema = (schema) => {
|
|
183
139
|
try {
|
|
184
140
|
transforms.fromJSONSchemaLegacy(schema);
|
|
@@ -219,7 +175,6 @@ export {
|
|
|
219
175
|
awaitObject,
|
|
220
176
|
toValidObjectName,
|
|
221
177
|
stripInvalidIdentifiers,
|
|
222
|
-
convertObjectToZuiLiterals,
|
|
223
178
|
isValidSchema,
|
|
224
179
|
isZuiSchema,
|
|
225
180
|
isJsonSchema,
|
|
@@ -6,11 +6,11 @@ var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
|
6
6
|
var _chunkCQ3UJW76cjs = require('./chunk-CQ3UJW76.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkGFSUTNRMcjs = require('./chunk-GFSUTNRM.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkNFZXJRXScjs = require('./chunk-NFZXJRXS.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -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 += _chunkNFZXJRXScjs.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 += _chunkNFZXJRXScjs.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 += _chunkNFZXJRXScjs.getTokenizer.call(void 0, ).count(result);
|
|
93
93
|
return result;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
const output =
|
|
96
|
+
const output = _chunkNFZXJRXScjs.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,9 +158,9 @@ function previewValue(value, length = LONG_TEXT_LENGTH) {
|
|
|
158
158
|
}
|
|
159
159
|
const previewStr = (str) => {
|
|
160
160
|
if (str.length > length) {
|
|
161
|
-
return
|
|
161
|
+
return _chunkNFZXJRXScjs.escapeString.call(void 0, str.slice(0, length)) + " ... <truncated>";
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return _chunkNFZXJRXScjs.escapeString.call(void 0, str);
|
|
164
164
|
};
|
|
165
165
|
const previewObj = (obj) => {
|
|
166
166
|
const mapped = _chunkHC2QZTVTcjs.mapKeys_default.call(void 0, obj, (_value, key) => previewStr(key));
|
|
@@ -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 (_chunkNFZXJRXScjs.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": _chunkGFSUTNRMcjs.wrapContent.call(void 0, dts, {
|
|
512
512
|
preserve: "both",
|
|
513
513
|
minTokens: 500
|
|
514
514
|
}),
|
|
515
|
-
identity:
|
|
515
|
+
identity: _chunkGFSUTNRMcjs.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: _chunkGFSUTNRMcjs.wrapContent.call(void 0, props.transcript.toString(), {
|
|
520
520
|
preserve: "bottom",
|
|
521
521
|
minTokens: 500
|
|
522
522
|
}),
|
|
@@ -525,7 +525,7 @@ ${variables_example}
|
|
|
525
525
|
writeable_vars: writeable_vars.join(", "),
|
|
526
526
|
variables_example,
|
|
527
527
|
exits,
|
|
528
|
-
components:
|
|
528
|
+
components: _chunkGFSUTNRMcjs.wrapContent.call(void 0,
|
|
529
529
|
props.components.map((component) => _chunkCQ3UJW76cjs.getComponentReference.call(void 0, component.definition)).join("\n\n"),
|
|
530
530
|
{
|
|
531
531
|
preserve: "top",
|
|
@@ -603,13 +603,13 @@ Code:
|
|
|
603
603
|
|
|
604
604
|
\`\`\`tsx
|
|
605
605
|
\u25A0fn_start
|
|
606
|
-
${
|
|
606
|
+
${_chunkGFSUTNRMcjs.wrapContent.call(void 0, props.code)}
|
|
607
607
|
\u25A0fn_end
|
|
608
608
|
\`\`\`
|
|
609
609
|
|
|
610
610
|
Error:
|
|
611
611
|
\`\`\`
|
|
612
|
-
${
|
|
612
|
+
${_chunkGFSUTNRMcjs.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
|
+
${_chunkGFSUTNRMcjs.wrapContent.call(void 0, props.message, { preserve: "top", flex: 4 })}
|
|
636
636
|
|
|
637
637
|
Stack Trace:
|
|
638
638
|
\`\`\`
|
|
639
|
-
${
|
|
639
|
+
${_chunkGFSUTNRMcjs.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.
|
|
@@ -659,7 +659,7 @@ var getThinkingMessage = async (props) => {
|
|
|
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 ${_chunkGFSUTNRMcjs.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 ${_chunkGFSUTNRMcjs.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
|
+
${_chunkGFSUTNRMcjs.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
|
+
// ${_chunkGFSUTNRMcjs.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
|
+
// ${_chunkGFSUTNRMcjs.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 = _chunkGFSUTNRMcjs.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
|
+
${_chunkGFSUTNRMcjs.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 = _chunkGFSUTNRMcjs.wrapContent.call(void 0, _nullishCoalesce(errorMessage.split("\n").join("\n * "), () => ( "Unknown Error")), {
|
|
768
768
|
preserve: "both",
|
|
769
769
|
minTokens: 100
|
|
770
770
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from '@bpinternal/zui';
|
|
2
|
+
export type StaticValue = string | number | boolean | null | undefined | readonly StaticValue[] | StaticObject;
|
|
3
|
+
export type StaticObject = {
|
|
4
|
+
readonly [key: string]: StaticValue;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Transforms static input values to Zui schemas that narrow manually provided values to literals.
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertObjectToZuiLiterals<T extends StaticObject>(obj: T, nested?: false): keyof T extends never ? z.ZodTypeAny : z.ZodRawShape;
|
|
10
|
+
export declare function convertObjectToZuiLiterals<T extends StaticValue>(obj: T, nested: true): z.ZodTypeAny;
|
|
11
|
+
export declare function convertObjectToZuiLiterals<T extends Exclude<StaticValue, StaticObject>>(obj: T, nested?: false): z.ZodTypeAny;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DualModePrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EADBCAE7.js";
|
|
4
4
|
import "./chunk-YEAWWJSJ.js";
|
|
5
5
|
import "./chunk-3T5IU7OU.js";
|
|
6
6
|
import "./chunk-XTEHT2TK.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-GEN6TAXY.js";
|
|
8
|
+
import "./chunk-ZHHB3FT4.js";
|
|
9
9
|
import "./chunk-34GJUS6U.js";
|
|
10
10
|
export {
|
|
11
11
|
DualModePrompt
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZVSO527Dcjs = require('./chunk-ZVSO527D.cjs');
|
|
4
4
|
require('./chunk-KIN7Y247.cjs');
|
|
5
5
|
require('./chunk-CQ3UJW76.cjs');
|
|
6
6
|
require('./chunk-5ZF6NTYI.cjs');
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-GFSUTNRM.cjs');
|
|
8
|
+
require('./chunk-NFZXJRXS.cjs');
|
|
9
9
|
require('./chunk-HC2QZTVT.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DualModePrompt =
|
|
12
|
+
exports.DualModePrompt = _chunkZVSO527Dcjs.DualModePrompt;
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
Snapshot,
|
|
9
9
|
SuccessExecutionResult,
|
|
10
10
|
parseExit
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-2XSXXGXJ.js";
|
|
12
|
+
import "./chunk-EADBCAE7.js";
|
|
13
|
+
import "./chunk-YTFNFSDT.js";
|
|
14
|
+
import "./chunk-PASYUKW4.js";
|
|
15
15
|
import {
|
|
16
16
|
AssignmentError,
|
|
17
17
|
CodeExecutionError,
|
|
@@ -25,17 +25,17 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
cleanStackTrace
|
|
27
27
|
} from "./chunk-YEAWWJSJ.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-TRWUQSEK.js";
|
|
29
29
|
import "./chunk-3T5IU7OU.js";
|
|
30
30
|
import "./chunk-XTEHT2TK.js";
|
|
31
31
|
import {
|
|
32
32
|
truncateWrappedContent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-GEN6TAXY.js";
|
|
34
34
|
import {
|
|
35
35
|
getErrorMessage,
|
|
36
36
|
init,
|
|
37
37
|
stripInvalidIdentifiers
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ZHHB3FT4.js";
|
|
39
39
|
import {
|
|
40
40
|
clamp_default,
|
|
41
41
|
isEqual_default,
|