llmz 0.7.0 → 0.8.0
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/{_baseForOwn-buOZDFbK.cjs → _baseForOwn-BfWDTL8L.cjs} +0 -50
- package/dist/common-DdArNQhl.cjs +643 -0
- package/dist/common-pgJjFu2Y.js +596 -0
- package/dist/compiler-C-OI9sim.cjs +547 -0
- package/dist/compiler-CW1VjQsn.js +473 -0
- package/dist/{component-BwixNVH8.cjs → component-BXS8vAwO.cjs} +3 -3
- package/dist/{component-DGG7d_Mz.js → component-Dq7ZLdvy.js} +1 -1
- package/dist/component.d.ts +4 -4
- package/dist/component.default.d.ts +60 -87
- package/dist/component.default.test.d.ts +1 -0
- package/dist/context.d.ts +10 -0
- package/dist/{custom-client-CMuy7fXU.js → custom-client-2V9lmzUf.js} +119 -24
- package/dist/{custom-client-Bp1TgTKk.cjs → custom-client-HkM1Sdzv.cjs} +124 -29
- package/dist/{dual-modes-CfqTk9M8.cjs → dual-modes-Cb7ThvoV.cjs} +1268 -1062
- package/dist/{dual-modes-mNyMThtf.js → dual-modes-Cy0_W4O2.js} +1242 -1036
- package/dist/example.d.ts +45 -0
- package/dist/example.test.d.ts +1 -0
- package/dist/{execute-DP_17lYZ.js → execute-Aw4cbIx-.js} +23 -10
- package/dist/{execute-msui51b2.cjs → execute-COIHOIKR.cjs} +30 -18
- package/dist/{exit-BGi0Kk0y.cjs → exit-DUM96DN1.cjs} +3 -3
- package/dist/exit-parser.d.ts +2 -0
- package/dist/index.cjs +33 -356
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -337
- package/dist/index.workerd.js +9981 -9388
- package/dist/{jsx-CIgdGGVs.js → jsx-B0iYyvfr.js} +50 -2
- package/dist/{jsx-BWvT6ukg.cjs → jsx-D5Y2cPo-.cjs} +58 -4
- package/dist/message-stream/parser.d.ts +3 -0
- package/dist/message-stream/types.d.ts +1 -1
- package/dist/prompts/chat-mode/system.d.ts +2 -0
- package/dist/prompts/chat-mode/user.d.ts +2 -0
- package/dist/prompts/execution-history.d.ts +6 -0
- package/dist/prompts/execution-state.d.ts +3 -0
- package/dist/prompts/prompt.d.ts +26 -0
- package/dist/prompts/protocol.test.d.ts +1 -0
- package/dist/prompts/worker-mode/system.d.ts +2 -0
- package/dist/prompts/worker-mode/user.d.ts +2 -0
- package/dist/runtime/types.d.ts +9 -0
- package/dist/{tool-ReA9gxMp.cjs → tool-Dy6AJpJH.cjs} +4 -4
- package/dist/{truncator-B6aaJaN1.cjs → truncator-CLkouTCO.cjs} +3 -3
- package/dist/{typings-BwAz_TM9.cjs → typings-3lsqCbkn.cjs} +3 -3
- package/dist/{utils-ZpJm00ed.cjs → utils-3ESwP3yg.cjs} +2 -2
- package/dist/{vm-C5vf1LH3.js → vm-BLsHw1da.js} +3 -462
- package/dist/{vm-BjkJqSQH.cjs → vm-D6s1zF6M.cjs} +28 -489
- package/package.json +2 -2
- package/dist/isPlainObject-CSxXVKCk.cjs +0 -56
- package/dist/isPlainObject-D39AzPO2.js +0 -51
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Component } from './component.js';
|
|
2
|
+
import type { Exit } from './exit.js';
|
|
3
|
+
export type ExampleMessage = {
|
|
4
|
+
component: Component | string;
|
|
5
|
+
props?: Record<string, unknown>;
|
|
6
|
+
body?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Exactly one model response: messages followed by code or an exit. */
|
|
9
|
+
type ExampleResponse = {
|
|
10
|
+
messages?: ExampleMessage[];
|
|
11
|
+
} & ({
|
|
12
|
+
code: string;
|
|
13
|
+
exit?: never;
|
|
14
|
+
props?: never;
|
|
15
|
+
} | {
|
|
16
|
+
exit: Exit | string;
|
|
17
|
+
props?: Record<string, unknown>;
|
|
18
|
+
code?: never;
|
|
19
|
+
});
|
|
20
|
+
/** One hypothetical situation and the single response to produce in it. */
|
|
21
|
+
export type ExampleDefinition = {
|
|
22
|
+
/** Include the request, known facts, or previous tool results needed to understand this response. */
|
|
23
|
+
situation: string;
|
|
24
|
+
/** Optional explanation of why this response is appropriate. Context for the model, not generated output. */
|
|
25
|
+
reason?: string;
|
|
26
|
+
} & ExampleResponse;
|
|
27
|
+
/**
|
|
28
|
+
* Builds one protocol-correct response to one hypothetical situation.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* new Example({
|
|
32
|
+
* situation: 'The user asks a question that needs a knowledge-base search.',
|
|
33
|
+
* reason: 'Search first so the answer can use actual evidence.',
|
|
34
|
+
* code: 'return await searchKnowledge({ query: "reset password" })',
|
|
35
|
+
* })
|
|
36
|
+
*/
|
|
37
|
+
export declare class Example {
|
|
38
|
+
readonly situation: string;
|
|
39
|
+
readonly reason?: string;
|
|
40
|
+
readonly output: string;
|
|
41
|
+
constructor(definition: ExampleDefinition);
|
|
42
|
+
}
|
|
43
|
+
/** Internal prompt renderer. Checks examples against this iteration's component/exit catalog. */
|
|
44
|
+
export declare const renderExamples: (examples: readonly Example[], components: Component[], exits: Exit[]) => Promise<string>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { a as StreamingMessageParser,
|
|
2
|
-
import {
|
|
1
|
+
import { a as StreamingMessageParser, i as toParsedAssistantResponse } from "./common-pgJjFu2Y.js";
|
|
2
|
+
import { c as isEqual, f as toNumber } from "./dual-modes-Cy0_W4O2.js";
|
|
3
|
+
import { d as Snapshot, f as parseExit, l as PartialExecutionResult, n as Context, s as ErrorExecutionResult, t as _CustomModelClient, u as SuccessExecutionResult } from "./custom-client-2V9lmzUf.js";
|
|
3
4
|
import { d as stripInvalidIdentifiers, i as getErrorMessage, s as init } from "./utils-UBeAFeEI.js";
|
|
4
|
-
import { t as createJsxComponent } from "./jsx-
|
|
5
|
+
import { t as createJsxComponent } from "./jsx-B0iYyvfr.js";
|
|
5
6
|
import { t as cleanStackTrace } from "./stack-traces-BIE_5Xwf.js";
|
|
6
7
|
import { a as InvalidCodeError, c as SnapshotSignal, i as CognitiveError, l as ThinkSignal, n as CodeExecutionError, o as LoopExceededError, s as Signals, t as AssignmentError } from "./errors-Cg1G0Awu.js";
|
|
7
8
|
import { n as truncateWrappedContent } from "./truncator-DZqEqnpD.js";
|
|
8
|
-
import {
|
|
9
|
+
import { r as hasTopLevelReturn } from "./compiler-CW1VjQsn.js";
|
|
10
|
+
import { runAsyncFunction, warmupVM } from "./vm-BLsHw1da.js";
|
|
9
11
|
import { z } from "@bpinternal/zui";
|
|
10
12
|
import { ulid } from "ulid";
|
|
11
13
|
import { Client } from "@botpress/client";
|
|
@@ -217,6 +219,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
217
219
|
const liveContent = /* @__PURE__ */ new Map();
|
|
218
220
|
let codeGenerationTraced = false;
|
|
219
221
|
let runCompleted = false;
|
|
222
|
+
let awaitsRunResult = false;
|
|
220
223
|
const dispatchSends = async (events) => {
|
|
221
224
|
for (const event of events) if (event.type === "item-start") {
|
|
222
225
|
liveItems.set(event.item.id, event.item);
|
|
@@ -230,7 +233,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
230
233
|
}
|
|
231
234
|
} else if (event.type === "body-delta" && onSendDelta) {
|
|
232
235
|
const item = liveItems.get(event.itemId);
|
|
233
|
-
if ((item === null || item === void 0 ? void 0 : item.kind) !== "send") continue;
|
|
236
|
+
if ((item === null || item === void 0 ? void 0 : item.kind) !== "send" || awaitsRunResult) continue;
|
|
234
237
|
const content = (liveContent.get(item.id) ?? "") + event.delta;
|
|
235
238
|
liveContent.set(item.id, content);
|
|
236
239
|
const delta = {
|
|
@@ -243,7 +246,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
243
246
|
};
|
|
244
247
|
await preview(delta);
|
|
245
248
|
} else if (event.type === "item-complete") {
|
|
246
|
-
if (event.item.kind === "send" && onSend) await onSend({
|
|
249
|
+
if (event.item.kind === "send" && onSend && !awaitsRunResult) await onSend({
|
|
247
250
|
name: event.item.name,
|
|
248
251
|
props: event.item.props,
|
|
249
252
|
body: event.item.body
|
|
@@ -251,6 +254,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
251
254
|
else if (event.item.kind === "run" && event.item.status === "complete" && !runCompleted) {
|
|
252
255
|
runCompleted = true;
|
|
253
256
|
const code = (event.item.body ?? "").trim();
|
|
257
|
+
awaitsRunResult = hasTopLevelReturn(code);
|
|
254
258
|
onRunComplete === null || onRunComplete === void 0 || onRunComplete(code);
|
|
255
259
|
}
|
|
256
260
|
}
|
|
@@ -315,6 +319,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
315
319
|
liveContent.clear();
|
|
316
320
|
codeGenerationTraced = false;
|
|
317
321
|
runCompleted = false;
|
|
322
|
+
awaitsRunResult = false;
|
|
318
323
|
responseMetadata = void 0;
|
|
319
324
|
attempt = chunk.value.restart.attempt;
|
|
320
325
|
await preview({
|
|
@@ -396,6 +401,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
396
401
|
//#endregion
|
|
397
402
|
//#region src/runtime/interpret-result.ts
|
|
398
403
|
const interpretVMResult = async ({ iteration, result, controller, startedAt, onExit }) => {
|
|
404
|
+
Object.assign(iteration.variables, Object.fromEntries(Object.entries(result.variables ?? {}).filter(([, value]) => value !== "[[non-primitive]]")));
|
|
399
405
|
if (result.error && result.error instanceof InvalidCodeError) {
|
|
400
406
|
iteration.end({
|
|
401
407
|
type: "invalid_code_error",
|
|
@@ -443,7 +449,8 @@ const interpretVMResult = async ({ iteration, result, controller, startedAt, onE
|
|
|
443
449
|
thinking_requested: {
|
|
444
450
|
variables: result.signal.context,
|
|
445
451
|
reason: result.signal.reason,
|
|
446
|
-
metadata: result.signal.metadata
|
|
452
|
+
metadata: result.signal.metadata,
|
|
453
|
+
interrupted: true
|
|
447
454
|
}
|
|
448
455
|
});
|
|
449
456
|
return;
|
|
@@ -504,11 +511,14 @@ const applyNextExit = async ({ iteration, controller, onExit }) => {
|
|
|
504
511
|
value: parsedExit.success ? parsedExit.value : next.props
|
|
505
512
|
};
|
|
506
513
|
if (!parsedExit.success) {
|
|
514
|
+
var _parsedExit$validatio;
|
|
515
|
+
const details = (_parsedExit$validatio = parsedExit.validationErrors) === null || _parsedExit$validatio === void 0 ? void 0 : _parsedExit$validatio.join("; ");
|
|
516
|
+
const error = [parsedExit.error.split("\n")[0], details].filter(Boolean).join(". ");
|
|
507
517
|
iteration.end({
|
|
508
518
|
type: "exit_error",
|
|
509
519
|
exit_error: {
|
|
510
520
|
exit: next.name,
|
|
511
|
-
message:
|
|
521
|
+
message: `${error}. Received props: ${JSON.stringify(next.props)}. Choose an exit from <exits> and supply its required props as ONE JSON object on the SAME LINE as ■next=${next.name}. Do not use a JavaScript return statement or wrap the fields in "value" or "props".`,
|
|
512
522
|
return_value: returnValue
|
|
513
523
|
}
|
|
514
524
|
});
|
|
@@ -748,6 +758,7 @@ const executeContextInternal = async (props) => {
|
|
|
748
758
|
const ctx = new Context({
|
|
749
759
|
chat: props.chat,
|
|
750
760
|
instructions: props.instructions,
|
|
761
|
+
examples: props.examples,
|
|
751
762
|
objects: props.objects,
|
|
752
763
|
tools: props.tools,
|
|
753
764
|
loop: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.loop,
|
|
@@ -969,10 +980,12 @@ const executeIteration = async ({ iteration, ctx, cognitive, controller, onExit,
|
|
|
969
980
|
onSend: async (send, messageMetadata) => {
|
|
970
981
|
if (!ctx.chat) return;
|
|
971
982
|
const sendStartedAt = Date.now();
|
|
972
|
-
const
|
|
983
|
+
const registered = iteration.components.find((component) => component.definition.name.toLowerCase() === send.name);
|
|
984
|
+
const children = send.body ? [send.body] : [];
|
|
985
|
+
const component = registered ? registered.render(send.props, children) : createJsxComponent({
|
|
973
986
|
type: send.name,
|
|
974
987
|
props: send.props,
|
|
975
|
-
children
|
|
988
|
+
children
|
|
976
989
|
});
|
|
977
990
|
try {
|
|
978
991
|
await ctx.chat.handler(component, messageMetadata);
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_compiler = require("./compiler-C-OI9sim.cjs");
|
|
2
|
+
const require_common = require("./common-DdArNQhl.cjs");
|
|
3
|
+
const require_dual_modes = require("./dual-modes-Cb7ThvoV.cjs");
|
|
4
|
+
const require_custom_client = require("./custom-client-HkM1Sdzv.cjs");
|
|
5
|
+
const require_utils = require("./utils-3ESwP3yg.cjs");
|
|
6
|
+
const require_jsx = require("./jsx-D5Y2cPo-.cjs");
|
|
6
7
|
const require_stack_traces = require("./stack-traces-ntw_qhoy.cjs");
|
|
7
8
|
const require_errors = require("./errors-C962uJdS.cjs");
|
|
8
|
-
const require_truncator = require("./truncator-
|
|
9
|
-
const require_vm = require("./vm-
|
|
9
|
+
const require_truncator = require("./truncator-CLkouTCO.cjs");
|
|
10
|
+
const require_vm = require("./vm-D6s1zF6M.cjs");
|
|
10
11
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
11
12
|
let ulid = require("ulid");
|
|
12
13
|
let _botpress_client = require("@botpress/client");
|
|
13
14
|
let _botpress_cognitive = require("@botpress/cognitive");
|
|
14
15
|
let ms = require("ms");
|
|
15
|
-
ms =
|
|
16
|
+
ms = require_compiler.__toESM(ms, 1);
|
|
16
17
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClamp.js
|
|
17
18
|
/**
|
|
18
19
|
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
|
@@ -219,6 +220,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
219
220
|
const liveContent = /* @__PURE__ */ new Map();
|
|
220
221
|
let codeGenerationTraced = false;
|
|
221
222
|
let runCompleted = false;
|
|
223
|
+
let awaitsRunResult = false;
|
|
222
224
|
const dispatchSends = async (events) => {
|
|
223
225
|
for (const event of events) if (event.type === "item-start") {
|
|
224
226
|
liveItems.set(event.item.id, event.item);
|
|
@@ -232,7 +234,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
232
234
|
}
|
|
233
235
|
} else if (event.type === "body-delta" && onSendDelta) {
|
|
234
236
|
const item = liveItems.get(event.itemId);
|
|
235
|
-
if ((item === null || item === void 0 ? void 0 : item.kind) !== "send") continue;
|
|
237
|
+
if ((item === null || item === void 0 ? void 0 : item.kind) !== "send" || awaitsRunResult) continue;
|
|
236
238
|
const content = (liveContent.get(item.id) ?? "") + event.delta;
|
|
237
239
|
liveContent.set(item.id, content);
|
|
238
240
|
const delta = {
|
|
@@ -245,7 +247,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
245
247
|
};
|
|
246
248
|
await preview(delta);
|
|
247
249
|
} else if (event.type === "item-complete") {
|
|
248
|
-
if (event.item.kind === "send" && onSend) await onSend({
|
|
250
|
+
if (event.item.kind === "send" && onSend && !awaitsRunResult) await onSend({
|
|
249
251
|
name: event.item.name,
|
|
250
252
|
props: event.item.props,
|
|
251
253
|
body: event.item.body
|
|
@@ -253,12 +255,13 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
253
255
|
else if (event.item.kind === "run" && event.item.status === "complete" && !runCompleted) {
|
|
254
256
|
runCompleted = true;
|
|
255
257
|
const code = (event.item.body ?? "").trim();
|
|
258
|
+
awaitsRunResult = require_compiler.hasTopLevelReturn(code);
|
|
256
259
|
onRunComplete === null || onRunComplete === void 0 || onRunComplete(code);
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
};
|
|
260
263
|
if (typeof cognitive.generateTextStream === "function") {
|
|
261
|
-
let parser = new
|
|
264
|
+
let parser = new require_common.StreamingMessageParser();
|
|
262
265
|
let fence = new LeadingFenceFilter();
|
|
263
266
|
const streamController = createJoinedAbortController([controller.signal]);
|
|
264
267
|
const requestedAt = Date.now();
|
|
@@ -311,12 +314,13 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
311
314
|
...chunk.value.restart
|
|
312
315
|
});
|
|
313
316
|
raw = "";
|
|
314
|
-
parser = new
|
|
317
|
+
parser = new require_common.StreamingMessageParser();
|
|
315
318
|
fence = new LeadingFenceFilter();
|
|
316
319
|
liveItems.clear();
|
|
317
320
|
liveContent.clear();
|
|
318
321
|
codeGenerationTraced = false;
|
|
319
322
|
runCompleted = false;
|
|
323
|
+
awaitsRunResult = false;
|
|
320
324
|
responseMetadata = void 0;
|
|
321
325
|
attempt = chunk.value.restart.attempt;
|
|
322
326
|
await preview({
|
|
@@ -341,7 +345,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
341
345
|
const remaining = fence.flush();
|
|
342
346
|
if (remaining) await dispatchSends(parser.push(remaining));
|
|
343
347
|
await dispatchSends(parser.finish());
|
|
344
|
-
assistantResponse =
|
|
348
|
+
assistantResponse = require_common.toParsedAssistantResponse(parser.items, raw, parser.diagnostics);
|
|
345
349
|
} finally {
|
|
346
350
|
streamController.abort("LLM stream closed");
|
|
347
351
|
if (!streamCompleted) stream.return(void 0).catch((err) => {});
|
|
@@ -398,6 +402,7 @@ const generateCode = async ({ iteration, ctx, cognitive, controller, metadata, o
|
|
|
398
402
|
//#endregion
|
|
399
403
|
//#region src/runtime/interpret-result.ts
|
|
400
404
|
const interpretVMResult = async ({ iteration, result, controller, startedAt, onExit }) => {
|
|
405
|
+
Object.assign(iteration.variables, Object.fromEntries(Object.entries(result.variables ?? {}).filter(([, value]) => value !== "[[non-primitive]]")));
|
|
401
406
|
if (result.error && result.error instanceof require_errors.InvalidCodeError) {
|
|
402
407
|
iteration.end({
|
|
403
408
|
type: "invalid_code_error",
|
|
@@ -445,7 +450,8 @@ const interpretVMResult = async ({ iteration, result, controller, startedAt, onE
|
|
|
445
450
|
thinking_requested: {
|
|
446
451
|
variables: result.signal.context,
|
|
447
452
|
reason: result.signal.reason,
|
|
448
|
-
metadata: result.signal.metadata
|
|
453
|
+
metadata: result.signal.metadata,
|
|
454
|
+
interrupted: true
|
|
449
455
|
}
|
|
450
456
|
});
|
|
451
457
|
return;
|
|
@@ -458,7 +464,7 @@ const interpretVMResult = async ({ iteration, result, controller, startedAt, onE
|
|
|
458
464
|
return;
|
|
459
465
|
}
|
|
460
466
|
const returnValue = result.return_value;
|
|
461
|
-
const codeRequestsInspection =
|
|
467
|
+
const codeRequestsInspection = require_compiler.hasTopLevelReturn(iteration.code ?? "");
|
|
462
468
|
if (iteration.next && !codeRequestsInspection) {
|
|
463
469
|
await applyNextExit({
|
|
464
470
|
iteration,
|
|
@@ -506,11 +512,14 @@ const applyNextExit = async ({ iteration, controller, onExit }) => {
|
|
|
506
512
|
value: parsedExit.success ? parsedExit.value : next.props
|
|
507
513
|
};
|
|
508
514
|
if (!parsedExit.success) {
|
|
515
|
+
var _parsedExit$validatio;
|
|
516
|
+
const details = (_parsedExit$validatio = parsedExit.validationErrors) === null || _parsedExit$validatio === void 0 ? void 0 : _parsedExit$validatio.join("; ");
|
|
517
|
+
const error = [parsedExit.error.split("\n")[0], details].filter(Boolean).join(". ");
|
|
509
518
|
iteration.end({
|
|
510
519
|
type: "exit_error",
|
|
511
520
|
exit_error: {
|
|
512
521
|
exit: next.name,
|
|
513
|
-
message:
|
|
522
|
+
message: `${error}. Received props: ${JSON.stringify(next.props)}. Choose an exit from <exits> and supply its required props as ONE JSON object on the SAME LINE as ■next=${next.name}. Do not use a JavaScript return statement or wrap the fields in "value" or "props".`,
|
|
514
523
|
return_value: returnValue
|
|
515
524
|
}
|
|
516
525
|
});
|
|
@@ -750,6 +759,7 @@ const executeContextInternal = async (props) => {
|
|
|
750
759
|
const ctx = new require_custom_client.Context({
|
|
751
760
|
chat: props.chat,
|
|
752
761
|
instructions: props.instructions,
|
|
762
|
+
examples: props.examples,
|
|
753
763
|
objects: props.objects,
|
|
754
764
|
tools: props.tools,
|
|
755
765
|
loop: (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.loop,
|
|
@@ -971,10 +981,12 @@ const executeIteration = async ({ iteration, ctx, cognitive, controller, onExit,
|
|
|
971
981
|
onSend: async (send, messageMetadata) => {
|
|
972
982
|
if (!ctx.chat) return;
|
|
973
983
|
const sendStartedAt = Date.now();
|
|
974
|
-
const
|
|
984
|
+
const registered = iteration.components.find((component) => component.definition.name.toLowerCase() === send.name);
|
|
985
|
+
const children = send.body ? [send.body] : [];
|
|
986
|
+
const component = registered ? registered.render(send.props, children) : require_jsx.createJsxComponent({
|
|
975
987
|
type: send.name,
|
|
976
988
|
props: send.props,
|
|
977
|
-
children
|
|
989
|
+
children
|
|
978
990
|
});
|
|
979
991
|
try {
|
|
980
992
|
await ctx.chat.handler(component, messageMetadata);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_compiler = require("./compiler-C-OI9sim.cjs");
|
|
2
2
|
const require_uniq = require("./uniq-G872RWmE.cjs");
|
|
3
|
-
const require_utils = require("./utils-
|
|
3
|
+
const require_utils = require("./utils-3ESwP3yg.cjs");
|
|
4
4
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
5
5
|
//#region src/exit.ts
|
|
6
|
-
var exit_exports = /* @__PURE__ */
|
|
6
|
+
var exit_exports = /* @__PURE__ */ require_compiler.__exportAll({ Exit: () => Exit });
|
|
7
7
|
/**
|
|
8
8
|
* Defines how LLMz agent execution can terminate.
|
|
9
9
|
*
|
package/dist/exit-parser.d.ts
CHANGED