@botpress/runtime 1.13.17 → 1.13.19

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/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.17", adk: "1.13.17", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.13.19", adk: "1.13.19", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
52
52
  }
53
53
  });
54
54
 
@@ -38635,6 +38635,7 @@ var init_library = __esm({
38635
38635
  init_define_PACKAGE_VERSIONS();
38636
38636
  init_runtime2();
38637
38637
  init_client();
38638
+ init_constants();
38638
38639
  init_primitives();
38639
38640
  init_chat2();
38640
38641
  init_workflow_utils();
@@ -49414,6 +49415,7 @@ var init_primitives = __esm({
49414
49415
  DataSource3.isDirectory = isDirectorySource;
49415
49416
  DataSource3.isWebsite = isWebsiteSource;
49416
49417
  DataSource3.isTable = isTableSource;
49418
+ DataSource3.Base = DataSource;
49417
49419
  })(DataSource2 || (DataSource2 = {}));
49418
49420
  }
49419
49421
  });
@@ -49458,6 +49460,7 @@ var WORKER_TASK_TIMEOUT_MS = 2 * 60 * 1e3;
49458
49460
  var WORKER_EXPIRY_CHECK_INTERVAL_MS = 10 * 1e3;
49459
49461
  var QUEUE_TIMEOUT_MS = 30 * 1e3;
49460
49462
  var WorkerPool = class {
49463
+ MAX_STATS_SIZE = 1e3;
49461
49464
  workers = /* @__PURE__ */ new Map();
49462
49465
  roundRobinIndex = 0;
49463
49466
  nextWorkerId = 0;
@@ -49608,6 +49611,7 @@ var WorkerPool = class {
49608
49611
  timing.ackedAt = Date.now();
49609
49612
  const ackTime = timing.ackedAt - timing.dispatchedAt;
49610
49613
  this.stats.ackTimes.push(ackTime);
49614
+ if (this.stats.ackTimes.length > this.MAX_STATS_SIZE) this.stats.ackTimes.shift();
49611
49615
  }
49612
49616
  break;
49613
49617
  case "complete":
@@ -49627,6 +49631,7 @@ var WorkerPool = class {
49627
49631
  if (completeTiming.dispatchedAt) {
49628
49632
  const processingTime = completeTiming.completedAt - completeTiming.dispatchedAt;
49629
49633
  this.stats.processingTimes.push(processingTime);
49634
+ if (this.stats.processingTimes.length > this.MAX_STATS_SIZE) this.stats.processingTimes.shift();
49630
49635
  }
49631
49636
  this.taskTimings.delete(message.taskId);
49632
49637
  }
@@ -49733,6 +49738,7 @@ var WorkerPool = class {
49733
49738
  }
49734
49739
  const queueTime = Date.now() - queued.queuedAt;
49735
49740
  this.stats.queueTimes.push(queueTime);
49741
+ if (this.stats.queueTimes.length > this.MAX_STATS_SIZE) this.stats.queueTimes.shift();
49736
49742
  debugLog(
49737
49743
  `[WorkerPool] Dequeued task ${queued.taskId} (waited ${queueTime}ms, ${this.requestQueue.length} remaining in queue)`
49738
49744
  );
@@ -49986,15 +49992,20 @@ function initializeParentWorker(bot2) {
49986
49992
  throw error;
49987
49993
  }
49988
49994
  };
49995
+ let statsInterval = null;
49989
49996
  const shutdown = async () => {
49990
49997
  debugLog2("[Main] Shutting down...");
49998
+ if (statsInterval) {
49999
+ clearInterval(statsInterval);
50000
+ statsInterval = null;
50001
+ }
49991
50002
  await pool.shutdown();
49992
50003
  process.exit(0);
49993
50004
  };
49994
50005
  process.on("SIGINT", shutdown);
49995
50006
  process.on("SIGTERM", shutdown);
49996
50007
  debugLog2("[Main] Bot initialized with worker pool");
49997
- setInterval(() => {
50008
+ statsInterval = setInterval(() => {
49998
50009
  const stats = pool.getWorkerStats();
49999
50010
  const detailedStats = pool.getStats();
50000
50011
  console.log(
@@ -50010,7 +50021,7 @@ function initializeParentWorker(bot2) {
50010
50021
  }
50011
50022
  })
50012
50023
  );
50013
- }, 500);
50024
+ }, 5e3);
50014
50025
  }
50015
50026
 
50016
50027
  // src/workers/dev_worker.ts