@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/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.0", adk: "1.8.0", sdk: "4.19.0", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
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 z26 = new Array(need + 1).join("0");
27681
+ const z27 = new Array(need + 1).join("0");
27682
27682
  if (i < 0) {
27683
- c = "-" + z26 + c.slice(1);
27683
+ c = "-" + z27 + c.slice(1);
27684
27684
  } else {
27685
- c = z26 + 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 z19 } from "@botpress/sdk";
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 z17 } from "@botpress/sdk";
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
 
@@ -36341,14 +36341,15 @@ import { CitationsManager } from "llmz";
36341
36341
  init_define_BUILD();
36342
36342
  init_define_PACKAGE_VERSIONS();
36343
36343
  var InterfaceMappings = class {
36344
- static mappings = {};
36345
- static registerMappings(mappings) {
36344
+ mappings = {};
36345
+ registerMappings(mappings) {
36346
36346
  this.mappings = { ...this.mappings, ...mappings };
36347
36347
  }
36348
- static getIntegrationAction(interfaceName, actionName, integrationName) {
36348
+ getIntegrationAction(interfaceName, actionName, integrationName) {
36349
36349
  return this.mappings[interfaceName]?.actions[`${integrationName}:${actionName}`];
36350
36350
  }
36351
36351
  };
36352
+ var interfaceMappings = getSingleton("__ADK_GLOBAL_INTERFACE_MAPPINGS", () => new InterfaceMappings());
36352
36353
 
36353
36354
  // src/runtime/context/http.ts
36354
36355
  init_define_BUILD();
@@ -41985,7 +41986,7 @@ init_define_PACKAGE_VERSIONS();
41985
41986
  // src/runtime/chat/chat.ts
41986
41987
  init_define_BUILD();
41987
41988
  init_define_PACKAGE_VERSIONS();
41988
- import { Chat, DefaultComponents, isAnyComponent as isAnyComponent2 } from "llmz";
41989
+ import { Chat, isAnyComponent as isAnyComponent2 } from "llmz";
41989
41990
 
41990
41991
  // src/runtime/chat/truncate-transcript.ts
41991
41992
  init_define_BUILD();
@@ -42317,6 +42318,268 @@ var Transcript = {
42317
42318
  TRANSCRIPT_ITEM_MAX_BYTES: 1e4
42318
42319
  };
42319
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
+
42320
42583
  // src/runtime/chat/citations.ts
42321
42584
  init_define_BUILD();
42322
42585
  init_define_PACKAGE_VERSIONS();
@@ -42324,21 +42587,21 @@ init_define_PACKAGE_VERSIONS();
42324
42587
  // src/runtime/chat/transcript.ts
42325
42588
  init_define_BUILD();
42326
42589
  init_define_PACKAGE_VERSIONS();
42327
- import { z as z14 } from "@botpress/sdk";
42328
- var AttachmentSchema = z14.object({
42329
- type: z14.literal("image"),
42330
- url: z14.string()
42331
- });
42332
- var TranscriptItemSchema = z14.object({
42333
- id: z14.string(),
42334
- role: z14.union([z14.literal("assistant"), z14.literal("user"), z14.literal("event"), z14.literal("summary")]),
42335
- name: z14.string().optional(),
42336
- createdAt: z14.string().optional(),
42337
- content: z14.string().optional(),
42338
- attachments: z14.array(AttachmentSchema).optional(),
42339
- payload: z14.unknown().optional()
42340
- });
42341
- var TranscriptSchema = z14.array(TranscriptItemSchema);
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);
42342
42605
 
42343
42606
  // src/runtime/handlers/index.ts
42344
42607
  init_define_BUILD();
@@ -42351,7 +42614,7 @@ init_define_PACKAGE_VERSIONS();
42351
42614
  // src/primitives/conversation.ts
42352
42615
  init_define_BUILD();
42353
42616
  init_define_PACKAGE_VERSIONS();
42354
- import { z as z15 } from "@botpress/sdk";
42617
+ import { z as z16 } from "@botpress/sdk";
42355
42618
  import { setTimeout as setTimeout2 } from "node:timers/promises";
42356
42619
 
42357
42620
  // src/primitives/conversation-instance.ts
@@ -42405,7 +42668,7 @@ var BaseConversationInstance = class {
42405
42668
  * Start typing indicator
42406
42669
  */
42407
42670
  async startTyping() {
42408
- const mapping = InterfaceMappings.getIntegrationAction("typingIndicator", "startTypingIndicator", this.integration);
42671
+ const mapping = interfaceMappings.getIntegrationAction("typingIndicator", "startTypingIndicator", this.integration);
42409
42672
  if (mapping) {
42410
42673
  const message = context.get("message", { optional: true });
42411
42674
  await this.client.callAction({
@@ -42422,7 +42685,7 @@ var BaseConversationInstance = class {
42422
42685
  * Stop typing indicator
42423
42686
  */
42424
42687
  async stopTyping() {
42425
- const mapping = InterfaceMappings.getIntegrationAction("typingIndicator", "stopTypingIndicator", this.integration);
42688
+ const mapping = interfaceMappings.getIntegrationAction("typingIndicator", "stopTypingIndicator", this.integration);
42426
42689
  if (mapping) {
42427
42690
  const message = context.get("message", { optional: true });
42428
42691
  await this.client.callAction({
@@ -42483,7 +42746,7 @@ var BaseConversation = class {
42483
42746
  #startFromTrigger;
42484
42747
  constructor(props) {
42485
42748
  this.channel = props.channel;
42486
- this.schema = props.state ?? z15.object({}).passthrough();
42749
+ this.schema = props.state ?? z16.object({}).passthrough();
42487
42750
  this.#handler = props.handler;
42488
42751
  if (props.startFromTrigger) {
42489
42752
  this.#startFromTrigger = props.startFromTrigger;
@@ -42520,6 +42783,8 @@ var BaseConversation = class {
42520
42783
  const client = context.get("client");
42521
42784
  const botpressConversation = context.get("conversation");
42522
42785
  const conversationInstance = new BaseConversationInstance(botpressConversation, client);
42786
+ const startTypingPromise = conversationInstance.startTyping().catch(() => {
42787
+ });
42523
42788
  let type;
42524
42789
  let requestObject = void 0;
42525
42790
  if (message) {
@@ -42631,6 +42896,8 @@ var BaseConversation = class {
42631
42896
  execute
42632
42897
  });
42633
42898
  controller.abort();
42899
+ void startTypingPromise.then(() => conversationInstance.stopTyping().catch(() => {
42900
+ }));
42634
42901
  }
42635
42902
  };
42636
42903
 
@@ -43078,25 +43345,25 @@ step.request = async (request, message, stepName) => {
43078
43345
  };
43079
43346
 
43080
43347
  // src/primitives/workflow-instance.ts
43081
- var workflowStepContextSchema = z19.lazy(
43082
- () => z19.object({
43083
- output: z19.unknown().optional(),
43084
- attempts: z19.number(),
43085
- i: z19.number().optional(),
43086
- startedAt: z19.string(),
43087
- finishedAt: z19.string().optional(),
43088
- steps: z19.record(z19.string(), workflowStepContextSchema).optional(),
43089
- error: z19.object({
43090
- message: z19.string(),
43091
- failedAt: z19.string(),
43092
- maxAttemptsReached: z19.boolean()
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()
43093
43360
  }).optional()
43094
43361
  })
43095
43362
  );
43096
- var workflowExecutionContextSchema = z19.object({
43097
- executionCount: z19.number().default(0),
43098
- revision: z19.number().default(0),
43099
- steps: z19.record(z19.string(), workflowStepContextSchema)
43363
+ var workflowExecutionContextSchema = z20.object({
43364
+ executionCount: z20.number().default(0),
43365
+ revision: z20.number().default(0),
43366
+ steps: z20.record(z20.string(), workflowStepContextSchema)
43100
43367
  }).default({
43101
43368
  executionCount: 0,
43102
43369
  steps: {}
@@ -43335,45 +43602,45 @@ function createWorkflowExecutionState(client, workflowId) {
43335
43602
  // src/primitives/definition.ts
43336
43603
  init_define_BUILD();
43337
43604
  init_define_PACKAGE_VERSIONS();
43338
- import { z as z20 } from "@botpress/sdk";
43605
+ import { z as z21 } from "@botpress/sdk";
43339
43606
  var Definitions;
43340
43607
  ((Definitions2) => {
43341
- const conversationDefinitionSchema = z20.object({
43342
- type: z20.literal("conversation"),
43343
- channel: z20.union([
43344
- 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 '*'"),
43345
- z20.array(
43346
- 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")
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")
43347
43614
  )
43348
43615
  ])
43349
43616
  });
43350
- const workflowDefinitionSchema = z20.object({
43351
- type: z20.literal("workflow"),
43352
- 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")
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")
43353
43620
  });
43354
- const knowledgeDefinitionSchema = z20.object({
43355
- type: z20.literal("knowledge"),
43356
- 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")
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")
43357
43624
  });
43358
- const triggerDefinitionSchema = z20.object({
43359
- type: z20.literal("trigger"),
43360
- 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")
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")
43361
43628
  });
43362
- const actionDefinitionSchema = z20.object({
43363
- type: z20.literal("action"),
43364
- 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"),
43365
- title: z20.string().optional(),
43366
- description: z20.string().optional(),
43367
- attributes: z20.record(z20.string()).optional(),
43368
- input: z20.any().optional(),
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(),
43369
43636
  // JSONSchema7
43370
- output: z20.any().optional(),
43637
+ output: z21.any().optional(),
43371
43638
  // JSONSchema7
43372
- cached: z20.boolean().optional()
43639
+ cached: z21.boolean().optional()
43373
43640
  });
43374
- const tableDefinitionSchema = z20.object({
43375
- type: z20.literal("table"),
43376
- 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")
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")
43377
43644
  });
43378
43645
  function isConversationDefinition(value) {
43379
43646
  return conversationDefinitionSchema.safeParse(value).success;
@@ -43429,7 +43696,7 @@ init_define_PACKAGE_VERSIONS();
43429
43696
  // src/primitives/data-sources/source-table.ts
43430
43697
  init_define_BUILD();
43431
43698
  init_define_PACKAGE_VERSIONS();
43432
- import { z as z21 } from "@botpress/sdk";
43699
+ import { z as z22 } from "@botpress/sdk";
43433
43700
  var TableSource = class _TableSource extends DataSource {
43434
43701
  table;
43435
43702
  transformFn;
@@ -43450,7 +43717,7 @@ var TableSource = class _TableSource extends DataSource {
43450
43717
  get syncWorkflow() {
43451
43718
  return createSyncWorkflow({
43452
43719
  type: "table",
43453
- state: z21.object({ offset: z21.number().default(0) }),
43720
+ state: z22.object({ offset: z22.number().default(0) }),
43454
43721
  handler: async () => {
43455
43722
  throw new Error("TableSource synchronization not implemented");
43456
43723
  }
@@ -43465,7 +43732,7 @@ var TableSource = class _TableSource extends DataSource {
43465
43732
  // src/primitives/data-sources/source-website.ts
43466
43733
  init_define_BUILD();
43467
43734
  init_define_PACKAGE_VERSIONS();
43468
- import { z as z22 } from "@botpress/sdk";
43735
+ import { z as z23 } from "@botpress/sdk";
43469
43736
 
43470
43737
  // ../../node_modules/fast-xml-parser/src/fxp.js
43471
43738
  init_define_BUILD();
@@ -45018,16 +45285,16 @@ async function fetchHtml(url2, options) {
45018
45285
  }
45019
45286
 
45020
45287
  // src/primitives/data-sources/source-website.ts
45021
- var State = z22.object({
45022
- urls: z22.array(
45023
- z22.object({
45024
- loc: z22.string(),
45025
- lastmod: z22.string().optional(),
45026
- changefreq: z22.string().optional(),
45027
- priority: z22.string().optional()
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()
45028
45295
  })
45029
45296
  ).default([]),
45030
- queue: z22.array(z22.object({ url: z22.string(), depth: z22.number() })).default([])
45297
+ queue: z23.array(z23.object({ url: z23.string(), depth: z23.number() })).default([])
45031
45298
  });
45032
45299
  var WebsiteSource = class _WebsiteSource extends DataSource {
45033
45300
  mode;
@@ -45553,7 +45820,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
45553
45820
  // src/primitives/data-sources/source-directory.ts
45554
45821
  init_define_BUILD();
45555
45822
  init_define_PACKAGE_VERSIONS();
45556
- import { z as z23 } from "@botpress/sdk";
45823
+ import { z as z24 } from "@botpress/sdk";
45557
45824
  var DirectorySource = class _DirectorySource extends DataSource {
45558
45825
  _directoryPath;
45559
45826
  _filterFn;
@@ -45582,7 +45849,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
45582
45849
  get syncWorkflow() {
45583
45850
  return createSyncWorkflow({
45584
45851
  type: "directory",
45585
- state: z23.object({}),
45852
+ state: z24.object({}),
45586
45853
  handler: async ({ input, step: step2, client }) => {
45587
45854
  if (!adk.environment.isDevelopment()) {
45588
45855
  console.log("Directory ingestion is only supported in development environment");
@@ -45801,7 +46068,7 @@ var BaseKnowledge = class {
45801
46068
  // src/primitives/table.ts
45802
46069
  init_define_BUILD();
45803
46070
  init_define_PACKAGE_VERSIONS();
45804
- import { transforms as transforms3, z as z24 } from "@bpinternal/zui";
46071
+ import { transforms as transforms3, z as z25 } from "@bpinternal/zui";
45805
46072
  var Typings6;
45806
46073
  ((Typings8) => {
45807
46074
  Typings8.Primitive = "table";
@@ -45819,7 +46086,7 @@ var BaseTable = class {
45819
46086
  return context.get("client");
45820
46087
  }
45821
46088
  constructor(props) {
45822
- const tableNameSchema = z24.string().min(1).refine((name) => !z24.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
46089
+ const tableNameSchema = z25.string().min(1).refine((name) => !z25.string().uuid().safeParse(name).success, "Table name cannot be a UUID").refine(
45823
46090
  (name) => /^[a-zA-Z_$][a-zA-Z0-9_]{0,29}Table$/.test(name),
45824
46091
  "Table name must start with a letter/underscore, be 35 chars or less, contain only letters/numbers/underscores, and end with 'Table'"
45825
46092
  );
@@ -45833,7 +46100,7 @@ var BaseTable = class {
45833
46100
  }
45834
46101
  this.factor = props.factor ?? 1;
45835
46102
  this.columns = {};
45836
- let schema = z24.object({});
46103
+ let schema = z25.object({});
45837
46104
  for (const [key, value] of Object.entries(props.columns)) {
45838
46105
  const val = value;
45839
46106
  if (val && typeof val === "object" && "schema" in val) {
@@ -46009,16 +46276,16 @@ var BaseTable = class {
46009
46276
  // src/primitives/trigger.ts
46010
46277
  init_define_BUILD();
46011
46278
  init_define_PACKAGE_VERSIONS();
46012
- import { z as z25 } from "@botpress/sdk";
46279
+ import { z as z26 } from "@botpress/sdk";
46013
46280
  var Typings7;
46014
46281
  ((Typings8) => {
46015
46282
  Typings8.Primitive = "trigger";
46016
46283
  })(Typings7 || (Typings7 = {}));
46017
- var TriggerSchema = z25.object({
46018
- 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"),
46019
- description: z25.string().max(1024, "Description must be less than 1024 characters").optional(),
46020
- events: z25.array(z25.string()),
46021
- handler: z25.function().describe("Handler function for the trigger")
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")
46022
46289
  });
46023
46290
  var Trigger = class {
46024
46291
  name;