@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/library.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.7", adk: "1.13.7", sdk: "5.0.2", llmz: "0.0.35", zai: "2.5.6", cognitive: "0.3.3" };
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
 
@@ -26314,7 +26314,7 @@ var require_form_data = __commonJS({
26314
26314
  var parseUrl = __require("url").parse;
26315
26315
  var fs3 = __require("fs");
26316
26316
  var Stream2 = __require("stream").Stream;
26317
- var crypto3 = __require("crypto");
26317
+ var crypto2 = __require("crypto");
26318
26318
  var mime = require_mime_types();
26319
26319
  var asynckit = require_asynckit();
26320
26320
  var setToStringTag = require_es_set_tostringtag();
@@ -26520,7 +26520,7 @@ var require_form_data = __commonJS({
26520
26520
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
26521
26521
  };
26522
26522
  FormData3.prototype._generateBoundary = function() {
26523
- this._boundary = "--------------------------" + crypto3.randomBytes(12).toString("hex");
26523
+ this._boundary = "--------------------------" + crypto2.randomBytes(12).toString("hex");
26524
26524
  };
26525
26525
  FormData3.prototype.getLengthSync = function() {
26526
26526
  var knownLength = this._overheadLength + this._valueLength;
@@ -34821,47 +34821,6 @@ var init_structured_logging = __esm({
34821
34821
  }
34822
34822
  });
34823
34823
 
34824
- // src/utilities/trigger-tags.ts
34825
- var trigger_tags_exports = {};
34826
- __export(trigger_tags_exports, {
34827
- getTriggerSubscriptionTags: () => getTriggerSubscriptionTags,
34828
- getTriggerTagName: () => getTriggerTagName,
34829
- getTriggerTagValue: () => getTriggerTagValue,
34830
- isConversationSubscribedToTrigger: () => isConversationSubscribedToTrigger
34831
- });
34832
- import crypto2 from "crypto";
34833
- var hashString, getTriggerTagName, getTriggerTagValue, getTriggerSubscriptionTags, isConversationSubscribedToTrigger;
34834
- var init_trigger_tags = __esm({
34835
- "src/utilities/trigger-tags.ts"() {
34836
- "use strict";
34837
- init_define_BUILD();
34838
- init_define_PACKAGE_VERSIONS();
34839
- hashString = (str) => {
34840
- return crypto2.createHash("md5").update(str).digest("hex").substring(0, 5).toUpperCase();
34841
- };
34842
- getTriggerTagName = (triggerName) => {
34843
- return `trigger${hashString(triggerName)}`;
34844
- };
34845
- getTriggerTagValue = (key) => {
34846
- return key ?? "*";
34847
- };
34848
- getTriggerSubscriptionTags = (triggerName, key) => {
34849
- return {
34850
- name: getTriggerTagName(triggerName),
34851
- value: getTriggerTagValue(key)
34852
- };
34853
- };
34854
- isConversationSubscribedToTrigger = (conversationTags, triggerName, triggerKey) => {
34855
- const tagName = getTriggerTagName(triggerName);
34856
- const tagValue = conversationTags[tagName];
34857
- if (!tagValue) {
34858
- return false;
34859
- }
34860
- return tagValue === "*" || tagValue === triggerKey;
34861
- };
34862
- }
34863
- });
34864
-
34865
34824
  // src/types.ts
34866
34825
  var init_types2 = __esm({
34867
34826
  "src/types.ts"() {
@@ -35201,7 +35160,6 @@ var init_runtime = __esm({
35201
35160
  init_structured_logging();
35202
35161
  init_environment();
35203
35162
  init_runtime2();
35204
- init_trigger_tags();
35205
35163
  init_types2();
35206
35164
  init_errors();
35207
35165
  init_state();
@@ -38274,38 +38232,6 @@ var init_conversation_instance = __esm({
38274
38232
  });
38275
38233
  }
38276
38234
  }
38277
- /**
38278
- * Subscribe to a trigger
38279
- */
38280
- async subscribeToTrigger(triggerName, key) {
38281
- const { getTriggerSubscriptionTags: getTriggerSubscriptionTags2, isConversationSubscribedToTrigger: isConversationSubscribedToTrigger2 } = await Promise.resolve().then(() => (init_trigger_tags(), trigger_tags_exports));
38282
- if (isConversationSubscribedToTrigger2(this.tags, triggerName, key)) {
38283
- return;
38284
- }
38285
- const { name, value } = getTriggerSubscriptionTags2(triggerName, key);
38286
- await this.client.updateConversation({
38287
- id: this.id,
38288
- tags: {
38289
- [name]: value
38290
- }
38291
- });
38292
- }
38293
- /**
38294
- * Unsubscribe from a trigger
38295
- */
38296
- async unsubscribeFromTrigger(triggerName, key) {
38297
- const { getTriggerSubscriptionTags: getTriggerSubscriptionTags2, isConversationSubscribedToTrigger: isConversationSubscribedToTrigger2 } = await Promise.resolve().then(() => (init_trigger_tags(), trigger_tags_exports));
38298
- if (!isConversationSubscribedToTrigger2(this.tags, triggerName, key)) {
38299
- return;
38300
- }
38301
- const { name } = getTriggerSubscriptionTags2(triggerName, key);
38302
- await this.client.updateConversation({
38303
- id: this.id,
38304
- tags: {
38305
- [name]: ""
38306
- }
38307
- });
38308
- }
38309
38235
  };
38310
38236
  }
38311
38237
  });
@@ -38341,19 +38267,11 @@ var init_conversation = __esm({
38341
38267
  /** @internal */
38342
38268
  schema;
38343
38269
  #handler;
38344
- #startFromTrigger;
38345
38270
  constructor(props) {
38346
38271
  this.channel = props.channel;
38347
38272
  this.events = props.events ?? [];
38348
38273
  this.schema = props.state ?? z19.object({}).passthrough();
38349
38274
  this.#handler = props.handler;
38350
- if (props.startFromTrigger) {
38351
- this.#startFromTrigger = props.startFromTrigger;
38352
- }
38353
- }
38354
- /** @internal */
38355
- get startFromTrigger() {
38356
- return this.#startFromTrigger;
38357
38275
  }
38358
38276
  /** @internal */
38359
38277
  getDefinition() {
@@ -40773,7 +40691,7 @@ var init_source_website = __esm({
40773
40691
  type: "website",
40774
40692
  state: State,
40775
40693
  async handler({ input, step: step2, state, client: client2 }) {
40776
- const crypto3 = await import("crypto");
40694
+ const crypto2 = await import("crypto");
40777
40695
  console.log(
40778
40696
  `Starting sync for WebsiteSource [${this.id}] in mode [${this.mode}, maxPages=${this.maxPages}, maxDepth=${this.maxDepth}, baseUrl=${this.baseUrl}, sitemapUrl=${this.sitemapUrl}]`
40779
40697
  );
@@ -40855,7 +40773,7 @@ var init_source_website = __esm({
40855
40773
  content,
40856
40774
  metadata: fetchMetadata
40857
40775
  } = await this.fetchUrl(sitemapUrl.loc);
40858
- const hash = crypto3.createHash("sha256").update(content).digest("hex");
40776
+ const hash = crypto2.createHash("sha256").update(content).digest("hex");
40859
40777
  let contentType = fetchedContentType;
40860
40778
  if (!contentType) {
40861
40779
  contentType = content.includes("<html") ? "text/html" : "text/markdown";
@@ -47852,7 +47770,7 @@ var init_source_directory = __esm({
47852
47770
  const glob2 = await Promise.resolve().then(() => (init_esm9(), esm_exports3));
47853
47771
  const path4 = await import("path");
47854
47772
  const fs3 = await import("fs/promises");
47855
- const crypto3 = await import("crypto");
47773
+ const crypto2 = await import("crypto");
47856
47774
  const directory = path4.resolve(adk.environment.agent.directory, this.directoryPath);
47857
47775
  const tags = {
47858
47776
  [WellKnownTags.knowledge.KNOWLEDGE]: "knowledge-base",
@@ -47914,7 +47832,7 @@ var init_source_directory = __esm({
47914
47832
  const upsertFile = async (local) => {
47915
47833
  const key = `data_source://${this.type}/${this.id}/${local.rel}`;
47916
47834
  const content = await fs3.readFile(local.abs);
47917
- const hash = crypto3.createHash("sha256").update(content).digest("hex");
47835
+ const hash = crypto2.createHash("sha256").update(content).digest("hex");
47918
47836
  const { file } = await client2.getFile({ id: key }).catch(() => ({ file: null }));
47919
47837
  if (!input.force && file?.metadata?.hash === hash) {
47920
47838
  console.log(`Skipping unchanged file: ${local.rel}`);
@@ -48203,7 +48121,7 @@ var init_table = __esm({
48203
48121
  }
48204
48122
  /** @internal */
48205
48123
  getDefinition() {
48206
- const schema = transforms3.toJSONSchema(this.schema);
48124
+ const schema = transforms3.toJSONSchemaLegacy(this.schema);
48207
48125
  for (const col of Object.keys(this.columns)) {
48208
48126
  if (this.computedColumns.has(col) || this.nullableColumns.has(col)) {
48209
48127
  if ("properties" in schema && schema.properties && col in schema.properties && typeof schema.properties[col] === "object" && schema.properties[col] !== null) {