llmz 0.0.78 → 0.0.80
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-6EAURSDP.js → chunk-2KRDL5AW.js} +1 -1
- package/dist/{chunk-3SZK4YSR.cjs → chunk-BSKF4J2E.cjs} +2 -2
- package/dist/{chunk-EXSETPV7.js → chunk-ESMRQVFC.js} +3 -3
- package/dist/{chunk-2JTZOTO5.cjs → chunk-QOM7BK7U.cjs} +25 -2
- package/dist/{chunk-G5INQ5LJ.js → chunk-UI6J4WKQ.js} +25 -2
- package/dist/{chunk-K2B5YEGJ.cjs → chunk-WDYTCDIK.cjs} +4 -0
- package/dist/{chunk-BFZJ4UV2.cjs → chunk-XLUYPCCY.cjs} +11 -11
- package/dist/{chunk-AMQFJRRX.js → chunk-YTDNCBQW.js} +4 -0
- package/dist/{component-EZAROCAF.js → component-DWFDDH5N.js} +1 -1
- package/dist/component-RVYDIBUM.cjs +18 -0
- package/dist/component.d.ts +3 -6
- package/dist/{dual-modes-EFWC4CAY.cjs → dual-modes-A4SC4APN.cjs} +3 -3
- package/dist/{dual-modes-ILL7OVJG.js → dual-modes-FNC3BGK3.js} +2 -2
- package/dist/index.cjs +20 -20
- package/dist/index.js +10 -10
- package/dist/{llmz-D4MQK65F.js → llmz-F227HVGB.js} +22 -9
- package/dist/{llmz-YPI4WWBW.cjs → llmz-XRURR7Z5.cjs} +32 -19
- package/dist/{tool-NCCTC74P.cjs → tool-A7EOCUQG.cjs} +2 -2
- package/dist/{tool-ZP6BC3P2.js → tool-FNWHZGDU.js} +1 -1
- package/dist/tool.d.ts +6 -3
- package/package.json +3 -3
- package/dist/component-36KG7B5H.cjs +0 -18
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkWDYTCDIKcjs = require('./chunk-WDYTCDIK.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkUCXQ4U7Pcjs = require('./chunk-UCXQ4U7P.cjs');
|
|
@@ -526,7 +526,7 @@ ${variables_example}
|
|
|
526
526
|
variables_example,
|
|
527
527
|
exits,
|
|
528
528
|
components: _chunkUCXQ4U7Pcjs.wrapContent.call(void 0,
|
|
529
|
-
props.components.map((component) =>
|
|
529
|
+
props.components.map((component) => _chunkWDYTCDIKcjs.getComponentReference.call(void 0, component.definition)).join("\n\n"),
|
|
530
530
|
{
|
|
531
531
|
preserve: "top",
|
|
532
532
|
minTokens: 500
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
DualModePrompt,
|
|
3
3
|
extractType,
|
|
4
4
|
inspect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2KRDL5AW.js";
|
|
6
6
|
import {
|
|
7
7
|
Tool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UI6J4WKQ.js";
|
|
9
9
|
import {
|
|
10
10
|
LoopExceededError
|
|
11
11
|
} from "./chunk-WSVDMGMR.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-E5YW5YQN.js";
|
|
15
15
|
import {
|
|
16
16
|
assertValidComponent
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YTDNCBQW.js";
|
|
18
18
|
import {
|
|
19
19
|
wrapContent
|
|
20
20
|
} from "./chunk-M4WTTARE.js";
|
|
@@ -391,6 +391,26 @@ var Tool = (_class = class _Tool {
|
|
|
391
391
|
this.setStaticInputValues(props.staticInputValues);
|
|
392
392
|
this.retry = props.retry;
|
|
393
393
|
}
|
|
394
|
+
async _executeHandler(input, ctx, chat, yieldedCount, setYieldedCount) {
|
|
395
|
+
var _a;
|
|
396
|
+
const handler = this._handler(input, ctx);
|
|
397
|
+
const isGen = typeof handler === "object" && handler !== null && "next" in handler;
|
|
398
|
+
if (!isGen) {
|
|
399
|
+
return handler;
|
|
400
|
+
}
|
|
401
|
+
let yieldIndex = 0;
|
|
402
|
+
while (true) {
|
|
403
|
+
const { value, done } = await handler.next();
|
|
404
|
+
if (done) {
|
|
405
|
+
return value;
|
|
406
|
+
}
|
|
407
|
+
if (yieldIndex >= yieldedCount) {
|
|
408
|
+
setYieldedCount(yieldIndex + 1);
|
|
409
|
+
await ((_a = chat == null ? void 0 : chat.handler) == null ? void 0 : _a.call(chat, value));
|
|
410
|
+
}
|
|
411
|
+
yieldIndex++;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
394
414
|
/**
|
|
395
415
|
* Executes the tool with the given input and context.
|
|
396
416
|
*
|
|
@@ -415,7 +435,7 @@ var Tool = (_class = class _Tool {
|
|
|
415
435
|
*
|
|
416
436
|
* @internal This method is primarily used internally by the LLMz execution engine
|
|
417
437
|
*/
|
|
418
|
-
async execute(rawInput, ctx) {
|
|
438
|
+
async execute(rawInput, ctx, chat) {
|
|
419
439
|
var _a;
|
|
420
440
|
const isZodObject = this.zInput._def.typeName === "ZodObject";
|
|
421
441
|
const input = isZodObject ? _nullishCoalesce(rawInput, () => ( {})) : rawInput;
|
|
@@ -424,9 +444,12 @@ var Tool = (_class = class _Tool {
|
|
|
424
444
|
throw new Error(`Tool "${this.name}" received invalid input: ${pInput.error.message}`);
|
|
425
445
|
}
|
|
426
446
|
let attempt = 0;
|
|
447
|
+
let yieldedCount = 0;
|
|
427
448
|
while (attempt < this.MAX_RETRIES) {
|
|
428
449
|
try {
|
|
429
|
-
const result = await this.
|
|
450
|
+
const result = await this._executeHandler(pInput.data, ctx, chat, yieldedCount, (n) => {
|
|
451
|
+
yieldedCount = n;
|
|
452
|
+
});
|
|
430
453
|
const pOutput = this.zOutput.safeParse(result);
|
|
431
454
|
return pOutput.success ? pOutput.data : result;
|
|
432
455
|
} catch (err) {
|
|
@@ -391,6 +391,26 @@ var Tool = class _Tool {
|
|
|
391
391
|
this.setStaticInputValues(props.staticInputValues);
|
|
392
392
|
this.retry = props.retry;
|
|
393
393
|
}
|
|
394
|
+
async _executeHandler(input, ctx, chat, yieldedCount, setYieldedCount) {
|
|
395
|
+
var _a;
|
|
396
|
+
const handler = this._handler(input, ctx);
|
|
397
|
+
const isGen = typeof handler === "object" && handler !== null && "next" in handler;
|
|
398
|
+
if (!isGen) {
|
|
399
|
+
return handler;
|
|
400
|
+
}
|
|
401
|
+
let yieldIndex = 0;
|
|
402
|
+
while (true) {
|
|
403
|
+
const { value, done } = await handler.next();
|
|
404
|
+
if (done) {
|
|
405
|
+
return value;
|
|
406
|
+
}
|
|
407
|
+
if (yieldIndex >= yieldedCount) {
|
|
408
|
+
setYieldedCount(yieldIndex + 1);
|
|
409
|
+
await ((_a = chat == null ? void 0 : chat.handler) == null ? void 0 : _a.call(chat, value));
|
|
410
|
+
}
|
|
411
|
+
yieldIndex++;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
394
414
|
/**
|
|
395
415
|
* Executes the tool with the given input and context.
|
|
396
416
|
*
|
|
@@ -415,7 +435,7 @@ var Tool = class _Tool {
|
|
|
415
435
|
*
|
|
416
436
|
* @internal This method is primarily used internally by the LLMz execution engine
|
|
417
437
|
*/
|
|
418
|
-
async execute(rawInput, ctx) {
|
|
438
|
+
async execute(rawInput, ctx, chat) {
|
|
419
439
|
var _a;
|
|
420
440
|
const isZodObject = this.zInput._def.typeName === "ZodObject";
|
|
421
441
|
const input = isZodObject ? rawInput ?? {} : rawInput;
|
|
@@ -424,9 +444,12 @@ var Tool = class _Tool {
|
|
|
424
444
|
throw new Error(`Tool "${this.name}" received invalid input: ${pInput.error.message}`);
|
|
425
445
|
}
|
|
426
446
|
let attempt = 0;
|
|
447
|
+
let yieldedCount = 0;
|
|
427
448
|
while (attempt < this.MAX_RETRIES) {
|
|
428
449
|
try {
|
|
429
|
-
const result = await this.
|
|
450
|
+
const result = await this._executeHandler(pInput.data, ctx, chat, yieldedCount, (n) => {
|
|
451
|
+
yieldedCount = n;
|
|
452
|
+
});
|
|
430
453
|
const pOutput = this.zOutput.safeParse(result);
|
|
431
454
|
return pOutput.success ? pOutput.data : result;
|
|
432
455
|
} catch (err) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
var _chunk54G63644cjs = require('./chunk-54G63644.cjs');
|
|
5
6
|
|
|
6
7
|
// src/component.ts
|
|
@@ -134,6 +135,9 @@ var Component = class {
|
|
|
134
135
|
assertValidComponent(definition);
|
|
135
136
|
this.definition = definition;
|
|
136
137
|
}
|
|
138
|
+
render(props, children = []) {
|
|
139
|
+
return _chunk54G63644cjs.createJsxComponent.call(void 0, { type: this.definition.name, props, children });
|
|
140
|
+
}
|
|
137
141
|
};
|
|
138
142
|
function isComponent(rendered, component) {
|
|
139
143
|
return _chunk54G63644cjs.isJsxComponent.call(void 0, component.definition.name, rendered);
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkBSKF4J2Ecjs = require('./chunk-BSKF4J2E.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkQOM7BK7Ucjs = require('./chunk-QOM7BK7U.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 _chunkF4OZHUMScjs = require('./chunk-F4OZHUMS.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkWDYTCDIKcjs = require('./chunk-WDYTCDIK.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunkUCXQ4U7Pcjs = require('./chunk-UCXQ4U7P.cjs');
|
|
@@ -493,10 +493,10 @@ var Snapshot = class _Snapshot {
|
|
|
493
493
|
};
|
|
494
494
|
function parseVariables(variableMap) {
|
|
495
495
|
return Object.entries(variableMap).map(([name, value]) => {
|
|
496
|
-
const type =
|
|
496
|
+
const type = _chunkBSKF4J2Ecjs.extractType.call(void 0, value);
|
|
497
497
|
const bytes = JSON.stringify(value || "").length;
|
|
498
498
|
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
499
|
-
return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(
|
|
499
|
+
return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunkBSKF4J2Ecjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
502
|
|
|
@@ -507,9 +507,9 @@ function getMessagePreview(message) {
|
|
|
507
507
|
return message.content;
|
|
508
508
|
}
|
|
509
509
|
if (message.role === "event") {
|
|
510
|
-
return
|
|
510
|
+
return _chunkBSKF4J2Ecjs.inspect.call(void 0, message.payload, message.name, { tokens: 1e3 });
|
|
511
511
|
}
|
|
512
|
-
return
|
|
512
|
+
return _chunkBSKF4J2Ecjs.inspect.call(void 0, message, void 0, { tokens: 1e3 });
|
|
513
513
|
}
|
|
514
514
|
function getMessageType(message) {
|
|
515
515
|
if (message.role === "assistant" || message.role === "user" || message.role === "summary") {
|
|
@@ -1103,7 +1103,7 @@ var Context = (_class2 = class {
|
|
|
1103
1103
|
|
|
1104
1104
|
|
|
1105
1105
|
|
|
1106
|
-
__init3() {this.version =
|
|
1106
|
+
__init3() {this.version = _chunkBSKF4J2Ecjs.DualModePrompt}
|
|
1107
1107
|
__init4() {this.timeout = 6e4}
|
|
1108
1108
|
// Default timeout of 60 seconds
|
|
1109
1109
|
|
|
@@ -1279,7 +1279,7 @@ var Context = (_class2 = class {
|
|
|
1279
1279
|
var _a, _b;
|
|
1280
1280
|
const instructions = await getValue(this.instructions, this);
|
|
1281
1281
|
const transcript = new TranscriptArray(await getValue(_nullishCoalesce(((_a = this.chat) == null ? void 0 : _a.transcript), () => ( [])), this));
|
|
1282
|
-
const tools =
|
|
1282
|
+
const tools = _chunkQOM7BK7Ucjs.Tool.withUniqueNames(await _asyncNullishCoalesce(await getValue(this.tools, this), async () => ( [])));
|
|
1283
1283
|
const objects = await _asyncNullishCoalesce(await getValue(this.objects, this), async () => ( []));
|
|
1284
1284
|
const exits = await _asyncNullishCoalesce(await getValue(this.exits, this), async () => ( []));
|
|
1285
1285
|
const components = await getValue(_nullishCoalesce(((_b = this.chat) == null ? void 0 : _b.components), () => ( [])), this);
|
|
@@ -1293,7 +1293,7 @@ var Context = (_class2 = class {
|
|
|
1293
1293
|
throw new Error("Too many tools. Expected at most 100 tools.");
|
|
1294
1294
|
}
|
|
1295
1295
|
for (const component of components) {
|
|
1296
|
-
|
|
1296
|
+
_chunkWDYTCDIKcjs.assertValidComponent.call(void 0, component.definition);
|
|
1297
1297
|
}
|
|
1298
1298
|
const ReservedToolNames = [
|
|
1299
1299
|
"think",
|
|
@@ -1312,7 +1312,7 @@ var Context = (_class2 = class {
|
|
|
1312
1312
|
"boolean",
|
|
1313
1313
|
"array"
|
|
1314
1314
|
];
|
|
1315
|
-
const MessageTool = this.chat && components.length ? new (0,
|
|
1315
|
+
const MessageTool = this.chat && components.length ? new (0, _chunkQOM7BK7Ucjs.Tool)({
|
|
1316
1316
|
name: "Message",
|
|
1317
1317
|
description: "Send a message to the user",
|
|
1318
1318
|
aliases: Array.from(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createJsxComponent,
|
|
2
3
|
isAnyJsxComponent,
|
|
3
4
|
isJsxComponent
|
|
4
5
|
} from "./chunk-UOPTKXLE.js";
|
|
@@ -134,6 +135,9 @@ var Component = class {
|
|
|
134
135
|
assertValidComponent(definition);
|
|
135
136
|
this.definition = definition;
|
|
136
137
|
}
|
|
138
|
+
render(props, children = []) {
|
|
139
|
+
return createJsxComponent({ type: this.definition.name, props, children });
|
|
140
|
+
}
|
|
137
141
|
};
|
|
138
142
|
function isComponent(rendered, component) {
|
|
139
143
|
return isJsxComponent(component.definition.name, rendered);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkWDYTCDIKcjs = require('./chunk-WDYTCDIK.cjs');
|
|
9
|
+
require('./chunk-54G63644.cjs');
|
|
10
|
+
require('./chunk-RKKRSBX3.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.Component = _chunkWDYTCDIKcjs.Component; exports.assertValidComponent = _chunkWDYTCDIKcjs.assertValidComponent; exports.getComponentReference = _chunkWDYTCDIKcjs.getComponentReference; exports.isAnyComponent = _chunkWDYTCDIKcjs.isAnyComponent; exports.isComponent = _chunkWDYTCDIKcjs.isComponent; exports.renderToTsx = _chunkWDYTCDIKcjs.renderToTsx;
|
package/dist/component.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from '@bpinternal/zui';
|
|
2
|
+
import { JsxComponent } from './jsx.js';
|
|
2
3
|
export type ExampleUsage = {
|
|
3
4
|
name: string;
|
|
4
5
|
description: string;
|
|
@@ -44,16 +45,12 @@ export type ContainerComponentDefinition<T extends z.ZodObject<any> = z.ZodObjec
|
|
|
44
45
|
};
|
|
45
46
|
export type ComponentDefinition = DefaultComponentDefinition | LeafComponentDefinition | ContainerComponentDefinition;
|
|
46
47
|
type ExtractComponentProps<T extends ComponentDefinition> = T extends LeafComponentDefinition<infer P> ? z.infer<P> : T extends ContainerComponentDefinition<infer P> ? z.infer<P> : T extends DefaultComponentDefinition<infer P> ? z.infer<P> : never;
|
|
47
|
-
export type RenderedComponent<TProps =
|
|
48
|
-
__jsx: true;
|
|
49
|
-
type: string;
|
|
50
|
-
children: any[];
|
|
51
|
-
props: TProps;
|
|
52
|
-
};
|
|
48
|
+
export type RenderedComponent<TProps extends {} = {}> = JsxComponent<string, TProps>;
|
|
53
49
|
export declare class Component<T extends ComponentDefinition = ComponentDefinition> {
|
|
54
50
|
readonly definition: T;
|
|
55
51
|
readonly propsType: ExtractComponentProps<T>;
|
|
56
52
|
constructor(definition: T);
|
|
53
|
+
render<TChildren extends any = any>(props: Component['propsType'], children?: Array<TChildren>): RenderedComponent;
|
|
57
54
|
}
|
|
58
55
|
export declare function isComponent<T extends ComponentDefinition>(rendered: RenderedComponent<any>, component: Component<T>): rendered is RenderedComponent<ExtractComponentProps<T>>;
|
|
59
56
|
export declare function isAnyComponent(message: unknown): message is RenderedComponent;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBSKF4J2Ecjs = require('./chunk-BSKF4J2E.cjs');
|
|
4
4
|
require('./chunk-KIN7Y247.cjs');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-WDYTCDIK.cjs');
|
|
6
6
|
require('./chunk-54G63644.cjs');
|
|
7
7
|
require('./chunk-UCXQ4U7P.cjs');
|
|
8
8
|
require('./chunk-4VYDQ3VF.cjs');
|
|
9
9
|
require('./chunk-RKKRSBX3.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DualModePrompt =
|
|
12
|
+
exports.DualModePrompt = _chunkBSKF4J2Ecjs.DualModePrompt;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DualModePrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2KRDL5AW.js";
|
|
4
4
|
import "./chunk-YEAWWJSJ.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-YTDNCBQW.js";
|
|
6
6
|
import "./chunk-UOPTKXLE.js";
|
|
7
7
|
import "./chunk-M4WTTARE.js";
|
|
8
8
|
import "./chunk-EKXZXQJB.js";
|
package/dist/index.cjs
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
12
|
+
var _chunkXLUYPCCYcjs = require('./chunk-XLUYPCCY.cjs');
|
|
13
|
+
require('./chunk-BSKF4J2E.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkQOM7BK7Ucjs = require('./chunk-QOM7BK7U.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -34,7 +34,7 @@ var _chunkF4OZHUMScjs = require('./chunk-F4OZHUMS.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkWDYTCDIKcjs = require('./chunk-WDYTCDIK.cjs');
|
|
38
38
|
require('./chunk-54G63644.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
@@ -53,7 +53,7 @@ var _chunk4VYDQ3VFcjs = require('./chunk-4VYDQ3VF.cjs');
|
|
|
53
53
|
var _chunkRKKRSBX3cjs = require('./chunk-RKKRSBX3.cjs');
|
|
54
54
|
|
|
55
55
|
// package.json
|
|
56
|
-
var version = "0.0.
|
|
56
|
+
var version = "0.0.80";
|
|
57
57
|
|
|
58
58
|
// src/objects.ts
|
|
59
59
|
var _zui = require('@bpinternal/zui');
|
|
@@ -431,7 +431,7 @@ var ObjectInstance = class {
|
|
|
431
431
|
this.description = props.description;
|
|
432
432
|
this.metadata = _nullishCoalesce(props.metadata, () => ( {}));
|
|
433
433
|
this.properties = props.properties;
|
|
434
|
-
this.tools =
|
|
434
|
+
this.tools = _chunkQOM7BK7Ucjs.Tool.withUniqueNames(_nullishCoalesce(props.tools, () => ( [])));
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
437
437
|
* Generates TypeScript namespace declarations for this object.
|
|
@@ -769,7 +769,7 @@ var CitationsManager = (_class = class {constructor() { _class.prototype.__init.
|
|
|
769
769
|
|
|
770
770
|
// src/component.default.ts
|
|
771
771
|
|
|
772
|
-
var Button = new (0,
|
|
772
|
+
var Button = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
773
773
|
type: "leaf",
|
|
774
774
|
description: "A button component that can perform actions when clicked",
|
|
775
775
|
name: "Button",
|
|
@@ -801,7 +801,7 @@ var Button = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
801
801
|
})
|
|
802
802
|
}
|
|
803
803
|
});
|
|
804
|
-
var Image = new (0,
|
|
804
|
+
var Image = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
805
805
|
type: "leaf",
|
|
806
806
|
name: "Image",
|
|
807
807
|
description: "Displays an image from a URL.",
|
|
@@ -823,7 +823,7 @@ var Image = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
823
823
|
})
|
|
824
824
|
}
|
|
825
825
|
});
|
|
826
|
-
var File = new (0,
|
|
826
|
+
var File = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
827
827
|
type: "leaf",
|
|
828
828
|
name: "File",
|
|
829
829
|
description: "Sends a downloadable file to the user.",
|
|
@@ -845,7 +845,7 @@ var File = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
845
845
|
})
|
|
846
846
|
}
|
|
847
847
|
});
|
|
848
|
-
var Video = new (0,
|
|
848
|
+
var Video = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
849
849
|
type: "leaf",
|
|
850
850
|
name: "Video",
|
|
851
851
|
description: "Embeds a video from a URL.",
|
|
@@ -867,7 +867,7 @@ var Video = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
867
867
|
})
|
|
868
868
|
}
|
|
869
869
|
});
|
|
870
|
-
var Audio = new (0,
|
|
870
|
+
var Audio = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
871
871
|
type: "leaf",
|
|
872
872
|
name: "Audio",
|
|
873
873
|
description: "Plays an audio clip from a URL.",
|
|
@@ -889,7 +889,7 @@ var Audio = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
889
889
|
})
|
|
890
890
|
}
|
|
891
891
|
});
|
|
892
|
-
var Card = new (0,
|
|
892
|
+
var Card = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
893
893
|
type: "container",
|
|
894
894
|
name: "Card",
|
|
895
895
|
description: "A visual card component that can include an image and buttons.",
|
|
@@ -925,7 +925,7 @@ var Card = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
925
925
|
]
|
|
926
926
|
}
|
|
927
927
|
});
|
|
928
|
-
var Carousel = new (0,
|
|
928
|
+
var Carousel = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
929
929
|
type: "container",
|
|
930
930
|
name: "Carousel",
|
|
931
931
|
description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
|
|
@@ -959,7 +959,7 @@ var Carousel = new (0, _chunkK2B5YEGJcjs.Component)({
|
|
|
959
959
|
]
|
|
960
960
|
}
|
|
961
961
|
});
|
|
962
|
-
var Text = new (0,
|
|
962
|
+
var Text = new (0, _chunkWDYTCDIKcjs.Component)({
|
|
963
963
|
type: "default",
|
|
964
964
|
name: "Message",
|
|
965
965
|
aliases: ["Text", "Markdown"],
|
|
@@ -1115,20 +1115,20 @@ var utils = {
|
|
|
1115
1115
|
truncateWrappedContent: _chunkUCXQ4U7Pcjs.truncateWrappedContent
|
|
1116
1116
|
};
|
|
1117
1117
|
var execute = async (props) => {
|
|
1118
|
-
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-
|
|
1118
|
+
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-XRURR7Z5.cjs")));
|
|
1119
1119
|
return executeContext(props);
|
|
1120
1120
|
};
|
|
1121
1121
|
var init = async () => {
|
|
1122
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-
|
|
1123
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./component-
|
|
1124
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-
|
|
1122
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./llmz-XRURR7Z5.cjs")));
|
|
1123
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./component-RVYDIBUM.cjs")));
|
|
1124
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-A7EOCUQG.cjs")));
|
|
1125
1125
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-OOGJ3TAS.cjs")));
|
|
1126
1126
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./jsx-ENFGHP6S.cjs")));
|
|
1127
1127
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./vm-CR5NE6NS.cjs")));
|
|
1128
1128
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./utils-BZUEJT4W.cjs")));
|
|
1129
1129
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./truncator-6M2EP2NZ.cjs")));
|
|
1130
1130
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-54UIN7ZR.cjs")));
|
|
1131
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-
|
|
1131
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-A4SC4APN.cjs")));
|
|
1132
1132
|
};
|
|
1133
1133
|
|
|
1134
1134
|
|
|
@@ -1159,4 +1159,4 @@ var init = async () => {
|
|
|
1159
1159
|
|
|
1160
1160
|
|
|
1161
1161
|
|
|
1162
|
-
exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component =
|
|
1162
|
+
exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkWDYTCDIKcjs.Component; exports.DefaultComponents = DefaultComponents; exports.DefaultExit = _chunkXLUYPCCYcjs.DefaultExit; exports.ErrorExecutionResult = _chunkXLUYPCCYcjs.ErrorExecutionResult; exports.ExecutionResult = _chunkXLUYPCCYcjs.ExecutionResult; exports.Exit = _chunkF4OZHUMScjs.Exit; exports.ListenExit = _chunkXLUYPCCYcjs.ListenExit; exports.LoopExceededError = _chunkPK72FAKDcjs.LoopExceededError; exports.ObjectInstance = ObjectInstance; exports.PartialExecutionResult = _chunkXLUYPCCYcjs.PartialExecutionResult; exports.Snapshot = _chunkXLUYPCCYcjs.Snapshot; exports.SnapshotSignal = _chunkPK72FAKDcjs.SnapshotSignal; exports.SuccessExecutionResult = _chunkXLUYPCCYcjs.SuccessExecutionResult; exports.ThinkExit = _chunkXLUYPCCYcjs.ThinkExit; exports.ThinkSignal = _chunkPK72FAKDcjs.ThinkSignal; exports.Tool = _chunkQOM7BK7Ucjs.Tool; exports.assertValidComponent = _chunkWDYTCDIKcjs.assertValidComponent; exports.execute = execute; exports.getValue = _chunkXLUYPCCYcjs.getValue; exports.init = init; exports.isAnyComponent = _chunkWDYTCDIKcjs.isAnyComponent; exports.isComponent = _chunkWDYTCDIKcjs.isComponent; exports.parseExit = _chunkXLUYPCCYcjs.parseExit; exports.renderToTsx = _chunkWDYTCDIKcjs.renderToTsx; exports.utils = utils; exports.version = version;
|
package/dist/index.js
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
ThinkExit,
|
|
10
10
|
getValue,
|
|
11
11
|
parseExit
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ESMRQVFC.js";
|
|
13
|
+
import "./chunk-2KRDL5AW.js";
|
|
14
14
|
import {
|
|
15
15
|
Tool
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UI6J4WKQ.js";
|
|
17
17
|
import {
|
|
18
18
|
formatTypings,
|
|
19
19
|
getTypings
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isAnyComponent,
|
|
35
35
|
isComponent,
|
|
36
36
|
renderToTsx
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-YTDNCBQW.js";
|
|
38
38
|
import "./chunk-UOPTKXLE.js";
|
|
39
39
|
import {
|
|
40
40
|
truncateWrappedContent,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
} from "./chunk-5XC6ZMS5.js";
|
|
54
54
|
|
|
55
55
|
// package.json
|
|
56
|
-
var version = "0.0.
|
|
56
|
+
var version = "0.0.80";
|
|
57
57
|
|
|
58
58
|
// src/objects.ts
|
|
59
59
|
import { z } from "@bpinternal/zui";
|
|
@@ -1115,20 +1115,20 @@ var utils = {
|
|
|
1115
1115
|
truncateWrappedContent
|
|
1116
1116
|
};
|
|
1117
1117
|
var execute = async (props) => {
|
|
1118
|
-
const { executeContext } = await import("./llmz-
|
|
1118
|
+
const { executeContext } = await import("./llmz-F227HVGB.js");
|
|
1119
1119
|
return executeContext(props);
|
|
1120
1120
|
};
|
|
1121
1121
|
var init = async () => {
|
|
1122
|
-
await import("./llmz-
|
|
1123
|
-
await import("./component-
|
|
1124
|
-
await import("./tool-
|
|
1122
|
+
await import("./llmz-F227HVGB.js");
|
|
1123
|
+
await import("./component-DWFDDH5N.js");
|
|
1124
|
+
await import("./tool-FNWHZGDU.js");
|
|
1125
1125
|
await import("./exit-56DISPLS.js");
|
|
1126
1126
|
await import("./jsx-PCXQVMLU.js");
|
|
1127
1127
|
await import("./vm-GDB4GW4S.js");
|
|
1128
1128
|
await import("./utils-D3J443FA.js");
|
|
1129
1129
|
await import("./truncator-2FSONJM2.js");
|
|
1130
1130
|
await import("./typings-DVMU3KVB.js");
|
|
1131
|
-
await import("./dual-modes-
|
|
1131
|
+
await import("./dual-modes-FNC3BGK3.js");
|
|
1132
1132
|
};
|
|
1133
1133
|
export {
|
|
1134
1134
|
Chat,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
Snapshot,
|
|
9
9
|
SuccessExecutionResult,
|
|
10
10
|
parseExit
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ESMRQVFC.js";
|
|
12
|
+
import "./chunk-2KRDL5AW.js";
|
|
13
|
+
import "./chunk-UI6J4WKQ.js";
|
|
14
14
|
import "./chunk-LR6KTFHO.js";
|
|
15
15
|
import {
|
|
16
16
|
AssignmentError,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
cleanStackTrace
|
|
28
28
|
} from "./chunk-YEAWWJSJ.js";
|
|
29
29
|
import "./chunk-E5YW5YQN.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-YTDNCBQW.js";
|
|
31
31
|
import "./chunk-UOPTKXLE.js";
|
|
32
32
|
import {
|
|
33
33
|
truncateWrappedContent
|
|
@@ -359,6 +359,7 @@ var executeIteration = async ({
|
|
|
359
359
|
}
|
|
360
360
|
for (const tool of obj.tools ?? []) {
|
|
361
361
|
instance[tool.name] = wrapTool({
|
|
362
|
+
chat: ctx.chat,
|
|
362
363
|
tool,
|
|
363
364
|
traces,
|
|
364
365
|
object: obj.name,
|
|
@@ -373,7 +374,15 @@ var executeIteration = async ({
|
|
|
373
374
|
vmContext[obj.name] = instance;
|
|
374
375
|
}
|
|
375
376
|
for (const tool of iteration.tools) {
|
|
376
|
-
const wrapped = wrapTool({
|
|
377
|
+
const wrapped = wrapTool({
|
|
378
|
+
chat: ctx.chat,
|
|
379
|
+
tool,
|
|
380
|
+
traces,
|
|
381
|
+
iteration,
|
|
382
|
+
beforeHook: onBeforeTool,
|
|
383
|
+
afterHook: onAfterTool,
|
|
384
|
+
controller
|
|
385
|
+
});
|
|
377
386
|
for (const key of [tool.name, ...tool.aliases ?? []]) {
|
|
378
387
|
vmContext[key] = wrapped;
|
|
379
388
|
}
|
|
@@ -522,7 +531,7 @@ var executeIteration = async ({
|
|
|
522
531
|
}
|
|
523
532
|
});
|
|
524
533
|
};
|
|
525
|
-
function wrapTool({ tool, traces, object, iteration, beforeHook, afterHook, controller }) {
|
|
534
|
+
function wrapTool({ chat, tool, traces, object, iteration, beforeHook, afterHook, controller }) {
|
|
526
535
|
const getToolInput = (input) => tool.zInput.safeParse(input).data ?? input;
|
|
527
536
|
return function(input) {
|
|
528
537
|
const toolCallId = `tcall_${ulid()}`;
|
|
@@ -582,9 +591,13 @@ function wrapTool({ tool, traces, object, iteration, beforeHook, afterHook, cont
|
|
|
582
591
|
if (typeof (beforeRes == null ? void 0 : beforeRes.input) !== "undefined") {
|
|
583
592
|
input2 = beforeRes.input;
|
|
584
593
|
}
|
|
585
|
-
let output2 = await tool.execute(
|
|
586
|
-
|
|
587
|
-
|
|
594
|
+
let output2 = await tool.execute(
|
|
595
|
+
input2,
|
|
596
|
+
{
|
|
597
|
+
callId: toolCallId
|
|
598
|
+
},
|
|
599
|
+
chat
|
|
600
|
+
);
|
|
588
601
|
const afterRes = await (afterHook == null ? void 0 : afterHook({
|
|
589
602
|
iteration,
|
|
590
603
|
tool,
|
|
@@ -8,9 +8,9 @@ var _chunk5CXOW4DCcjs = require('./chunk-5CXOW4DC.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
11
|
+
var _chunkXLUYPCCYcjs = require('./chunk-XLUYPCCY.cjs');
|
|
12
|
+
require('./chunk-BSKF4J2E.cjs');
|
|
13
|
+
require('./chunk-QOM7BK7U.cjs');
|
|
14
14
|
require('./chunk-BLB44ZDU.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
|
27
27
|
|
|
28
28
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
29
29
|
require('./chunk-F4OZHUMS.cjs');
|
|
30
|
-
require('./chunk-
|
|
30
|
+
require('./chunk-WDYTCDIK.cjs');
|
|
31
31
|
require('./chunk-54G63644.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
@@ -109,7 +109,7 @@ var _executeContext = async (props) => {
|
|
|
109
109
|
const client = _nullishCoalesce(props.client, () => ( new (0, _client.Client)()));
|
|
110
110
|
const cognitive = _cognitive.Cognitive.isCognitiveClient(client) ? client : new (0, _cognitive.Cognitive)({ client, __experimental_beta: true });
|
|
111
111
|
const cleanups = [];
|
|
112
|
-
const ctx = new (0,
|
|
112
|
+
const ctx = new (0, _chunkXLUYPCCYcjs.Context)({
|
|
113
113
|
chat: props.chat,
|
|
114
114
|
instructions: props.instructions,
|
|
115
115
|
objects: props.objects,
|
|
@@ -125,7 +125,7 @@ var _executeContext = async (props) => {
|
|
|
125
125
|
try {
|
|
126
126
|
while (true) {
|
|
127
127
|
if (ctx.iterations.length >= ctx.loop) {
|
|
128
|
-
return new (0,
|
|
128
|
+
return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, new (0, _chunkPK72FAKDcjs.LoopExceededError)());
|
|
129
129
|
}
|
|
130
130
|
const iteration = await ctx.nextIteration();
|
|
131
131
|
try {
|
|
@@ -148,7 +148,7 @@ var _executeContext = async (props) => {
|
|
|
148
148
|
reason: _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted"))
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
return new (0,
|
|
151
|
+
return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(controller.signal.reason, () => ( "The operation was aborted")));
|
|
152
152
|
}
|
|
153
153
|
cleanups.push(
|
|
154
154
|
iteration.traces.onPush((traces) => {
|
|
@@ -170,7 +170,7 @@ var _executeContext = async (props) => {
|
|
|
170
170
|
});
|
|
171
171
|
} catch (err) {
|
|
172
172
|
if (err instanceof _chunkPK72FAKDcjs.CognitiveError) {
|
|
173
|
-
return new (0,
|
|
173
|
+
return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, err);
|
|
174
174
|
}
|
|
175
175
|
iteration.end({
|
|
176
176
|
type: "execution_error",
|
|
@@ -187,25 +187,25 @@ var _executeContext = async (props) => {
|
|
|
187
187
|
}
|
|
188
188
|
if (iteration.status.type === "exit_success") {
|
|
189
189
|
const exitName = iteration.status.exit_success.exit_name;
|
|
190
|
-
return new (0,
|
|
190
|
+
return new (0, _chunkXLUYPCCYcjs.SuccessExecutionResult)(ctx, {
|
|
191
191
|
exit: iteration.exits.find((x) => x.name === exitName),
|
|
192
192
|
result: iteration.status.exit_success.return_value
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
if (iteration.status.type === "callback_requested") {
|
|
196
|
-
return new (0,
|
|
196
|
+
return new (0, _chunkXLUYPCCYcjs.PartialExecutionResult)(
|
|
197
197
|
ctx,
|
|
198
198
|
iteration.status.callback_requested.signal,
|
|
199
|
-
|
|
199
|
+
_chunkXLUYPCCYcjs.Snapshot.fromSignal(iteration.status.callback_requested.signal)
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
if (iteration.status.type === "thinking_requested" || iteration.status.type === "exit_error" || iteration.status.type === "execution_error" || iteration.status.type === "invalid_code_error") {
|
|
203
203
|
continue;
|
|
204
204
|
}
|
|
205
|
-
return new (0,
|
|
205
|
+
return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(iteration.error, () => ( `Unknown error. Status: ${iteration.status.type}`)));
|
|
206
206
|
}
|
|
207
207
|
} catch (error) {
|
|
208
|
-
return new (0,
|
|
208
|
+
return new (0, _chunkXLUYPCCYcjs.ErrorExecutionResult)(ctx, _nullishCoalesce(error, () => ( "Unknown error")));
|
|
209
209
|
} finally {
|
|
210
210
|
for (const cleanup of cleanups) {
|
|
211
211
|
try {
|
|
@@ -359,6 +359,7 @@ var executeIteration = async ({
|
|
|
359
359
|
}
|
|
360
360
|
for (const tool of _nullishCoalesce(obj.tools, () => ( []))) {
|
|
361
361
|
instance[tool.name] = wrapTool({
|
|
362
|
+
chat: ctx.chat,
|
|
362
363
|
tool,
|
|
363
364
|
traces,
|
|
364
365
|
object: obj.name,
|
|
@@ -373,7 +374,15 @@ var executeIteration = async ({
|
|
|
373
374
|
vmContext[obj.name] = instance;
|
|
374
375
|
}
|
|
375
376
|
for (const tool of iteration.tools) {
|
|
376
|
-
const wrapped = wrapTool({
|
|
377
|
+
const wrapped = wrapTool({
|
|
378
|
+
chat: ctx.chat,
|
|
379
|
+
tool,
|
|
380
|
+
traces,
|
|
381
|
+
iteration,
|
|
382
|
+
beforeHook: onBeforeTool,
|
|
383
|
+
afterHook: onAfterTool,
|
|
384
|
+
controller
|
|
385
|
+
});
|
|
377
386
|
for (const key of [tool.name, ..._nullishCoalesce(tool.aliases, () => ( []))]) {
|
|
378
387
|
vmContext[key] = wrapped;
|
|
379
388
|
}
|
|
@@ -486,7 +495,7 @@ var executeIteration = async ({
|
|
|
486
495
|
}
|
|
487
496
|
});
|
|
488
497
|
}
|
|
489
|
-
const parsedExit =
|
|
498
|
+
const parsedExit = _chunkXLUYPCCYcjs.parseExit.call(void 0, returnValue, iteration.exits);
|
|
490
499
|
if (!parsedExit.success) {
|
|
491
500
|
return iteration.end({
|
|
492
501
|
type: "exit_error",
|
|
@@ -522,7 +531,7 @@ var executeIteration = async ({
|
|
|
522
531
|
}
|
|
523
532
|
});
|
|
524
533
|
};
|
|
525
|
-
function wrapTool({ tool, traces, object, iteration, beforeHook, afterHook, controller }) {
|
|
534
|
+
function wrapTool({ chat, tool, traces, object, iteration, beforeHook, afterHook, controller }) {
|
|
526
535
|
const getToolInput = (input) => _nullishCoalesce(tool.zInput.safeParse(input).data, () => ( input));
|
|
527
536
|
return function(input) {
|
|
528
537
|
const toolCallId = `tcall_${_ulid.ulid.call(void 0, )}`;
|
|
@@ -582,9 +591,13 @@ function wrapTool({ tool, traces, object, iteration, beforeHook, afterHook, cont
|
|
|
582
591
|
if (typeof (beforeRes == null ? void 0 : beforeRes.input) !== "undefined") {
|
|
583
592
|
input2 = beforeRes.input;
|
|
584
593
|
}
|
|
585
|
-
let output2 = await tool.execute(
|
|
586
|
-
|
|
587
|
-
|
|
594
|
+
let output2 = await tool.execute(
|
|
595
|
+
input2,
|
|
596
|
+
{
|
|
597
|
+
callId: toolCallId
|
|
598
|
+
},
|
|
599
|
+
chat
|
|
600
|
+
);
|
|
588
601
|
const afterRes = await (afterHook == null ? void 0 : afterHook({
|
|
589
602
|
iteration,
|
|
590
603
|
tool,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQOM7BK7Ucjs = require('./chunk-QOM7BK7U.cjs');
|
|
4
4
|
require('./chunk-BLB44ZDU.cjs');
|
|
5
5
|
require('./chunk-PK72FAKD.cjs');
|
|
6
6
|
require('./chunk-KIN7Y247.cjs');
|
|
@@ -8,4 +8,4 @@ require('./chunk-4VYDQ3VF.cjs');
|
|
|
8
8
|
require('./chunk-RKKRSBX3.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.Tool =
|
|
11
|
+
exports.Tool = _chunkQOM7BK7Ucjs.Tool;
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TypeOf, z } from '@bpinternal/zui';
|
|
2
2
|
import { JSONSchema7 } from 'json-schema';
|
|
3
|
+
import { Chat } from './chat.js';
|
|
4
|
+
import { RenderedComponent } from './component.js';
|
|
3
5
|
import { Serializable } from './types.js';
|
|
4
6
|
/**
|
|
5
7
|
* Input parameters passed to tool retry functions.
|
|
@@ -349,7 +351,7 @@ export declare class Tool<I extends z.ZodType = z.ZodType, O extends z.ZodType =
|
|
|
349
351
|
input: IX | ((original: I | undefined) => IX);
|
|
350
352
|
output: OX | ((original: O | undefined) => OX);
|
|
351
353
|
staticInputValues?: SmartPartial<TypeOf<IX>>;
|
|
352
|
-
handler: (args: TypeOf<IX>, ctx: ToolCallContext) => Promise<TypeOf<OX>>;
|
|
354
|
+
handler: (args: TypeOf<IX>, ctx: ToolCallContext) => AsyncGenerator<RenderedComponent, TypeOf<OX>> | Promise<TypeOf<OX>>;
|
|
353
355
|
retry: ToolRetryFn<TypeOf<IX>>;
|
|
354
356
|
}>): Tool<IX, OX>;
|
|
355
357
|
private _handler;
|
|
@@ -437,9 +439,10 @@ export declare class Tool<I extends z.ZodType = z.ZodType, O extends z.ZodType =
|
|
|
437
439
|
input?: I;
|
|
438
440
|
output?: O;
|
|
439
441
|
staticInputValues?: Partial<TypeOf<I>>;
|
|
440
|
-
handler: (args: TypeOf<I>, ctx: ToolCallContext) => Promise<TypeOf<O>>;
|
|
442
|
+
handler: (args: TypeOf<I>, ctx: ToolCallContext) => AsyncGenerator<RenderedComponent, TypeOf<O>> | Promise<TypeOf<O>>;
|
|
441
443
|
retry?: ToolRetryFn<TypeOf<I>>;
|
|
442
444
|
});
|
|
445
|
+
private _executeHandler;
|
|
443
446
|
/**
|
|
444
447
|
* Executes the tool with the given input and context.
|
|
445
448
|
*
|
|
@@ -464,7 +467,7 @@ export declare class Tool<I extends z.ZodType = z.ZodType, O extends z.ZodType =
|
|
|
464
467
|
*
|
|
465
468
|
* @internal This method is primarily used internally by the LLMz execution engine
|
|
466
469
|
*/
|
|
467
|
-
execute(rawInput: TypeOf<I>, ctx: ToolCallContext): Promise<TypeOf<O>>;
|
|
470
|
+
execute(rawInput: TypeOf<I>, ctx: ToolCallContext, chat?: Chat): Promise<TypeOf<O>>;
|
|
468
471
|
/**
|
|
469
472
|
* Generates TypeScript type definitions for this tool.
|
|
470
473
|
*
|
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.80",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@botpress/client": "1.46.0",
|
|
75
|
-
"@botpress/cognitive": "0.
|
|
75
|
+
"@botpress/cognitive": "0.6.0",
|
|
76
76
|
"@bpinternal/thicktoken": "^2.0.0",
|
|
77
|
-
"@bpinternal/zui": "^2.
|
|
77
|
+
"@bpinternal/zui": "^2.3.0"
|
|
78
78
|
},
|
|
79
79
|
"dependenciesMeta": {
|
|
80
80
|
"@bpinternal/zui": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkK2B5YEGJcjs = require('./chunk-K2B5YEGJ.cjs');
|
|
9
|
-
require('./chunk-54G63644.cjs');
|
|
10
|
-
require('./chunk-RKKRSBX3.cjs');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
exports.Component = _chunkK2B5YEGJcjs.Component; exports.assertValidComponent = _chunkK2B5YEGJcjs.assertValidComponent; exports.getComponentReference = _chunkK2B5YEGJcjs.getComponentReference; exports.isAnyComponent = _chunkK2B5YEGJcjs.isAnyComponent; exports.isComponent = _chunkK2B5YEGJcjs.isComponent; exports.renderToTsx = _chunkK2B5YEGJcjs.renderToTsx;
|