@botpress/runtime 1.8.0 → 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 +281 -14
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +362 -95
- package/dist/internal.js.map +4 -4
- package/dist/library.js +346 -79
- package/dist/library.js.map +4 -4
- package/dist/primitives/conversation.d.ts.map +1 -1
- 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/interfaces.d.ts +5 -4
- package/dist/runtime/interfaces.d.ts.map +1 -1
- package/dist/runtime.js +315 -35
- 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
|
|
|
@@ -36151,14 +36151,15 @@ import { CitationsManager } from "llmz";
|
|
|
36151
36151
|
init_define_BUILD();
|
|
36152
36152
|
init_define_PACKAGE_VERSIONS();
|
|
36153
36153
|
var InterfaceMappings = class {
|
|
36154
|
-
|
|
36155
|
-
|
|
36154
|
+
mappings = {};
|
|
36155
|
+
registerMappings(mappings) {
|
|
36156
36156
|
this.mappings = { ...this.mappings, ...mappings };
|
|
36157
36157
|
}
|
|
36158
|
-
|
|
36158
|
+
getIntegrationAction(interfaceName, actionName, integrationName) {
|
|
36159
36159
|
return this.mappings[interfaceName]?.actions[`${integrationName}:${actionName}`];
|
|
36160
36160
|
}
|
|
36161
36161
|
};
|
|
36162
|
+
var interfaceMappings = getSingleton("__ADK_GLOBAL_INTERFACE_MAPPINGS", () => new InterfaceMappings());
|
|
36162
36163
|
|
|
36163
36164
|
// src/runtime/context/http.ts
|
|
36164
36165
|
init_define_BUILD();
|
|
@@ -42700,7 +42701,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
42700
42701
|
// src/runtime/chat/chat.ts
|
|
42701
42702
|
init_define_BUILD();
|
|
42702
42703
|
init_define_PACKAGE_VERSIONS();
|
|
42703
|
-
import { Chat,
|
|
42704
|
+
import { Chat, isAnyComponent as isAnyComponent2 } from "llmz";
|
|
42704
42705
|
|
|
42705
42706
|
// src/runtime/chat/truncate-transcript.ts
|
|
42706
42707
|
init_define_BUILD();
|
|
@@ -43018,6 +43019,268 @@ var Transcript = {
|
|
|
43018
43019
|
TRANSCRIPT_ITEM_MAX_BYTES: 1e4
|
|
43019
43020
|
};
|
|
43020
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
|
+
|
|
43021
43284
|
// src/runtime/chat/citations.ts
|
|
43022
43285
|
init_define_BUILD();
|
|
43023
43286
|
init_define_PACKAGE_VERSIONS();
|
|
@@ -43025,21 +43288,21 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43025
43288
|
// src/runtime/chat/transcript.ts
|
|
43026
43289
|
init_define_BUILD();
|
|
43027
43290
|
init_define_PACKAGE_VERSIONS();
|
|
43028
|
-
import { z as
|
|
43029
|
-
var AttachmentSchema =
|
|
43030
|
-
type:
|
|
43031
|
-
url:
|
|
43032
|
-
});
|
|
43033
|
-
var TranscriptItemSchema =
|
|
43034
|
-
id:
|
|
43035
|
-
role:
|
|
43036
|
-
name:
|
|
43037
|
-
createdAt:
|
|
43038
|
-
content:
|
|
43039
|
-
attachments:
|
|
43040
|
-
payload:
|
|
43041
|
-
});
|
|
43042
|
-
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);
|
|
43043
43306
|
|
|
43044
43307
|
// src/runtime/handlers/index.ts
|
|
43045
43308
|
init_define_BUILD();
|
|
@@ -43052,7 +43315,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43052
43315
|
// src/primitives/conversation.ts
|
|
43053
43316
|
init_define_BUILD();
|
|
43054
43317
|
init_define_PACKAGE_VERSIONS();
|
|
43055
|
-
import { z as
|
|
43318
|
+
import { z as z19 } from "@botpress/sdk";
|
|
43056
43319
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
43057
43320
|
|
|
43058
43321
|
// src/primitives/conversation-instance.ts
|
|
@@ -43106,7 +43369,7 @@ var BaseConversationInstance = class {
|
|
|
43106
43369
|
* Start typing indicator
|
|
43107
43370
|
*/
|
|
43108
43371
|
async startTyping() {
|
|
43109
|
-
const mapping =
|
|
43372
|
+
const mapping = interfaceMappings.getIntegrationAction("typingIndicator", "startTypingIndicator", this.integration);
|
|
43110
43373
|
if (mapping) {
|
|
43111
43374
|
const message = context.get("message", { optional: true });
|
|
43112
43375
|
await this.client.callAction({
|
|
@@ -43123,7 +43386,7 @@ var BaseConversationInstance = class {
|
|
|
43123
43386
|
* Stop typing indicator
|
|
43124
43387
|
*/
|
|
43125
43388
|
async stopTyping() {
|
|
43126
|
-
const mapping =
|
|
43389
|
+
const mapping = interfaceMappings.getIntegrationAction("typingIndicator", "stopTypingIndicator", this.integration);
|
|
43127
43390
|
if (mapping) {
|
|
43128
43391
|
const message = context.get("message", { optional: true });
|
|
43129
43392
|
await this.client.callAction({
|
|
@@ -43184,7 +43447,7 @@ var BaseConversation = class {
|
|
|
43184
43447
|
#startFromTrigger;
|
|
43185
43448
|
constructor(props) {
|
|
43186
43449
|
this.channel = props.channel;
|
|
43187
|
-
this.schema = props.state ??
|
|
43450
|
+
this.schema = props.state ?? z19.object({}).passthrough();
|
|
43188
43451
|
this.#handler = props.handler;
|
|
43189
43452
|
if (props.startFromTrigger) {
|
|
43190
43453
|
this.#startFromTrigger = props.startFromTrigger;
|
|
@@ -43221,6 +43484,8 @@ var BaseConversation = class {
|
|
|
43221
43484
|
const client = context.get("client");
|
|
43222
43485
|
const botpressConversation = context.get("conversation");
|
|
43223
43486
|
const conversationInstance = new BaseConversationInstance(botpressConversation, client);
|
|
43487
|
+
const startTypingPromise = conversationInstance.startTyping().catch(() => {
|
|
43488
|
+
});
|
|
43224
43489
|
let type;
|
|
43225
43490
|
let requestObject = void 0;
|
|
43226
43491
|
if (message) {
|
|
@@ -43332,6 +43597,8 @@ var BaseConversation = class {
|
|
|
43332
43597
|
execute
|
|
43333
43598
|
});
|
|
43334
43599
|
controller.abort();
|
|
43600
|
+
void startTypingPromise.then(() => conversationInstance.stopTyping().catch(() => {
|
|
43601
|
+
}));
|
|
43335
43602
|
}
|
|
43336
43603
|
};
|
|
43337
43604
|
|
|
@@ -43358,45 +43625,45 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43358
43625
|
// src/primitives/definition.ts
|
|
43359
43626
|
init_define_BUILD();
|
|
43360
43627
|
init_define_PACKAGE_VERSIONS();
|
|
43361
|
-
import { z as
|
|
43628
|
+
import { z as z20 } from "@botpress/sdk";
|
|
43362
43629
|
var Definitions;
|
|
43363
43630
|
((Definitions2) => {
|
|
43364
|
-
const conversationDefinitionSchema =
|
|
43365
|
-
type:
|
|
43366
|
-
channel:
|
|
43367
|
-
|
|
43368
|
-
|
|
43369
|
-
|
|
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")
|
|
43370
43637
|
)
|
|
43371
43638
|
])
|
|
43372
43639
|
});
|
|
43373
|
-
const workflowDefinitionSchema =
|
|
43374
|
-
type:
|
|
43375
|
-
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")
|
|
43376
43643
|
});
|
|
43377
|
-
const knowledgeDefinitionSchema =
|
|
43378
|
-
type:
|
|
43379
|
-
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")
|
|
43380
43647
|
});
|
|
43381
|
-
const triggerDefinitionSchema =
|
|
43382
|
-
type:
|
|
43383
|
-
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")
|
|
43384
43651
|
});
|
|
43385
|
-
const actionDefinitionSchema =
|
|
43386
|
-
type:
|
|
43387
|
-
name:
|
|
43388
|
-
title:
|
|
43389
|
-
description:
|
|
43390
|
-
attributes:
|
|
43391
|
-
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(),
|
|
43392
43659
|
// JSONSchema7
|
|
43393
|
-
output:
|
|
43660
|
+
output: z20.any().optional(),
|
|
43394
43661
|
// JSONSchema7
|
|
43395
|
-
cached:
|
|
43662
|
+
cached: z20.boolean().optional()
|
|
43396
43663
|
});
|
|
43397
|
-
const tableDefinitionSchema =
|
|
43398
|
-
type:
|
|
43399
|
-
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")
|
|
43400
43667
|
});
|
|
43401
43668
|
function isConversationDefinition(value) {
|
|
43402
43669
|
return conversationDefinitionSchema.safeParse(value).success;
|
|
@@ -43452,7 +43719,7 @@ init_define_PACKAGE_VERSIONS();
|
|
|
43452
43719
|
// src/primitives/data-sources/source-table.ts
|
|
43453
43720
|
init_define_BUILD();
|
|
43454
43721
|
init_define_PACKAGE_VERSIONS();
|
|
43455
|
-
import { z as
|
|
43722
|
+
import { z as z21 } from "@botpress/sdk";
|
|
43456
43723
|
var TableSource = class _TableSource extends DataSource {
|
|
43457
43724
|
table;
|
|
43458
43725
|
transformFn;
|
|
@@ -43473,7 +43740,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43473
43740
|
get syncWorkflow() {
|
|
43474
43741
|
return createSyncWorkflow({
|
|
43475
43742
|
type: "table",
|
|
43476
|
-
state:
|
|
43743
|
+
state: z21.object({ offset: z21.number().default(0) }),
|
|
43477
43744
|
handler: async () => {
|
|
43478
43745
|
throw new Error("TableSource synchronization not implemented");
|
|
43479
43746
|
}
|
|
@@ -43488,7 +43755,7 @@ var TableSource = class _TableSource extends DataSource {
|
|
|
43488
43755
|
// src/primitives/data-sources/source-website.ts
|
|
43489
43756
|
init_define_BUILD();
|
|
43490
43757
|
init_define_PACKAGE_VERSIONS();
|
|
43491
|
-
import { z as
|
|
43758
|
+
import { z as z22 } from "@botpress/sdk";
|
|
43492
43759
|
|
|
43493
43760
|
// ../../node_modules/fast-xml-parser/src/fxp.js
|
|
43494
43761
|
init_define_BUILD();
|
|
@@ -45041,16 +45308,16 @@ async function fetchHtml(url2, options) {
|
|
|
45041
45308
|
}
|
|
45042
45309
|
|
|
45043
45310
|
// src/primitives/data-sources/source-website.ts
|
|
45044
|
-
var State =
|
|
45045
|
-
urls:
|
|
45046
|
-
|
|
45047
|
-
loc:
|
|
45048
|
-
lastmod:
|
|
45049
|
-
changefreq:
|
|
45050
|
-
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()
|
|
45051
45318
|
})
|
|
45052
45319
|
).default([]),
|
|
45053
|
-
queue:
|
|
45320
|
+
queue: z22.array(z22.object({ url: z22.string(), depth: z22.number() })).default([])
|
|
45054
45321
|
});
|
|
45055
45322
|
var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
45056
45323
|
mode;
|
|
@@ -45576,7 +45843,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
|
|
|
45576
45843
|
// src/primitives/data-sources/source-directory.ts
|
|
45577
45844
|
init_define_BUILD();
|
|
45578
45845
|
init_define_PACKAGE_VERSIONS();
|
|
45579
|
-
import { z as
|
|
45846
|
+
import { z as z23 } from "@botpress/sdk";
|
|
45580
45847
|
var DirectorySource = class _DirectorySource extends DataSource {
|
|
45581
45848
|
_directoryPath;
|
|
45582
45849
|
_filterFn;
|
|
@@ -45605,7 +45872,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
|
|
|
45605
45872
|
get syncWorkflow() {
|
|
45606
45873
|
return createSyncWorkflow({
|
|
45607
45874
|
type: "directory",
|
|
45608
|
-
state:
|
|
45875
|
+
state: z23.object({}),
|
|
45609
45876
|
handler: async ({ input, step: step2, client }) => {
|
|
45610
45877
|
if (!adk.environment.isDevelopment()) {
|
|
45611
45878
|
console.log("Directory ingestion is only supported in development environment");
|
|
@@ -45824,7 +46091,7 @@ var BaseKnowledge = class {
|
|
|
45824
46091
|
// src/primitives/table.ts
|
|
45825
46092
|
init_define_BUILD();
|
|
45826
46093
|
init_define_PACKAGE_VERSIONS();
|
|
45827
|
-
import { transforms as transforms3, z as
|
|
46094
|
+
import { transforms as transforms3, z as z24 } from "@bpinternal/zui";
|
|
45828
46095
|
var Typings6;
|
|
45829
46096
|
((Typings8) => {
|
|
45830
46097
|
Typings8.Primitive = "table";
|
|
@@ -45842,7 +46109,7 @@ var BaseTable = class {
|
|
|
45842
46109
|
return context.get("client");
|
|
45843
46110
|
}
|
|
45844
46111
|
constructor(props) {
|
|
45845
|
-
const tableNameSchema =
|
|
46112
|
+
const tableNameSchema = z24.string().min(1).refine((name) => !z24.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
|
|
45846
46113
|
(name) => /^[a-zA-Z_$][a-zA-Z0-9_]{0,29}Table$/.test(name),
|
|
45847
46114
|
"Table name must start with a letter/underscore, be 35 chars or less, contain only letters/numbers/underscores, and end with 'Table'"
|
|
45848
46115
|
);
|
|
@@ -45856,7 +46123,7 @@ var BaseTable = class {
|
|
|
45856
46123
|
}
|
|
45857
46124
|
this.factor = props.factor ?? 1;
|
|
45858
46125
|
this.columns = {};
|
|
45859
|
-
let schema =
|
|
46126
|
+
let schema = z24.object({});
|
|
45860
46127
|
for (const [key, value] of Object.entries(props.columns)) {
|
|
45861
46128
|
const val = value;
|
|
45862
46129
|
if (val && typeof val === "object" && "schema" in val) {
|
|
@@ -46032,16 +46299,16 @@ var BaseTable = class {
|
|
|
46032
46299
|
// src/primitives/trigger.ts
|
|
46033
46300
|
init_define_BUILD();
|
|
46034
46301
|
init_define_PACKAGE_VERSIONS();
|
|
46035
|
-
import { z as
|
|
46302
|
+
import { z as z25 } from "@botpress/sdk";
|
|
46036
46303
|
var Typings7;
|
|
46037
46304
|
((Typings8) => {
|
|
46038
46305
|
Typings8.Primitive = "trigger";
|
|
46039
46306
|
})(Typings7 || (Typings7 = {}));
|
|
46040
|
-
var TriggerSchema =
|
|
46041
|
-
name:
|
|
46042
|
-
description:
|
|
46043
|
-
events:
|
|
46044
|
-
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")
|
|
46045
46312
|
});
|
|
46046
46313
|
var Trigger = class {
|
|
46047
46314
|
name;
|
|
@@ -46130,7 +46397,7 @@ export {
|
|
|
46130
46397
|
defineConfig,
|
|
46131
46398
|
isWorkflowDataRequest,
|
|
46132
46399
|
user,
|
|
46133
|
-
|
|
46400
|
+
z26 as z
|
|
46134
46401
|
};
|
|
46135
46402
|
/*! Bundled license information:
|
|
46136
46403
|
|