@botpress/runtime 1.13.0 → 1.13.1
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 +25 -4
- package/dist/definition.js.map +2 -2
- package/dist/internal.js +25 -4
- package/dist/internal.js.map +2 -2
- package/dist/library.js +25 -4
- package/dist/library.js.map +2 -2
- package/dist/primitives/conversation-instance.d.ts +7 -1
- package/dist/primitives/conversation-instance.d.ts.map +1 -1
- package/dist/runtime/handlers/conversation.d.ts.map +1 -1
- package/dist/runtime/handlers/event.d.ts.map +1 -1
- package/dist/runtime.js +45 -6
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
|
@@ -12,8 +12,14 @@ export declare class BaseConversationInstance<TChannel extends Channels = Channe
|
|
|
12
12
|
readonly id: string;
|
|
13
13
|
readonly channel: TChannel;
|
|
14
14
|
readonly integration: string;
|
|
15
|
+
/**
|
|
16
|
+
* The integration alias (e.g., "telegram1", "telegram2").
|
|
17
|
+
* This is useful when you have multiple instances of the same integration
|
|
18
|
+
* with different configurations (multi-integration setup).
|
|
19
|
+
*/
|
|
20
|
+
readonly alias: string;
|
|
15
21
|
readonly conversation: BotpressConversation;
|
|
16
|
-
constructor(conversation: BotpressConversation, client: BotClient<any
|
|
22
|
+
constructor(conversation: BotpressConversation, client: BotClient<any>, alias?: string);
|
|
17
23
|
get tags(): ConversationDefinitions[TChannel]['tags'];
|
|
18
24
|
set tags(value: ConversationDefinitions[TChannel]['tags']);
|
|
19
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-instance.d.ts","sourceRoot":"","sources":["../../src/primitives/conversation-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,oBAAoB,EAAU,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yB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C,QAAQ,CAAC,CAAC,MAAM,CAAC,EAE/D;IAED;;OAEG;IACG,IAAI,CAAC,CAAC,SAAS,MAAM,uBAAuB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE;QACjF,IAAI,EAAE,CAAC,CAAA;QACP,OAAO,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;KAC1D,GAAG,OAAO,CACT,KAAK,CACH,OAAO,EACP;QACE,IAAI,EAAE,CAAC,CAAA;QACP,OAAO,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;KAC1D,CACF,CACF;IAqBD;;OAEG;IACG,WAAW;IAsBjB;;OAEG;IACG,UAAU;IAsBhB;;OAEG;IACG,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAiB1D;;OAEG;IACG,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;CAgB/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAS9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAS9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,SAoE3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAc9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAc9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,SA6G3C,CAAA"}
|
package/dist/runtime.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.13.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.13.1", adk: "1.13.1", sdk: "5.0.2", llmz: "0.0.35", zai: "2.5.5", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -33643,10 +33643,16 @@ var init_conversation_instance = __esm({
|
|
|
33643
33643
|
init_define_BUILD();
|
|
33644
33644
|
init_define_PACKAGE_VERSIONS();
|
|
33645
33645
|
init_runtime();
|
|
33646
|
-
BaseConversationInstance = class {
|
|
33646
|
+
BaseConversationInstance = class _BaseConversationInstance {
|
|
33647
33647
|
id;
|
|
33648
33648
|
channel;
|
|
33649
33649
|
integration;
|
|
33650
|
+
/**
|
|
33651
|
+
* The integration alias (e.g., "telegram1", "telegram2").
|
|
33652
|
+
* This is useful when you have multiple instances of the same integration
|
|
33653
|
+
* with different configurations (multi-integration setup).
|
|
33654
|
+
*/
|
|
33655
|
+
alias;
|
|
33650
33656
|
conversation;
|
|
33651
33657
|
// @internal
|
|
33652
33658
|
client;
|
|
@@ -33654,10 +33660,25 @@ var init_conversation_instance = __esm({
|
|
|
33654
33660
|
TrackedState;
|
|
33655
33661
|
// @internal
|
|
33656
33662
|
TrackedTags;
|
|
33657
|
-
|
|
33663
|
+
/**
|
|
33664
|
+
* Extract integration alias from tags (e.g., "telegram3:id" -> "telegram3")
|
|
33665
|
+
* @internal
|
|
33666
|
+
*/
|
|
33667
|
+
static extractAliasFromTags(tags) {
|
|
33668
|
+
if (!tags) return void 0;
|
|
33669
|
+
for (const tagKey of Object.keys(tags)) {
|
|
33670
|
+
const colonIndex = tagKey.indexOf(":");
|
|
33671
|
+
if (colonIndex > 0) {
|
|
33672
|
+
return tagKey.substring(0, colonIndex);
|
|
33673
|
+
}
|
|
33674
|
+
}
|
|
33675
|
+
return void 0;
|
|
33676
|
+
}
|
|
33677
|
+
constructor(conversation, client2, alias) {
|
|
33658
33678
|
this.id = conversation.id;
|
|
33659
|
-
this.channel = `${conversation.integration}.${conversation.channel}`;
|
|
33660
33679
|
this.integration = conversation.integration;
|
|
33680
|
+
this.alias = alias ?? _BaseConversationInstance.extractAliasFromTags(conversation.tags) ?? conversation.integration;
|
|
33681
|
+
this.channel = `${this.alias}.${conversation.channel}`;
|
|
33661
33682
|
this.conversation = conversation;
|
|
33662
33683
|
this.client = client2;
|
|
33663
33684
|
const states = context2.get("states", { optional: true });
|
|
@@ -48286,7 +48307,20 @@ var init_conversation2 = __esm({
|
|
|
48286
48307
|
"event.payload": event.payload
|
|
48287
48308
|
},
|
|
48288
48309
|
async () => {
|
|
48289
|
-
|
|
48310
|
+
let alias = conversation.integration;
|
|
48311
|
+
const allTags = {
|
|
48312
|
+
...conversation.tags,
|
|
48313
|
+
...message.tags,
|
|
48314
|
+
...user2.tags
|
|
48315
|
+
};
|
|
48316
|
+
for (const tagKey of Object.keys(allTags)) {
|
|
48317
|
+
const colonIndex = tagKey.indexOf(":");
|
|
48318
|
+
if (colonIndex > 0) {
|
|
48319
|
+
alias = tagKey.substring(0, colonIndex);
|
|
48320
|
+
break;
|
|
48321
|
+
}
|
|
48322
|
+
}
|
|
48323
|
+
const handlerName = alias + "." + conversation.channel;
|
|
48290
48324
|
const handler = findMatchingHandler(adk.project.conversations, handlerName);
|
|
48291
48325
|
if (!handler) {
|
|
48292
48326
|
logger.debug(`Skipping message, no ADK Conversation defined for "${handlerName}"`);
|
|
@@ -48600,7 +48634,12 @@ var init_event = __esm({
|
|
|
48600
48634
|
logger.warn(`Skipping ${WorkflowCallbackEvent.name} event, conversation not found in context`);
|
|
48601
48635
|
return;
|
|
48602
48636
|
}
|
|
48603
|
-
|
|
48637
|
+
let alias = conversation.integration;
|
|
48638
|
+
const colonIndex = event.type.indexOf(":");
|
|
48639
|
+
if (colonIndex > 0) {
|
|
48640
|
+
alias = event.type.substring(0, colonIndex);
|
|
48641
|
+
}
|
|
48642
|
+
const handlerName = alias + "." + conversation.channel;
|
|
48604
48643
|
const handler = findMatchingHandler(adk.project.conversations, handlerName);
|
|
48605
48644
|
if (!handler) {
|
|
48606
48645
|
logger.debug(`Skipping message, no ADK Conversation defined for "${handlerName}"`);
|