@botpress/runtime 1.13.7 → 1.13.9
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 +7 -89
- package/dist/definition.js.map +4 -4
- package/dist/internal.js +8 -90
- package/dist/internal.js.map +4 -4
- package/dist/library.js +8 -90
- package/dist/library.js.map +4 -4
- package/dist/primitives/conversation-instance.d.ts +0 -8
- package/dist/primitives/conversation-instance.d.ts.map +1 -1
- package/dist/primitives/conversation.d.ts +0 -2
- package/dist/primitives/conversation.d.ts.map +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +8 -94
- package/dist/runtime.js.map +4 -4
- package/package.json +2 -2
- package/dist/utilities/trigger-tags.d.ts +0 -31
- package/dist/utilities/trigger-tags.d.ts.map +0 -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.9", adk: "1.13.9", sdk: "5.0.2", llmz: "0.0.35", zai: "2.5.6", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -26507,7 +26507,7 @@ var require_form_data = __commonJS({
|
|
|
26507
26507
|
var parseUrl = __require("url").parse;
|
|
26508
26508
|
var fs3 = __require("fs");
|
|
26509
26509
|
var Stream2 = __require("stream").Stream;
|
|
26510
|
-
var
|
|
26510
|
+
var crypto2 = __require("crypto");
|
|
26511
26511
|
var mime = require_mime_types();
|
|
26512
26512
|
var asynckit = require_asynckit();
|
|
26513
26513
|
var setToStringTag = require_es_set_tostringtag();
|
|
@@ -26713,7 +26713,7 @@ var require_form_data = __commonJS({
|
|
|
26713
26713
|
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
26714
26714
|
};
|
|
26715
26715
|
FormData3.prototype._generateBoundary = function() {
|
|
26716
|
-
this._boundary = "--------------------------" +
|
|
26716
|
+
this._boundary = "--------------------------" + crypto2.randomBytes(12).toString("hex");
|
|
26717
26717
|
};
|
|
26718
26718
|
FormData3.prototype.getLengthSync = function() {
|
|
26719
26719
|
var knownLength = this._overheadLength + this._valueLength;
|
|
@@ -35021,47 +35021,6 @@ var init_structured_logging = __esm({
|
|
|
35021
35021
|
}
|
|
35022
35022
|
});
|
|
35023
35023
|
|
|
35024
|
-
// src/utilities/trigger-tags.ts
|
|
35025
|
-
var trigger_tags_exports = {};
|
|
35026
|
-
__export(trigger_tags_exports, {
|
|
35027
|
-
getTriggerSubscriptionTags: () => getTriggerSubscriptionTags,
|
|
35028
|
-
getTriggerTagName: () => getTriggerTagName,
|
|
35029
|
-
getTriggerTagValue: () => getTriggerTagValue,
|
|
35030
|
-
isConversationSubscribedToTrigger: () => isConversationSubscribedToTrigger
|
|
35031
|
-
});
|
|
35032
|
-
import crypto2 from "crypto";
|
|
35033
|
-
var hashString, getTriggerTagName, getTriggerTagValue, getTriggerSubscriptionTags, isConversationSubscribedToTrigger;
|
|
35034
|
-
var init_trigger_tags = __esm({
|
|
35035
|
-
"src/utilities/trigger-tags.ts"() {
|
|
35036
|
-
"use strict";
|
|
35037
|
-
init_define_BUILD();
|
|
35038
|
-
init_define_PACKAGE_VERSIONS();
|
|
35039
|
-
hashString = (str) => {
|
|
35040
|
-
return crypto2.createHash("md5").update(str).digest("hex").substring(0, 5).toUpperCase();
|
|
35041
|
-
};
|
|
35042
|
-
getTriggerTagName = (triggerName) => {
|
|
35043
|
-
return `trigger${hashString(triggerName)}`;
|
|
35044
|
-
};
|
|
35045
|
-
getTriggerTagValue = (key) => {
|
|
35046
|
-
return key ?? "*";
|
|
35047
|
-
};
|
|
35048
|
-
getTriggerSubscriptionTags = (triggerName, key) => {
|
|
35049
|
-
return {
|
|
35050
|
-
name: getTriggerTagName(triggerName),
|
|
35051
|
-
value: getTriggerTagValue(key)
|
|
35052
|
-
};
|
|
35053
|
-
};
|
|
35054
|
-
isConversationSubscribedToTrigger = (conversationTags, triggerName, triggerKey) => {
|
|
35055
|
-
const tagName = getTriggerTagName(triggerName);
|
|
35056
|
-
const tagValue = conversationTags[tagName];
|
|
35057
|
-
if (!tagValue) {
|
|
35058
|
-
return false;
|
|
35059
|
-
}
|
|
35060
|
-
return tagValue === "*" || tagValue === triggerKey;
|
|
35061
|
-
};
|
|
35062
|
-
}
|
|
35063
|
-
});
|
|
35064
|
-
|
|
35065
35024
|
// src/types.ts
|
|
35066
35025
|
var init_types2 = __esm({
|
|
35067
35026
|
"src/types.ts"() {
|
|
@@ -35256,7 +35215,6 @@ var init_runtime = __esm({
|
|
|
35256
35215
|
init_structured_logging();
|
|
35257
35216
|
init_environment();
|
|
35258
35217
|
init_runtime2();
|
|
35259
|
-
init_trigger_tags();
|
|
35260
35218
|
init_types2();
|
|
35261
35219
|
init_errors();
|
|
35262
35220
|
init_state();
|
|
@@ -37315,38 +37273,6 @@ var init_conversation_instance = __esm({
|
|
|
37315
37273
|
});
|
|
37316
37274
|
}
|
|
37317
37275
|
}
|
|
37318
|
-
/**
|
|
37319
|
-
* Subscribe to a trigger
|
|
37320
|
-
*/
|
|
37321
|
-
async subscribeToTrigger(triggerName, key) {
|
|
37322
|
-
const { getTriggerSubscriptionTags: getTriggerSubscriptionTags2, isConversationSubscribedToTrigger: isConversationSubscribedToTrigger2 } = await Promise.resolve().then(() => (init_trigger_tags(), trigger_tags_exports));
|
|
37323
|
-
if (isConversationSubscribedToTrigger2(this.tags, triggerName, key)) {
|
|
37324
|
-
return;
|
|
37325
|
-
}
|
|
37326
|
-
const { name, value } = getTriggerSubscriptionTags2(triggerName, key);
|
|
37327
|
-
await this.client.updateConversation({
|
|
37328
|
-
id: this.id,
|
|
37329
|
-
tags: {
|
|
37330
|
-
[name]: value
|
|
37331
|
-
}
|
|
37332
|
-
});
|
|
37333
|
-
}
|
|
37334
|
-
/**
|
|
37335
|
-
* Unsubscribe from a trigger
|
|
37336
|
-
*/
|
|
37337
|
-
async unsubscribeFromTrigger(triggerName, key) {
|
|
37338
|
-
const { getTriggerSubscriptionTags: getTriggerSubscriptionTags2, isConversationSubscribedToTrigger: isConversationSubscribedToTrigger2 } = await Promise.resolve().then(() => (init_trigger_tags(), trigger_tags_exports));
|
|
37339
|
-
if (!isConversationSubscribedToTrigger2(this.tags, triggerName, key)) {
|
|
37340
|
-
return;
|
|
37341
|
-
}
|
|
37342
|
-
const { name } = getTriggerSubscriptionTags2(triggerName, key);
|
|
37343
|
-
await this.client.updateConversation({
|
|
37344
|
-
id: this.id,
|
|
37345
|
-
tags: {
|
|
37346
|
-
[name]: ""
|
|
37347
|
-
}
|
|
37348
|
-
});
|
|
37349
|
-
}
|
|
37350
37276
|
};
|
|
37351
37277
|
}
|
|
37352
37278
|
});
|
|
@@ -37382,19 +37308,11 @@ var init_conversation = __esm({
|
|
|
37382
37308
|
/** @internal */
|
|
37383
37309
|
schema;
|
|
37384
37310
|
#handler;
|
|
37385
|
-
#startFromTrigger;
|
|
37386
37311
|
constructor(props) {
|
|
37387
37312
|
this.channel = props.channel;
|
|
37388
37313
|
this.events = props.events ?? [];
|
|
37389
37314
|
this.schema = props.state ?? z16.object({}).passthrough();
|
|
37390
37315
|
this.#handler = props.handler;
|
|
37391
|
-
if (props.startFromTrigger) {
|
|
37392
|
-
this.#startFromTrigger = props.startFromTrigger;
|
|
37393
|
-
}
|
|
37394
|
-
}
|
|
37395
|
-
/** @internal */
|
|
37396
|
-
get startFromTrigger() {
|
|
37397
|
-
return this.#startFromTrigger;
|
|
37398
37316
|
}
|
|
37399
37317
|
/** @internal */
|
|
37400
37318
|
getDefinition() {
|
|
@@ -41035,7 +40953,7 @@ var init_source_website = __esm({
|
|
|
41035
40953
|
type: "website",
|
|
41036
40954
|
state: State,
|
|
41037
40955
|
async handler({ input, step: step2, state, client: client2 }) {
|
|
41038
|
-
const
|
|
40956
|
+
const crypto2 = await import("crypto");
|
|
41039
40957
|
console.log(
|
|
41040
40958
|
`Starting sync for WebsiteSource [${this.id}] in mode [${this.mode}, maxPages=${this.maxPages}, maxDepth=${this.maxDepth}, baseUrl=${this.baseUrl}, sitemapUrl=${this.sitemapUrl}]`
|
|
41041
40959
|
);
|
|
@@ -41117,7 +41035,7 @@ var init_source_website = __esm({
|
|
|
41117
41035
|
content,
|
|
41118
41036
|
metadata: fetchMetadata
|
|
41119
41037
|
} = await this.fetchUrl(sitemapUrl.loc);
|
|
41120
|
-
const hash =
|
|
41038
|
+
const hash = crypto2.createHash("sha256").update(content).digest("hex");
|
|
41121
41039
|
let contentType = fetchedContentType;
|
|
41122
41040
|
if (!contentType) {
|
|
41123
41041
|
contentType = content.includes("<html") ? "text/html" : "text/markdown";
|
|
@@ -48114,7 +48032,7 @@ var init_source_directory = __esm({
|
|
|
48114
48032
|
const glob2 = await Promise.resolve().then(() => (init_esm9(), esm_exports3));
|
|
48115
48033
|
const path5 = await import("path");
|
|
48116
48034
|
const fs3 = await import("fs/promises");
|
|
48117
|
-
const
|
|
48035
|
+
const crypto2 = await import("crypto");
|
|
48118
48036
|
const directory = path5.resolve(adk.environment.agent.directory, this.directoryPath);
|
|
48119
48037
|
const tags = {
|
|
48120
48038
|
[WellKnownTags.knowledge.KNOWLEDGE]: "knowledge-base",
|
|
@@ -48176,7 +48094,7 @@ var init_source_directory = __esm({
|
|
|
48176
48094
|
const upsertFile = async (local) => {
|
|
48177
48095
|
const key = `data_source://${this.type}/${this.id}/${local.rel}`;
|
|
48178
48096
|
const content = await fs3.readFile(local.abs);
|
|
48179
|
-
const hash =
|
|
48097
|
+
const hash = crypto2.createHash("sha256").update(content).digest("hex");
|
|
48180
48098
|
const { file } = await client2.getFile({ id: key }).catch(() => ({ file: null }));
|
|
48181
48099
|
if (!input.force && file?.metadata?.hash === hash) {
|
|
48182
48100
|
console.log(`Skipping unchanged file: ${local.rel}`);
|
|
@@ -48465,7 +48383,7 @@ var init_table = __esm({
|
|
|
48465
48383
|
}
|
|
48466
48384
|
/** @internal */
|
|
48467
48385
|
getDefinition() {
|
|
48468
|
-
const schema = transforms3.
|
|
48386
|
+
const schema = transforms3.toJSONSchemaLegacy(this.schema);
|
|
48469
48387
|
for (const col of Object.keys(this.columns)) {
|
|
48470
48388
|
if (this.computedColumns.has(col) || this.nullableColumns.has(col)) {
|
|
48471
48389
|
if ("properties" in schema && schema.properties && col in schema.properties && typeof schema.properties[col] === "object" && schema.properties[col] !== null) {
|