@botpress/runtime 1.8.1 → 1.8.2
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/definition.js +271 -9
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +352 -90
- package/dist/internal.js.map +4 -4
- package/dist/library.js +336 -74
- package/dist/library.js.map +4 -4
- package/dist/runtime/chat/chat.d.ts +2 -1
- package/dist/runtime/chat/chat.d.ts.map +1 -1
- package/dist/runtime/chat/components.d.ts +101 -0
- package/dist/runtime/chat/components.d.ts.map +1 -1
- package/dist/runtime.js +303 -28
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
package/dist/internal.js
CHANGED
|
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
|
|
|
48
48
|
var define_PACKAGE_VERSIONS_default;
|
|
49
49
|
var init_define_PACKAGE_VERSIONS = __esm({
|
|
50
50
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
51
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.8.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.8.2", adk: "1.8.2", sdk: "4.19.0", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -27678,11 +27678,11 @@ function expand_(str, isTop) {
|
|
|
27678
27678
|
if (pad) {
|
|
27679
27679
|
const need = width - c.length;
|
|
27680
27680
|
if (need > 0) {
|
|
27681
|
-
const
|
|
27681
|
+
const z27 = new Array(need + 1).join("0");
|
|
27682
27682
|
if (i < 0) {
|
|
27683
|
-
c = "-" +
|
|
27683
|
+
c = "-" + z27 + c.slice(1);
|
|
27684
27684
|
} else {
|
|
27685
|
-
c =
|
|
27685
|
+
c = z27 + c;
|
|
27686
27686
|
}
|
|
27687
27687
|
}
|
|
27688
27688
|
}
|
|
@@ -34305,7 +34305,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
34305
34305
|
// src/primitives/workflow-instance.ts
|
|
34306
34306
|
init_define_BUILD();
|
|
34307
34307
|
init_define_PACKAGE_VERSIONS();
|
|
34308
|
-
import { z as
|
|
34308
|
+
import { z as z20 } from "@botpress/sdk";
|
|
34309
34309
|
import assert2 from "assert";
|
|
34310
34310
|
|
|
34311
34311
|
// src/errors.ts
|
|
@@ -34480,7 +34480,7 @@ ${issues.join("\n")}`;
|
|
|
34480
34480
|
// src/library.ts
|
|
34481
34481
|
init_define_BUILD();
|
|
34482
34482
|
init_define_PACKAGE_VERSIONS();
|
|
34483
|
-
import { z as
|
|
34483
|
+
import { z as z18 } from "@botpress/sdk";
|
|
34484
34484
|
import { Cognitive as Cognitive2 } from "@botpress/cognitive";
|
|
34485
34485
|
import { Zai as Zai2 } from "@botpress/zai";
|
|
34486
34486
|
|
|
@@ -41986,7 +41986,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
41986
41986
|
// src/runtime/chat/chat.ts
|
|
41987
41987
|
init_define_BUILD();
|
|
41988
41988
|
init_define_PACKAGE_VERSIONS();
|
|
41989
|
-
import { Chat,
|
|
41989
|
+
import { Chat, isAnyComponent as isAnyComponent2 } from "llmz";
|
|
41990
41990
|
|
|
41991
41991
|
// src/runtime/chat/truncate-transcript.ts
|
|
41992
41992
|
init_define_BUILD();
|
|
@@ -42318,6 +42318,268 @@ var Transcript = {
|
|
|
42318
42318
|
TRANSCRIPT_ITEM_MAX_BYTES: 1e4
|
|
42319
42319
|
};
|
|
42320
42320
|
|
|
42321
|
+
// src/runtime/chat/components.ts
|
|
42322
|
+
init_define_BUILD();
|
|
42323
|
+
init_define_PACKAGE_VERSIONS();
|
|
42324
|
+
import { messages, z as z14 } from "@botpress/sdk";
|
|
42325
|
+
var DefaultMessageTypes = {
|
|
42326
|
+
text: messages.defaults["text"].schema,
|
|
42327
|
+
audio: messages.defaults["audio"].schema,
|
|
42328
|
+
card: messages.defaults["card"].schema,
|
|
42329
|
+
image: messages.defaults["image"].schema,
|
|
42330
|
+
carousel: messages.defaults["carousel"].schema,
|
|
42331
|
+
choice: messages.defaults["choice"].schema,
|
|
42332
|
+
dropdown: messages.defaults["dropdown"].schema,
|
|
42333
|
+
file: messages.defaults["file"].schema,
|
|
42334
|
+
location: messages.defaults["location"].schema,
|
|
42335
|
+
video: messages.defaults["video"].schema,
|
|
42336
|
+
bloc: messages.defaults["bloc"].schema
|
|
42337
|
+
};
|
|
42338
|
+
var AudioComponent = new Autonomous.Component({
|
|
42339
|
+
type: "leaf",
|
|
42340
|
+
aliases: [],
|
|
42341
|
+
name: "Audio",
|
|
42342
|
+
description: `Send an audio file to the user, which will be playable by the user whithin the chat interface. The audio file should be in a supported format (e.g., MP3, WAV) and accessible via a public URL.`,
|
|
42343
|
+
examples: [
|
|
42344
|
+
{
|
|
42345
|
+
name: " Basic Audio Message",
|
|
42346
|
+
description: "Sends a simple audio message to the user",
|
|
42347
|
+
code: `
|
|
42348
|
+
yield <Message>
|
|
42349
|
+
Here's an **awesome** audio clip for you!
|
|
42350
|
+
<Audio audioUrl="https://example.com/path/to/audio.mp3" />
|
|
42351
|
+
</Message>`
|
|
42352
|
+
}
|
|
42353
|
+
],
|
|
42354
|
+
leaf: {
|
|
42355
|
+
props: z14.object({
|
|
42356
|
+
audioUrl: z14.string().url().describe("The URL of the audio file to be sent.")
|
|
42357
|
+
})
|
|
42358
|
+
}
|
|
42359
|
+
});
|
|
42360
|
+
var ImageComponent = new Autonomous.Component({
|
|
42361
|
+
type: "leaf",
|
|
42362
|
+
aliases: ["img"],
|
|
42363
|
+
name: "Image",
|
|
42364
|
+
description: `Send an image to the user, which will be displayed within the chat interface. The image should be in a supported format (e.g., JPEG, PNG) and accessible via a public URL.`,
|
|
42365
|
+
examples: [
|
|
42366
|
+
{
|
|
42367
|
+
name: " Basic Image Message",
|
|
42368
|
+
description: "Sends a simple image message to the user",
|
|
42369
|
+
code: `
|
|
42370
|
+
yield <Message>
|
|
42371
|
+
Here's an **awesome** image for you!
|
|
42372
|
+
<Image imageUrl="https://example.com/path/to/image.jpg" />
|
|
42373
|
+
</Message>`
|
|
42374
|
+
}
|
|
42375
|
+
],
|
|
42376
|
+
leaf: {
|
|
42377
|
+
props: z14.object({
|
|
42378
|
+
imageUrl: z14.string().url().describe("The URL of the image to be sent.")
|
|
42379
|
+
})
|
|
42380
|
+
}
|
|
42381
|
+
});
|
|
42382
|
+
var VideoComponent = new Autonomous.Component({
|
|
42383
|
+
type: "leaf",
|
|
42384
|
+
aliases: [],
|
|
42385
|
+
name: "Video",
|
|
42386
|
+
description: `Send a video to the user, which will be playable within the chat interface. The video should be in a supported format (e.g., MP4, WebM) and accessible via a public URL.`,
|
|
42387
|
+
examples: [
|
|
42388
|
+
{
|
|
42389
|
+
name: " Basic Video Message",
|
|
42390
|
+
description: "Sends a simple video message to the user",
|
|
42391
|
+
code: `
|
|
42392
|
+
yield <Message>
|
|
42393
|
+
Here's an **awesome** video for you!
|
|
42394
|
+
<Video videoUrl="https://example.com/path/to/video.mp4" />
|
|
42395
|
+
</Message>`
|
|
42396
|
+
}
|
|
42397
|
+
],
|
|
42398
|
+
leaf: {
|
|
42399
|
+
props: z14.object({
|
|
42400
|
+
videoUrl: z14.string().url().describe("The URL of the video to be sent.")
|
|
42401
|
+
})
|
|
42402
|
+
}
|
|
42403
|
+
});
|
|
42404
|
+
var LocationComponent = new Autonomous.Component({
|
|
42405
|
+
type: "leaf",
|
|
42406
|
+
aliases: [],
|
|
42407
|
+
name: "Location",
|
|
42408
|
+
description: `Send a location to the user, which will be displayed as a map within the chat interface. The location should include latitude and longitude coordinates.
|
|
42409
|
+
The location can also optionally include an address and a title for better context.`,
|
|
42410
|
+
examples: [
|
|
42411
|
+
{
|
|
42412
|
+
name: " Basic Location Message",
|
|
42413
|
+
description: "Sends a simple location message to the user",
|
|
42414
|
+
code: `
|
|
42415
|
+
yield <Message>
|
|
42416
|
+
Here's the location you requested!
|
|
42417
|
+
<Location latitude={37.7749} longitude={-122.4194} />
|
|
42418
|
+
</Message>`
|
|
42419
|
+
},
|
|
42420
|
+
{
|
|
42421
|
+
name: " Location Message with Address and Title",
|
|
42422
|
+
description: "Sends a location message with additional address and title information",
|
|
42423
|
+
code: `
|
|
42424
|
+
yield <Message>
|
|
42425
|
+
Here's the location of our office!
|
|
42426
|
+
<Location
|
|
42427
|
+
latitude={45.506342}
|
|
42428
|
+
longitude={-73.572012}
|
|
42429
|
+
address="400 Blvd. De Maisonneuve Ouest #200, Montreal, Quebec H3A 1L4, Canada"
|
|
42430
|
+
title="Botpress HQ"
|
|
42431
|
+
/>
|
|
42432
|
+
</Message>`
|
|
42433
|
+
}
|
|
42434
|
+
],
|
|
42435
|
+
leaf: {
|
|
42436
|
+
props: z14.object({
|
|
42437
|
+
latitude: z14.number().describe("The latitude of the location to be sent."),
|
|
42438
|
+
longitude: z14.number().describe("The longitude of the location to be sent."),
|
|
42439
|
+
address: z14.string().optional().describe("The address of the location to be sent."),
|
|
42440
|
+
title: z14.string().optional().describe("The title of the location to be sent.")
|
|
42441
|
+
})
|
|
42442
|
+
}
|
|
42443
|
+
});
|
|
42444
|
+
var ChoiceComponent = new Autonomous.Component({
|
|
42445
|
+
type: "leaf",
|
|
42446
|
+
aliases: ["choices", "option", "options", "buttons"],
|
|
42447
|
+
name: "Choice",
|
|
42448
|
+
description: `Present a choice to the user with multiple options.
|
|
42449
|
+
The user can select one of the provided options, and the selection will be sent back to the system for further processing.
|
|
42450
|
+
You can include up to 10 options for the user to choose from.
|
|
42451
|
+
Values for each option should be unique identifiers that can be used to identify the user's selection.`,
|
|
42452
|
+
examples: [
|
|
42453
|
+
{
|
|
42454
|
+
name: " Basic Choice Message",
|
|
42455
|
+
description: "Presents a simple choice message to the user",
|
|
42456
|
+
code: `
|
|
42457
|
+
yield <Message>
|
|
42458
|
+
Please choose one of the following options:
|
|
42459
|
+
<Choice
|
|
42460
|
+
text="Select an option:"
|
|
42461
|
+
options={[
|
|
42462
|
+
{ label: "Option 1", value: "option_1" },
|
|
42463
|
+
{ label: "Option 2", value: "option_2" },
|
|
42464
|
+
{ label: "Option 3", value: "option_3" }
|
|
42465
|
+
]}
|
|
42466
|
+
/>
|
|
42467
|
+
</Message>`
|
|
42468
|
+
}
|
|
42469
|
+
],
|
|
42470
|
+
leaf: {
|
|
42471
|
+
props: z14.object({
|
|
42472
|
+
text: z14.string().describe("The prompt text for the choice."),
|
|
42473
|
+
options: z14.array(
|
|
42474
|
+
z14.object({
|
|
42475
|
+
label: z14.string().describe("The label of the option to be displayed to the user."),
|
|
42476
|
+
value: z14.string().describe("The value of the option to be sent back when selected.")
|
|
42477
|
+
})
|
|
42478
|
+
).describe("The list of options to present to the user.")
|
|
42479
|
+
})
|
|
42480
|
+
}
|
|
42481
|
+
});
|
|
42482
|
+
var DropdownComponent = new Autonomous.Component({
|
|
42483
|
+
type: "leaf",
|
|
42484
|
+
aliases: ["dropdown", "select", "combo"],
|
|
42485
|
+
name: "Dropdown",
|
|
42486
|
+
description: `Present a dropdown menu to the user with multiple options.
|
|
42487
|
+
The user can select one of the provided options from the dropdown, and the selection will be sent back to the system for further processing.
|
|
42488
|
+
Unlike the Choice component, the Dropdown component is typically used when there are more options to choose from, providing a more compact UI.
|
|
42489
|
+
The dropdown can include up to 100 options for the user to choose from.
|
|
42490
|
+
Values for each option should be unique identifiers that can be used to identify the user's selection.`,
|
|
42491
|
+
examples: [
|
|
42492
|
+
{
|
|
42493
|
+
name: " Basic Dropdown Message",
|
|
42494
|
+
description: "Presents a simple dropdown message to the user",
|
|
42495
|
+
code: `
|
|
42496
|
+
yield <Message>
|
|
42497
|
+
Please select a fruit from the dropdown:
|
|
42498
|
+
<Dropdown
|
|
42499
|
+
text="Choose an option:"
|
|
42500
|
+
options={[
|
|
42501
|
+
{ label: "\u{1F350} Pear", value: "pear" },
|
|
42502
|
+
{ label: "\u{1F34E} Apple", value: "apple" },
|
|
42503
|
+
{ label: "\u{1F34C} Banana", value: "banana" }
|
|
42504
|
+
]}
|
|
42505
|
+
/>
|
|
42506
|
+
</Message>`
|
|
42507
|
+
}
|
|
42508
|
+
],
|
|
42509
|
+
leaf: {
|
|
42510
|
+
props: z14.object({
|
|
42511
|
+
text: z14.string().describe("The prompt text for the dropdown."),
|
|
42512
|
+
options: z14.array(
|
|
42513
|
+
z14.object({
|
|
42514
|
+
label: z14.string().describe("The label of the option to be displayed to the user."),
|
|
42515
|
+
value: z14.string().describe("The value of the option to be sent back when selected.")
|
|
42516
|
+
})
|
|
42517
|
+
).describe("The list of options to present in the dropdown.")
|
|
42518
|
+
})
|
|
42519
|
+
}
|
|
42520
|
+
});
|
|
42521
|
+
var CarouselComponent = new Autonomous.Component({
|
|
42522
|
+
type: "leaf",
|
|
42523
|
+
aliases: ["carousel", "cards", "card"],
|
|
42524
|
+
name: "Carousel",
|
|
42525
|
+
description: `Send a carousel of cards to the user, allowing them to browse through multiple items.
|
|
42526
|
+
Carousels are useful for displaying a collection of related items in a compact and interactive format.
|
|
42527
|
+
It is also possible to send a single card using the Carousel component, useful for sending a combination of image, text, and actions in one message such as a receipt or product detail.
|
|
42528
|
+
Each item in the carousel is represented as a card, which can include an image, title, subtitle, and actions.
|
|
42529
|
+
Users can navigate through the carousel by swiping or clicking on navigation controls.
|
|
42530
|
+
You can include multiple cards in the carousel, each with its own set of actions. A carousel can contain between 1 and 10 items (cards).`,
|
|
42531
|
+
examples: [
|
|
42532
|
+
{
|
|
42533
|
+
name: " Basic Carousel Message",
|
|
42534
|
+
description: "Sends a simple carousel message to the user",
|
|
42535
|
+
code: `
|
|
42536
|
+
yield <Message>
|
|
42537
|
+
Here is an **exciting** carousel for you!
|
|
42538
|
+
<Carousel
|
|
42539
|
+
items={[
|
|
42540
|
+
{
|
|
42541
|
+
title: "Product 1",
|
|
42542
|
+
subtitle: "Description of Product 1",
|
|
42543
|
+
imageUrl: "https://example.com/path/to/image1.jpg",
|
|
42544
|
+
actions: [
|
|
42545
|
+
{ action: "postback", label: "Buy Now", value: "buy_product_1" },
|
|
42546
|
+
{ action: "url", label: "View Details", value: "https://example.com/product_1" }
|
|
42547
|
+
]
|
|
42548
|
+
},
|
|
42549
|
+
{
|
|
42550
|
+
title: "Product 2",
|
|
42551
|
+
subtitle: "Description of Product 2",
|
|
42552
|
+
imageUrl: "https://example.com/path/to/image2.jpg",
|
|
42553
|
+
actions: [
|
|
42554
|
+
{ action: "postback", label: "Buy Now", value: "buy_product_2" },
|
|
42555
|
+
{ action: "url", label: "View Details", value: "https://example.com/product_2" }
|
|
42556
|
+
]
|
|
42557
|
+
}
|
|
42558
|
+
]}
|
|
42559
|
+
/>
|
|
42560
|
+
</Message>`
|
|
42561
|
+
}
|
|
42562
|
+
],
|
|
42563
|
+
leaf: {
|
|
42564
|
+
props: z14.object({
|
|
42565
|
+
items: z14.array(
|
|
42566
|
+
z14.object({
|
|
42567
|
+
title: z14.string().describe("The title of the carousel item."),
|
|
42568
|
+
subtitle: z14.string().optional().describe("The subtitle of the carousel item."),
|
|
42569
|
+
imageUrl: z14.string().url().optional().describe("The URL of the image to be displayed on the carousel item."),
|
|
42570
|
+
actions: z14.array(
|
|
42571
|
+
z14.object({
|
|
42572
|
+
action: z14.enum(["postback", "url", "say"]).describe("The type of action for the button."),
|
|
42573
|
+
label: z14.string().describe("The label of the button to be displayed to the user."),
|
|
42574
|
+
value: z14.string().describe("The value associated with the button action.")
|
|
42575
|
+
})
|
|
42576
|
+
).max(3).describe("The list of actions (buttons) to include on the carousel item.")
|
|
42577
|
+
})
|
|
42578
|
+
).describe("The list of items (cards) to include in the carousel.")
|
|
42579
|
+
})
|
|
42580
|
+
}
|
|
42581
|
+
});
|
|
42582
|
+
|
|
42321
42583
|
// src/runtime/chat/citations.ts
|
|
42322
42584
|
init_define_BUILD();
|
|
42323
42585
|
init_define_PACKAGE_VERSIONS();
|
|
@@ -42325,21 +42587,21 @@ init_define_PACKAGE_VERSIONS();
|
|
|
42325
42587
|
// src/runtime/chat/transcript.ts
|
|
42326
42588
|
init_define_BUILD();
|
|
42327
42589
|
init_define_PACKAGE_VERSIONS();
|
|
42328
|
-
import { z as
|
|
42329
|
-
var AttachmentSchema =
|
|
42330
|
-
type:
|
|
42331
|
-
url:
|
|
42332
|
-
});
|
|
42333
|
-
var TranscriptItemSchema =
|
|
42334
|
-
id:
|
|
42335
|
-
role:
|
|
42336
|
-
name:
|
|
42337
|
-
createdAt:
|
|
42338
|
-
content:
|
|
42339
|
-
attachments:
|
|
42340
|
-
payload:
|
|
42341
|
-
});
|
|
42342
|
-
var TranscriptSchema =
|
|
42590
|
+
import { z as z15 } from "@botpress/sdk";
|
|
42591
|
+
var AttachmentSchema = z15.object({
|
|
42592
|
+
type: z15.literal("image"),
|
|
42593
|
+
url: z15.string()
|
|
42594
|
+
});
|
|
42595
|
+
var TranscriptItemSchema = z15.object({
|
|
42596
|
+
id: z15.string(),
|
|
42597
|
+
role: z15.union([z15.literal("assistant"), z15.literal("user"), z15.literal("event"), z15.literal("summary")]),
|
|
42598
|
+
name: z15.string().optional(),
|
|
42599
|
+
createdAt: z15.string().optional(),
|
|
42600
|
+
content: z15.string().optional(),
|
|
42601
|
+
attachments: z15.array(AttachmentSchema).optional(),
|
|
42602
|
+
payload: z15.unknown().optional()
|
|
42603
|
+
});
|
|
42604
|
+
var TranscriptSchema = z15.array(TranscriptItemSchema);
|
|
42343
42605
|
|
|
42344
42606
|
// src/runtime/handlers/index.ts
|
|
42345
42607
|
init_define_BUILD();
|
|
@@ -42352,7 +42614,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
42352
42614
|
// src/primitives/conversation.ts
|
|
42353
42615
|
init_define_BUILD();
|
|
42354
42616
|
init_define_PACKAGE_VERSIONS();
|
|
42355
|
-
import { z as
|
|
42617
|
+
import { z as z16 } from "@botpress/sdk";
|
|
42356
42618
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
42357
42619
|
|
|
42358
42620
|
// src/primitives/conversation-instance.ts
|
|
@@ -42484,7 +42746,7 @@ var BaseConversation = class {
|
|
|
42484
42746
|
#startFromTrigger;
|
|
42485
42747
|
constructor(props) {
|
|
42486
42748
|
this.channel = props.channel;
|
|
42487
|
-
this.schema = props.state ??
|
|
42749
|
+
this.schema = props.state ?? z16.object({}).passthrough();
|
|
42488
42750
|
this.#handler = props.handler;
|
|
42489
42751
|
if (props.startFromTrigger) {
|
|
42490
42752
|
this.#startFromTrigger = props.startFromTrigger;
|
|
@@ -43083,25 +43345,25 @@ step.request = async (request, message, stepName) => {
|
|
|
43083
43345
|
};
|
|
43084
43346
|
|
|
43085
43347
|
// src/primitives/workflow-instance.ts
|
|
43086
|
-
var workflowStepContextSchema =
|
|
43087
|
-
() =>
|
|
43088
|
-
output:
|
|
43089
|
-
attempts:
|
|
43090
|
-
i:
|
|
43091
|
-
startedAt:
|
|
43092
|
-
finishedAt:
|
|
43093
|
-
steps:
|
|
43094
|
-
error:
|
|
43095
|
-
message:
|
|
43096
|
-
failedAt:
|
|
43097
|
-
maxAttemptsReached:
|
|
43348
|
+
var workflowStepContextSchema = z20.lazy(
|
|
43349
|
+
() => z20.object({
|
|
43350
|
+
output: z20.unknown().optional(),
|
|
43351
|
+
attempts: z20.number(),
|
|
43352
|
+
i: z20.number().optional(),
|
|
43353
|
+
startedAt: z20.string(),
|
|
43354
|
+
finishedAt: z20.string().optional(),
|
|
43355
|
+
steps: z20.record(z20.string(), workflowStepContextSchema).optional(),
|
|
43356
|
+
error: z20.object({
|
|
43357
|
+
message: z20.string(),
|
|
43358
|
+
failedAt: z20.string(),
|
|
43359
|
+
maxAttemptsReached: z20.boolean()
|
|
43098
43360
|
}).optional()
|
|
43099
43361
|
})
|
|
43100
43362
|
);
|
|
43101
|
-
var workflowExecutionContextSchema =
|
|
43102
|
-
executionCount:
|
|
43103
|
-
revision:
|
|
43104
|
-
steps:
|
|
43363
|
+
var workflowExecutionContextSchema = z20.object({
|
|
43364
|
+
executionCount: z20.number().default(0),
|
|
43365
|
+
revision: z20.number().default(0),
|
|
43366
|
+
steps: z20.record(z20.string(), workflowStepContextSchema)
|
|
43105
43367
|
}).default({
|
|
43106
43368
|
executionCount: 0,
|
|
43107
43369
|
steps: {}
|
|
@@ -43340,45 +43602,45 @@ function createWorkflowExecutionState(client, workflowId) {
|
|
|
43340
43602
|
// src/primitives/definition.ts
|
|
43341
43603
|
init_define_BUILD();
|
|
43342
43604
|
init_define_PACKAGE_VERSIONS();
|
|
43343
|
-
import { z as
|
|
43605
|
+
import { z as z21 } from "@botpress/sdk";
|
|
43344
43606
|
var Definitions;
|
|
43345
43607
|
((Definitions2) => {
|
|
43346
|
-
const conversationDefinitionSchema =
|
|
43347
|
-
type:
|
|
43348
|
-
channel:
|
|
43349
|
-
|
|
43350
|
-
|
|
43351
|
-
|
|
43608
|
+
const conversationDefinitionSchema = z21.object({
|
|
43609
|
+
type: z21.literal("conversation"),
|
|
43610
|
+
channel: z21.union([
|
|
43611
|
+
z21.string().min(1, "Channel must be a non-empty string").max(255, "Channel must be less than 255 characters").regex(/^(\*|[a-zA-Z0-9._-]+)$/, "Channel must be a valid identifier or glob '*'"),
|
|
43612
|
+
z21.array(
|
|
43613
|
+
z21.string().min(1, "Channel must be a non-empty string").max(255, "Channel must be less than 255 characters").regex(/^[a-zA-Z0-9._-]+$/, "Channel must be a valid identifier")
|
|
43352
43614
|
)
|
|
43353
43615
|
])
|
|
43354
43616
|
});
|
|
43355
|
-
const workflowDefinitionSchema =
|
|
43356
|
-
type:
|
|
43357
|
-
name:
|
|
43617
|
+
const workflowDefinitionSchema = z21.object({
|
|
43618
|
+
type: z21.literal("workflow"),
|
|
43619
|
+
name: z21.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z0-9_-]+$/, "Name must be a valid identifier")
|
|
43358
43620
|
});
|
|
43359
|
-
const knowledgeDefinitionSchema =
|
|
43360
|
-
type:
|
|
43361
|
-
name:
|
|
43621
|
+
const knowledgeDefinitionSchema = z21.object({
|
|
43622
|
+
type: z21.literal("knowledge"),
|
|
43623
|
+
name: z21.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z0-9_-]+$/, "Name must be a valid identifier")
|
|
43362
43624
|
});
|
|
43363
|
-
const triggerDefinitionSchema =
|
|
43364
|
-
type:
|
|
43365
|
-
name:
|
|
43625
|
+
const triggerDefinitionSchema = z21.object({
|
|
43626
|
+
type: z21.literal("trigger"),
|
|
43627
|
+
name: z21.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z0-9_-]+$/, "Name must be a valid identifier")
|
|
43366
43628
|
});
|
|
43367
|
-
const actionDefinitionSchema =
|
|
43368
|
-
type:
|
|
43369
|
-
name:
|
|
43370
|
-
title:
|
|
43371
|
-
description:
|
|
43372
|
-
attributes:
|
|
43373
|
-
input:
|
|
43629
|
+
const actionDefinitionSchema = z21.object({
|
|
43630
|
+
type: z21.literal("action"),
|
|
43631
|
+
name: z21.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z][a-zA-Z0-9]*$/, "Name must be alphanumeric with no special characters"),
|
|
43632
|
+
title: z21.string().optional(),
|
|
43633
|
+
description: z21.string().optional(),
|
|
43634
|
+
attributes: z21.record(z21.string()).optional(),
|
|
43635
|
+
input: z21.any().optional(),
|
|
43374
43636
|
// JSONSchema7
|
|
43375
|
-
output:
|
|
43637
|
+
output: z21.any().optional(),
|
|
43376
43638
|
// JSONSchema7
|
|
43377
|
-
cached:
|
|
43639
|
+
cached: z21.boolean().optional()
|
|
43378
43640
|
});
|
|
43379
|
-
const tableDefinitionSchema =
|
|
43380
|
-
type:
|
|
43381
|
-
name:
|
|
43641
|
+
const tableDefinitionSchema = z21.object({
|
|
43642
|
+
type: z21.literal("table"),
|
|
43643
|
+
name: z21.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z0-9_-]+$/, "Name must be a valid identifier")
|
|
43382
43644
|
});
|
|
43383
43645
|
function isConversationDefinition(value) {
|
|
43384
43646
|
return conversationDefinitionSchema.safeParse(value).success;
|
|
@@ -43434,7 +43696,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43434
43696
|
// src/primitives/data-sources/source-table.ts
|
|
43435
43697
|
init_define_BUILD();
|
|
43436
43698
|
init_define_PACKAGE_VERSIONS();
|
|
43437
|
-
import { z as
|
|
43699
|
+
import { z as z22 } from "@botpress/sdk";
|
|
43438
43700
|
var TableSource = class _TableSource extends DataSource {
|
|
43439
43701
|
table;
|
|
43440
43702
|
transformFn;
|
|
@@ -43455,7 +43717,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43455
43717
|
get syncWorkflow() {
|
|
43456
43718
|
return createSyncWorkflow({
|
|
43457
43719
|
type: "table",
|
|
43458
|
-
state:
|
|
43720
|
+
state: z22.object({ offset: z22.number().default(0) }),
|
|
43459
43721
|
handler: async () => {
|
|
43460
43722
|
throw new Error("TableSource synchronization not implemented");
|
|
43461
43723
|
}
|
|
@@ -43470,7 +43732,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43470
43732
|
// src/primitives/data-sources/source-website.ts
|
|
43471
43733
|
init_define_BUILD();
|
|
43472
43734
|
init_define_PACKAGE_VERSIONS();
|
|
43473
|
-
import { z as
|
|
43735
|
+
import { z as z23 } from "@botpress/sdk";
|
|
43474
43736
|
|
|
43475
43737
|
// ../../node_modules/fast-xml-parser/src/fxp.js
|
|
43476
43738
|
init_define_BUILD();
|
|
@@ -45023,16 +45285,16 @@ async function fetchHtml(url2, options) {
|
|
|
45023
45285
|
}
|
|
45024
45286
|
|
|
45025
45287
|
// src/primitives/data-sources/source-website.ts
|
|
45026
|
-
var State =
|
|
45027
|
-
urls:
|
|
45028
|
-
|
|
45029
|
-
loc:
|
|
45030
|
-
lastmod:
|
|
45031
|
-
changefreq:
|
|
45032
|
-
priority:
|
|
45288
|
+
var State = z23.object({
|
|
45289
|
+
urls: z23.array(
|
|
45290
|
+
z23.object({
|
|
45291
|
+
loc: z23.string(),
|
|
45292
|
+
lastmod: z23.string().optional(),
|
|
45293
|
+
changefreq: z23.string().optional(),
|
|
45294
|
+
priority: z23.string().optional()
|
|
45033
45295
|
})
|
|
45034
45296
|
).default([]),
|
|
45035
|
-
queue:
|
|
45297
|
+
queue: z23.array(z23.object({ url: z23.string(), depth: z23.number() })).default([])
|
|
45036
45298
|
});
|
|
45037
45299
|
var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
45038
45300
|
mode;
|
|
@@ -45558,7 +45820,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
|
45558
45820
|
// src/primitives/data-sources/source-directory.ts
|
|
45559
45821
|
init_define_BUILD();
|
|
45560
45822
|
init_define_PACKAGE_VERSIONS();
|
|
45561
|
-
import { z as
|
|
45823
|
+
import { z as z24 } from "@botpress/sdk";
|
|
45562
45824
|
var DirectorySource = class _DirectorySource extends DataSource {
|
|
45563
45825
|
_directoryPath;
|
|
45564
45826
|
_filterFn;
|
|
@@ -45587,7 +45849,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
|
|
|
45587
45849
|
get syncWorkflow() {
|
|
45588
45850
|
return createSyncWorkflow({
|
|
45589
45851
|
type: "directory",
|
|
45590
|
-
state:
|
|
45852
|
+
state: z24.object({}),
|
|
45591
45853
|
handler: async ({ input, step: step2, client }) => {
|
|
45592
45854
|
if (!adk.environment.isDevelopment()) {
|
|
45593
45855
|
console.log("Directory ingestion is only supported in development environment");
|
|
@@ -45806,7 +46068,7 @@ var BaseKnowledge = class {
|
|
|
45806
46068
|
// src/primitives/table.ts
|
|
45807
46069
|
init_define_BUILD();
|
|
45808
46070
|
init_define_PACKAGE_VERSIONS();
|
|
45809
|
-
import { transforms as transforms3, z as
|
|
46071
|
+
import { transforms as transforms3, z as z25 } from "@bpinternal/zui";
|
|
45810
46072
|
var Typings6;
|
|
45811
46073
|
((Typings8) => {
|
|
45812
46074
|
Typings8.Primitive = "table";
|
|
@@ -45824,7 +46086,7 @@ var BaseTable = class {
|
|
|
45824
46086
|
return context.get("client");
|
|
45825
46087
|
}
|
|
45826
46088
|
constructor(props) {
|
|
45827
|
-
const tableNameSchema =
|
|
46089
|
+
const tableNameSchema = z25.string().min(1).refine((name) => !z25.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
|
|
45828
46090
|
(name) => /^[a-zA-Z_$][a-zA-Z0-9_]{0,29}Table$/.test(name),
|
|
45829
46091
|
"Table name must start with a letter/underscore, be 35 chars or less, contain only letters/numbers/underscores, and end with 'Table'"
|
|
45830
46092
|
);
|
|
@@ -45838,7 +46100,7 @@ var BaseTable = class {
|
|
|
45838
46100
|
}
|
|
45839
46101
|
this.factor = props.factor ?? 1;
|
|
45840
46102
|
this.columns = {};
|
|
45841
|
-
let schema =
|
|
46103
|
+
let schema = z25.object({});
|
|
45842
46104
|
for (const [key, value] of Object.entries(props.columns)) {
|
|
45843
46105
|
const val = value;
|
|
45844
46106
|
if (val && typeof val === "object" && "schema" in val) {
|
|
@@ -46014,16 +46276,16 @@ var BaseTable = class {
|
|
|
46014
46276
|
// src/primitives/trigger.ts
|
|
46015
46277
|
init_define_BUILD();
|
|
46016
46278
|
init_define_PACKAGE_VERSIONS();
|
|
46017
|
-
import { z as
|
|
46279
|
+
import { z as z26 } from "@botpress/sdk";
|
|
46018
46280
|
var Typings7;
|
|
46019
46281
|
((Typings8) => {
|
|
46020
46282
|
Typings8.Primitive = "trigger";
|
|
46021
46283
|
})(Typings7 || (Typings7 = {}));
|
|
46022
|
-
var TriggerSchema =
|
|
46023
|
-
name:
|
|
46024
|
-
description:
|
|
46025
|
-
events:
|
|
46026
|
-
handler:
|
|
46284
|
+
var TriggerSchema = z26.object({
|
|
46285
|
+
name: z26.string().min(3, "Trigger name must be at least 3 characters").max(255, "Trigger name must be less than 255 characters").regex(/^[a-zA-Z0-9_]+$/, "Trigger name must contain only alphanumeric characters and underscores"),
|
|
46286
|
+
description: z26.string().max(1024, "Description must be less than 1024 characters").optional(),
|
|
46287
|
+
events: z26.array(z26.string()),
|
|
46288
|
+
handler: z26.function().describe("Handler function for the trigger")
|
|
46027
46289
|
});
|
|
46028
46290
|
var Trigger = class {
|
|
46029
46291
|
name;
|