llmz 0.0.33 → 0.0.34
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-U4HWJLF2.js → chunk-B42FGPCX.js} +1 -1
- package/dist/{chunk-4XIOQWVZ.cjs → chunk-B742DUFY.cjs} +36 -16
- package/dist/{chunk-AAHUDKBY.js → chunk-DOIKBDLR.js} +2 -2
- package/dist/{chunk-23SY6IDW.js → chunk-GXLMCQYF.js} +9 -8
- package/dist/{chunk-GGWM6X2K.js → chunk-HA52ORZL.js} +0 -2
- package/dist/{chunk-INDOGCAQ.cjs → chunk-KED57HR5.cjs} +1 -1
- package/dist/{chunk-SOEKWFU2.cjs → chunk-QR54TZ36.cjs} +10 -9
- package/dist/{chunk-5BEKU5MZ.cjs → chunk-QRFGEFRO.cjs} +3 -3
- package/dist/{chunk-ZRCU35UV.cjs → chunk-QY2TRWGK.cjs} +0 -2
- package/dist/{chunk-4JN4PPGP.js → chunk-RANA7NBF.js} +31 -11
- package/dist/component-AAEMNCHB.cjs +18 -0
- package/dist/{component-WFVDVSDK.js → component-EOMTLA64.js} +1 -1
- package/dist/{dual-modes-UBHAMQW4.cjs → dual-modes-MHUM2LEI.cjs} +3 -3
- package/dist/{dual-modes-LEAHGCOF.js → dual-modes-NJGSJEE4.js} +2 -2
- package/dist/index.cjs +43 -35
- package/dist/index.js +29 -21
- package/dist/{llmz-3E2JM3HM.js → llmz-HAHKYXAJ.js} +6 -5
- package/dist/{llmz-HGUVAYIN.cjs → llmz-YU4TWA2R.cjs} +15 -14
- package/dist/snapshots.d.ts +1 -1
- package/dist/{tool-7QXH6A24.js → tool-ADXBCB4R.js} +2 -2
- package/dist/{tool-JVLOALQN.cjs → tool-JYXLFJGQ.cjs} +3 -3
- package/dist/tool.d.ts +2 -2
- package/dist/{typings-OLI56LGT.cjs → typings-7C2RXO75.cjs} +2 -2
- package/dist/{typings-ALZEKGV6.js → typings-AQGJAMVH.js} +1 -1
- package/package.json +3 -2
- package/dist/component-R4WTW6DZ.cjs +0 -18
|
@@ -124,7 +124,7 @@ declare function ${schema.identifier}${typings};${closingTag}`);
|
|
|
124
124
|
declare const ${schema.identifier}: ${typings};${closingTag}`);
|
|
125
125
|
}
|
|
126
126
|
if (schema instanceof KeyValue) {
|
|
127
|
-
if (schema.value instanceof z.ZodOptional) {
|
|
127
|
+
if (schema.value instanceof z.ZodOptional || schema.value instanceof z.ZodDefault) {
|
|
128
128
|
let innerType = schema.value._def.innerType;
|
|
129
129
|
if (innerType instanceof z.Schema && !innerType.description && schema.value.description) {
|
|
130
130
|
innerType = innerType == null ? void 0 : innerType.describe(schema.value.description);
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQRFGEFROcjs = require('./chunk-QRFGEFRO.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkQR54TZ36cjs = require('./chunk-QR54TZ36.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
@@ -14,7 +14,7 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
|
14
14
|
var _chunk3G3BS5IAcjs = require('./chunk-3G3BS5IA.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkQY2TRWGKcjs = require('./chunk-QY2TRWGK.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunkGZPN7RGHcjs = require('./chunk-GZPN7RGH.cjs');
|
|
@@ -346,17 +346,11 @@ var Snapshot = class _Snapshot {
|
|
|
346
346
|
* @internal
|
|
347
347
|
*/
|
|
348
348
|
static fromSignal(signal) {
|
|
349
|
-
const variables = Object.entries(signal.variables).map(([name, value]) => {
|
|
350
|
-
const type = _chunk5BEKU5MZcjs.extractType.call(void 0, value);
|
|
351
|
-
const bytes = JSON.stringify(value || "").length;
|
|
352
|
-
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
353
|
-
return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunk5BEKU5MZcjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
|
|
354
|
-
});
|
|
355
349
|
return new _Snapshot({
|
|
356
350
|
id: "snapshot_" + _ulid.ulid.call(void 0, ),
|
|
357
351
|
reason: signal.message,
|
|
358
352
|
stack: signal.truncatedCode,
|
|
359
|
-
variables,
|
|
353
|
+
variables: parseVariables(signal.variables),
|
|
360
354
|
toolCall: signal.toolCall,
|
|
361
355
|
status: { type: "pending" }
|
|
362
356
|
});
|
|
@@ -453,9 +447,19 @@ var Snapshot = class _Snapshot {
|
|
|
453
447
|
* ```
|
|
454
448
|
*/
|
|
455
449
|
resolve(value) {
|
|
450
|
+
var _a;
|
|
456
451
|
if (this.#status.type !== "pending") {
|
|
457
452
|
throw new Error(`Cannot resolve snapshot because it is already settled: ${this.#status.type}`);
|
|
458
453
|
}
|
|
454
|
+
const assignment = (_a = this.toolCall) == null ? void 0 : _a.assignment;
|
|
455
|
+
if (assignment) {
|
|
456
|
+
try {
|
|
457
|
+
const fn = new Function(assignment.evalFn);
|
|
458
|
+
const assignmentValue = fn(value);
|
|
459
|
+
this.variables = [...this.variables, ...parseVariables(assignmentValue)];
|
|
460
|
+
} catch (e2) {
|
|
461
|
+
}
|
|
462
|
+
}
|
|
459
463
|
this.#status = { type: "resolved", value };
|
|
460
464
|
}
|
|
461
465
|
/**
|
|
@@ -487,6 +491,14 @@ var Snapshot = class _Snapshot {
|
|
|
487
491
|
this.#status = { type: "rejected", error };
|
|
488
492
|
}
|
|
489
493
|
};
|
|
494
|
+
function parseVariables(variableMap) {
|
|
495
|
+
return Object.entries(variableMap).map(([name, value]) => {
|
|
496
|
+
const type = _chunkQRFGEFROcjs.extractType.call(void 0, value);
|
|
497
|
+
const bytes = JSON.stringify(value || "").length;
|
|
498
|
+
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
499
|
+
return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunkQRFGEFROcjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
|
|
500
|
+
});
|
|
501
|
+
}
|
|
490
502
|
|
|
491
503
|
// src/transcript.ts
|
|
492
504
|
var MAX_MESSAGE_LENGTH = 5e3;
|
|
@@ -495,9 +507,9 @@ function getMessagePreview(message) {
|
|
|
495
507
|
return message.content;
|
|
496
508
|
}
|
|
497
509
|
if (message.role === "event") {
|
|
498
|
-
return
|
|
510
|
+
return _chunkQRFGEFROcjs.inspect.call(void 0, message.payload, message.name, { tokens: 1e3 });
|
|
499
511
|
}
|
|
500
|
-
return
|
|
512
|
+
return _chunkQRFGEFROcjs.inspect.call(void 0, message, void 0, { tokens: 1e3 });
|
|
501
513
|
}
|
|
502
514
|
function getMessageType(message) {
|
|
503
515
|
if (message.role === "assistant" || message.role === "user" || message.role === "summary") {
|
|
@@ -1086,7 +1098,7 @@ var Context = (_class2 = class {
|
|
|
1086
1098
|
|
|
1087
1099
|
|
|
1088
1100
|
|
|
1089
|
-
__init3() {this.version =
|
|
1101
|
+
__init3() {this.version = _chunkQRFGEFROcjs.DualModePrompt}
|
|
1090
1102
|
__init4() {this.timeout = 6e4}
|
|
1091
1103
|
// Default timeout of 60 seconds
|
|
1092
1104
|
|
|
@@ -1117,6 +1129,7 @@ var Context = (_class2 = class {
|
|
|
1117
1129
|
return iteration;
|
|
1118
1130
|
}
|
|
1119
1131
|
_getIterationVariables() {
|
|
1132
|
+
var _a;
|
|
1120
1133
|
const lastIteration = this.iterations.at(-1);
|
|
1121
1134
|
const variables = {};
|
|
1122
1135
|
if ((lastIteration == null ? void 0 : lastIteration.status.type) === "thinking_requested") {
|
|
@@ -1128,6 +1141,13 @@ var Context = (_class2 = class {
|
|
|
1128
1141
|
if (_chunkUQOBUJIQcjs.isPlainObject_default.call(void 0, lastIteration == null ? void 0 : lastIteration.variables)) {
|
|
1129
1142
|
Object.assign(variables, _chunkUQOBUJIQcjs.cloneDeep_default.call(void 0, _nullishCoalesce((lastIteration == null ? void 0 : lastIteration.variables), () => ( {}))));
|
|
1130
1143
|
}
|
|
1144
|
+
if (((_a = this.snapshot) == null ? void 0 : _a.status.type) === "resolved") {
|
|
1145
|
+
for (const v of this.snapshot.variables) {
|
|
1146
|
+
if (!v.truncated && v.value !== void 0) {
|
|
1147
|
+
variables[v.name] = v.value;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1131
1151
|
return variables;
|
|
1132
1152
|
}
|
|
1133
1153
|
async _getIterationMessages(parameters) {
|
|
@@ -1254,7 +1274,7 @@ var Context = (_class2 = class {
|
|
|
1254
1274
|
var _a, _b;
|
|
1255
1275
|
const instructions = await getValue(this.instructions, this);
|
|
1256
1276
|
const transcript = new TranscriptArray(await getValue(_nullishCoalesce(((_a = this.chat) == null ? void 0 : _a.transcript), () => ( [])), this));
|
|
1257
|
-
const tools =
|
|
1277
|
+
const tools = _chunkQR54TZ36cjs.Tool.withUniqueNames(await _asyncNullishCoalesce(await getValue(this.tools, this), async () => ( [])));
|
|
1258
1278
|
const objects = await _asyncNullishCoalesce(await getValue(this.objects, this), async () => ( []));
|
|
1259
1279
|
const exits = await _asyncNullishCoalesce(await getValue(this.exits, this), async () => ( []));
|
|
1260
1280
|
const components = await getValue(_nullishCoalesce(((_b = this.chat) == null ? void 0 : _b.components), () => ( [])), this);
|
|
@@ -1267,7 +1287,7 @@ var Context = (_class2 = class {
|
|
|
1267
1287
|
throw new Error("Too many tools. Expected at most 100 tools.");
|
|
1268
1288
|
}
|
|
1269
1289
|
for (const component of components) {
|
|
1270
|
-
|
|
1290
|
+
_chunkQY2TRWGKcjs.assertValidComponent.call(void 0, component.definition);
|
|
1271
1291
|
}
|
|
1272
1292
|
const ReservedToolNames = [
|
|
1273
1293
|
"think",
|
|
@@ -1286,7 +1306,7 @@ var Context = (_class2 = class {
|
|
|
1286
1306
|
"boolean",
|
|
1287
1307
|
"array"
|
|
1288
1308
|
];
|
|
1289
|
-
const MessageTool = this.chat && components.length ? new (0,
|
|
1309
|
+
const MessageTool = this.chat && components.length ? new (0, _chunkQR54TZ36cjs.Tool)({
|
|
1290
1310
|
name: "Message",
|
|
1291
1311
|
description: "Send a message to the user",
|
|
1292
1312
|
aliases: Array.from(
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YEAWWJSJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getComponentReference
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HA52ORZL.js";
|
|
7
7
|
import {
|
|
8
8
|
wrapContent
|
|
9
9
|
} from "./chunk-3JYCCI4S.js";
|
|
@@ -449,7 +449,7 @@ var getSystemMessage = async (props) => {
|
|
|
449
449
|
|
|
450
450
|
`;
|
|
451
451
|
}
|
|
452
|
-
for (const tool of props.globalTools) {
|
|
452
|
+
for (const tool of props.globalTools.filter((t) => t.name.toLowerCase() !== "message")) {
|
|
453
453
|
dts += await tool.getTypings() + "\n";
|
|
454
454
|
tool_names.push(tool.name);
|
|
455
455
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTypings
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B42FGPCX.js";
|
|
4
4
|
import {
|
|
5
5
|
convertObjectToZuiLiterals,
|
|
6
6
|
isJsonSchema,
|
|
@@ -123,14 +123,15 @@ var Tool = class _Tool {
|
|
|
123
123
|
* @internal
|
|
124
124
|
*/
|
|
125
125
|
get zOutput() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
let output = z.void();
|
|
127
|
+
if (this.output) {
|
|
128
|
+
try {
|
|
129
|
+
output = transforms.fromJSONSchema(this.output);
|
|
130
|
+
} catch {
|
|
131
|
+
output = transforms.fromJSONSchemaLegacy(this.output);
|
|
132
|
+
}
|
|
133
133
|
}
|
|
134
|
+
return z.promise(output);
|
|
134
135
|
}
|
|
135
136
|
/**
|
|
136
137
|
* Renames the tool and updates its aliases.
|
|
@@ -121,8 +121,6 @@ ${example.code.trim()}
|
|
|
121
121
|
default:
|
|
122
122
|
doc += "**Props:**\n\n";
|
|
123
123
|
doc += getPropsDoc(component.default.props);
|
|
124
|
-
doc += "**Children:**\n\n";
|
|
125
|
-
doc += getChildrenDoc(component.default.children);
|
|
126
124
|
doc += getExamplesDoc(component.examples);
|
|
127
125
|
break;
|
|
128
126
|
}
|
|
@@ -124,7 +124,7 @@ declare function ${schema.identifier}${typings};${closingTag}`);
|
|
|
124
124
|
declare const ${schema.identifier}: ${typings};${closingTag}`);
|
|
125
125
|
}
|
|
126
126
|
if (schema instanceof KeyValue) {
|
|
127
|
-
if (schema.value instanceof _zui.z.ZodOptional) {
|
|
127
|
+
if (schema.value instanceof _zui.z.ZodOptional || schema.value instanceof _zui.z.ZodDefault) {
|
|
128
128
|
let innerType = schema.value._def.innerType;
|
|
129
129
|
if (innerType instanceof _zui.z.Schema && !innerType.description && schema.value.description) {
|
|
130
130
|
innerType = innerType == null ? void 0 : innerType.describe(schema.value.description);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKED57HR5cjs = require('./chunk-KED57HR5.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -123,14 +123,15 @@ var Tool = (_class = class _Tool {
|
|
|
123
123
|
* @internal
|
|
124
124
|
*/
|
|
125
125
|
get zOutput() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
let output = _zui.z.void();
|
|
127
|
+
if (this.output) {
|
|
128
|
+
try {
|
|
129
|
+
output = _zui.transforms.fromJSONSchema(this.output);
|
|
130
|
+
} catch (e3) {
|
|
131
|
+
output = _zui.transforms.fromJSONSchemaLegacy(this.output);
|
|
132
|
+
}
|
|
133
133
|
}
|
|
134
|
+
return _zui.z.promise(output);
|
|
134
135
|
}
|
|
135
136
|
/**
|
|
136
137
|
* Renames the tool and updates its aliases.
|
|
@@ -476,7 +477,7 @@ var Tool = (_class = class _Tool {
|
|
|
476
477
|
input = _chunkWHNOR4ZUcjs.convertObjectToZuiLiterals.call(void 0, this._staticInputValues);
|
|
477
478
|
}
|
|
478
479
|
const fnType = _zui.z.function(input, _zui.z.promise(output)).title(this.name).describe(_nullishCoalesce(this.description, () => ( "")));
|
|
479
|
-
return
|
|
480
|
+
return _chunkKED57HR5cjs.getTypings.call(void 0, fnType, {
|
|
480
481
|
declaration: true
|
|
481
482
|
});
|
|
482
483
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQY2TRWGKcjs = require('./chunk-QY2TRWGK.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkGZPN7RGHcjs = require('./chunk-GZPN7RGH.cjs');
|
|
@@ -449,7 +449,7 @@ var getSystemMessage = async (props) => {
|
|
|
449
449
|
|
|
450
450
|
`;
|
|
451
451
|
}
|
|
452
|
-
for (const tool of props.globalTools) {
|
|
452
|
+
for (const tool of props.globalTools.filter((t) => t.name.toLowerCase() !== "message")) {
|
|
453
453
|
dts += await tool.getTypings() + "\n";
|
|
454
454
|
tool_names.push(tool.name);
|
|
455
455
|
}
|
|
@@ -509,7 +509,7 @@ ${variables_example}
|
|
|
509
509
|
variables_example,
|
|
510
510
|
exits,
|
|
511
511
|
components: _chunkGZPN7RGHcjs.wrapContent.call(void 0,
|
|
512
|
-
props.components.map((component) =>
|
|
512
|
+
props.components.map((component) => _chunkQY2TRWGKcjs.getComponentReference.call(void 0, component.definition)).join("\n\n"),
|
|
513
513
|
{
|
|
514
514
|
preserve: "top",
|
|
515
515
|
minTokens: 500
|
|
@@ -121,8 +121,6 @@ ${example.code.trim()}
|
|
|
121
121
|
default:
|
|
122
122
|
doc += "**Props:**\n\n";
|
|
123
123
|
doc += getPropsDoc(component.default.props);
|
|
124
|
-
doc += "**Children:**\n\n";
|
|
125
|
-
doc += getChildrenDoc(component.default.children);
|
|
126
124
|
doc += getExamplesDoc(component.examples);
|
|
127
125
|
break;
|
|
128
126
|
}
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
DualModePrompt,
|
|
3
3
|
extractType,
|
|
4
4
|
inspect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DOIKBDLR.js";
|
|
6
6
|
import {
|
|
7
7
|
Tool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GXLMCQYF.js";
|
|
9
9
|
import {
|
|
10
10
|
LoopExceededError
|
|
11
11
|
} from "./chunk-WSVDMGMR.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-VPTFUOIK.js";
|
|
15
15
|
import {
|
|
16
16
|
assertValidComponent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HA52ORZL.js";
|
|
18
18
|
import {
|
|
19
19
|
wrapContent
|
|
20
20
|
} from "./chunk-3JYCCI4S.js";
|
|
@@ -315,8 +315,8 @@ var Snapshot = class _Snapshot {
|
|
|
315
315
|
id;
|
|
316
316
|
reason;
|
|
317
317
|
stack;
|
|
318
|
-
variables;
|
|
319
318
|
toolCall;
|
|
319
|
+
variables;
|
|
320
320
|
#status;
|
|
321
321
|
/**
|
|
322
322
|
* Gets the current status of the snapshot.
|
|
@@ -346,17 +346,11 @@ var Snapshot = class _Snapshot {
|
|
|
346
346
|
* @internal
|
|
347
347
|
*/
|
|
348
348
|
static fromSignal(signal) {
|
|
349
|
-
const variables = Object.entries(signal.variables).map(([name, value]) => {
|
|
350
|
-
const type = extractType(value);
|
|
351
|
-
const bytes = JSON.stringify(value || "").length;
|
|
352
|
-
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
353
|
-
return truncated ? { name, type, bytes, truncated: true, preview: inspect(value, name) ?? "N/A" } : { name, type, bytes, truncated: false, value };
|
|
354
|
-
});
|
|
355
349
|
return new _Snapshot({
|
|
356
350
|
id: "snapshot_" + ulid(),
|
|
357
351
|
reason: signal.message,
|
|
358
352
|
stack: signal.truncatedCode,
|
|
359
|
-
variables,
|
|
353
|
+
variables: parseVariables(signal.variables),
|
|
360
354
|
toolCall: signal.toolCall,
|
|
361
355
|
status: { type: "pending" }
|
|
362
356
|
});
|
|
@@ -453,9 +447,19 @@ var Snapshot = class _Snapshot {
|
|
|
453
447
|
* ```
|
|
454
448
|
*/
|
|
455
449
|
resolve(value) {
|
|
450
|
+
var _a;
|
|
456
451
|
if (this.#status.type !== "pending") {
|
|
457
452
|
throw new Error(`Cannot resolve snapshot because it is already settled: ${this.#status.type}`);
|
|
458
453
|
}
|
|
454
|
+
const assignment = (_a = this.toolCall) == null ? void 0 : _a.assignment;
|
|
455
|
+
if (assignment) {
|
|
456
|
+
try {
|
|
457
|
+
const fn = new Function(assignment.evalFn);
|
|
458
|
+
const assignmentValue = fn(value);
|
|
459
|
+
this.variables = [...this.variables, ...parseVariables(assignmentValue)];
|
|
460
|
+
} catch {
|
|
461
|
+
}
|
|
462
|
+
}
|
|
459
463
|
this.#status = { type: "resolved", value };
|
|
460
464
|
}
|
|
461
465
|
/**
|
|
@@ -487,6 +491,14 @@ var Snapshot = class _Snapshot {
|
|
|
487
491
|
this.#status = { type: "rejected", error };
|
|
488
492
|
}
|
|
489
493
|
};
|
|
494
|
+
function parseVariables(variableMap) {
|
|
495
|
+
return Object.entries(variableMap).map(([name, value]) => {
|
|
496
|
+
const type = extractType(value);
|
|
497
|
+
const bytes = JSON.stringify(value || "").length;
|
|
498
|
+
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
499
|
+
return truncated ? { name, type, bytes, truncated: true, preview: inspect(value, name) ?? "N/A" } : { name, type, bytes, truncated: false, value };
|
|
500
|
+
});
|
|
501
|
+
}
|
|
490
502
|
|
|
491
503
|
// src/transcript.ts
|
|
492
504
|
var MAX_MESSAGE_LENGTH = 5e3;
|
|
@@ -1117,6 +1129,7 @@ var Context = class {
|
|
|
1117
1129
|
return iteration;
|
|
1118
1130
|
}
|
|
1119
1131
|
_getIterationVariables() {
|
|
1132
|
+
var _a;
|
|
1120
1133
|
const lastIteration = this.iterations.at(-1);
|
|
1121
1134
|
const variables = {};
|
|
1122
1135
|
if ((lastIteration == null ? void 0 : lastIteration.status.type) === "thinking_requested") {
|
|
@@ -1128,6 +1141,13 @@ var Context = class {
|
|
|
1128
1141
|
if (isPlainObject_default(lastIteration == null ? void 0 : lastIteration.variables)) {
|
|
1129
1142
|
Object.assign(variables, cloneDeep_default((lastIteration == null ? void 0 : lastIteration.variables) ?? {}));
|
|
1130
1143
|
}
|
|
1144
|
+
if (((_a = this.snapshot) == null ? void 0 : _a.status.type) === "resolved") {
|
|
1145
|
+
for (const v of this.snapshot.variables) {
|
|
1146
|
+
if (!v.truncated && v.value !== void 0) {
|
|
1147
|
+
variables[v.name] = v.value;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1131
1151
|
return variables;
|
|
1132
1152
|
}
|
|
1133
1153
|
async _getIterationMessages(parameters) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkQY2TRWGKcjs = require('./chunk-QY2TRWGK.cjs');
|
|
9
|
+
require('./chunk-KMZDFWYZ.cjs');
|
|
10
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.Component = _chunkQY2TRWGKcjs.Component; exports.assertValidComponent = _chunkQY2TRWGKcjs.assertValidComponent; exports.getComponentReference = _chunkQY2TRWGKcjs.getComponentReference; exports.isAnyComponent = _chunkQY2TRWGKcjs.isAnyComponent; exports.isComponent = _chunkQY2TRWGKcjs.isComponent; exports.renderToTsx = _chunkQY2TRWGKcjs.renderToTsx;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQRFGEFROcjs = require('./chunk-QRFGEFRO.cjs');
|
|
4
4
|
require('./chunk-KIN7Y247.cjs');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-QY2TRWGK.cjs');
|
|
6
6
|
require('./chunk-KMZDFWYZ.cjs');
|
|
7
7
|
require('./chunk-GZPN7RGH.cjs');
|
|
8
8
|
require('./chunk-WHNOR4ZU.cjs');
|
|
9
9
|
require('./chunk-UQOBUJIQ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DualModePrompt =
|
|
12
|
+
exports.DualModePrompt = _chunkQRFGEFROcjs.DualModePrompt;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DualModePrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DOIKBDLR.js";
|
|
4
4
|
import "./chunk-YEAWWJSJ.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-HA52ORZL.js";
|
|
6
6
|
import "./chunk-ORQP26SZ.js";
|
|
7
7
|
import "./chunk-3JYCCI4S.js";
|
|
8
8
|
import "./chunk-ZORRILUV.js";
|
package/dist/index.cjs
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
12
|
+
var _chunkB742DUFYcjs = require('./chunk-B742DUFY.cjs');
|
|
13
|
+
require('./chunk-QRFGEFRO.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQR54TZ36cjs = require('./chunk-QR54TZ36.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkKED57HR5cjs = require('./chunk-KED57HR5.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -34,7 +34,7 @@ var _chunk3G3BS5IAcjs = require('./chunk-3G3BS5IA.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkQY2TRWGKcjs = require('./chunk-QY2TRWGK.cjs');
|
|
38
38
|
require('./chunk-KMZDFWYZ.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
@@ -302,7 +302,7 @@ async function hoistTypings(code, formatOptions) {
|
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
return
|
|
305
|
+
return _chunkKED57HR5cjs.formatTypings.call(void 0, code, formatOptions);
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
// src/objects.ts
|
|
@@ -428,7 +428,7 @@ var ObjectInstance = class {
|
|
|
428
428
|
this.description = props.description;
|
|
429
429
|
this.metadata = _nullishCoalesce(props.metadata, () => ( {}));
|
|
430
430
|
this.properties = props.properties;
|
|
431
|
-
this.tools =
|
|
431
|
+
this.tools = _chunkQR54TZ36cjs.Tool.withUniqueNames(_nullishCoalesce(props.tools, () => ( [])));
|
|
432
432
|
}
|
|
433
433
|
/**
|
|
434
434
|
* Generates TypeScript namespace declarations for this object.
|
|
@@ -509,7 +509,7 @@ function getObjectTypings(obj) {
|
|
|
509
509
|
}
|
|
510
510
|
let type = "unknown";
|
|
511
511
|
if (prop.type) {
|
|
512
|
-
type = await
|
|
512
|
+
type = await _chunkKED57HR5cjs.getTypings.call(void 0, prop.type, {});
|
|
513
513
|
} else if (prop.value !== void 0) {
|
|
514
514
|
type = typeof prop.value;
|
|
515
515
|
}
|
|
@@ -529,7 +529,7 @@ function getObjectTypings(obj) {
|
|
|
529
529
|
typings.push("");
|
|
530
530
|
for (const tool of obj.tools) {
|
|
531
531
|
const fnType = _zui.z.function(tool.zInput, tool.zOutput).title(tool.name).describe(_nullishCoalesce(tool.description, () => ( "")));
|
|
532
|
-
let temp = await
|
|
532
|
+
let temp = await _chunkKED57HR5cjs.getTypings.call(void 0, fnType, {
|
|
533
533
|
declaration: true
|
|
534
534
|
});
|
|
535
535
|
temp = temp.replace("declare function ", "function ");
|
|
@@ -552,7 +552,7 @@ function getObjectTypings(obj) {
|
|
|
552
552
|
if ((_a = obj.description) == null ? void 0 : _a.trim().length) {
|
|
553
553
|
header = _chunkWHNOR4ZUcjs.getMultilineComment.call(void 0, obj.description);
|
|
554
554
|
}
|
|
555
|
-
return
|
|
555
|
+
return _chunkKED57HR5cjs.formatTypings.call(void 0,
|
|
556
556
|
`${header}
|
|
557
557
|
export namespace ${obj.name} {
|
|
558
558
|
${body}
|
|
@@ -766,7 +766,7 @@ var CitationsManager = (_class = class {constructor() { _class.prototype.__init.
|
|
|
766
766
|
|
|
767
767
|
// src/component.default.ts
|
|
768
768
|
|
|
769
|
-
var Button = new (0,
|
|
769
|
+
var Button = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
770
770
|
type: "leaf",
|
|
771
771
|
description: "A button component that can perform actions when clicked",
|
|
772
772
|
name: "Button",
|
|
@@ -775,28 +775,30 @@ var Button = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
775
775
|
{
|
|
776
776
|
name: "Say action",
|
|
777
777
|
description: "A button that triggers a say action",
|
|
778
|
-
code:
|
|
778
|
+
code: `yield <Message>
|
|
779
779
|
<Button action="say" label="Hello" />
|
|
780
780
|
</Message>`
|
|
781
781
|
},
|
|
782
782
|
{
|
|
783
783
|
name: "Postback action",
|
|
784
784
|
description: "A button that sends a postback value",
|
|
785
|
-
code:
|
|
785
|
+
code: `yield <Message>
|
|
786
|
+
Choose an option:
|
|
786
787
|
<Button action="postback" label="Buy" value="buy_product" />
|
|
788
|
+
<Button action="postback" label="Buy" value="buy_product2" />
|
|
787
789
|
</Message>`
|
|
788
790
|
}
|
|
789
791
|
],
|
|
790
792
|
leaf: {
|
|
791
793
|
props: _zui.z.object({
|
|
792
794
|
action: _zui.z.enum(["say", "url", "postback"]).default("say").describe('The action to perform when the button is clicked. Can be "say", "url", or "postback"'),
|
|
793
|
-
label: _zui.z.string().describe("The text displayed on the button"),
|
|
795
|
+
label: _zui.z.string().describe("The text displayed on the button (min 1 character, max 250 characters)"),
|
|
794
796
|
value: _zui.z.string().optional().describe('The postback value to send when the button is clicked. Required if action is "postback"'),
|
|
795
797
|
url: _zui.z.string().optional().describe('The URL to open when the button is clicked. Required if action is "url"')
|
|
796
798
|
})
|
|
797
799
|
}
|
|
798
800
|
});
|
|
799
|
-
var Image = new (0,
|
|
801
|
+
var Image = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
800
802
|
type: "leaf",
|
|
801
803
|
name: "Image",
|
|
802
804
|
description: "Displays an image from a URL.",
|
|
@@ -805,7 +807,8 @@ var Image = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
805
807
|
{
|
|
806
808
|
name: "Basic image",
|
|
807
809
|
description: "A simple image with alt text",
|
|
808
|
-
code:
|
|
810
|
+
code: `yield <Message>
|
|
811
|
+
An example image:
|
|
809
812
|
<Image url="https://example.com/photo.jpg" alt="Example image" />
|
|
810
813
|
</Message>`
|
|
811
814
|
}
|
|
@@ -817,7 +820,7 @@ var Image = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
817
820
|
})
|
|
818
821
|
}
|
|
819
822
|
});
|
|
820
|
-
var File = new (0,
|
|
823
|
+
var File = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
821
824
|
type: "leaf",
|
|
822
825
|
name: "File",
|
|
823
826
|
description: "Sends a downloadable file to the user.",
|
|
@@ -826,7 +829,8 @@ var File = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
826
829
|
{
|
|
827
830
|
name: "PDF download",
|
|
828
831
|
description: "Send a PDF file with a name",
|
|
829
|
-
code:
|
|
832
|
+
code: `yield <Message>
|
|
833
|
+
Here is your report:
|
|
830
834
|
<File url="https://example.com/report.pdf" name="Report.pdf" />
|
|
831
835
|
</Message>`
|
|
832
836
|
}
|
|
@@ -838,7 +842,7 @@ var File = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
838
842
|
})
|
|
839
843
|
}
|
|
840
844
|
});
|
|
841
|
-
var Video = new (0,
|
|
845
|
+
var Video = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
842
846
|
type: "leaf",
|
|
843
847
|
name: "Video",
|
|
844
848
|
description: "Embeds a video from a URL.",
|
|
@@ -847,7 +851,8 @@ var Video = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
847
851
|
{
|
|
848
852
|
name: "Intro video",
|
|
849
853
|
description: "A video with a title",
|
|
850
|
-
code:
|
|
854
|
+
code: `yield <Message>
|
|
855
|
+
Watch this video:
|
|
851
856
|
<Video url="https://example.com/intro.mp4" title="Welcome" />
|
|
852
857
|
</Message>`
|
|
853
858
|
}
|
|
@@ -859,7 +864,7 @@ var Video = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
859
864
|
})
|
|
860
865
|
}
|
|
861
866
|
});
|
|
862
|
-
var Audio = new (0,
|
|
867
|
+
var Audio = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
863
868
|
type: "leaf",
|
|
864
869
|
name: "Audio",
|
|
865
870
|
description: "Plays an audio clip from a URL.",
|
|
@@ -868,7 +873,8 @@ var Audio = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
868
873
|
{
|
|
869
874
|
name: "Sample audio",
|
|
870
875
|
description: "Play a short audio clip with a title",
|
|
871
|
-
code:
|
|
876
|
+
code: `yield <Message>
|
|
877
|
+
Listen to this audio:
|
|
872
878
|
<Audio url="https://example.com/audio.mp3" title="Sample" />
|
|
873
879
|
</Message>`
|
|
874
880
|
}
|
|
@@ -880,7 +886,7 @@ var Audio = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
880
886
|
})
|
|
881
887
|
}
|
|
882
888
|
});
|
|
883
|
-
var Card = new (0,
|
|
889
|
+
var Card = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
884
890
|
type: "container",
|
|
885
891
|
name: "Card",
|
|
886
892
|
description: "A visual card component that can include an image and buttons.",
|
|
@@ -889,7 +895,8 @@ var Card = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
889
895
|
{
|
|
890
896
|
name: "Product card",
|
|
891
897
|
description: "A card with an image and two buttons",
|
|
892
|
-
code:
|
|
898
|
+
code: `yield <Message>
|
|
899
|
+
Featured product:
|
|
893
900
|
<Card title="Product Name" subtitle="Limited offer">
|
|
894
901
|
<Image url="https://example.com/product.jpg" alt="Product image" />
|
|
895
902
|
<Button action="postback" label="Buy" value="buy_product" />
|
|
@@ -915,7 +922,7 @@ var Card = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
915
922
|
]
|
|
916
923
|
}
|
|
917
924
|
});
|
|
918
|
-
var Carousel = new (0,
|
|
925
|
+
var Carousel = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
919
926
|
type: "container",
|
|
920
927
|
name: "Carousel",
|
|
921
928
|
description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
|
|
@@ -924,7 +931,8 @@ var Carousel = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
924
931
|
{
|
|
925
932
|
name: "Product carousel",
|
|
926
933
|
description: "A carousel with multiple cards",
|
|
927
|
-
code:
|
|
934
|
+
code: `yield <Message>
|
|
935
|
+
Here are some products you might like:
|
|
928
936
|
<Carousel>
|
|
929
937
|
<Card title="Item 1" subtitle="First product">
|
|
930
938
|
<Image url="https://example.com/item1.jpg" alt="Item 1" />
|
|
@@ -948,7 +956,7 @@ var Carousel = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
948
956
|
]
|
|
949
957
|
}
|
|
950
958
|
});
|
|
951
|
-
var Text = new (0,
|
|
959
|
+
var Text = new (0, _chunkQY2TRWGKcjs.Component)({
|
|
952
960
|
type: "default",
|
|
953
961
|
name: "Message",
|
|
954
962
|
aliases: ["Text", "Markdown"],
|
|
@@ -957,7 +965,7 @@ var Text = new (0, _chunkZRCU35UVcjs.Component)({
|
|
|
957
965
|
{
|
|
958
966
|
name: "Basic Markdown",
|
|
959
967
|
description: "Simple markdown content inside a message",
|
|
960
|
-
code:
|
|
968
|
+
code: `yield <Message>
|
|
961
969
|
**Hello**, welcome to our service!
|
|
962
970
|
</Message>`
|
|
963
971
|
}
|
|
@@ -1104,20 +1112,20 @@ var utils = {
|
|
|
1104
1112
|
truncateWrappedContent: _chunkGZPN7RGHcjs.truncateWrappedContent
|
|
1105
1113
|
};
|
|
1106
1114
|
var execute = async (props) => {
|
|
1107
|
-
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-
|
|
1115
|
+
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-YU4TWA2R.cjs")));
|
|
1108
1116
|
return executeContext(props);
|
|
1109
1117
|
};
|
|
1110
1118
|
var init = async () => {
|
|
1111
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-
|
|
1112
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./component-
|
|
1113
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-
|
|
1119
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-YU4TWA2R.cjs")));
|
|
1120
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./component-AAEMNCHB.cjs")));
|
|
1121
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-JYXLFJGQ.cjs")));
|
|
1114
1122
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-XAYKJ6TR.cjs")));
|
|
1115
1123
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./jsx-AJAXBWFE.cjs")));
|
|
1116
1124
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./vm-VFORKC54.cjs")));
|
|
1117
1125
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./utils-L5QAQXV2.cjs")));
|
|
1118
1126
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./truncator-W3NXBLYJ.cjs")));
|
|
1119
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-
|
|
1120
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-
|
|
1127
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-7C2RXO75.cjs")));
|
|
1128
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-MHUM2LEI.cjs")));
|
|
1121
1129
|
};
|
|
1122
1130
|
|
|
1123
1131
|
|
|
@@ -1147,4 +1155,4 @@ var init = async () => {
|
|
|
1147
1155
|
|
|
1148
1156
|
|
|
1149
1157
|
|
|
1150
|
-
exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component =
|
|
1158
|
+
exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkQY2TRWGKcjs.Component; exports.DefaultComponents = DefaultComponents; exports.DefaultExit = _chunkB742DUFYcjs.DefaultExit; exports.ErrorExecutionResult = _chunkB742DUFYcjs.ErrorExecutionResult; exports.ExecutionResult = _chunkB742DUFYcjs.ExecutionResult; exports.Exit = _chunk3G3BS5IAcjs.Exit; exports.ListenExit = _chunkB742DUFYcjs.ListenExit; exports.LoopExceededError = _chunkPK72FAKDcjs.LoopExceededError; exports.ObjectInstance = ObjectInstance; exports.PartialExecutionResult = _chunkB742DUFYcjs.PartialExecutionResult; exports.Snapshot = _chunkB742DUFYcjs.Snapshot; exports.SnapshotSignal = _chunkPK72FAKDcjs.SnapshotSignal; exports.SuccessExecutionResult = _chunkB742DUFYcjs.SuccessExecutionResult; exports.ThinkExit = _chunkB742DUFYcjs.ThinkExit; exports.ThinkSignal = _chunkPK72FAKDcjs.ThinkSignal; exports.Tool = _chunkQR54TZ36cjs.Tool; exports.assertValidComponent = _chunkQY2TRWGKcjs.assertValidComponent; exports.execute = execute; exports.getValue = _chunkB742DUFYcjs.getValue; exports.init = init; exports.isAnyComponent = _chunkQY2TRWGKcjs.isAnyComponent; exports.isComponent = _chunkQY2TRWGKcjs.isComponent; exports.parseExit = _chunkB742DUFYcjs.parseExit; exports.renderToTsx = _chunkQY2TRWGKcjs.renderToTsx; exports.utils = utils;
|
package/dist/index.js
CHANGED
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
ThinkExit,
|
|
10
10
|
getValue,
|
|
11
11
|
parseExit
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-RANA7NBF.js";
|
|
13
|
+
import "./chunk-DOIKBDLR.js";
|
|
14
14
|
import {
|
|
15
15
|
Tool
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GXLMCQYF.js";
|
|
17
17
|
import {
|
|
18
18
|
formatTypings,
|
|
19
19
|
getTypings
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-B42FGPCX.js";
|
|
21
21
|
import {
|
|
22
22
|
CodeFormattingError,
|
|
23
23
|
LoopExceededError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isAnyComponent,
|
|
35
35
|
isComponent,
|
|
36
36
|
renderToTsx
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HA52ORZL.js";
|
|
38
38
|
import "./chunk-ORQP26SZ.js";
|
|
39
39
|
import {
|
|
40
40
|
truncateWrappedContent,
|
|
@@ -775,22 +775,24 @@ var Button = new Component({
|
|
|
775
775
|
{
|
|
776
776
|
name: "Say action",
|
|
777
777
|
description: "A button that triggers a say action",
|
|
778
|
-
code:
|
|
778
|
+
code: `yield <Message>
|
|
779
779
|
<Button action="say" label="Hello" />
|
|
780
780
|
</Message>`
|
|
781
781
|
},
|
|
782
782
|
{
|
|
783
783
|
name: "Postback action",
|
|
784
784
|
description: "A button that sends a postback value",
|
|
785
|
-
code:
|
|
785
|
+
code: `yield <Message>
|
|
786
|
+
Choose an option:
|
|
786
787
|
<Button action="postback" label="Buy" value="buy_product" />
|
|
788
|
+
<Button action="postback" label="Buy" value="buy_product2" />
|
|
787
789
|
</Message>`
|
|
788
790
|
}
|
|
789
791
|
],
|
|
790
792
|
leaf: {
|
|
791
793
|
props: z2.object({
|
|
792
794
|
action: z2.enum(["say", "url", "postback"]).default("say").describe('The action to perform when the button is clicked. Can be "say", "url", or "postback"'),
|
|
793
|
-
label: z2.string().describe("The text displayed on the button"),
|
|
795
|
+
label: z2.string().describe("The text displayed on the button (min 1 character, max 250 characters)"),
|
|
794
796
|
value: z2.string().optional().describe('The postback value to send when the button is clicked. Required if action is "postback"'),
|
|
795
797
|
url: z2.string().optional().describe('The URL to open when the button is clicked. Required if action is "url"')
|
|
796
798
|
})
|
|
@@ -805,7 +807,8 @@ var Image = new Component({
|
|
|
805
807
|
{
|
|
806
808
|
name: "Basic image",
|
|
807
809
|
description: "A simple image with alt text",
|
|
808
|
-
code:
|
|
810
|
+
code: `yield <Message>
|
|
811
|
+
An example image:
|
|
809
812
|
<Image url="https://example.com/photo.jpg" alt="Example image" />
|
|
810
813
|
</Message>`
|
|
811
814
|
}
|
|
@@ -826,7 +829,8 @@ var File = new Component({
|
|
|
826
829
|
{
|
|
827
830
|
name: "PDF download",
|
|
828
831
|
description: "Send a PDF file with a name",
|
|
829
|
-
code:
|
|
832
|
+
code: `yield <Message>
|
|
833
|
+
Here is your report:
|
|
830
834
|
<File url="https://example.com/report.pdf" name="Report.pdf" />
|
|
831
835
|
</Message>`
|
|
832
836
|
}
|
|
@@ -847,7 +851,8 @@ var Video = new Component({
|
|
|
847
851
|
{
|
|
848
852
|
name: "Intro video",
|
|
849
853
|
description: "A video with a title",
|
|
850
|
-
code:
|
|
854
|
+
code: `yield <Message>
|
|
855
|
+
Watch this video:
|
|
851
856
|
<Video url="https://example.com/intro.mp4" title="Welcome" />
|
|
852
857
|
</Message>`
|
|
853
858
|
}
|
|
@@ -868,7 +873,8 @@ var Audio = new Component({
|
|
|
868
873
|
{
|
|
869
874
|
name: "Sample audio",
|
|
870
875
|
description: "Play a short audio clip with a title",
|
|
871
|
-
code:
|
|
876
|
+
code: `yield <Message>
|
|
877
|
+
Listen to this audio:
|
|
872
878
|
<Audio url="https://example.com/audio.mp3" title="Sample" />
|
|
873
879
|
</Message>`
|
|
874
880
|
}
|
|
@@ -889,7 +895,8 @@ var Card = new Component({
|
|
|
889
895
|
{
|
|
890
896
|
name: "Product card",
|
|
891
897
|
description: "A card with an image and two buttons",
|
|
892
|
-
code:
|
|
898
|
+
code: `yield <Message>
|
|
899
|
+
Featured product:
|
|
893
900
|
<Card title="Product Name" subtitle="Limited offer">
|
|
894
901
|
<Image url="https://example.com/product.jpg" alt="Product image" />
|
|
895
902
|
<Button action="postback" label="Buy" value="buy_product" />
|
|
@@ -924,7 +931,8 @@ var Carousel = new Component({
|
|
|
924
931
|
{
|
|
925
932
|
name: "Product carousel",
|
|
926
933
|
description: "A carousel with multiple cards",
|
|
927
|
-
code:
|
|
934
|
+
code: `yield <Message>
|
|
935
|
+
Here are some products you might like:
|
|
928
936
|
<Carousel>
|
|
929
937
|
<Card title="Item 1" subtitle="First product">
|
|
930
938
|
<Image url="https://example.com/item1.jpg" alt="Item 1" />
|
|
@@ -957,7 +965,7 @@ var Text = new Component({
|
|
|
957
965
|
{
|
|
958
966
|
name: "Basic Markdown",
|
|
959
967
|
description: "Simple markdown content inside a message",
|
|
960
|
-
code:
|
|
968
|
+
code: `yield <Message>
|
|
961
969
|
**Hello**, welcome to our service!
|
|
962
970
|
</Message>`
|
|
963
971
|
}
|
|
@@ -1104,20 +1112,20 @@ var utils = {
|
|
|
1104
1112
|
truncateWrappedContent
|
|
1105
1113
|
};
|
|
1106
1114
|
var execute = async (props) => {
|
|
1107
|
-
const { executeContext } = await import("./llmz-
|
|
1115
|
+
const { executeContext } = await import("./llmz-HAHKYXAJ.js");
|
|
1108
1116
|
return executeContext(props);
|
|
1109
1117
|
};
|
|
1110
1118
|
var init = async () => {
|
|
1111
|
-
await import("./llmz-
|
|
1112
|
-
await import("./component-
|
|
1113
|
-
await import("./tool-
|
|
1119
|
+
await import("./llmz-HAHKYXAJ.js");
|
|
1120
|
+
await import("./component-EOMTLA64.js");
|
|
1121
|
+
await import("./tool-ADXBCB4R.js");
|
|
1114
1122
|
await import("./exit-YLO7BY7Z.js");
|
|
1115
1123
|
await import("./jsx-AEHVFB3L.js");
|
|
1116
1124
|
await import("./vm-Y3WY2627.js");
|
|
1117
1125
|
await import("./utils-RQHQ2KOG.js");
|
|
1118
1126
|
await import("./truncator-BSP6PQPC.js");
|
|
1119
|
-
await import("./typings-
|
|
1120
|
-
await import("./dual-modes-
|
|
1127
|
+
await import("./typings-AQGJAMVH.js");
|
|
1128
|
+
await import("./dual-modes-NJGSJEE4.js");
|
|
1121
1129
|
};
|
|
1122
1130
|
export {
|
|
1123
1131
|
Chat,
|
|
@@ -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-RANA7NBF.js";
|
|
12
|
+
import "./chunk-DOIKBDLR.js";
|
|
13
|
+
import "./chunk-GXLMCQYF.js";
|
|
14
|
+
import "./chunk-B42FGPCX.js";
|
|
15
15
|
import {
|
|
16
16
|
AssignmentError,
|
|
17
17
|
CodeExecutionError,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
cleanStackTrace
|
|
28
28
|
} from "./chunk-YEAWWJSJ.js";
|
|
29
29
|
import "./chunk-VPTFUOIK.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-HA52ORZL.js";
|
|
31
31
|
import "./chunk-ORQP26SZ.js";
|
|
32
32
|
import {
|
|
33
33
|
truncateWrappedContent
|
|
@@ -236,6 +236,7 @@ var executeIteration = async ({
|
|
|
236
236
|
typeof x.content !== "string" || x.content.trim().length > 0
|
|
237
237
|
)
|
|
238
238
|
);
|
|
239
|
+
iteration.messages = messages;
|
|
239
240
|
traces.push({
|
|
240
241
|
type: "llm_call_started",
|
|
241
242
|
started_at: startedAt,
|
|
@@ -8,10 +8,10 @@ var _chunk5FWOHMO4cjs = require('./chunk-5FWOHMO4.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
11
|
+
var _chunkB742DUFYcjs = require('./chunk-B742DUFY.cjs');
|
|
12
|
+
require('./chunk-QRFGEFRO.cjs');
|
|
13
|
+
require('./chunk-QR54TZ36.cjs');
|
|
14
|
+
require('./chunk-KED57HR5.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
|
27
27
|
|
|
28
28
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
29
29
|
require('./chunk-3G3BS5IA.cjs');
|
|
30
|
-
require('./chunk-
|
|
30
|
+
require('./chunk-QY2TRWGK.cjs');
|
|
31
31
|
require('./chunk-KMZDFWYZ.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
@@ -107,7 +107,7 @@ var _executeContext = async (props) => {
|
|
|
107
107
|
const { onIterationStart, onIterationEnd, onTrace, onExit, onBeforeExecution, onAfterTool, onBeforeTool } = props;
|
|
108
108
|
const cognitive = _cognitive.Cognitive.isCognitiveClient(props.client) ? props.client : new (0, _cognitive.Cognitive)({ client: props.client });
|
|
109
109
|
const cleanups = [];
|
|
110
|
-
const ctx = new (0,
|
|
110
|
+
const ctx = new (0, _chunkB742DUFYcjs.Context)({
|
|
111
111
|
chat: props.chat,
|
|
112
112
|
instructions: props.instructions,
|
|
113
113
|
objects: props.objects,
|
|
@@ -122,7 +122,7 @@ var _executeContext = async (props) => {
|
|
|
122
122
|
try {
|
|
123
123
|
while (true) {
|
|
124
124
|
if (ctx.iterations.length >= ctx.loop) {
|
|
125
|
-
return new (0,
|
|
125
|
+
return new (0, _chunkB742DUFYcjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
|
|
126
126
|
}
|
|
127
127
|
const iteration = await ctx.nextIteration();
|
|
128
128
|
try {
|
|
@@ -145,7 +145,7 @@ var _executeContext = async (props) => {
|
|
|
145
145
|
reason: _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted"))
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
-
return new (0,
|
|
148
|
+
return new (0, _chunkB742DUFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
|
|
149
149
|
}
|
|
150
150
|
cleanups.push(
|
|
151
151
|
iteration.traces.onPush((traces) => {
|
|
@@ -181,25 +181,25 @@ var _executeContext = async (props) => {
|
|
|
181
181
|
}
|
|
182
182
|
if (iteration.status.type === "exit_success") {
|
|
183
183
|
const exitName = iteration.status.exit_success.exit_name;
|
|
184
|
-
return new (0,
|
|
184
|
+
return new (0, _chunkB742DUFYcjs.SuccessExecutionResult)(ctx, {
|
|
185
185
|
exit: iteration.exits.find((x) => x.name === exitName),
|
|
186
186
|
result: iteration.status.exit_success.return_value
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
if (iteration.status.type === "callback_requested") {
|
|
190
|
-
return new (0,
|
|
190
|
+
return new (0, _chunkB742DUFYcjs.PartialExecutionResult)(
|
|
191
191
|
ctx,
|
|
192
192
|
iteration.status.callback_requested.signal,
|
|
193
|
-
|
|
193
|
+
_chunkB742DUFYcjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
if (iteration.status.type === "thinking_requested" || iteration.status.type === "exit_error" || iteration.status.type === "execution_error" || iteration.status.type === "invalid_code_error") {
|
|
197
197
|
continue;
|
|
198
198
|
}
|
|
199
|
-
return new (0,
|
|
199
|
+
return new (0, _chunkB742DUFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)));
|
|
200
200
|
}
|
|
201
201
|
} catch (error) {
|
|
202
|
-
return new (0,
|
|
202
|
+
return new (0, _chunkB742DUFYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
|
|
203
203
|
} finally {
|
|
204
204
|
for (const cleanup of cleanups) {
|
|
205
205
|
try {
|
|
@@ -236,6 +236,7 @@ var executeIteration = async ({
|
|
|
236
236
|
typeof x.content !== "string" || x.content.trim().length > 0
|
|
237
237
|
)
|
|
238
238
|
);
|
|
239
|
+
iteration.messages = messages;
|
|
239
240
|
traces.push({
|
|
240
241
|
type: "llm_call_started",
|
|
241
242
|
started_at: startedAt,
|
|
@@ -471,7 +472,7 @@ var executeIteration = async ({
|
|
|
471
472
|
}
|
|
472
473
|
});
|
|
473
474
|
}
|
|
474
|
-
const parsedExit =
|
|
475
|
+
const parsedExit = _chunkB742DUFYcjs.parseExit.call(void 0, returnValue, iteration.exits);
|
|
475
476
|
if (!parsedExit.success) {
|
|
476
477
|
return iteration.end({
|
|
477
478
|
type: "exit_error",
|
package/dist/snapshots.d.ts
CHANGED
|
@@ -116,8 +116,8 @@ export declare class Snapshot implements Serializable<Snapshot.JSON> {
|
|
|
116
116
|
readonly id: string;
|
|
117
117
|
readonly reason?: string;
|
|
118
118
|
readonly stack: string;
|
|
119
|
-
readonly variables: Variable[];
|
|
120
119
|
readonly toolCall?: ToolCall;
|
|
120
|
+
variables: Variable[];
|
|
121
121
|
/**
|
|
122
122
|
* Gets the current status of the snapshot.
|
|
123
123
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkQR54TZ36cjs = require('./chunk-QR54TZ36.cjs');
|
|
4
|
+
require('./chunk-KED57HR5.cjs');
|
|
5
5
|
require('./chunk-PK72FAKD.cjs');
|
|
6
6
|
require('./chunk-KIN7Y247.cjs');
|
|
7
7
|
require('./chunk-WHNOR4ZU.cjs');
|
|
8
8
|
require('./chunk-UQOBUJIQ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.Tool =
|
|
11
|
+
exports.Tool = _chunkQR54TZ36cjs.Tool;
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypeOf } from '@bpinternal/zui';
|
|
1
|
+
import { TypeOf, z } from '@bpinternal/zui';
|
|
2
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
3
|
import { Serializable, ZuiType } from './types.js';
|
|
4
4
|
/**
|
|
@@ -269,7 +269,7 @@ export declare class Tool<I extends ZuiType = ZuiType, O extends ZuiType = ZuiTy
|
|
|
269
269
|
* @returns The Zui schema for output validation
|
|
270
270
|
* @internal
|
|
271
271
|
*/
|
|
272
|
-
get zOutput(): import("@bpinternal/zui").
|
|
272
|
+
get zOutput(): import("@bpinternal/zui").ZodPromise<z.Schema<any, import("@bpinternal/zui").ZodTypeDef, any>>;
|
|
273
273
|
/**
|
|
274
274
|
* Renames the tool and updates its aliases.
|
|
275
275
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKED57HR5cjs = require('./chunk-KED57HR5.cjs');
|
|
4
4
|
require('./chunk-PK72FAKD.cjs');
|
|
5
5
|
require('./chunk-KIN7Y247.cjs');
|
|
6
6
|
require('./chunk-WHNOR4ZU.cjs');
|
|
7
7
|
require('./chunk-UQOBUJIQ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.getTypings =
|
|
10
|
+
exports.getTypings = _chunkKED57HR5cjs.getTypings;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "llmz",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "LLMz – An LLM-native Typescript VM built on top of Zui",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.34",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"ulid": "^2.3.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@botpress/cli": "workspace:*",
|
|
52
53
|
"@microsoft/api-extractor": "^7.49.0",
|
|
53
54
|
"@types/babel__core": "^7.20.5",
|
|
54
55
|
"@types/babel__generator": "^7.6.8",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"@botpress/client": "1.27.2",
|
|
74
75
|
"@botpress/cognitive": "0.3.1",
|
|
75
76
|
"@bpinternal/thicktoken": "^1.0.5",
|
|
76
|
-
"@bpinternal/zui": "1.2.
|
|
77
|
+
"@bpinternal/zui": "1.2.3"
|
|
77
78
|
},
|
|
78
79
|
"dependenciesMeta": {
|
|
79
80
|
"@bpinternal/zui": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkZRCU35UVcjs = require('./chunk-ZRCU35UV.cjs');
|
|
9
|
-
require('./chunk-KMZDFWYZ.cjs');
|
|
10
|
-
require('./chunk-UQOBUJIQ.cjs');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.Component = _chunkZRCU35UVcjs.Component; exports.assertValidComponent = _chunkZRCU35UVcjs.assertValidComponent; exports.getComponentReference = _chunkZRCU35UVcjs.getComponentReference; exports.isAnyComponent = _chunkZRCU35UVcjs.isAnyComponent; exports.isComponent = _chunkZRCU35UVcjs.isComponent; exports.renderToTsx = _chunkZRCU35UVcjs.renderToTsx;
|