@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/library.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
|
}
|
|
@@ -34293,7 +34293,7 @@ var init_esm9 = __esm({
|
|
|
34293
34293
|
// src/library.ts
|
|
34294
34294
|
init_define_BUILD();
|
|
34295
34295
|
init_define_PACKAGE_VERSIONS();
|
|
34296
|
-
import { z as
|
|
34296
|
+
import { z as z26 } from "@botpress/sdk";
|
|
34297
34297
|
import { Cognitive as Cognitive2 } from "@botpress/cognitive";
|
|
34298
34298
|
import { Zai as Zai2 } from "@botpress/zai";
|
|
34299
34299
|
|
|
@@ -42701,7 +42701,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
42701
42701
|
// src/runtime/chat/chat.ts
|
|
42702
42702
|
init_define_BUILD();
|
|
42703
42703
|
init_define_PACKAGE_VERSIONS();
|
|
42704
|
-
import { Chat,
|
|
42704
|
+
import { Chat, isAnyComponent as isAnyComponent2 } from "llmz";
|
|
42705
42705
|
|
|
42706
42706
|
// src/runtime/chat/truncate-transcript.ts
|
|
42707
42707
|
init_define_BUILD();
|
|
@@ -43019,6 +43019,268 @@ var Transcript = {
|
|
|
43019
43019
|
TRANSCRIPT_ITEM_MAX_BYTES: 1e4
|
|
43020
43020
|
};
|
|
43021
43021
|
|
|
43022
|
+
// src/runtime/chat/components.ts
|
|
43023
|
+
init_define_BUILD();
|
|
43024
|
+
init_define_PACKAGE_VERSIONS();
|
|
43025
|
+
import { messages, z as z17 } from "@botpress/sdk";
|
|
43026
|
+
var DefaultMessageTypes = {
|
|
43027
|
+
text: messages.defaults["text"].schema,
|
|
43028
|
+
audio: messages.defaults["audio"].schema,
|
|
43029
|
+
card: messages.defaults["card"].schema,
|
|
43030
|
+
image: messages.defaults["image"].schema,
|
|
43031
|
+
carousel: messages.defaults["carousel"].schema,
|
|
43032
|
+
choice: messages.defaults["choice"].schema,
|
|
43033
|
+
dropdown: messages.defaults["dropdown"].schema,
|
|
43034
|
+
file: messages.defaults["file"].schema,
|
|
43035
|
+
location: messages.defaults["location"].schema,
|
|
43036
|
+
video: messages.defaults["video"].schema,
|
|
43037
|
+
bloc: messages.defaults["bloc"].schema
|
|
43038
|
+
};
|
|
43039
|
+
var AudioComponent = new Autonomous.Component({
|
|
43040
|
+
type: "leaf",
|
|
43041
|
+
aliases: [],
|
|
43042
|
+
name: "Audio",
|
|
43043
|
+
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.`,
|
|
43044
|
+
examples: [
|
|
43045
|
+
{
|
|
43046
|
+
name: " Basic Audio Message",
|
|
43047
|
+
description: "Sends a simple audio message to the user",
|
|
43048
|
+
code: `
|
|
43049
|
+
yield <Message>
|
|
43050
|
+
Here's an **awesome** audio clip for you!
|
|
43051
|
+
<Audio audioUrl="https://example.com/path/to/audio.mp3" />
|
|
43052
|
+
</Message>`
|
|
43053
|
+
}
|
|
43054
|
+
],
|
|
43055
|
+
leaf: {
|
|
43056
|
+
props: z17.object({
|
|
43057
|
+
audioUrl: z17.string().url().describe("The URL of the audio file to be sent.")
|
|
43058
|
+
})
|
|
43059
|
+
}
|
|
43060
|
+
});
|
|
43061
|
+
var ImageComponent = new Autonomous.Component({
|
|
43062
|
+
type: "leaf",
|
|
43063
|
+
aliases: ["img"],
|
|
43064
|
+
name: "Image",
|
|
43065
|
+
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.`,
|
|
43066
|
+
examples: [
|
|
43067
|
+
{
|
|
43068
|
+
name: " Basic Image Message",
|
|
43069
|
+
description: "Sends a simple image message to the user",
|
|
43070
|
+
code: `
|
|
43071
|
+
yield <Message>
|
|
43072
|
+
Here's an **awesome** image for you!
|
|
43073
|
+
<Image imageUrl="https://example.com/path/to/image.jpg" />
|
|
43074
|
+
</Message>`
|
|
43075
|
+
}
|
|
43076
|
+
],
|
|
43077
|
+
leaf: {
|
|
43078
|
+
props: z17.object({
|
|
43079
|
+
imageUrl: z17.string().url().describe("The URL of the image to be sent.")
|
|
43080
|
+
})
|
|
43081
|
+
}
|
|
43082
|
+
});
|
|
43083
|
+
var VideoComponent = new Autonomous.Component({
|
|
43084
|
+
type: "leaf",
|
|
43085
|
+
aliases: [],
|
|
43086
|
+
name: "Video",
|
|
43087
|
+
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.`,
|
|
43088
|
+
examples: [
|
|
43089
|
+
{
|
|
43090
|
+
name: " Basic Video Message",
|
|
43091
|
+
description: "Sends a simple video message to the user",
|
|
43092
|
+
code: `
|
|
43093
|
+
yield <Message>
|
|
43094
|
+
Here's an **awesome** video for you!
|
|
43095
|
+
<Video videoUrl="https://example.com/path/to/video.mp4" />
|
|
43096
|
+
</Message>`
|
|
43097
|
+
}
|
|
43098
|
+
],
|
|
43099
|
+
leaf: {
|
|
43100
|
+
props: z17.object({
|
|
43101
|
+
videoUrl: z17.string().url().describe("The URL of the video to be sent.")
|
|
43102
|
+
})
|
|
43103
|
+
}
|
|
43104
|
+
});
|
|
43105
|
+
var LocationComponent = new Autonomous.Component({
|
|
43106
|
+
type: "leaf",
|
|
43107
|
+
aliases: [],
|
|
43108
|
+
name: "Location",
|
|
43109
|
+
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.
|
|
43110
|
+
The location can also optionally include an address and a title for better context.`,
|
|
43111
|
+
examples: [
|
|
43112
|
+
{
|
|
43113
|
+
name: " Basic Location Message",
|
|
43114
|
+
description: "Sends a simple location message to the user",
|
|
43115
|
+
code: `
|
|
43116
|
+
yield <Message>
|
|
43117
|
+
Here's the location you requested!
|
|
43118
|
+
<Location latitude={37.7749} longitude={-122.4194} />
|
|
43119
|
+
</Message>`
|
|
43120
|
+
},
|
|
43121
|
+
{
|
|
43122
|
+
name: " Location Message with Address and Title",
|
|
43123
|
+
description: "Sends a location message with additional address and title information",
|
|
43124
|
+
code: `
|
|
43125
|
+
yield <Message>
|
|
43126
|
+
Here's the location of our office!
|
|
43127
|
+
<Location
|
|
43128
|
+
latitude={45.506342}
|
|
43129
|
+
longitude={-73.572012}
|
|
43130
|
+
address="400 Blvd. De Maisonneuve Ouest #200, Montreal, Quebec H3A 1L4, Canada"
|
|
43131
|
+
title="Botpress HQ"
|
|
43132
|
+
/>
|
|
43133
|
+
</Message>`
|
|
43134
|
+
}
|
|
43135
|
+
],
|
|
43136
|
+
leaf: {
|
|
43137
|
+
props: z17.object({
|
|
43138
|
+
latitude: z17.number().describe("The latitude of the location to be sent."),
|
|
43139
|
+
longitude: z17.number().describe("The longitude of the location to be sent."),
|
|
43140
|
+
address: z17.string().optional().describe("The address of the location to be sent."),
|
|
43141
|
+
title: z17.string().optional().describe("The title of the location to be sent.")
|
|
43142
|
+
})
|
|
43143
|
+
}
|
|
43144
|
+
});
|
|
43145
|
+
var ChoiceComponent = new Autonomous.Component({
|
|
43146
|
+
type: "leaf",
|
|
43147
|
+
aliases: ["choices", "option", "options", "buttons"],
|
|
43148
|
+
name: "Choice",
|
|
43149
|
+
description: `Present a choice to the user with multiple options.
|
|
43150
|
+
The user can select one of the provided options, and the selection will be sent back to the system for further processing.
|
|
43151
|
+
You can include up to 10 options for the user to choose from.
|
|
43152
|
+
Values for each option should be unique identifiers that can be used to identify the user's selection.`,
|
|
43153
|
+
examples: [
|
|
43154
|
+
{
|
|
43155
|
+
name: " Basic Choice Message",
|
|
43156
|
+
description: "Presents a simple choice message to the user",
|
|
43157
|
+
code: `
|
|
43158
|
+
yield <Message>
|
|
43159
|
+
Please choose one of the following options:
|
|
43160
|
+
<Choice
|
|
43161
|
+
text="Select an option:"
|
|
43162
|
+
options={[
|
|
43163
|
+
{ label: "Option 1", value: "option_1" },
|
|
43164
|
+
{ label: "Option 2", value: "option_2" },
|
|
43165
|
+
{ label: "Option 3", value: "option_3" }
|
|
43166
|
+
]}
|
|
43167
|
+
/>
|
|
43168
|
+
</Message>`
|
|
43169
|
+
}
|
|
43170
|
+
],
|
|
43171
|
+
leaf: {
|
|
43172
|
+
props: z17.object({
|
|
43173
|
+
text: z17.string().describe("The prompt text for the choice."),
|
|
43174
|
+
options: z17.array(
|
|
43175
|
+
z17.object({
|
|
43176
|
+
label: z17.string().describe("The label of the option to be displayed to the user."),
|
|
43177
|
+
value: z17.string().describe("The value of the option to be sent back when selected.")
|
|
43178
|
+
})
|
|
43179
|
+
).describe("The list of options to present to the user.")
|
|
43180
|
+
})
|
|
43181
|
+
}
|
|
43182
|
+
});
|
|
43183
|
+
var DropdownComponent = new Autonomous.Component({
|
|
43184
|
+
type: "leaf",
|
|
43185
|
+
aliases: ["dropdown", "select", "combo"],
|
|
43186
|
+
name: "Dropdown",
|
|
43187
|
+
description: `Present a dropdown menu to the user with multiple options.
|
|
43188
|
+
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.
|
|
43189
|
+
Unlike the Choice component, the Dropdown component is typically used when there are more options to choose from, providing a more compact UI.
|
|
43190
|
+
The dropdown can include up to 100 options for the user to choose from.
|
|
43191
|
+
Values for each option should be unique identifiers that can be used to identify the user's selection.`,
|
|
43192
|
+
examples: [
|
|
43193
|
+
{
|
|
43194
|
+
name: " Basic Dropdown Message",
|
|
43195
|
+
description: "Presents a simple dropdown message to the user",
|
|
43196
|
+
code: `
|
|
43197
|
+
yield <Message>
|
|
43198
|
+
Please select a fruit from the dropdown:
|
|
43199
|
+
<Dropdown
|
|
43200
|
+
text="Choose an option:"
|
|
43201
|
+
options={[
|
|
43202
|
+
{ label: "\u{1F350} Pear", value: "pear" },
|
|
43203
|
+
{ label: "\u{1F34E} Apple", value: "apple" },
|
|
43204
|
+
{ label: "\u{1F34C} Banana", value: "banana" }
|
|
43205
|
+
]}
|
|
43206
|
+
/>
|
|
43207
|
+
</Message>`
|
|
43208
|
+
}
|
|
43209
|
+
],
|
|
43210
|
+
leaf: {
|
|
43211
|
+
props: z17.object({
|
|
43212
|
+
text: z17.string().describe("The prompt text for the dropdown."),
|
|
43213
|
+
options: z17.array(
|
|
43214
|
+
z17.object({
|
|
43215
|
+
label: z17.string().describe("The label of the option to be displayed to the user."),
|
|
43216
|
+
value: z17.string().describe("The value of the option to be sent back when selected.")
|
|
43217
|
+
})
|
|
43218
|
+
).describe("The list of options to present in the dropdown.")
|
|
43219
|
+
})
|
|
43220
|
+
}
|
|
43221
|
+
});
|
|
43222
|
+
var CarouselComponent = new Autonomous.Component({
|
|
43223
|
+
type: "leaf",
|
|
43224
|
+
aliases: ["carousel", "cards", "card"],
|
|
43225
|
+
name: "Carousel",
|
|
43226
|
+
description: `Send a carousel of cards to the user, allowing them to browse through multiple items.
|
|
43227
|
+
Carousels are useful for displaying a collection of related items in a compact and interactive format.
|
|
43228
|
+
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.
|
|
43229
|
+
Each item in the carousel is represented as a card, which can include an image, title, subtitle, and actions.
|
|
43230
|
+
Users can navigate through the carousel by swiping or clicking on navigation controls.
|
|
43231
|
+
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).`,
|
|
43232
|
+
examples: [
|
|
43233
|
+
{
|
|
43234
|
+
name: " Basic Carousel Message",
|
|
43235
|
+
description: "Sends a simple carousel message to the user",
|
|
43236
|
+
code: `
|
|
43237
|
+
yield <Message>
|
|
43238
|
+
Here is an **exciting** carousel for you!
|
|
43239
|
+
<Carousel
|
|
43240
|
+
items={[
|
|
43241
|
+
{
|
|
43242
|
+
title: "Product 1",
|
|
43243
|
+
subtitle: "Description of Product 1",
|
|
43244
|
+
imageUrl: "https://example.com/path/to/image1.jpg",
|
|
43245
|
+
actions: [
|
|
43246
|
+
{ action: "postback", label: "Buy Now", value: "buy_product_1" },
|
|
43247
|
+
{ action: "url", label: "View Details", value: "https://example.com/product_1" }
|
|
43248
|
+
]
|
|
43249
|
+
},
|
|
43250
|
+
{
|
|
43251
|
+
title: "Product 2",
|
|
43252
|
+
subtitle: "Description of Product 2",
|
|
43253
|
+
imageUrl: "https://example.com/path/to/image2.jpg",
|
|
43254
|
+
actions: [
|
|
43255
|
+
{ action: "postback", label: "Buy Now", value: "buy_product_2" },
|
|
43256
|
+
{ action: "url", label: "View Details", value: "https://example.com/product_2" }
|
|
43257
|
+
]
|
|
43258
|
+
}
|
|
43259
|
+
]}
|
|
43260
|
+
/>
|
|
43261
|
+
</Message>`
|
|
43262
|
+
}
|
|
43263
|
+
],
|
|
43264
|
+
leaf: {
|
|
43265
|
+
props: z17.object({
|
|
43266
|
+
items: z17.array(
|
|
43267
|
+
z17.object({
|
|
43268
|
+
title: z17.string().describe("The title of the carousel item."),
|
|
43269
|
+
subtitle: z17.string().optional().describe("The subtitle of the carousel item."),
|
|
43270
|
+
imageUrl: z17.string().url().optional().describe("The URL of the image to be displayed on the carousel item."),
|
|
43271
|
+
actions: z17.array(
|
|
43272
|
+
z17.object({
|
|
43273
|
+
action: z17.enum(["postback", "url", "say"]).describe("The type of action for the button."),
|
|
43274
|
+
label: z17.string().describe("The label of the button to be displayed to the user."),
|
|
43275
|
+
value: z17.string().describe("The value associated with the button action.")
|
|
43276
|
+
})
|
|
43277
|
+
).max(3).describe("The list of actions (buttons) to include on the carousel item.")
|
|
43278
|
+
})
|
|
43279
|
+
).describe("The list of items (cards) to include in the carousel.")
|
|
43280
|
+
})
|
|
43281
|
+
}
|
|
43282
|
+
});
|
|
43283
|
+
|
|
43022
43284
|
// src/runtime/chat/citations.ts
|
|
43023
43285
|
init_define_BUILD();
|
|
43024
43286
|
init_define_PACKAGE_VERSIONS();
|
|
@@ -43026,21 +43288,21 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43026
43288
|
// src/runtime/chat/transcript.ts
|
|
43027
43289
|
init_define_BUILD();
|
|
43028
43290
|
init_define_PACKAGE_VERSIONS();
|
|
43029
|
-
import { z as
|
|
43030
|
-
var AttachmentSchema =
|
|
43031
|
-
type:
|
|
43032
|
-
url:
|
|
43033
|
-
});
|
|
43034
|
-
var TranscriptItemSchema =
|
|
43035
|
-
id:
|
|
43036
|
-
role:
|
|
43037
|
-
name:
|
|
43038
|
-
createdAt:
|
|
43039
|
-
content:
|
|
43040
|
-
attachments:
|
|
43041
|
-
payload:
|
|
43042
|
-
});
|
|
43043
|
-
var TranscriptSchema =
|
|
43291
|
+
import { z as z18 } from "@botpress/sdk";
|
|
43292
|
+
var AttachmentSchema = z18.object({
|
|
43293
|
+
type: z18.literal("image"),
|
|
43294
|
+
url: z18.string()
|
|
43295
|
+
});
|
|
43296
|
+
var TranscriptItemSchema = z18.object({
|
|
43297
|
+
id: z18.string(),
|
|
43298
|
+
role: z18.union([z18.literal("assistant"), z18.literal("user"), z18.literal("event"), z18.literal("summary")]),
|
|
43299
|
+
name: z18.string().optional(),
|
|
43300
|
+
createdAt: z18.string().optional(),
|
|
43301
|
+
content: z18.string().optional(),
|
|
43302
|
+
attachments: z18.array(AttachmentSchema).optional(),
|
|
43303
|
+
payload: z18.unknown().optional()
|
|
43304
|
+
});
|
|
43305
|
+
var TranscriptSchema = z18.array(TranscriptItemSchema);
|
|
43044
43306
|
|
|
43045
43307
|
// src/runtime/handlers/index.ts
|
|
43046
43308
|
init_define_BUILD();
|
|
@@ -43053,7 +43315,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43053
43315
|
// src/primitives/conversation.ts
|
|
43054
43316
|
init_define_BUILD();
|
|
43055
43317
|
init_define_PACKAGE_VERSIONS();
|
|
43056
|
-
import { z as
|
|
43318
|
+
import { z as z19 } from "@botpress/sdk";
|
|
43057
43319
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
43058
43320
|
|
|
43059
43321
|
// src/primitives/conversation-instance.ts
|
|
@@ -43185,7 +43447,7 @@ var BaseConversation = class {
|
|
|
43185
43447
|
#startFromTrigger;
|
|
43186
43448
|
constructor(props) {
|
|
43187
43449
|
this.channel = props.channel;
|
|
43188
|
-
this.schema = props.state ??
|
|
43450
|
+
this.schema = props.state ?? z19.object({}).passthrough();
|
|
43189
43451
|
this.#handler = props.handler;
|
|
43190
43452
|
if (props.startFromTrigger) {
|
|
43191
43453
|
this.#startFromTrigger = props.startFromTrigger;
|
|
@@ -43363,45 +43625,45 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43363
43625
|
// src/primitives/definition.ts
|
|
43364
43626
|
init_define_BUILD();
|
|
43365
43627
|
init_define_PACKAGE_VERSIONS();
|
|
43366
|
-
import { z as
|
|
43628
|
+
import { z as z20 } from "@botpress/sdk";
|
|
43367
43629
|
var Definitions;
|
|
43368
43630
|
((Definitions2) => {
|
|
43369
|
-
const conversationDefinitionSchema =
|
|
43370
|
-
type:
|
|
43371
|
-
channel:
|
|
43372
|
-
|
|
43373
|
-
|
|
43374
|
-
|
|
43631
|
+
const conversationDefinitionSchema = z20.object({
|
|
43632
|
+
type: z20.literal("conversation"),
|
|
43633
|
+
channel: z20.union([
|
|
43634
|
+
z20.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 '*'"),
|
|
43635
|
+
z20.array(
|
|
43636
|
+
z20.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")
|
|
43375
43637
|
)
|
|
43376
43638
|
])
|
|
43377
43639
|
});
|
|
43378
|
-
const workflowDefinitionSchema =
|
|
43379
|
-
type:
|
|
43380
|
-
name:
|
|
43640
|
+
const workflowDefinitionSchema = z20.object({
|
|
43641
|
+
type: z20.literal("workflow"),
|
|
43642
|
+
name: z20.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")
|
|
43381
43643
|
});
|
|
43382
|
-
const knowledgeDefinitionSchema =
|
|
43383
|
-
type:
|
|
43384
|
-
name:
|
|
43644
|
+
const knowledgeDefinitionSchema = z20.object({
|
|
43645
|
+
type: z20.literal("knowledge"),
|
|
43646
|
+
name: z20.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")
|
|
43385
43647
|
});
|
|
43386
|
-
const triggerDefinitionSchema =
|
|
43387
|
-
type:
|
|
43388
|
-
name:
|
|
43648
|
+
const triggerDefinitionSchema = z20.object({
|
|
43649
|
+
type: z20.literal("trigger"),
|
|
43650
|
+
name: z20.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")
|
|
43389
43651
|
});
|
|
43390
|
-
const actionDefinitionSchema =
|
|
43391
|
-
type:
|
|
43392
|
-
name:
|
|
43393
|
-
title:
|
|
43394
|
-
description:
|
|
43395
|
-
attributes:
|
|
43396
|
-
input:
|
|
43652
|
+
const actionDefinitionSchema = z20.object({
|
|
43653
|
+
type: z20.literal("action"),
|
|
43654
|
+
name: z20.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"),
|
|
43655
|
+
title: z20.string().optional(),
|
|
43656
|
+
description: z20.string().optional(),
|
|
43657
|
+
attributes: z20.record(z20.string()).optional(),
|
|
43658
|
+
input: z20.any().optional(),
|
|
43397
43659
|
// JSONSchema7
|
|
43398
|
-
output:
|
|
43660
|
+
output: z20.any().optional(),
|
|
43399
43661
|
// JSONSchema7
|
|
43400
|
-
cached:
|
|
43662
|
+
cached: z20.boolean().optional()
|
|
43401
43663
|
});
|
|
43402
|
-
const tableDefinitionSchema =
|
|
43403
|
-
type:
|
|
43404
|
-
name:
|
|
43664
|
+
const tableDefinitionSchema = z20.object({
|
|
43665
|
+
type: z20.literal("table"),
|
|
43666
|
+
name: z20.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")
|
|
43405
43667
|
});
|
|
43406
43668
|
function isConversationDefinition(value) {
|
|
43407
43669
|
return conversationDefinitionSchema.safeParse(value).success;
|
|
@@ -43457,7 +43719,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43457
43719
|
// src/primitives/data-sources/source-table.ts
|
|
43458
43720
|
init_define_BUILD();
|
|
43459
43721
|
init_define_PACKAGE_VERSIONS();
|
|
43460
|
-
import { z as
|
|
43722
|
+
import { z as z21 } from "@botpress/sdk";
|
|
43461
43723
|
var TableSource = class _TableSource extends DataSource {
|
|
43462
43724
|
table;
|
|
43463
43725
|
transformFn;
|
|
@@ -43478,7 +43740,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43478
43740
|
get syncWorkflow() {
|
|
43479
43741
|
return createSyncWorkflow({
|
|
43480
43742
|
type: "table",
|
|
43481
|
-
state:
|
|
43743
|
+
state: z21.object({ offset: z21.number().default(0) }),
|
|
43482
43744
|
handler: async () => {
|
|
43483
43745
|
throw new Error("TableSource synchronization not implemented");
|
|
43484
43746
|
}
|
|
@@ -43493,7 +43755,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43493
43755
|
// src/primitives/data-sources/source-website.ts
|
|
43494
43756
|
init_define_BUILD();
|
|
43495
43757
|
init_define_PACKAGE_VERSIONS();
|
|
43496
|
-
import { z as
|
|
43758
|
+
import { z as z22 } from "@botpress/sdk";
|
|
43497
43759
|
|
|
43498
43760
|
// ../../node_modules/fast-xml-parser/src/fxp.js
|
|
43499
43761
|
init_define_BUILD();
|
|
@@ -45046,16 +45308,16 @@ async function fetchHtml(url2, options) {
|
|
|
45046
45308
|
}
|
|
45047
45309
|
|
|
45048
45310
|
// src/primitives/data-sources/source-website.ts
|
|
45049
|
-
var State =
|
|
45050
|
-
urls:
|
|
45051
|
-
|
|
45052
|
-
loc:
|
|
45053
|
-
lastmod:
|
|
45054
|
-
changefreq:
|
|
45055
|
-
priority:
|
|
45311
|
+
var State = z22.object({
|
|
45312
|
+
urls: z22.array(
|
|
45313
|
+
z22.object({
|
|
45314
|
+
loc: z22.string(),
|
|
45315
|
+
lastmod: z22.string().optional(),
|
|
45316
|
+
changefreq: z22.string().optional(),
|
|
45317
|
+
priority: z22.string().optional()
|
|
45056
45318
|
})
|
|
45057
45319
|
).default([]),
|
|
45058
|
-
queue:
|
|
45320
|
+
queue: z22.array(z22.object({ url: z22.string(), depth: z22.number() })).default([])
|
|
45059
45321
|
});
|
|
45060
45322
|
var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
45061
45323
|
mode;
|
|
@@ -45581,7 +45843,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
|
45581
45843
|
// src/primitives/data-sources/source-directory.ts
|
|
45582
45844
|
init_define_BUILD();
|
|
45583
45845
|
init_define_PACKAGE_VERSIONS();
|
|
45584
|
-
import { z as
|
|
45846
|
+
import { z as z23 } from "@botpress/sdk";
|
|
45585
45847
|
var DirectorySource = class _DirectorySource extends DataSource {
|
|
45586
45848
|
_directoryPath;
|
|
45587
45849
|
_filterFn;
|
|
@@ -45610,7 +45872,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
|
|
|
45610
45872
|
get syncWorkflow() {
|
|
45611
45873
|
return createSyncWorkflow({
|
|
45612
45874
|
type: "directory",
|
|
45613
|
-
state:
|
|
45875
|
+
state: z23.object({}),
|
|
45614
45876
|
handler: async ({ input, step: step2, client }) => {
|
|
45615
45877
|
if (!adk.environment.isDevelopment()) {
|
|
45616
45878
|
console.log("Directory ingestion is only supported in development environment");
|
|
@@ -45829,7 +46091,7 @@ var BaseKnowledge = class {
|
|
|
45829
46091
|
// src/primitives/table.ts
|
|
45830
46092
|
init_define_BUILD();
|
|
45831
46093
|
init_define_PACKAGE_VERSIONS();
|
|
45832
|
-
import { transforms as transforms3, z as
|
|
46094
|
+
import { transforms as transforms3, z as z24 } from "@bpinternal/zui";
|
|
45833
46095
|
var Typings6;
|
|
45834
46096
|
((Typings8) => {
|
|
45835
46097
|
Typings8.Primitive = "table";
|
|
@@ -45847,7 +46109,7 @@ var BaseTable = class {
|
|
|
45847
46109
|
return context.get("client");
|
|
45848
46110
|
}
|
|
45849
46111
|
constructor(props) {
|
|
45850
|
-
const tableNameSchema =
|
|
46112
|
+
const tableNameSchema = z24.string().min(1).refine((name) => !z24.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
|
|
45851
46113
|
(name) => /^[a-zA-Z_$][a-zA-Z0-9_]{0,29}Table$/.test(name),
|
|
45852
46114
|
"Table name must start with a letter/underscore, be 35 chars or less, contain only letters/numbers/underscores, and end with 'Table'"
|
|
45853
46115
|
);
|
|
@@ -45861,7 +46123,7 @@ var BaseTable = class {
|
|
|
45861
46123
|
}
|
|
45862
46124
|
this.factor = props.factor ?? 1;
|
|
45863
46125
|
this.columns = {};
|
|
45864
|
-
let schema =
|
|
46126
|
+
let schema = z24.object({});
|
|
45865
46127
|
for (const [key, value] of Object.entries(props.columns)) {
|
|
45866
46128
|
const val = value;
|
|
45867
46129
|
if (val && typeof val === "object" && "schema" in val) {
|
|
@@ -46037,16 +46299,16 @@ var BaseTable = class {
|
|
|
46037
46299
|
// src/primitives/trigger.ts
|
|
46038
46300
|
init_define_BUILD();
|
|
46039
46301
|
init_define_PACKAGE_VERSIONS();
|
|
46040
|
-
import { z as
|
|
46302
|
+
import { z as z25 } from "@botpress/sdk";
|
|
46041
46303
|
var Typings7;
|
|
46042
46304
|
((Typings8) => {
|
|
46043
46305
|
Typings8.Primitive = "trigger";
|
|
46044
46306
|
})(Typings7 || (Typings7 = {}));
|
|
46045
|
-
var TriggerSchema =
|
|
46046
|
-
name:
|
|
46047
|
-
description:
|
|
46048
|
-
events:
|
|
46049
|
-
handler:
|
|
46307
|
+
var TriggerSchema = z25.object({
|
|
46308
|
+
name: z25.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"),
|
|
46309
|
+
description: z25.string().max(1024, "Description must be less than 1024 characters").optional(),
|
|
46310
|
+
events: z25.array(z25.string()),
|
|
46311
|
+
handler: z25.function().describe("Handler function for the trigger")
|
|
46050
46312
|
});
|
|
46051
46313
|
var Trigger = class {
|
|
46052
46314
|
name;
|
|
@@ -46135,7 +46397,7 @@ export {
|
|
|
46135
46397
|
defineConfig,
|
|
46136
46398
|
isWorkflowDataRequest,
|
|
46137
46399
|
user,
|
|
46138
|
-
|
|
46400
|
+
z26 as z
|
|
46139
46401
|
};
|
|
46140
46402
|
/*! Bundled license information:
|
|
46141
46403
|
|