@botpress/runtime 1.13.10 → 1.13.12
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 +46 -8
- package/dist/definition.js.map +2 -2
- package/dist/internal.js +46 -8
- package/dist/internal.js.map +2 -2
- package/dist/library.js +46 -8
- package/dist/library.js.map +2 -2
- package/dist/runtime/context/context.d.ts +18 -0
- package/dist/runtime/context/context.d.ts.map +1 -1
- package/dist/runtime/handlers/trigger.d.ts.map +1 -1
- package/dist/runtime/tracked-tags.d.ts +2 -0
- package/dist/runtime/tracked-tags.d.ts.map +1 -1
- package/dist/runtime.js +60 -20
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
|
@@ -74,5 +74,23 @@ export declare const context: {
|
|
|
74
74
|
optional?: boolean;
|
|
75
75
|
}) => Required<BotContext>[T];
|
|
76
76
|
set: (key: keyof BotContext, value: any) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Set a default context that will be used as a fallback when no AsyncLocalStorage context is active.
|
|
79
|
+
* This is useful for testing and script execution where code runs outside of request handlers.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* context.setDefaultContext({
|
|
84
|
+
* botId: 'my-bot',
|
|
85
|
+
* integrations: agentRegistry.integrations,
|
|
86
|
+
* interfaces: agentRegistry.interfaces,
|
|
87
|
+
* })
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
setDefaultContext: (data: Partial<BotContext>) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Clear the default context.
|
|
93
|
+
*/
|
|
94
|
+
clearDefaultContext: () => void;
|
|
77
95
|
};
|
|
78
96
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/runtime/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAA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OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,YAAY,CAAC,EAAE,mBAAmB,CAAA;IAClC,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAClC,YAAY,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACtC,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,MAAM,EAAE,YAAY,EAAE,CAAA;IACtB,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,EAAE,MAAM,CAAA;QAClB,6BAA6B,EAAE,MAAM,MAAM,CAAA;KAC5C,CAAA;IACD,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;CAC/B,CAAA;AAcD,eAAO,MAAM,OAAO;sBACA,UAAU;UAItB,OAAO,QAAQ,UAAU,YAAY,MAAM,OAAO;kBAc5C,UAAU;UAYhB,CAAC,SAAS,MAAM,UAAU,wCACzB,CAAC,SACC;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAC5B,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;eAsBf,MAAM,UAAU,SAAS,GAAG;IAMvC;;;;;;;;;;;;OAYG;8BACuB,OAAO,CAAC,UAAU,CAAC;IAI7C;;OAEG;;CAIJ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../src/runtime/handlers/trigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAK9E,eAAO,MAAM,KAAK,GAAI,KAAK,iBAAiB,SA4D3C,CAAA"}
|
|
@@ -3,6 +3,8 @@ import { Client } from '@botpress/client';
|
|
|
3
3
|
* TrackedTags manages tags for bot, user, conversation, and workflow entities.
|
|
4
4
|
* Tags are key-value pairs where values are strings or undefined.
|
|
5
5
|
* Changes are tracked and persisted automatically.
|
|
6
|
+
*
|
|
7
|
+
* Note: System tags (containing ':') are read-only and will be ignored during saves and dirty checks.
|
|
6
8
|
*/
|
|
7
9
|
export declare class TrackedTags {
|
|
8
10
|
type: 'bot' | 'user' | 'conversation' | 'workflow';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracked-tags.d.ts","sourceRoot":"","sources":["../../src/runtime/tracked-tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"tracked-tags.d.ts","sourceRoot":"","sources":["../../src/runtime/tracked-tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAYzC;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAA;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IAEd,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,eAAe,CAAY;IAEnC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAiB;IAC1C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAiB;IAC7C,OAAO,CAAC,MAAM,CAAC,aAAa,CAAY;IAExC,OAAO;WAMO,MAAM,CAAC,KAAK,EAAE;QAC1B,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAA;QAClD,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;KACjD,GAAG,WAAW;WA4BK,YAAY;WAkCZ,OAAO;WA6Db,SAAS;IAIV,IAAI,CAAC,KAAK,GAAE,OAAe;IAqB3B,IAAI;IAqCV,OAAO,IAAI,OAAO;IAsBzB,IAAW,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAmBpD;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAExD;YAEa,SAAS;YAqBT,WAAW;CAyB1B"}
|
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.12", adk: "1.13.12", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -14851,7 +14851,7 @@ var init_assets = __esm({
|
|
|
14851
14851
|
|
|
14852
14852
|
// src/runtime/context/context.ts
|
|
14853
14853
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
14854
|
-
var storage, context2;
|
|
14854
|
+
var storage, defaultContext, context2;
|
|
14855
14855
|
var init_context3 = __esm({
|
|
14856
14856
|
"src/runtime/context/context.ts"() {
|
|
14857
14857
|
"use strict";
|
|
@@ -14859,6 +14859,7 @@ var init_context3 = __esm({
|
|
|
14859
14859
|
init_define_PACKAGE_VERSIONS();
|
|
14860
14860
|
init_singletons();
|
|
14861
14861
|
storage = getSingleton("__ADK_GLOBAL_CTX_STORAGE", () => new AsyncLocalStorage2());
|
|
14862
|
+
defaultContext = getSingleton("__ADK_GLOBAL_DEFAULT_CTX", () => ({ value: null }));
|
|
14862
14863
|
context2 = {
|
|
14863
14864
|
enterWith: (data) => {
|
|
14864
14865
|
storage.enterWith(data);
|
|
@@ -14872,12 +14873,18 @@ var init_context3 = __esm({
|
|
|
14872
14873
|
return storage.run(data, callback);
|
|
14873
14874
|
},
|
|
14874
14875
|
getAll: () => {
|
|
14875
|
-
|
|
14876
|
+
let store = storage.getStore();
|
|
14877
|
+
if (!store && defaultContext.value) {
|
|
14878
|
+
store = defaultContext.value;
|
|
14879
|
+
}
|
|
14876
14880
|
if (!store) throw new Error("No context found. Did you forget to call `context.run()`?");
|
|
14877
14881
|
return store;
|
|
14878
14882
|
},
|
|
14879
14883
|
get: (key, opts) => {
|
|
14880
|
-
|
|
14884
|
+
let store = storage.getStore();
|
|
14885
|
+
if (!store && defaultContext.value) {
|
|
14886
|
+
store = defaultContext.value;
|
|
14887
|
+
}
|
|
14881
14888
|
if (store) {
|
|
14882
14889
|
store.states ??= [];
|
|
14883
14890
|
store.tags ??= [];
|
|
@@ -14893,6 +14900,28 @@ var init_context3 = __esm({
|
|
|
14893
14900
|
const store = storage.getStore();
|
|
14894
14901
|
if (!store) throw new Error("Cannot set context outside of `run`");
|
|
14895
14902
|
store[key] = value;
|
|
14903
|
+
},
|
|
14904
|
+
/**
|
|
14905
|
+
* Set a default context that will be used as a fallback when no AsyncLocalStorage context is active.
|
|
14906
|
+
* This is useful for testing and script execution where code runs outside of request handlers.
|
|
14907
|
+
*
|
|
14908
|
+
* @example
|
|
14909
|
+
* ```typescript
|
|
14910
|
+
* context.setDefaultContext({
|
|
14911
|
+
* botId: 'my-bot',
|
|
14912
|
+
* integrations: agentRegistry.integrations,
|
|
14913
|
+
* interfaces: agentRegistry.interfaces,
|
|
14914
|
+
* })
|
|
14915
|
+
* ```
|
|
14916
|
+
*/
|
|
14917
|
+
setDefaultContext: (data) => {
|
|
14918
|
+
defaultContext.value = data;
|
|
14919
|
+
},
|
|
14920
|
+
/**
|
|
14921
|
+
* Clear the default context.
|
|
14922
|
+
*/
|
|
14923
|
+
clearDefaultContext: () => {
|
|
14924
|
+
defaultContext.value = null;
|
|
14896
14925
|
}
|
|
14897
14926
|
};
|
|
14898
14927
|
}
|
|
@@ -44203,7 +44232,7 @@ var init_actions = __esm({
|
|
|
44203
44232
|
}
|
|
44204
44233
|
integrations ??= context2.get("integrations", { optional: true });
|
|
44205
44234
|
client2 ??= context2.get("client", { optional: true });
|
|
44206
|
-
const integration = integrations
|
|
44235
|
+
const integration = integrations?.find((i) => i.alias === integrationName);
|
|
44207
44236
|
const actionDef = integration?.definition.actions?.[actionName];
|
|
44208
44237
|
const handler = async (params) => {
|
|
44209
44238
|
integrations ??= context2.get("integrations", { optional: true });
|
|
@@ -46740,6 +46769,9 @@ var init_tracked_state = __esm({
|
|
|
46740
46769
|
});
|
|
46741
46770
|
|
|
46742
46771
|
// src/runtime/tracked-tags.ts
|
|
46772
|
+
function isSystemTag(key) {
|
|
46773
|
+
return key.includes(":");
|
|
46774
|
+
}
|
|
46743
46775
|
var TrackedTags;
|
|
46744
46776
|
var init_tracked_tags = __esm({
|
|
46745
46777
|
"src/runtime/tracked-tags.ts"() {
|
|
@@ -46919,8 +46951,8 @@ var init_tracked_tags = __esm({
|
|
|
46919
46951
|
}
|
|
46920
46952
|
}
|
|
46921
46953
|
isDirty() {
|
|
46922
|
-
const currentKeys = Object.keys(this._tags).filter((k) => !k
|
|
46923
|
-
const initialKeys = Object.keys(this._initialTags).filter((k) => !k
|
|
46954
|
+
const currentKeys = Object.keys(this._tags).filter((k) => !isSystemTag(k)).sort();
|
|
46955
|
+
const initialKeys = Object.keys(this._initialTags).filter((k) => !isSystemTag(k)).sort();
|
|
46924
46956
|
if (currentKeys.length !== initialKeys.length) {
|
|
46925
46957
|
return true;
|
|
46926
46958
|
}
|
|
@@ -46934,10 +46966,16 @@ var init_tracked_tags = __esm({
|
|
|
46934
46966
|
get tags() {
|
|
46935
46967
|
return new Proxy(this._tags, {
|
|
46936
46968
|
set: (target, prop, value) => {
|
|
46969
|
+
if (isSystemTag(prop)) {
|
|
46970
|
+
return true;
|
|
46971
|
+
}
|
|
46937
46972
|
target[prop] = value;
|
|
46938
46973
|
return true;
|
|
46939
46974
|
},
|
|
46940
46975
|
deleteProperty: (target, prop) => {
|
|
46976
|
+
if (isSystemTag(prop)) {
|
|
46977
|
+
return true;
|
|
46978
|
+
}
|
|
46941
46979
|
target[prop] = void 0;
|
|
46942
46980
|
return true;
|
|
46943
46981
|
}
|
|
@@ -46969,7 +47007,7 @@ var init_tracked_tags = __esm({
|
|
|
46969
47007
|
async persistTags(tags) {
|
|
46970
47008
|
const tagsForApi = {};
|
|
46971
47009
|
for (const [key, value] of Object.entries(tags)) {
|
|
46972
|
-
if (value !== void 0 && !key
|
|
47010
|
+
if (value !== void 0 && !isSystemTag(key)) {
|
|
46973
47011
|
tagsForApi[key] = value;
|
|
46974
47012
|
}
|
|
46975
47013
|
}
|
|
@@ -48736,34 +48774,36 @@ var init_trigger2 = __esm({
|
|
|
48736
48774
|
} else {
|
|
48737
48775
|
events.add(name);
|
|
48738
48776
|
}
|
|
48739
|
-
const [integration, event] = name.split(":");
|
|
48740
48777
|
const names = /* @__PURE__ */ new Set([name]);
|
|
48741
|
-
|
|
48742
|
-
|
|
48743
|
-
|
|
48744
|
-
|
|
48778
|
+
if (name.includes(":")) {
|
|
48779
|
+
const [integration, event] = name.split(":");
|
|
48780
|
+
const int = adk.project.integrations.find((x) => x.alias === integration || x.definition.name === integration);
|
|
48781
|
+
if (!int) {
|
|
48782
|
+
console.warn(`Integration "${integration}" not found for event "${name}". Skipping trigger registration.`);
|
|
48783
|
+
continue;
|
|
48784
|
+
}
|
|
48785
|
+
names.add(`${int.definition.name}:${event}`);
|
|
48786
|
+
names.add(`${int.alias}:${event}`);
|
|
48745
48787
|
}
|
|
48746
|
-
names.add(`${int.definition.name}:${event}`);
|
|
48747
|
-
names.add(`${int.alias}:${event}`);
|
|
48748
48788
|
for (const name2 of names) {
|
|
48749
|
-
bot2.on.event(name2, async ({ event
|
|
48789
|
+
bot2.on.event(name2, async ({ event, ctx }) => {
|
|
48750
48790
|
const conversation = context2.get("conversation", { optional: true });
|
|
48751
48791
|
await span(
|
|
48752
48792
|
"handler.trigger",
|
|
48753
48793
|
{
|
|
48754
48794
|
botId: ctx.botId,
|
|
48755
|
-
eventId:
|
|
48795
|
+
eventId: event.id,
|
|
48756
48796
|
"event.type": originalName,
|
|
48757
|
-
conversationId:
|
|
48797
|
+
conversationId: event.conversationId,
|
|
48758
48798
|
integration: conversation?.integration,
|
|
48759
48799
|
channel: conversation?.channel,
|
|
48760
|
-
userId:
|
|
48800
|
+
userId: event.userId
|
|
48761
48801
|
},
|
|
48762
48802
|
async () => {
|
|
48763
48803
|
console.log(`Evaluating trigger "${trigger.name}" for event "${originalName}" (mapped to "${name2}")`);
|
|
48764
48804
|
await trigger.handler({
|
|
48765
48805
|
event: {
|
|
48766
|
-
...
|
|
48806
|
+
...event,
|
|
48767
48807
|
type: originalName
|
|
48768
48808
|
}
|
|
48769
48809
|
});
|