llmz 0.4.0 → 0.5.1
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-VC5IEFWI.js → chunk-4POZJQXN.js} +1 -1
- package/dist/{chunk-QDPE3KRX.cjs → chunk-5WBNTV42.cjs} +6 -6
- package/dist/{chunk-7CH23XHW.cjs → chunk-KTDBAJBB.cjs} +39 -14
- package/dist/{chunk-Q673NO2A.js → chunk-LOX7GOR6.js} +39 -14
- package/dist/component.d.ts +32 -0
- package/dist/component.default.d.ts +120 -64
- package/dist/{dual-modes-KZYB4L4M.js → dual-modes-S5TJ5JVJ.js} +1 -1
- package/dist/{dual-modes-FWUVU6C7.cjs → dual-modes-TCMWBZIH.cjs} +2 -2
- package/dist/{execute-4RIQATCY.js → execute-FF7D46TY.js} +2 -2
- package/dist/{execute-KHQ45ANS.cjs → execute-IK6O4SU2.cjs} +17 -17
- package/dist/index.cjs +75 -116
- package/dist/index.js +67 -108
- package/dist/index.workerd.js +96 -116
- package/dist/prompts/chat-mode/system.md.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk5WBNTV42cjs = require('./chunk-5WBNTV42.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkKTDBAJBBcjs = require('./chunk-KTDBAJBB.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkRGUG3UMFcjs = require('./chunk-RGUG3UMF.cjs');
|
|
@@ -69,7 +69,7 @@ var _chunkGOWPACSKcjs = require('./chunk-GOWPACSK.cjs');
|
|
|
69
69
|
var _chunkHC2QZTVTcjs = require('./chunk-HC2QZTVT.cjs');
|
|
70
70
|
|
|
71
71
|
// package.json
|
|
72
|
-
var version = "0.
|
|
72
|
+
var version = "0.5.1";
|
|
73
73
|
|
|
74
74
|
// src/objects.ts
|
|
75
75
|
var _zui = require('@bpinternal/zui');
|
|
@@ -738,24 +738,10 @@ var Button = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
738
738
|
description: "A button component that can perform actions when clicked",
|
|
739
739
|
name: "Button",
|
|
740
740
|
aliases: ["btn"],
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
code: `yield <Message>
|
|
746
|
-
<Button action="say" label="Hello" />
|
|
747
|
-
</Message>`
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
name: "Postback action",
|
|
751
|
-
description: "A button that sends a postback value",
|
|
752
|
-
code: `yield <Message>
|
|
753
|
-
Choose an option:
|
|
754
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
755
|
-
<Button action="postback" label="Buy" value="buy_product2" />
|
|
756
|
-
</Message>`
|
|
757
|
-
}
|
|
758
|
-
],
|
|
741
|
+
generation: {
|
|
742
|
+
usage: "Attach quick actions to a message, e.g. postback choices or a URL to open.",
|
|
743
|
+
examples: [{ props: { action: "postback", label: "Buy", value: "buy_product" } }]
|
|
744
|
+
},
|
|
759
745
|
leaf: {
|
|
760
746
|
props: _zui.z.object({
|
|
761
747
|
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"'),
|
|
@@ -770,16 +756,9 @@ var Image = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
770
756
|
name: "Image",
|
|
771
757
|
description: "Displays an image from a URL.",
|
|
772
758
|
aliases: [],
|
|
773
|
-
|
|
774
|
-
{
|
|
775
|
-
|
|
776
|
-
description: "A simple image with alt text",
|
|
777
|
-
code: `yield <Message>
|
|
778
|
-
An example image:
|
|
779
|
-
<Image url="https://example.com/photo.jpg" alt="Example image" />
|
|
780
|
-
</Message>`
|
|
781
|
-
}
|
|
782
|
-
],
|
|
759
|
+
generation: {
|
|
760
|
+
examples: [{ props: { url: "https://example.com/photo.jpg", alt: "Example image" } }]
|
|
761
|
+
},
|
|
783
762
|
leaf: {
|
|
784
763
|
props: _zui.z.object({
|
|
785
764
|
url: _zui.z.string().describe("The URL of the image (must be valid)"),
|
|
@@ -792,16 +771,9 @@ var File = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
792
771
|
name: "File",
|
|
793
772
|
description: "Sends a downloadable file to the user.",
|
|
794
773
|
aliases: [],
|
|
795
|
-
|
|
796
|
-
{
|
|
797
|
-
|
|
798
|
-
description: "Send a PDF file with a name",
|
|
799
|
-
code: `yield <Message>
|
|
800
|
-
Here is your report:
|
|
801
|
-
<File url="https://example.com/report.pdf" name="Report.pdf" />
|
|
802
|
-
</Message>`
|
|
803
|
-
}
|
|
804
|
-
],
|
|
774
|
+
generation: {
|
|
775
|
+
examples: [{ props: { url: "https://example.com/report.pdf", name: "Report.pdf" } }]
|
|
776
|
+
},
|
|
805
777
|
leaf: {
|
|
806
778
|
props: _zui.z.object({
|
|
807
779
|
url: _zui.z.string().describe("The URL of the file (must be valid)"),
|
|
@@ -814,16 +786,9 @@ var Video = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
814
786
|
name: "Video",
|
|
815
787
|
description: "Embeds a video from a URL.",
|
|
816
788
|
aliases: [],
|
|
817
|
-
|
|
818
|
-
{
|
|
819
|
-
|
|
820
|
-
description: "A video with a title",
|
|
821
|
-
code: `yield <Message>
|
|
822
|
-
Watch this video:
|
|
823
|
-
<Video url="https://example.com/intro.mp4" title="Welcome" />
|
|
824
|
-
</Message>`
|
|
825
|
-
}
|
|
826
|
-
],
|
|
789
|
+
generation: {
|
|
790
|
+
examples: [{ props: { url: "https://example.com/intro.mp4", title: "Welcome" } }]
|
|
791
|
+
},
|
|
827
792
|
leaf: {
|
|
828
793
|
props: _zui.z.object({
|
|
829
794
|
url: _zui.z.string().describe("The URL of the video (must be valid)"),
|
|
@@ -836,16 +801,9 @@ var Audio = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
836
801
|
name: "Audio",
|
|
837
802
|
description: "Plays an audio clip from a URL.",
|
|
838
803
|
aliases: [],
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
|
|
842
|
-
description: "Play a short audio clip with a title",
|
|
843
|
-
code: `yield <Message>
|
|
844
|
-
Listen to this audio:
|
|
845
|
-
<Audio url="https://example.com/audio.mp3" title="Sample" />
|
|
846
|
-
</Message>`
|
|
847
|
-
}
|
|
848
|
-
],
|
|
804
|
+
generation: {
|
|
805
|
+
examples: [{ props: { url: "https://example.com/audio.mp3", title: "Sample" } }]
|
|
806
|
+
},
|
|
849
807
|
leaf: {
|
|
850
808
|
props: _zui.z.object({
|
|
851
809
|
url: _zui.z.string().describe("The URL of the audio clip (must be valid)"),
|
|
@@ -858,20 +816,9 @@ var Card = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
858
816
|
name: "Card",
|
|
859
817
|
description: "A visual card component that can include an image and buttons.",
|
|
860
818
|
aliases: [],
|
|
861
|
-
|
|
862
|
-
{
|
|
863
|
-
|
|
864
|
-
description: "A card with an image and two buttons",
|
|
865
|
-
code: `yield <Message>
|
|
866
|
-
Featured product:
|
|
867
|
-
<Card title="Product Name" subtitle="Limited offer">
|
|
868
|
-
<Image url="https://example.com/product.jpg" alt="Product image" />
|
|
869
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
870
|
-
<Button action="postback" label="Wishlist" value="wishlist" />
|
|
871
|
-
</Card>
|
|
872
|
-
</Message>`
|
|
873
|
-
}
|
|
874
|
-
],
|
|
819
|
+
generation: {
|
|
820
|
+
examples: [{ props: { title: "Product Name", subtitle: "Limited offer" }, body: "Featured product of the week." }]
|
|
821
|
+
},
|
|
875
822
|
container: {
|
|
876
823
|
props: _zui.z.object({
|
|
877
824
|
title: _zui.z.string().min(1).max(250).describe("Title text (1\u2013250 characters)"),
|
|
@@ -894,25 +841,6 @@ var Carousel = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
894
841
|
name: "Carousel",
|
|
895
842
|
description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
|
|
896
843
|
aliases: [],
|
|
897
|
-
examples: [
|
|
898
|
-
{
|
|
899
|
-
name: "Product carousel",
|
|
900
|
-
description: "A carousel with multiple cards",
|
|
901
|
-
code: `yield <Message>
|
|
902
|
-
Here are some products you might like:
|
|
903
|
-
<Carousel>
|
|
904
|
-
<Card title="Item 1" subtitle="First product">
|
|
905
|
-
<Image url="https://example.com/item1.jpg" alt="Item 1" />
|
|
906
|
-
<Button action="postback" label="Buy" value="buy_1" />
|
|
907
|
-
</Card>
|
|
908
|
-
<Card title="Item 2" subtitle="Second product">
|
|
909
|
-
<Image url="https://example.com/item2.jpg" alt="Item 2" />
|
|
910
|
-
<Button action="postback" label="Buy" value="buy_2" />
|
|
911
|
-
</Card>
|
|
912
|
-
</Carousel>
|
|
913
|
-
</Message>`
|
|
914
|
-
}
|
|
915
|
-
],
|
|
916
844
|
container: {
|
|
917
845
|
props: _zui.z.object({}),
|
|
918
846
|
children: [
|
|
@@ -927,16 +855,46 @@ var Text = new (0, _chunkI56MPOVGcjs.Component)({
|
|
|
927
855
|
type: "default",
|
|
928
856
|
name: "Message",
|
|
929
857
|
aliases: ["Text", "Markdown"],
|
|
930
|
-
description: "A Markdown-formatted text message.",
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
858
|
+
description: "A Markdown-formatted text message. Long answers are written the same way: plain Markdown prose.",
|
|
859
|
+
generation: {
|
|
860
|
+
examples: [
|
|
861
|
+
// A long-form example matters: models shown only short bodies have been
|
|
862
|
+
// observed drifting into JSON-wrapping long replies ({"body": "..."})
|
|
863
|
+
{
|
|
864
|
+
body: `Great question! Deploying happens in three steps.
|
|
865
|
+
|
|
866
|
+
First, connect your repository from the dashboard \u2014 we support GitHub and GitLab. Once connected, every push to your main branch triggers a build automatically.
|
|
867
|
+
|
|
868
|
+
Then configure your build settings:
|
|
869
|
+
|
|
870
|
+
- **Build command** \u2014 usually \`npm run build\`
|
|
871
|
+
- **Output directory** \u2014 where the compiled assets end up
|
|
872
|
+
|
|
873
|
+
Finally, hit **Deploy**. The first build takes a couple of minutes; subsequent ones are incremental and much faster. Want me to walk you through connecting your repository?`
|
|
874
|
+
},
|
|
875
|
+
{ body: "**Hello**, welcome to our service!" }
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
default: {
|
|
879
|
+
props: _zui.z.object({}),
|
|
880
|
+
children: []
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
var Speech = new (0, _chunkI56MPOVGcjs.Component)({
|
|
884
|
+
type: "default",
|
|
885
|
+
name: "Speech",
|
|
886
|
+
aliases: ["speak", "spoken"],
|
|
887
|
+
description: "A message spoken aloud to the user via text-to-speech.",
|
|
888
|
+
body: {
|
|
889
|
+
format: "text",
|
|
890
|
+
description: 'Plain conversational prose only, written to be read aloud: no Markdown, no links or URLs, no emojis, no code, no bullet points, tables or headings. Write everything the way it should be pronounced \u2014 spell out numbers, dates, units and abbreviations (e.g. "June third at three thirty PM", not "06/03 @ 3:30pm").'
|
|
891
|
+
},
|
|
892
|
+
generation: {
|
|
893
|
+
usage: "Use when the reply will be played back as audio (voice conversations).",
|
|
894
|
+
examples: [
|
|
895
|
+
{ body: "Sure! Your order shipped this morning and should arrive on Tuesday, June third, around noon." }
|
|
896
|
+
]
|
|
897
|
+
},
|
|
940
898
|
default: {
|
|
941
899
|
props: _zui.z.object({}),
|
|
942
900
|
children: []
|
|
@@ -950,7 +908,8 @@ var DefaultComponents = {
|
|
|
950
908
|
Audio,
|
|
951
909
|
Card,
|
|
952
910
|
Carousel,
|
|
953
|
-
Text
|
|
911
|
+
Text,
|
|
912
|
+
Speech
|
|
954
913
|
};
|
|
955
914
|
|
|
956
915
|
// src/chat.ts
|
|
@@ -1167,7 +1126,7 @@ var SendResponse = class extends BaseResponse {
|
|
|
1167
1126
|
return this.item.props;
|
|
1168
1127
|
}
|
|
1169
1128
|
static formatToText(component, props, body) {
|
|
1170
|
-
const header = `${
|
|
1129
|
+
const header = `${_chunkKTDBAJBBcjs.MARKER}send=${component}${props && Object.keys(props).length ? ` ${JSON.stringify(props)}` : ""}`;
|
|
1171
1130
|
return body ? `${header}
|
|
1172
1131
|
${body}` : header;
|
|
1173
1132
|
}
|
|
@@ -1178,7 +1137,7 @@ var RunResponse = class extends BaseResponse {
|
|
|
1178
1137
|
this.code = code;
|
|
1179
1138
|
}
|
|
1180
1139
|
static formatToText(code) {
|
|
1181
|
-
return `${
|
|
1140
|
+
return `${_chunkKTDBAJBBcjs.MARKER}run
|
|
1182
1141
|
${code}`;
|
|
1183
1142
|
}
|
|
1184
1143
|
};
|
|
@@ -1193,7 +1152,7 @@ var NextResponse = class extends BaseResponse {
|
|
|
1193
1152
|
return this.item.props;
|
|
1194
1153
|
}
|
|
1195
1154
|
static formatToText(name, props) {
|
|
1196
|
-
return `${
|
|
1155
|
+
return `${_chunkKTDBAJBBcjs.MARKER}next=${name}${props && Object.keys(props).length ? ` ${JSON.stringify(props)}` : ""}`;
|
|
1197
1156
|
}
|
|
1198
1157
|
};
|
|
1199
1158
|
var EventPump = (_class3 = class {
|
|
@@ -1250,7 +1209,7 @@ function parseText(text, options) {
|
|
|
1250
1209
|
);
|
|
1251
1210
|
}
|
|
1252
1211
|
async function* parseResponses(stream, options) {
|
|
1253
|
-
const parser = new (0,
|
|
1212
|
+
const parser = new (0, _chunkKTDBAJBBcjs.StreamingMessageParser)(options);
|
|
1254
1213
|
const pump = new EventPump(stream, parser);
|
|
1255
1214
|
let activeBody;
|
|
1256
1215
|
while (true) {
|
|
@@ -1307,7 +1266,7 @@ var ComponentRegistry = (_class4 = class {
|
|
|
1307
1266
|
}
|
|
1308
1267
|
}
|
|
1309
1268
|
register(definition) {
|
|
1310
|
-
if (!
|
|
1269
|
+
if (!_chunkKTDBAJBBcjs.NAME_REGEX.test(definition.name)) {
|
|
1311
1270
|
throw new Error(
|
|
1312
1271
|
`Invalid component name "${definition.name}". Component names must be lowercase ([a-z][a-z0-9_-]*).`
|
|
1313
1272
|
);
|
|
@@ -1334,7 +1293,7 @@ var EMPTY_PROPS_SCHEMA = { type: "object", properties: {}, additionalProperties:
|
|
|
1334
1293
|
var normalizeComponentName = (name) => name.trim().toLowerCase();
|
|
1335
1294
|
function normalizeComponentDefinition(definition) {
|
|
1336
1295
|
const name = normalizeComponentName(_nullishCoalesce(definition.name, () => ( "")));
|
|
1337
|
-
if (!
|
|
1296
|
+
if (!_chunkKTDBAJBBcjs.NAME_REGEX.test(name)) {
|
|
1338
1297
|
throw new Error(
|
|
1339
1298
|
`Invalid component name "${definition.name}". Component names must be lowercase ([a-z][a-z0-9_-]*).`
|
|
1340
1299
|
);
|
|
@@ -1516,7 +1475,7 @@ var _checkValue = (value, schema, path, errors) => {
|
|
|
1516
1475
|
};
|
|
1517
1476
|
|
|
1518
1477
|
// src/message-stream/sanitize.ts
|
|
1519
|
-
var sanitizeMessageText = (value, options = {}) => value.replaceAll(
|
|
1478
|
+
var sanitizeMessageText = (value, options = {}) => value.replaceAll(_chunkKTDBAJBBcjs.MARKER, _nullishCoalesce(options.markerReplacement, () => ( "\u25AA")));
|
|
1520
1479
|
|
|
1521
1480
|
// src/index.ts
|
|
1522
1481
|
var utils = {
|
|
@@ -1527,11 +1486,11 @@ var utils = {
|
|
|
1527
1486
|
stripTruncationTags: _chunkHEAQAEFZcjs.stripTruncationTags
|
|
1528
1487
|
};
|
|
1529
1488
|
var execute = async (props) => {
|
|
1530
|
-
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./execute-
|
|
1489
|
+
const { executeContext } = await Promise.resolve().then(() => _interopRequireWildcard(require("./execute-IK6O4SU2.cjs")));
|
|
1531
1490
|
return executeContext(props);
|
|
1532
1491
|
};
|
|
1533
1492
|
var init = async () => {
|
|
1534
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./execute-
|
|
1493
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./execute-IK6O4SU2.cjs")));
|
|
1535
1494
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./component-2NYFY6CW.cjs")));
|
|
1536
1495
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./tool-VE2YHIY2.cjs")));
|
|
1537
1496
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./exit-MX56VN2C.cjs")));
|
|
@@ -1540,7 +1499,7 @@ var init = async () => {
|
|
|
1540
1499
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./utils-ITB4NEL7.cjs")));
|
|
1541
1500
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./truncator-FZNLYSDL.cjs")));
|
|
1542
1501
|
await Promise.resolve().then(() => _interopRequireWildcard(require("./typings-LQOBZXSO.cjs")));
|
|
1543
|
-
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-
|
|
1502
|
+
await Promise.resolve().then(() => _interopRequireWildcard(require("./dual-modes-TCMWBZIH.cjs")));
|
|
1544
1503
|
};
|
|
1545
1504
|
|
|
1546
1505
|
|
|
@@ -1593,4 +1552,4 @@ var init = async () => {
|
|
|
1593
1552
|
|
|
1594
1553
|
|
|
1595
1554
|
|
|
1596
|
-
exports.BaseResponse = BaseResponse; exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkI56MPOVGcjs.Component; exports.ComponentRegistry = ComponentRegistry; exports.DefaultComponents = DefaultComponents; exports.DefaultExit =
|
|
1555
|
+
exports.BaseResponse = BaseResponse; exports.Chat = Chat; exports.CitationsManager = CitationsManager; exports.Component = _chunkI56MPOVGcjs.Component; exports.ComponentRegistry = ComponentRegistry; exports.DefaultComponents = DefaultComponents; exports.DefaultExit = _chunk5WBNTV42cjs.DefaultExit; exports.ErrorExecutionResult = _chunk5WBNTV42cjs.ErrorExecutionResult; exports.ExecutionResult = _chunk5WBNTV42cjs.ExecutionResult; exports.Exit = _chunkDDSJTR6Qcjs.Exit; exports.ListenExit = _chunk5WBNTV42cjs.ListenExit; exports.LoopExceededError = _chunkPK72FAKDcjs.LoopExceededError; exports.MARKER = _chunkKTDBAJBBcjs.MARKER; exports.NAME_REGEX = _chunkKTDBAJBBcjs.NAME_REGEX; exports.NextResponse = NextResponse; exports.ObjectInstance = ObjectInstance; exports.PartialExecutionResult = _chunk5WBNTV42cjs.PartialExecutionResult; exports.ReplayableAsyncIterable = ReplayableAsyncIterable; exports.RunResponse = RunResponse; exports.SendResponse = SendResponse; exports.Snapshot = _chunk5WBNTV42cjs.Snapshot; exports.SnapshotSignal = _chunkPK72FAKDcjs.SnapshotSignal; exports.StreamingMessageParser = _chunkKTDBAJBBcjs.StreamingMessageParser; exports.SuccessExecutionResult = _chunk5WBNTV42cjs.SuccessExecutionResult; exports.ThinkExit = _chunk5WBNTV42cjs.ThinkExit; exports.ThinkSignal = _chunkPK72FAKDcjs.ThinkSignal; exports.Tool = _chunkPZE6PIPGcjs.Tool; exports._CustomModelClient = _chunk5WBNTV42cjs._CustomModelClient; exports.assertValidComponent = _chunkI56MPOVGcjs.assertValidComponent; exports.collectText = collectText; exports.configureQuickJS = _chunkRGUG3UMFcjs.configureQuickJS; exports.configureTokenizer = _chunkGOWPACSKcjs.configureTokenizer; exports.execute = execute; exports.generateInstructions = _chunkKTDBAJBBcjs.generateInstructions; exports.getValue = _chunk5WBNTV42cjs.getValue; exports.init = init; exports.isAnyComponent = _chunkI56MPOVGcjs.isAnyComponent; exports.isComponent = _chunkI56MPOVGcjs.isComponent; exports.normalizeComponentDefinition = normalizeComponentDefinition; exports.normalizeComponentName = normalizeComponentName; exports.normalizePropsSchema = normalizePropsSchema; exports.parseExit = _chunk5WBNTV42cjs.parseExit; exports.parseStream = parseStream; exports.parseText = parseText; exports.sanitizeMessageText = sanitizeMessageText; exports.tryParseJson = _chunkKTDBAJBBcjs.tryParseJson; exports.utils = utils; exports.validateComponent = validateComponent; exports.validateProps = validateProps; exports.version = version;
|
package/dist/index.js
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
_CustomModelClient,
|
|
11
11
|
getValue,
|
|
12
12
|
parseExit
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4POZJQXN.js";
|
|
14
14
|
import {
|
|
15
15
|
MARKER,
|
|
16
16
|
NAME_REGEX,
|
|
17
17
|
StreamingMessageParser,
|
|
18
18
|
generateInstructions,
|
|
19
19
|
tryParseJson
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LOX7GOR6.js";
|
|
21
21
|
import {
|
|
22
22
|
configureQuickJS
|
|
23
23
|
} from "./chunk-UGHFNCPD.js";
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
} from "./chunk-34GJUS6U.js";
|
|
70
70
|
|
|
71
71
|
// package.json
|
|
72
|
-
var version = "0.
|
|
72
|
+
var version = "0.5.1";
|
|
73
73
|
|
|
74
74
|
// src/objects.ts
|
|
75
75
|
import { z } from "@bpinternal/zui";
|
|
@@ -738,24 +738,10 @@ var Button = new Component({
|
|
|
738
738
|
description: "A button component that can perform actions when clicked",
|
|
739
739
|
name: "Button",
|
|
740
740
|
aliases: ["btn"],
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
code: `yield <Message>
|
|
746
|
-
<Button action="say" label="Hello" />
|
|
747
|
-
</Message>`
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
name: "Postback action",
|
|
751
|
-
description: "A button that sends a postback value",
|
|
752
|
-
code: `yield <Message>
|
|
753
|
-
Choose an option:
|
|
754
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
755
|
-
<Button action="postback" label="Buy" value="buy_product2" />
|
|
756
|
-
</Message>`
|
|
757
|
-
}
|
|
758
|
-
],
|
|
741
|
+
generation: {
|
|
742
|
+
usage: "Attach quick actions to a message, e.g. postback choices or a URL to open.",
|
|
743
|
+
examples: [{ props: { action: "postback", label: "Buy", value: "buy_product" } }]
|
|
744
|
+
},
|
|
759
745
|
leaf: {
|
|
760
746
|
props: z2.object({
|
|
761
747
|
action: z2.enum(["say", "url", "postback"]).default("say").describe('The action to perform when the button is clicked. Can be "say", "url", or "postback"'),
|
|
@@ -770,16 +756,9 @@ var Image = new Component({
|
|
|
770
756
|
name: "Image",
|
|
771
757
|
description: "Displays an image from a URL.",
|
|
772
758
|
aliases: [],
|
|
773
|
-
|
|
774
|
-
{
|
|
775
|
-
|
|
776
|
-
description: "A simple image with alt text",
|
|
777
|
-
code: `yield <Message>
|
|
778
|
-
An example image:
|
|
779
|
-
<Image url="https://example.com/photo.jpg" alt="Example image" />
|
|
780
|
-
</Message>`
|
|
781
|
-
}
|
|
782
|
-
],
|
|
759
|
+
generation: {
|
|
760
|
+
examples: [{ props: { url: "https://example.com/photo.jpg", alt: "Example image" } }]
|
|
761
|
+
},
|
|
783
762
|
leaf: {
|
|
784
763
|
props: z2.object({
|
|
785
764
|
url: z2.string().describe("The URL of the image (must be valid)"),
|
|
@@ -792,16 +771,9 @@ var File = new Component({
|
|
|
792
771
|
name: "File",
|
|
793
772
|
description: "Sends a downloadable file to the user.",
|
|
794
773
|
aliases: [],
|
|
795
|
-
|
|
796
|
-
{
|
|
797
|
-
|
|
798
|
-
description: "Send a PDF file with a name",
|
|
799
|
-
code: `yield <Message>
|
|
800
|
-
Here is your report:
|
|
801
|
-
<File url="https://example.com/report.pdf" name="Report.pdf" />
|
|
802
|
-
</Message>`
|
|
803
|
-
}
|
|
804
|
-
],
|
|
774
|
+
generation: {
|
|
775
|
+
examples: [{ props: { url: "https://example.com/report.pdf", name: "Report.pdf" } }]
|
|
776
|
+
},
|
|
805
777
|
leaf: {
|
|
806
778
|
props: z2.object({
|
|
807
779
|
url: z2.string().describe("The URL of the file (must be valid)"),
|
|
@@ -814,16 +786,9 @@ var Video = new Component({
|
|
|
814
786
|
name: "Video",
|
|
815
787
|
description: "Embeds a video from a URL.",
|
|
816
788
|
aliases: [],
|
|
817
|
-
|
|
818
|
-
{
|
|
819
|
-
|
|
820
|
-
description: "A video with a title",
|
|
821
|
-
code: `yield <Message>
|
|
822
|
-
Watch this video:
|
|
823
|
-
<Video url="https://example.com/intro.mp4" title="Welcome" />
|
|
824
|
-
</Message>`
|
|
825
|
-
}
|
|
826
|
-
],
|
|
789
|
+
generation: {
|
|
790
|
+
examples: [{ props: { url: "https://example.com/intro.mp4", title: "Welcome" } }]
|
|
791
|
+
},
|
|
827
792
|
leaf: {
|
|
828
793
|
props: z2.object({
|
|
829
794
|
url: z2.string().describe("The URL of the video (must be valid)"),
|
|
@@ -836,16 +801,9 @@ var Audio = new Component({
|
|
|
836
801
|
name: "Audio",
|
|
837
802
|
description: "Plays an audio clip from a URL.",
|
|
838
803
|
aliases: [],
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
|
|
842
|
-
description: "Play a short audio clip with a title",
|
|
843
|
-
code: `yield <Message>
|
|
844
|
-
Listen to this audio:
|
|
845
|
-
<Audio url="https://example.com/audio.mp3" title="Sample" />
|
|
846
|
-
</Message>`
|
|
847
|
-
}
|
|
848
|
-
],
|
|
804
|
+
generation: {
|
|
805
|
+
examples: [{ props: { url: "https://example.com/audio.mp3", title: "Sample" } }]
|
|
806
|
+
},
|
|
849
807
|
leaf: {
|
|
850
808
|
props: z2.object({
|
|
851
809
|
url: z2.string().describe("The URL of the audio clip (must be valid)"),
|
|
@@ -858,20 +816,9 @@ var Card = new Component({
|
|
|
858
816
|
name: "Card",
|
|
859
817
|
description: "A visual card component that can include an image and buttons.",
|
|
860
818
|
aliases: [],
|
|
861
|
-
|
|
862
|
-
{
|
|
863
|
-
|
|
864
|
-
description: "A card with an image and two buttons",
|
|
865
|
-
code: `yield <Message>
|
|
866
|
-
Featured product:
|
|
867
|
-
<Card title="Product Name" subtitle="Limited offer">
|
|
868
|
-
<Image url="https://example.com/product.jpg" alt="Product image" />
|
|
869
|
-
<Button action="postback" label="Buy" value="buy_product" />
|
|
870
|
-
<Button action="postback" label="Wishlist" value="wishlist" />
|
|
871
|
-
</Card>
|
|
872
|
-
</Message>`
|
|
873
|
-
}
|
|
874
|
-
],
|
|
819
|
+
generation: {
|
|
820
|
+
examples: [{ props: { title: "Product Name", subtitle: "Limited offer" }, body: "Featured product of the week." }]
|
|
821
|
+
},
|
|
875
822
|
container: {
|
|
876
823
|
props: z2.object({
|
|
877
824
|
title: z2.string().min(1).max(250).describe("Title text (1\u2013250 characters)"),
|
|
@@ -894,25 +841,6 @@ var Carousel = new Component({
|
|
|
894
841
|
name: "Carousel",
|
|
895
842
|
description: "A virtual container for displaying 1 to 10 Card components as a carousel.",
|
|
896
843
|
aliases: [],
|
|
897
|
-
examples: [
|
|
898
|
-
{
|
|
899
|
-
name: "Product carousel",
|
|
900
|
-
description: "A carousel with multiple cards",
|
|
901
|
-
code: `yield <Message>
|
|
902
|
-
Here are some products you might like:
|
|
903
|
-
<Carousel>
|
|
904
|
-
<Card title="Item 1" subtitle="First product">
|
|
905
|
-
<Image url="https://example.com/item1.jpg" alt="Item 1" />
|
|
906
|
-
<Button action="postback" label="Buy" value="buy_1" />
|
|
907
|
-
</Card>
|
|
908
|
-
<Card title="Item 2" subtitle="Second product">
|
|
909
|
-
<Image url="https://example.com/item2.jpg" alt="Item 2" />
|
|
910
|
-
<Button action="postback" label="Buy" value="buy_2" />
|
|
911
|
-
</Card>
|
|
912
|
-
</Carousel>
|
|
913
|
-
</Message>`
|
|
914
|
-
}
|
|
915
|
-
],
|
|
916
844
|
container: {
|
|
917
845
|
props: z2.object({}),
|
|
918
846
|
children: [
|
|
@@ -927,16 +855,46 @@ var Text = new Component({
|
|
|
927
855
|
type: "default",
|
|
928
856
|
name: "Message",
|
|
929
857
|
aliases: ["Text", "Markdown"],
|
|
930
|
-
description: "A Markdown-formatted text message.",
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
858
|
+
description: "A Markdown-formatted text message. Long answers are written the same way: plain Markdown prose.",
|
|
859
|
+
generation: {
|
|
860
|
+
examples: [
|
|
861
|
+
// A long-form example matters: models shown only short bodies have been
|
|
862
|
+
// observed drifting into JSON-wrapping long replies ({"body": "..."})
|
|
863
|
+
{
|
|
864
|
+
body: `Great question! Deploying happens in three steps.
|
|
865
|
+
|
|
866
|
+
First, connect your repository from the dashboard \u2014 we support GitHub and GitLab. Once connected, every push to your main branch triggers a build automatically.
|
|
867
|
+
|
|
868
|
+
Then configure your build settings:
|
|
869
|
+
|
|
870
|
+
- **Build command** \u2014 usually \`npm run build\`
|
|
871
|
+
- **Output directory** \u2014 where the compiled assets end up
|
|
872
|
+
|
|
873
|
+
Finally, hit **Deploy**. The first build takes a couple of minutes; subsequent ones are incremental and much faster. Want me to walk you through connecting your repository?`
|
|
874
|
+
},
|
|
875
|
+
{ body: "**Hello**, welcome to our service!" }
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
default: {
|
|
879
|
+
props: z2.object({}),
|
|
880
|
+
children: []
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
var Speech = new Component({
|
|
884
|
+
type: "default",
|
|
885
|
+
name: "Speech",
|
|
886
|
+
aliases: ["speak", "spoken"],
|
|
887
|
+
description: "A message spoken aloud to the user via text-to-speech.",
|
|
888
|
+
body: {
|
|
889
|
+
format: "text",
|
|
890
|
+
description: 'Plain conversational prose only, written to be read aloud: no Markdown, no links or URLs, no emojis, no code, no bullet points, tables or headings. Write everything the way it should be pronounced \u2014 spell out numbers, dates, units and abbreviations (e.g. "June third at three thirty PM", not "06/03 @ 3:30pm").'
|
|
891
|
+
},
|
|
892
|
+
generation: {
|
|
893
|
+
usage: "Use when the reply will be played back as audio (voice conversations).",
|
|
894
|
+
examples: [
|
|
895
|
+
{ body: "Sure! Your order shipped this morning and should arrive on Tuesday, June third, around noon." }
|
|
896
|
+
]
|
|
897
|
+
},
|
|
940
898
|
default: {
|
|
941
899
|
props: z2.object({}),
|
|
942
900
|
children: []
|
|
@@ -950,7 +908,8 @@ var DefaultComponents = {
|
|
|
950
908
|
Audio,
|
|
951
909
|
Card,
|
|
952
910
|
Carousel,
|
|
953
|
-
Text
|
|
911
|
+
Text,
|
|
912
|
+
Speech
|
|
954
913
|
};
|
|
955
914
|
|
|
956
915
|
// src/chat.ts
|
|
@@ -1527,11 +1486,11 @@ var utils = {
|
|
|
1527
1486
|
stripTruncationTags
|
|
1528
1487
|
};
|
|
1529
1488
|
var execute = async (props) => {
|
|
1530
|
-
const { executeContext } = await import("./execute-
|
|
1489
|
+
const { executeContext } = await import("./execute-FF7D46TY.js");
|
|
1531
1490
|
return executeContext(props);
|
|
1532
1491
|
};
|
|
1533
1492
|
var init = async () => {
|
|
1534
|
-
await import("./execute-
|
|
1493
|
+
await import("./execute-FF7D46TY.js");
|
|
1535
1494
|
await import("./component-ASNZHQUR.js");
|
|
1536
1495
|
await import("./tool-KD7FL45V.js");
|
|
1537
1496
|
await import("./exit-UQ3EUX5D.js");
|
|
@@ -1540,7 +1499,7 @@ var init = async () => {
|
|
|
1540
1499
|
await import("./utils-IATCUNKF.js");
|
|
1541
1500
|
await import("./truncator-73RCL52Y.js");
|
|
1542
1501
|
await import("./typings-E2RROCLT.js");
|
|
1543
|
-
await import("./dual-modes-
|
|
1502
|
+
await import("./dual-modes-S5TJ5JVJ.js");
|
|
1544
1503
|
};
|
|
1545
1504
|
export {
|
|
1546
1505
|
BaseResponse,
|