@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.
@@ -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.1", adk: "1.8.1", 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
  }
@@ -34328,7 +34328,7 @@ var TrackedStateSchema = z2.object({
34328
34328
  // src/runtime/tracked-state.ts
34329
34329
  init_define_BUILD();
34330
34330
  init_define_PACKAGE_VERSIONS();
34331
- import { z as z25 } from "@botpress/sdk";
34331
+ import { z as z26 } from "@botpress/sdk";
34332
34332
 
34333
34333
  // ../../node_modules/axios/index.js
34334
34334
  init_define_BUILD();
@@ -39236,7 +39236,7 @@ init_define_PACKAGE_VERSIONS();
39236
39236
  // src/runtime/chat/chat.ts
39237
39237
  init_define_BUILD();
39238
39238
  init_define_PACKAGE_VERSIONS();
39239
- import { Chat, DefaultComponents, isAnyComponent as isAnyComponent2 } from "llmz";
39239
+ import { Chat, isAnyComponent as isAnyComponent2 } from "llmz";
39240
39240
 
39241
39241
  // src/runtime/chat/truncate-transcript.ts
39242
39242
  init_define_BUILD();
@@ -44806,6 +44806,268 @@ var Transcript = {
44806
44806
  TRANSCRIPT_ITEM_MAX_BYTES: 1e4
44807
44807
  };
44808
44808
 
44809
+ // src/runtime/chat/components.ts
44810
+ init_define_BUILD();
44811
+ init_define_PACKAGE_VERSIONS();
44812
+ import { messages, z as z25 } from "@botpress/sdk";
44813
+ var DefaultMessageTypes = {
44814
+ text: messages.defaults["text"].schema,
44815
+ audio: messages.defaults["audio"].schema,
44816
+ card: messages.defaults["card"].schema,
44817
+ image: messages.defaults["image"].schema,
44818
+ carousel: messages.defaults["carousel"].schema,
44819
+ choice: messages.defaults["choice"].schema,
44820
+ dropdown: messages.defaults["dropdown"].schema,
44821
+ file: messages.defaults["file"].schema,
44822
+ location: messages.defaults["location"].schema,
44823
+ video: messages.defaults["video"].schema,
44824
+ bloc: messages.defaults["bloc"].schema
44825
+ };
44826
+ var AudioComponent = new Autonomous.Component({
44827
+ type: "leaf",
44828
+ aliases: [],
44829
+ name: "Audio",
44830
+ 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.`,
44831
+ examples: [
44832
+ {
44833
+ name: " Basic Audio Message",
44834
+ description: "Sends a simple audio message to the user",
44835
+ code: `
44836
+ yield <Message>
44837
+ Here's an **awesome** audio clip for you!
44838
+ <Audio audioUrl="https://example.com/path/to/audio.mp3" />
44839
+ </Message>`
44840
+ }
44841
+ ],
44842
+ leaf: {
44843
+ props: z25.object({
44844
+ audioUrl: z25.string().url().describe("The URL of the audio file to be sent.")
44845
+ })
44846
+ }
44847
+ });
44848
+ var ImageComponent = new Autonomous.Component({
44849
+ type: "leaf",
44850
+ aliases: ["img"],
44851
+ name: "Image",
44852
+ 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.`,
44853
+ examples: [
44854
+ {
44855
+ name: " Basic Image Message",
44856
+ description: "Sends a simple image message to the user",
44857
+ code: `
44858
+ yield <Message>
44859
+ Here's an **awesome** image for you!
44860
+ <Image imageUrl="https://example.com/path/to/image.jpg" />
44861
+ </Message>`
44862
+ }
44863
+ ],
44864
+ leaf: {
44865
+ props: z25.object({
44866
+ imageUrl: z25.string().url().describe("The URL of the image to be sent.")
44867
+ })
44868
+ }
44869
+ });
44870
+ var VideoComponent = new Autonomous.Component({
44871
+ type: "leaf",
44872
+ aliases: [],
44873
+ name: "Video",
44874
+ 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.`,
44875
+ examples: [
44876
+ {
44877
+ name: " Basic Video Message",
44878
+ description: "Sends a simple video message to the user",
44879
+ code: `
44880
+ yield <Message>
44881
+ Here's an **awesome** video for you!
44882
+ <Video videoUrl="https://example.com/path/to/video.mp4" />
44883
+ </Message>`
44884
+ }
44885
+ ],
44886
+ leaf: {
44887
+ props: z25.object({
44888
+ videoUrl: z25.string().url().describe("The URL of the video to be sent.")
44889
+ })
44890
+ }
44891
+ });
44892
+ var LocationComponent = new Autonomous.Component({
44893
+ type: "leaf",
44894
+ aliases: [],
44895
+ name: "Location",
44896
+ 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.
44897
+ The location can also optionally include an address and a title for better context.`,
44898
+ examples: [
44899
+ {
44900
+ name: " Basic Location Message",
44901
+ description: "Sends a simple location message to the user",
44902
+ code: `
44903
+ yield <Message>
44904
+ Here's the location you requested!
44905
+ <Location latitude={37.7749} longitude={-122.4194} />
44906
+ </Message>`
44907
+ },
44908
+ {
44909
+ name: " Location Message with Address and Title",
44910
+ description: "Sends a location message with additional address and title information",
44911
+ code: `
44912
+ yield <Message>
44913
+ Here's the location of our office!
44914
+ <Location
44915
+ latitude={45.506342}
44916
+ longitude={-73.572012}
44917
+ address="400 Blvd. De Maisonneuve Ouest #200, Montreal, Quebec H3A 1L4, Canada"
44918
+ title="Botpress HQ"
44919
+ />
44920
+ </Message>`
44921
+ }
44922
+ ],
44923
+ leaf: {
44924
+ props: z25.object({
44925
+ latitude: z25.number().describe("The latitude of the location to be sent."),
44926
+ longitude: z25.number().describe("The longitude of the location to be sent."),
44927
+ address: z25.string().optional().describe("The address of the location to be sent."),
44928
+ title: z25.string().optional().describe("The title of the location to be sent.")
44929
+ })
44930
+ }
44931
+ });
44932
+ var ChoiceComponent = new Autonomous.Component({
44933
+ type: "leaf",
44934
+ aliases: ["choices", "option", "options", "buttons"],
44935
+ name: "Choice",
44936
+ description: `Present a choice to the user with multiple options.
44937
+ The user can select one of the provided options, and the selection will be sent back to the system for further processing.
44938
+ You can include up to 10 options for the user to choose from.
44939
+ Values for each option should be unique identifiers that can be used to identify the user's selection.`,
44940
+ examples: [
44941
+ {
44942
+ name: " Basic Choice Message",
44943
+ description: "Presents a simple choice message to the user",
44944
+ code: `
44945
+ yield <Message>
44946
+ Please choose one of the following options:
44947
+ <Choice
44948
+ text="Select an option:"
44949
+ options={[
44950
+ { label: "Option 1", value: "option_1" },
44951
+ { label: "Option 2", value: "option_2" },
44952
+ { label: "Option 3", value: "option_3" }
44953
+ ]}
44954
+ />
44955
+ </Message>`
44956
+ }
44957
+ ],
44958
+ leaf: {
44959
+ props: z25.object({
44960
+ text: z25.string().describe("The prompt text for the choice."),
44961
+ options: z25.array(
44962
+ z25.object({
44963
+ label: z25.string().describe("The label of the option to be displayed to the user."),
44964
+ value: z25.string().describe("The value of the option to be sent back when selected.")
44965
+ })
44966
+ ).describe("The list of options to present to the user.")
44967
+ })
44968
+ }
44969
+ });
44970
+ var DropdownComponent = new Autonomous.Component({
44971
+ type: "leaf",
44972
+ aliases: ["dropdown", "select", "combo"],
44973
+ name: "Dropdown",
44974
+ description: `Present a dropdown menu to the user with multiple options.
44975
+ 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.
44976
+ Unlike the Choice component, the Dropdown component is typically used when there are more options to choose from, providing a more compact UI.
44977
+ The dropdown can include up to 100 options for the user to choose from.
44978
+ Values for each option should be unique identifiers that can be used to identify the user's selection.`,
44979
+ examples: [
44980
+ {
44981
+ name: " Basic Dropdown Message",
44982
+ description: "Presents a simple dropdown message to the user",
44983
+ code: `
44984
+ yield <Message>
44985
+ Please select a fruit from the dropdown:
44986
+ <Dropdown
44987
+ text="Choose an option:"
44988
+ options={[
44989
+ { label: "\u{1F350} Pear", value: "pear" },
44990
+ { label: "\u{1F34E} Apple", value: "apple" },
44991
+ { label: "\u{1F34C} Banana", value: "banana" }
44992
+ ]}
44993
+ />
44994
+ </Message>`
44995
+ }
44996
+ ],
44997
+ leaf: {
44998
+ props: z25.object({
44999
+ text: z25.string().describe("The prompt text for the dropdown."),
45000
+ options: z25.array(
45001
+ z25.object({
45002
+ label: z25.string().describe("The label of the option to be displayed to the user."),
45003
+ value: z25.string().describe("The value of the option to be sent back when selected.")
45004
+ })
45005
+ ).describe("The list of options to present in the dropdown.")
45006
+ })
45007
+ }
45008
+ });
45009
+ var CarouselComponent = new Autonomous.Component({
45010
+ type: "leaf",
45011
+ aliases: ["carousel", "cards", "card"],
45012
+ name: "Carousel",
45013
+ description: `Send a carousel of cards to the user, allowing them to browse through multiple items.
45014
+ Carousels are useful for displaying a collection of related items in a compact and interactive format.
45015
+ 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.
45016
+ Each item in the carousel is represented as a card, which can include an image, title, subtitle, and actions.
45017
+ Users can navigate through the carousel by swiping or clicking on navigation controls.
45018
+ 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).`,
45019
+ examples: [
45020
+ {
45021
+ name: " Basic Carousel Message",
45022
+ description: "Sends a simple carousel message to the user",
45023
+ code: `
45024
+ yield <Message>
45025
+ Here is an **exciting** carousel for you!
45026
+ <Carousel
45027
+ items={[
45028
+ {
45029
+ title: "Product 1",
45030
+ subtitle: "Description of Product 1",
45031
+ imageUrl: "https://example.com/path/to/image1.jpg",
45032
+ actions: [
45033
+ { action: "postback", label: "Buy Now", value: "buy_product_1" },
45034
+ { action: "url", label: "View Details", value: "https://example.com/product_1" }
45035
+ ]
45036
+ },
45037
+ {
45038
+ title: "Product 2",
45039
+ subtitle: "Description of Product 2",
45040
+ imageUrl: "https://example.com/path/to/image2.jpg",
45041
+ actions: [
45042
+ { action: "postback", label: "Buy Now", value: "buy_product_2" },
45043
+ { action: "url", label: "View Details", value: "https://example.com/product_2" }
45044
+ ]
45045
+ }
45046
+ ]}
45047
+ />
45048
+ </Message>`
45049
+ }
45050
+ ],
45051
+ leaf: {
45052
+ props: z25.object({
45053
+ items: z25.array(
45054
+ z25.object({
45055
+ title: z25.string().describe("The title of the carousel item."),
45056
+ subtitle: z25.string().optional().describe("The subtitle of the carousel item."),
45057
+ imageUrl: z25.string().url().optional().describe("The URL of the image to be displayed on the carousel item."),
45058
+ actions: z25.array(
45059
+ z25.object({
45060
+ action: z25.enum(["postback", "url", "say"]).describe("The type of action for the button."),
45061
+ label: z25.string().describe("The label of the button to be displayed to the user."),
45062
+ value: z25.string().describe("The value associated with the button action.")
45063
+ })
45064
+ ).max(3).describe("The list of actions (buttons) to include on the carousel item.")
45065
+ })
45066
+ ).describe("The list of items (cards) to include in the carousel.")
45067
+ })
45068
+ }
45069
+ });
45070
+
44809
45071
  // src/runtime/chat/citations.ts
44810
45072
  init_define_BUILD();
44811
45073
  init_define_PACKAGE_VERSIONS();
@@ -45803,7 +46065,7 @@ var TrackedState = class _TrackedState {
45803
46065
  name: BUILT_IN_STATES.bot,
45804
46066
  type: "bot",
45805
46067
  id: botId,
45806
- schema: adk.project.config.bot?.state || z25.object({})
46068
+ schema: adk.project.config.bot?.state || z26.object({})
45807
46069
  });
45808
46070
  }
45809
46071
  if (user2) {
@@ -45812,7 +46074,7 @@ var TrackedState = class _TrackedState {
45812
46074
  name: BUILT_IN_STATES.user,
45813
46075
  type: "user",
45814
46076
  id: user2.id,
45815
- schema: adk.project.config.user?.state || z25.object({})
46077
+ schema: adk.project.config.user?.state || z26.object({})
45816
46078
  });
45817
46079
  }
45818
46080
  if (conversation) {
@@ -45829,7 +46091,7 @@ var TrackedState = class _TrackedState {
45829
46091
  name: BUILT_IN_STATES.conversation,
45830
46092
  type: "conversation",
45831
46093
  id: conversation.id,
45832
- schema: definition?.schema || z25.object({})
46094
+ schema: definition?.schema || z26.object({})
45833
46095
  });
45834
46096
  }
45835
46097
  const states = context2.get("states", { optional: true });