@botpress/runtime 1.11.1 → 1.11.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.
@@ -1,5 +1,10 @@
1
- import type { ConversationDefinitions as CD } from '@botpress/runtime/_types/conversations';
1
+ import type { ConversationDefinitions as CD, ConversationRoutableEvents as CRE } from '@botpress/runtime/_types/conversations';
2
2
  export type ConversationDefinitions = CD extends never ? never : CD;
3
+ /**
4
+ * Events that can be routed to conversations (events with conversationId property).
5
+ * Keyed by channel, containing only the event names that have conversationId.
6
+ */
7
+ export type ConversationRoutableEvents = CRE extends never ? never : CRE;
3
8
  export type ConversationStates = {
4
9
  [K in keyof ConversationDefinitions]: ConversationDefinitions[K]['state'];
5
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/_types/conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI,EAAE,EAAE,MAAM,wCAAwC,CAAA;AAG3F,MAAM,MAAM,uBAAuB,GAAG,EAAE,SAAS,KAAK,GAAG,KAAK,GAAG,EAAE,CAAA;AAEnE,MAAM,MAAM,kBAAkB,GAAG;KAC9B,CAAC,IAAI,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;CAC1E,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;CAC5E,CAAA"}
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/_types/conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI,EAAE,EAAE,0BAA0B,IAAI,GAAG,EAAE,MAAM,wCAAwC,CAAA;AAG9H,MAAM,MAAM,uBAAuB,GAAG,EAAE,SAAS,KAAK,GAAG,KAAK,GAAG,EAAE,CAAA;AAEnE;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,GAAG,SAAS,KAAK,GAAG,KAAK,GAAG,GAAG,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG;KAC9B,CAAC,IAAI,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;CAC1E,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;KAChC,CAAC,IAAI,MAAM,uBAAuB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;CAC5E,CAAA"}
@@ -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.11.1", adk: "1.11.1", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.11.2", adk: "1.11.2", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
52
52
  }
53
53
  });
54
54
 
@@ -43801,12 +43801,19 @@ var init_conversation = __esm({
43801
43801
  })(Typings2 || (Typings2 = {}));
43802
43802
  BaseConversation = class {
43803
43803
  channel;
43804
+ /**
43805
+ * Array of event names this conversation listens to.
43806
+ * Only events with conversationId property are allowed.
43807
+ * Empty array means no events (only messages).
43808
+ */
43809
+ events;
43804
43810
  /** @internal */
43805
43811
  schema;
43806
43812
  #handler;
43807
43813
  #startFromTrigger;
43808
43814
  constructor(props) {
43809
43815
  this.channel = props.channel;
43816
+ this.events = props.events ?? [];
43810
43817
  this.schema = props.state ?? z13.object({}).passthrough();
43811
43818
  this.#handler = props.handler;
43812
43819
  if (props.startFromTrigger) {
@@ -43819,22 +43826,17 @@ var init_conversation = __esm({
43819
43826
  }
43820
43827
  /** @internal */
43821
43828
  getDefinition() {
43822
- if (this.channel === "*") {
43823
- return {
43824
- type: "conversation",
43825
- channel: "*"
43826
- };
43827
- } else if (Array.isArray(this.channel)) {
43828
- return {
43829
- type: "conversation",
43830
- channel: this.channel
43831
- };
43832
- } else {
43829
+ const base = {
43830
+ type: "conversation",
43831
+ channel: this.channel === "*" ? "*" : Array.isArray(this.channel) ? this.channel : this.channel
43832
+ };
43833
+ if (this.events.length > 0) {
43833
43834
  return {
43834
- type: "conversation",
43835
- channel: this.channel
43835
+ ...base,
43836
+ events: [...this.events]
43836
43837
  };
43837
43838
  }
43839
+ return base;
43838
43840
  }
43839
43841
  /** @internal */
43840
43842
  async [ConversationHandler]() {