@botpress/runtime 1.13.18 → 1.14.0
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 +1 -1
- package/dist/definition.js.map +2 -2
- package/dist/internal.js +12 -3
- package/dist/internal.js.map +2 -2
- package/dist/library.js +1 -1
- package/dist/library.js.map +2 -2
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +2 -2
- package/dist/workers/parent_worker.d.ts.map +1 -1
- package/dist/workers/worker_pool.d.ts +1 -0
- package/dist/workers/worker_pool.d.ts.map +1 -1
- 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.
|
|
51
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.14.0", adk: "1.14.0", sdk: "5.0.2", llmz: "0.0.37", zai: "2.5.6", cognitive: "0.3.3" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -49460,6 +49460,7 @@ var WORKER_TASK_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
|
49460
49460
|
var WORKER_EXPIRY_CHECK_INTERVAL_MS = 10 * 1e3;
|
|
49461
49461
|
var QUEUE_TIMEOUT_MS = 30 * 1e3;
|
|
49462
49462
|
var WorkerPool = class {
|
|
49463
|
+
MAX_STATS_SIZE = 1e3;
|
|
49463
49464
|
workers = /* @__PURE__ */ new Map();
|
|
49464
49465
|
roundRobinIndex = 0;
|
|
49465
49466
|
nextWorkerId = 0;
|
|
@@ -49610,6 +49611,7 @@ var WorkerPool = class {
|
|
|
49610
49611
|
timing.ackedAt = Date.now();
|
|
49611
49612
|
const ackTime = timing.ackedAt - timing.dispatchedAt;
|
|
49612
49613
|
this.stats.ackTimes.push(ackTime);
|
|
49614
|
+
if (this.stats.ackTimes.length > this.MAX_STATS_SIZE) this.stats.ackTimes.shift();
|
|
49613
49615
|
}
|
|
49614
49616
|
break;
|
|
49615
49617
|
case "complete":
|
|
@@ -49629,6 +49631,7 @@ var WorkerPool = class {
|
|
|
49629
49631
|
if (completeTiming.dispatchedAt) {
|
|
49630
49632
|
const processingTime = completeTiming.completedAt - completeTiming.dispatchedAt;
|
|
49631
49633
|
this.stats.processingTimes.push(processingTime);
|
|
49634
|
+
if (this.stats.processingTimes.length > this.MAX_STATS_SIZE) this.stats.processingTimes.shift();
|
|
49632
49635
|
}
|
|
49633
49636
|
this.taskTimings.delete(message.taskId);
|
|
49634
49637
|
}
|
|
@@ -49735,6 +49738,7 @@ var WorkerPool = class {
|
|
|
49735
49738
|
}
|
|
49736
49739
|
const queueTime = Date.now() - queued.queuedAt;
|
|
49737
49740
|
this.stats.queueTimes.push(queueTime);
|
|
49741
|
+
if (this.stats.queueTimes.length > this.MAX_STATS_SIZE) this.stats.queueTimes.shift();
|
|
49738
49742
|
debugLog(
|
|
49739
49743
|
`[WorkerPool] Dequeued task ${queued.taskId} (waited ${queueTime}ms, ${this.requestQueue.length} remaining in queue)`
|
|
49740
49744
|
);
|
|
@@ -49988,15 +49992,20 @@ function initializeParentWorker(bot2) {
|
|
|
49988
49992
|
throw error;
|
|
49989
49993
|
}
|
|
49990
49994
|
};
|
|
49995
|
+
let statsInterval = null;
|
|
49991
49996
|
const shutdown = async () => {
|
|
49992
49997
|
debugLog2("[Main] Shutting down...");
|
|
49998
|
+
if (statsInterval) {
|
|
49999
|
+
clearInterval(statsInterval);
|
|
50000
|
+
statsInterval = null;
|
|
50001
|
+
}
|
|
49993
50002
|
await pool.shutdown();
|
|
49994
50003
|
process.exit(0);
|
|
49995
50004
|
};
|
|
49996
50005
|
process.on("SIGINT", shutdown);
|
|
49997
50006
|
process.on("SIGTERM", shutdown);
|
|
49998
50007
|
debugLog2("[Main] Bot initialized with worker pool");
|
|
49999
|
-
setInterval(() => {
|
|
50008
|
+
statsInterval = setInterval(() => {
|
|
50000
50009
|
const stats = pool.getWorkerStats();
|
|
50001
50010
|
const detailedStats = pool.getStats();
|
|
50002
50011
|
console.log(
|
|
@@ -50012,7 +50021,7 @@ function initializeParentWorker(bot2) {
|
|
|
50012
50021
|
}
|
|
50013
50022
|
})
|
|
50014
50023
|
);
|
|
50015
|
-
},
|
|
50024
|
+
}, 5e3);
|
|
50016
50025
|
}
|
|
50017
50026
|
|
|
50018
50027
|
// src/workers/dev_worker.ts
|