@botpress/runtime 1.13.14 → 1.13.16
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 +1994 -1945
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +70 -21
- package/dist/internal.js.map +2 -2
- package/dist/library.js +70 -21
- package/dist/library.js.map +2 -2
- package/dist/primitives/conversation.d.ts +9 -5
- package/dist/primitives/conversation.d.ts.map +1 -1
- package/dist/primitives/data-sources/source-website.d.ts.map +1 -1
- package/dist/primitives/workflow-instance.d.ts.map +1 -1
- package/dist/runtime/actions.d.ts.map +1 -1
- package/dist/runtime/tracked-state.d.ts.map +1 -1
- package/dist/runtime/tracked-tags.d.ts +5 -0
- package/dist/runtime/tracked-tags.d.ts.map +1 -1
- package/dist/runtime.js +70 -21
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
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.13.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.13.16", adk: "1.13.16", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -34809,10 +34809,15 @@ var init_actions = __esm({
|
|
|
34809
34809
|
if (typeof propertyName !== "string") {
|
|
34810
34810
|
return void 0;
|
|
34811
34811
|
}
|
|
34812
|
+
let client2;
|
|
34813
|
+
client2 ??= context.get("client", { optional: true });
|
|
34812
34814
|
const botAction = adk.project.actions.find((a) => a.name === propertyName);
|
|
34813
34815
|
if (botAction) {
|
|
34814
34816
|
const handler = async (input) => {
|
|
34815
|
-
return await botAction.handler(
|
|
34817
|
+
return await botAction.handler({
|
|
34818
|
+
input,
|
|
34819
|
+
client: client2
|
|
34820
|
+
});
|
|
34816
34821
|
};
|
|
34817
34822
|
handler.asTool = () => new Autonomous.Tool({
|
|
34818
34823
|
name: botAction.name,
|
|
@@ -34824,9 +34829,7 @@ var init_actions = __esm({
|
|
|
34824
34829
|
return handler;
|
|
34825
34830
|
}
|
|
34826
34831
|
let integrations;
|
|
34827
|
-
let client2;
|
|
34828
34832
|
integrations ??= context.get("integrations", { optional: true });
|
|
34829
|
-
client2 ??= context.get("client", { optional: true });
|
|
34830
34833
|
const integrationName = propertyName.replace("__", "/");
|
|
34831
34834
|
return new Proxy(
|
|
34832
34835
|
{},
|
|
@@ -36194,7 +36197,8 @@ var init_tracked_state = __esm({
|
|
|
36194
36197
|
} else {
|
|
36195
36198
|
this.value = value;
|
|
36196
36199
|
}
|
|
36197
|
-
|
|
36200
|
+
const needsDefaults = this.value == null || this.value === void 0;
|
|
36201
|
+
if (needsDefaults) {
|
|
36198
36202
|
if (this.state && "parse" in this.state) {
|
|
36199
36203
|
try {
|
|
36200
36204
|
this.value = this.state.parse({});
|
|
@@ -36397,6 +36401,7 @@ var init_tracked_tags = __esm({
|
|
|
36397
36401
|
init_define_PACKAGE_VERSIONS();
|
|
36398
36402
|
init_context();
|
|
36399
36403
|
init_tracing();
|
|
36404
|
+
init_adk();
|
|
36400
36405
|
TrackedTags = class _TrackedTags {
|
|
36401
36406
|
type;
|
|
36402
36407
|
id;
|
|
@@ -36621,13 +36626,49 @@ var init_tracked_tags = __esm({
|
|
|
36621
36626
|
}
|
|
36622
36627
|
return {};
|
|
36623
36628
|
}
|
|
36629
|
+
/**
|
|
36630
|
+
* Get the list of valid tag keys from the agent configuration.
|
|
36631
|
+
* Only tags defined in agent.config.ts can be persisted.
|
|
36632
|
+
*/
|
|
36633
|
+
getValidTagKeys() {
|
|
36634
|
+
const validKeys = /* @__PURE__ */ new Set();
|
|
36635
|
+
try {
|
|
36636
|
+
const config = adk.project.config;
|
|
36637
|
+
if (this.type === "bot" && config.bot?.tags) {
|
|
36638
|
+
Object.keys(config.bot.tags).forEach((key) => validKeys.add(key));
|
|
36639
|
+
} else if (this.type === "user" && config.user?.tags) {
|
|
36640
|
+
Object.keys(config.user.tags).forEach((key) => validKeys.add(key));
|
|
36641
|
+
} else if (this.type === "conversation" && config.conversation?.tags) {
|
|
36642
|
+
Object.keys(config.conversation.tags).forEach((key) => validKeys.add(key));
|
|
36643
|
+
} else if (this.type === "workflow" && config.workflow?.tags) {
|
|
36644
|
+
Object.keys(config.workflow.tags).forEach((key) => validKeys.add(key));
|
|
36645
|
+
}
|
|
36646
|
+
} catch (err) {
|
|
36647
|
+
console.warn(`[TrackedTags] Could not load tag definitions from config: ${err}`);
|
|
36648
|
+
}
|
|
36649
|
+
return validKeys;
|
|
36650
|
+
}
|
|
36624
36651
|
async persistTags(tags) {
|
|
36652
|
+
const validKeys = this.getValidTagKeys();
|
|
36625
36653
|
const tagsForApi = {};
|
|
36654
|
+
const skippedTags = [];
|
|
36626
36655
|
for (const [key, value] of Object.entries(tags)) {
|
|
36627
|
-
if (value
|
|
36656
|
+
if (value === void 0 || isSystemTag(key)) {
|
|
36657
|
+
continue;
|
|
36658
|
+
}
|
|
36659
|
+
if (validKeys.size === 0 || validKeys.has(key)) {
|
|
36628
36660
|
tagsForApi[key] = value;
|
|
36661
|
+
} else {
|
|
36662
|
+
skippedTags.push(key);
|
|
36663
|
+
delete this._tags[key];
|
|
36664
|
+
delete this._initialTags[key];
|
|
36629
36665
|
}
|
|
36630
36666
|
}
|
|
36667
|
+
if (skippedTags.length > 0) {
|
|
36668
|
+
console.warn(
|
|
36669
|
+
`[TrackedTags] Skipping tags not defined in agent.config.ts for ${this.type}/${this.id}: ${skippedTags.join(", ")}`
|
|
36670
|
+
);
|
|
36671
|
+
}
|
|
36631
36672
|
try {
|
|
36632
36673
|
if (this.type === "bot") {
|
|
36633
36674
|
await this.client.updateBot({ id: this.id, tags: tagsForApi });
|
|
@@ -37745,9 +37786,13 @@ var init_conversation = __esm({
|
|
|
37745
37786
|
}
|
|
37746
37787
|
const stateProxy = new Proxy(conversationInstance.TrackedState.value, {
|
|
37747
37788
|
set(target, prop, value) {
|
|
37748
|
-
const
|
|
37749
|
-
|
|
37750
|
-
|
|
37789
|
+
const oldValue = target[prop];
|
|
37790
|
+
if (oldValue !== value) {
|
|
37791
|
+
const result = Reflect.set(target, prop, value);
|
|
37792
|
+
conversationInstance.TrackedState.markDirty();
|
|
37793
|
+
return result;
|
|
37794
|
+
}
|
|
37795
|
+
return true;
|
|
37751
37796
|
}
|
|
37752
37797
|
});
|
|
37753
37798
|
await this.#handler({
|
|
@@ -38778,9 +38823,13 @@ var init_workflow_instance = __esm({
|
|
|
38778
38823
|
const trackedState = this.TrackedState;
|
|
38779
38824
|
const stateProxy = new Proxy(this.TrackedState.value, {
|
|
38780
38825
|
set(target, prop, value) {
|
|
38781
|
-
const
|
|
38782
|
-
|
|
38783
|
-
|
|
38826
|
+
const oldValue = target[prop];
|
|
38827
|
+
if (oldValue !== value) {
|
|
38828
|
+
const result = Reflect.set(target, prop, value);
|
|
38829
|
+
trackedState.markDirty();
|
|
38830
|
+
return result;
|
|
38831
|
+
}
|
|
38832
|
+
return true;
|
|
38784
38833
|
}
|
|
38785
38834
|
});
|
|
38786
38835
|
if (this.workflow.status === "pending") {
|
|
@@ -40932,13 +40981,13 @@ var init_source_website = __esm({
|
|
|
40932
40981
|
parseLlmsTxt(content) {
|
|
40933
40982
|
const urls = [];
|
|
40934
40983
|
const lines = content.split("\n");
|
|
40935
|
-
const
|
|
40984
|
+
const linkRegex = /\[([^\]]+)\]\((https?:\/\/[^\s)]+\.md)\)/g;
|
|
40936
40985
|
for (const line of lines) {
|
|
40937
|
-
const matches = line.matchAll(
|
|
40986
|
+
const matches = line.matchAll(linkRegex);
|
|
40938
40987
|
for (const match2 of matches) {
|
|
40939
|
-
const [url2] = match2;
|
|
40988
|
+
const [, title, url2] = match2;
|
|
40940
40989
|
if (url2) {
|
|
40941
|
-
urls.push(url2);
|
|
40990
|
+
urls.push({ loc: url2, ...title && { title } });
|
|
40942
40991
|
}
|
|
40943
40992
|
}
|
|
40944
40993
|
}
|
|
@@ -41014,11 +41063,11 @@ var init_source_website = __esm({
|
|
|
41014
41063
|
console.log(`Reached maxPages limit (${this.maxPages}), stopping`);
|
|
41015
41064
|
break;
|
|
41016
41065
|
}
|
|
41017
|
-
const filterContext = { url: url2 };
|
|
41066
|
+
const filterContext = { url: url2.loc };
|
|
41018
41067
|
if (!this.filterFn || this.filterFn(filterContext)) {
|
|
41019
|
-
filteredUrls.push(
|
|
41068
|
+
filteredUrls.push(url2);
|
|
41020
41069
|
} else {
|
|
41021
|
-
console.log(`Skipped URL (filtered): ${url2}`);
|
|
41070
|
+
console.log(`Skipped URL (filtered): ${url2.loc}`);
|
|
41022
41071
|
}
|
|
41023
41072
|
}
|
|
41024
41073
|
return filteredUrls;
|
|
@@ -41213,8 +41262,8 @@ var init_source_website = __esm({
|
|
|
41213
41262
|
hash,
|
|
41214
41263
|
...sitemapUrl.lastmod && { lastmod: sitemapUrl.lastmod },
|
|
41215
41264
|
...contentType && { contentType },
|
|
41216
|
-
...fetchMetadata?.[WellKnownMetadata.knowledge.TITLE] && {
|
|
41217
|
-
[WellKnownMetadata.knowledge.TITLE]: fetchMetadata[WellKnownMetadata.knowledge.TITLE]
|
|
41265
|
+
...(fetchMetadata?.[WellKnownMetadata.knowledge.TITLE] || sitemapUrl.title) && {
|
|
41266
|
+
[WellKnownMetadata.knowledge.TITLE]: fetchMetadata?.[WellKnownMetadata.knowledge.TITLE] ?? sitemapUrl.title
|
|
41218
41267
|
},
|
|
41219
41268
|
...fetchMetadata?.[WellKnownMetadata.knowledge.DESCRIPTION] && {
|
|
41220
41269
|
[WellKnownMetadata.knowledge.DESCRIPTION]: fetchMetadata[WellKnownMetadata.knowledge.DESCRIPTION]
|