@botpress/runtime 1.1.0 → 1.2.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/define-config.d.ts +1 -1
- package/dist/define-config.d.ts.map +1 -1
- package/dist/internal.js +92 -46
- package/dist/internal.js.map +3 -3
- package/dist/library.d.ts +1 -1
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +4412 -4412
- package/dist/library.js.map +4 -4
- package/dist/primitives/conversation.d.ts +1 -1
- package/dist/primitives/conversation.d.ts.map +1 -1
- package/dist/primitives/workflow.d.ts +2 -1
- package/dist/primitives/workflow.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +14 -27
- package/dist/runtime.js.map +1 -1
- package/dist/workers/dev_worker.d.ts.map +1 -1
- package/dist/workers/parent_worker.d.ts +5 -0
- package/dist/workers/parent_worker.d.ts.map +1 -1
- package/dist/workers/worker_pool.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/define-config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Autonomous } from "./runtime";
|
|
1
|
+
import { Autonomous } from "./runtime/autonomous";
|
|
2
2
|
import { z } from "@botpress/sdk";
|
|
3
3
|
declare const configSchema: import("@bpinternal/zui").ZodObject<{
|
|
4
4
|
name: import("@bpinternal/zui").ZodOptional<import("@bpinternal/zui").ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAW,MAAM,eAAe,CAAC;AA0B3C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBhB,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,GAAG;IACxD,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAIF,eAAO,MAAM,YAAY,GAAI,SAAQ,gBAAqB,KAAG,WAO5D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAOvD,CAAC"}
|
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.2.0", adk: "not-installed", sdk: "4.16.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -40395,16 +40395,16 @@ var WellKnownMetadata = {
|
|
|
40395
40395
|
// src/runtime/autonomous.ts
|
|
40396
40396
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
|
40397
40397
|
var Autonomous;
|
|
40398
|
-
((
|
|
40399
|
-
|
|
40400
|
-
|
|
40401
|
-
|
|
40402
|
-
|
|
40403
|
-
|
|
40404
|
-
|
|
40405
|
-
|
|
40406
|
-
|
|
40407
|
-
|
|
40398
|
+
((Autonomous2) => {
|
|
40399
|
+
Autonomous2.Tool = LlmzTool;
|
|
40400
|
+
Autonomous2.Exit = LlmzExit;
|
|
40401
|
+
Autonomous2.Object = LlmzObject;
|
|
40402
|
+
Autonomous2.ThinkSignal = _ThinkSignal;
|
|
40403
|
+
Autonomous2.SnapshotSignal = _SnapshotSignal;
|
|
40404
|
+
Autonomous2.CitationsManager = _CitationsManager;
|
|
40405
|
+
Autonomous2.ListenExit = _ListenExit;
|
|
40406
|
+
Autonomous2.ThinkExit = _ThinkExit;
|
|
40407
|
+
Autonomous2.DefaultExit = _DefaultExit;
|
|
40408
40408
|
function createKnowledgeSearchTool(knowledgeBases) {
|
|
40409
40409
|
const kbNames = knowledgeBases.map((kb) => kb.name);
|
|
40410
40410
|
const description = knowledgeBases.map((kb) => `- "${kb.name}": ${kb.description || "No description"}`).join("\n");
|
|
@@ -40437,7 +40437,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
40437
40437
|
}
|
|
40438
40438
|
});
|
|
40439
40439
|
if (!passages.length) {
|
|
40440
|
-
throw new
|
|
40440
|
+
throw new Autonomous2.ThinkSignal(
|
|
40441
40441
|
"No results were found",
|
|
40442
40442
|
"No results were found in the knowledge bases. You can try rephrasing your question or asking something else. Do NOT answer the question as no results were found."
|
|
40443
40443
|
);
|
|
@@ -40479,7 +40479,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
40479
40479
|
message.push(p.content);
|
|
40480
40480
|
message.push(`</${tag}>`);
|
|
40481
40481
|
}
|
|
40482
|
-
throw new
|
|
40482
|
+
throw new Autonomous2.ThinkSignal(
|
|
40483
40483
|
`We got the search results. When answering the question, you MUST add inline the citations used (eg: "Yes, the price is $10${example} ...")`,
|
|
40484
40484
|
message.join("\n").trim()
|
|
40485
40485
|
);
|
|
@@ -40718,7 +40718,7 @@ ${iteration.status.execution_error.stack}`;
|
|
|
40718
40718
|
);
|
|
40719
40719
|
};
|
|
40720
40720
|
}
|
|
40721
|
-
|
|
40721
|
+
Autonomous2.createExecute = createExecute;
|
|
40722
40722
|
})(Autonomous || (Autonomous = {}));
|
|
40723
40723
|
|
|
40724
40724
|
// src/runtime/actions.ts
|
|
@@ -45834,6 +45834,12 @@ init_define_BUILD();
|
|
|
45834
45834
|
init_define_PACKAGE_VERSIONS();
|
|
45835
45835
|
import { Worker } from "worker_threads";
|
|
45836
45836
|
import path4 from "path";
|
|
45837
|
+
var DEBUG_ENABLED = process.env.BP_DEBUG === "true" || process.env.BP_DEBUG === "1";
|
|
45838
|
+
function debugLog(...args) {
|
|
45839
|
+
if (DEBUG_ENABLED) {
|
|
45840
|
+
console.log(...args);
|
|
45841
|
+
}
|
|
45842
|
+
}
|
|
45837
45843
|
var WORKER_POOL_SIZE = 10;
|
|
45838
45844
|
var WORKER_LIFETIME_MS = process.env.WORKER_LIFETIME_MS ? Math.max(parseInt(process.env.WORKER_LIFETIME_MS, 10), 1 * 60 * 1e3) : 5 * 60 * 1e3;
|
|
45839
45845
|
var WORKER_MIN_LIFETIME_MS = 30 * 1e3;
|
|
@@ -45865,7 +45871,7 @@ var WorkerPool = class {
|
|
|
45865
45871
|
};
|
|
45866
45872
|
constructor(workerScript) {
|
|
45867
45873
|
this.workerScript = workerScript || path4.join(process.cwd(), ".botpress/dist/index.cjs");
|
|
45868
|
-
|
|
45874
|
+
debugLog(
|
|
45869
45875
|
"[WorkerPool] Initializing...",
|
|
45870
45876
|
this.workerScript,
|
|
45871
45877
|
process.cwd()
|
|
@@ -45876,7 +45882,7 @@ var WorkerPool = class {
|
|
|
45876
45882
|
* Initialize the worker pool with the configured number of workers
|
|
45877
45883
|
*/
|
|
45878
45884
|
initialize() {
|
|
45879
|
-
|
|
45885
|
+
debugLog(
|
|
45880
45886
|
`[WorkerPool] Initializing pool with ${WORKER_POOL_SIZE} workers`
|
|
45881
45887
|
);
|
|
45882
45888
|
for (let i = 0; i < WORKER_POOL_SIZE; i++) {
|
|
@@ -45891,7 +45897,7 @@ var WorkerPool = class {
|
|
|
45891
45897
|
this.expiryCheckInterval = setInterval(() => {
|
|
45892
45898
|
this.checkWorkerExpiry();
|
|
45893
45899
|
}, WORKER_EXPIRY_CHECK_INTERVAL_MS);
|
|
45894
|
-
|
|
45900
|
+
debugLog(
|
|
45895
45901
|
`[WorkerPool] Started expiry check (interval: ${WORKER_EXPIRY_CHECK_INTERVAL_MS}ms, threshold: ${WORKER_MIN_LIFETIME_MS}ms)`
|
|
45896
45902
|
);
|
|
45897
45903
|
}
|
|
@@ -45906,7 +45912,7 @@ var WorkerPool = class {
|
|
|
45906
45912
|
}
|
|
45907
45913
|
const timeRemaining = workerInfo.expiryTime - now;
|
|
45908
45914
|
if (timeRemaining <= WORKER_MIN_LIFETIME_MS) {
|
|
45909
|
-
|
|
45915
|
+
debugLog(
|
|
45910
45916
|
`[WorkerPool] Proactively replacing worker ${workerId} (${Math.floor(timeRemaining / 1e3)}s remaining)`
|
|
45911
45917
|
);
|
|
45912
45918
|
this.replaceWorker(workerId);
|
|
@@ -45920,7 +45926,7 @@ var WorkerPool = class {
|
|
|
45920
45926
|
const workerId = this.nextWorkerId++;
|
|
45921
45927
|
const startTime = Date.now();
|
|
45922
45928
|
const expiryTime = startTime + WORKER_LIFETIME_MS;
|
|
45923
|
-
|
|
45929
|
+
debugLog(
|
|
45924
45930
|
`[WorkerPool] Creating worker ${workerId} (expires at ${new Date(expiryTime).toISOString()})`
|
|
45925
45931
|
);
|
|
45926
45932
|
const worker = new Worker(this.workerScript, {
|
|
@@ -45947,10 +45953,10 @@ var WorkerPool = class {
|
|
|
45947
45953
|
this.handleWorkerCrash(workerId, error);
|
|
45948
45954
|
});
|
|
45949
45955
|
worker.on("exit", (code) => {
|
|
45950
|
-
|
|
45956
|
+
debugLog(`[WorkerPool] Worker ${workerId} exited with code ${code}`);
|
|
45951
45957
|
const info = this.workers.get(workerId);
|
|
45952
45958
|
if (info && info.status !== "terminated") {
|
|
45953
|
-
|
|
45959
|
+
debugLog(
|
|
45954
45960
|
`[WorkerPool] Worker ${workerId} died unexpectedly, respawning...`
|
|
45955
45961
|
);
|
|
45956
45962
|
this.handleWorkerCrash(workerId);
|
|
@@ -45984,11 +45990,11 @@ var WorkerPool = class {
|
|
|
45984
45990
|
console.debug(prefix, ...args);
|
|
45985
45991
|
break;
|
|
45986
45992
|
default:
|
|
45987
|
-
|
|
45993
|
+
debugLog(prefix, ...args);
|
|
45988
45994
|
}
|
|
45989
45995
|
break;
|
|
45990
45996
|
case "ack":
|
|
45991
|
-
|
|
45997
|
+
debugLog(
|
|
45992
45998
|
`[WorkerPool] Worker ${workerId} acknowledged task ${message.taskId}`
|
|
45993
45999
|
);
|
|
45994
46000
|
const pendingAck = this.pendingTasks.get(message.taskId);
|
|
@@ -46004,7 +46010,7 @@ var WorkerPool = class {
|
|
|
46004
46010
|
}
|
|
46005
46011
|
break;
|
|
46006
46012
|
case "complete":
|
|
46007
|
-
|
|
46013
|
+
debugLog(
|
|
46008
46014
|
`[WorkerPool] Worker ${workerId} completed task ${message.taskId}`
|
|
46009
46015
|
);
|
|
46010
46016
|
workerInfo.status = "idle";
|
|
@@ -46066,7 +46072,7 @@ var WorkerPool = class {
|
|
|
46066
46072
|
}
|
|
46067
46073
|
}
|
|
46068
46074
|
this.workers.delete(workerId);
|
|
46069
|
-
|
|
46075
|
+
debugLog(`[WorkerPool] Spawning replacement worker for ${workerId}`);
|
|
46070
46076
|
this.createWorker();
|
|
46071
46077
|
}
|
|
46072
46078
|
/**
|
|
@@ -46088,7 +46094,7 @@ var WorkerPool = class {
|
|
|
46088
46094
|
if (workerInfo.status === "idle") {
|
|
46089
46095
|
const timeRemaining = workerInfo.expiryTime - Date.now();
|
|
46090
46096
|
if (timeRemaining < WORKER_MIN_LIFETIME_MS) {
|
|
46091
|
-
|
|
46097
|
+
debugLog(
|
|
46092
46098
|
`[WorkerPool] Worker ${workerId} has ${timeRemaining}ms remaining, replacing...`
|
|
46093
46099
|
);
|
|
46094
46100
|
this.replaceWorker(workerId);
|
|
@@ -46107,7 +46113,7 @@ var WorkerPool = class {
|
|
|
46107
46113
|
replaceWorker(workerId) {
|
|
46108
46114
|
const workerInfo = this.workers.get(workerId);
|
|
46109
46115
|
if (!workerInfo) return;
|
|
46110
|
-
|
|
46116
|
+
debugLog(`[WorkerPool] Replacing worker ${workerId}`);
|
|
46111
46117
|
workerInfo.status = "terminated";
|
|
46112
46118
|
this.workers.delete(workerId);
|
|
46113
46119
|
workerInfo.worker.terminate().catch((err) => {
|
|
@@ -46133,7 +46139,7 @@ var WorkerPool = class {
|
|
|
46133
46139
|
}
|
|
46134
46140
|
const queueTime = Date.now() - queued.queuedAt;
|
|
46135
46141
|
this.stats.queueTimes.push(queueTime);
|
|
46136
|
-
|
|
46142
|
+
debugLog(
|
|
46137
46143
|
`[WorkerPool] Dequeued task ${queued.taskId} (waited ${queueTime}ms, ${this.requestQueue.length} remaining in queue)`
|
|
46138
46144
|
);
|
|
46139
46145
|
this.dispatchToWorker(
|
|
@@ -46149,7 +46155,7 @@ var WorkerPool = class {
|
|
|
46149
46155
|
* Dispatch a task to a specific worker
|
|
46150
46156
|
*/
|
|
46151
46157
|
dispatchToWorker(workerId, workerInfo, taskId, event, resolve, reject) {
|
|
46152
|
-
|
|
46158
|
+
debugLog(`[WorkerPool] Assigning task ${taskId} to worker ${workerId}`);
|
|
46153
46159
|
const timing = this.taskTimings.get(taskId);
|
|
46154
46160
|
if (timing) {
|
|
46155
46161
|
timing.dispatchedAt = Date.now();
|
|
@@ -46212,7 +46218,7 @@ var WorkerPool = class {
|
|
|
46212
46218
|
reject
|
|
46213
46219
|
);
|
|
46214
46220
|
} else {
|
|
46215
|
-
|
|
46221
|
+
debugLog(
|
|
46216
46222
|
`[WorkerPool] All workers busy, queueing task ${taskId} (queue size: ${this.requestQueue.length})`
|
|
46217
46223
|
);
|
|
46218
46224
|
timing.queuedAt = Date.now();
|
|
@@ -46246,7 +46252,7 @@ var WorkerPool = class {
|
|
|
46246
46252
|
* Shutdown the worker pool
|
|
46247
46253
|
*/
|
|
46248
46254
|
async shutdown() {
|
|
46249
|
-
|
|
46255
|
+
debugLog(`[WorkerPool] Shutting down pool...`);
|
|
46250
46256
|
if (this.expiryCheckInterval) {
|
|
46251
46257
|
clearInterval(this.expiryCheckInterval);
|
|
46252
46258
|
this.expiryCheckInterval = void 0;
|
|
@@ -46260,7 +46266,7 @@ var WorkerPool = class {
|
|
|
46260
46266
|
this.requestQueue = [];
|
|
46261
46267
|
const terminationPromises = Array.from(this.workers.entries()).map(
|
|
46262
46268
|
([workerId, info]) => {
|
|
46263
|
-
|
|
46269
|
+
debugLog(`[WorkerPool] Terminating worker ${workerId}`);
|
|
46264
46270
|
info.status = "terminated";
|
|
46265
46271
|
return info.worker.terminate();
|
|
46266
46272
|
}
|
|
@@ -46269,7 +46275,7 @@ var WorkerPool = class {
|
|
|
46269
46275
|
this.workers.clear();
|
|
46270
46276
|
this.pendingTasks.clear();
|
|
46271
46277
|
this.taskTimings.clear();
|
|
46272
|
-
|
|
46278
|
+
debugLog(`[WorkerPool] Pool shutdown complete`);
|
|
46273
46279
|
}
|
|
46274
46280
|
/**
|
|
46275
46281
|
* Get basic pool statistics (worker status)
|
|
@@ -46379,35 +46385,72 @@ var WorkerPool = class {
|
|
|
46379
46385
|
};
|
|
46380
46386
|
|
|
46381
46387
|
// src/workers/parent_worker.ts
|
|
46388
|
+
var DEBUG_ENABLED2 = process.env.BP_DEBUG === "true" || process.env.BP_DEBUG === "1";
|
|
46389
|
+
function debugLog2(...args) {
|
|
46390
|
+
if (DEBUG_ENABLED2) {
|
|
46391
|
+
console.log(...args);
|
|
46392
|
+
}
|
|
46393
|
+
}
|
|
46394
|
+
var globalWorkerPool = null;
|
|
46382
46395
|
function initializeParentWorker(bot2) {
|
|
46383
|
-
|
|
46396
|
+
debugLog2("[Main] Initializing bot with worker pool...");
|
|
46384
46397
|
const pool = new WorkerPool();
|
|
46398
|
+
globalWorkerPool = pool;
|
|
46385
46399
|
bot2.handler = async (event) => {
|
|
46386
|
-
|
|
46400
|
+
debugLog2(
|
|
46401
|
+
"[Main] Received event, delegating to worker pool:",
|
|
46402
|
+
event.type || "unknown"
|
|
46403
|
+
);
|
|
46387
46404
|
const workerStats = pool.getWorkerStats();
|
|
46388
|
-
|
|
46405
|
+
debugLog2(
|
|
46406
|
+
`[Main] Pool stats - Total: ${workerStats.total}, Idle: ${workerStats.idle}, Busy: ${workerStats.busy}`
|
|
46407
|
+
);
|
|
46389
46408
|
try {
|
|
46390
46409
|
await pool.executeTask(event);
|
|
46391
|
-
|
|
46410
|
+
debugLog2("[Main] Event processed successfully by worker");
|
|
46392
46411
|
} catch (error) {
|
|
46393
46412
|
console.error("[Main] Error processing event:", error);
|
|
46394
46413
|
throw error;
|
|
46395
46414
|
}
|
|
46396
46415
|
};
|
|
46397
46416
|
const shutdown = async () => {
|
|
46398
|
-
|
|
46417
|
+
debugLog2("[Main] Shutting down...");
|
|
46399
46418
|
await pool.shutdown();
|
|
46400
46419
|
process.exit(0);
|
|
46401
46420
|
};
|
|
46402
46421
|
process.on("SIGINT", shutdown);
|
|
46403
46422
|
process.on("SIGTERM", shutdown);
|
|
46404
|
-
|
|
46423
|
+
debugLog2("[Main] Bot initialized with worker pool");
|
|
46424
|
+
setInterval(() => {
|
|
46425
|
+
const stats = pool.getWorkerStats();
|
|
46426
|
+
const detailedStats = pool.getStats();
|
|
46427
|
+
console.log(
|
|
46428
|
+
JSON.stringify({
|
|
46429
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
46430
|
+
type: "worker_stats",
|
|
46431
|
+
stats: {
|
|
46432
|
+
total: stats.total,
|
|
46433
|
+
idle: stats.idle,
|
|
46434
|
+
busy: stats.busy,
|
|
46435
|
+
terminated: stats.terminated,
|
|
46436
|
+
queueSize: detailedStats.currentQueueSize
|
|
46437
|
+
}
|
|
46438
|
+
})
|
|
46439
|
+
);
|
|
46440
|
+
}, 2e3);
|
|
46405
46441
|
}
|
|
46406
46442
|
|
|
46407
46443
|
// src/workers/dev_worker.ts
|
|
46408
46444
|
init_define_BUILD();
|
|
46409
46445
|
init_define_PACKAGE_VERSIONS();
|
|
46410
46446
|
import { parentPort } from "worker_threads";
|
|
46447
|
+
var DEBUG_ENABLED3 = process.env.BP_DEBUG === "true" || process.env.BP_DEBUG === "1";
|
|
46448
|
+
var originalLog = console.log;
|
|
46449
|
+
function debugLog3(...args) {
|
|
46450
|
+
if (DEBUG_ENABLED3) {
|
|
46451
|
+
originalLog(...args);
|
|
46452
|
+
}
|
|
46453
|
+
}
|
|
46411
46454
|
function setupLogRelay() {
|
|
46412
46455
|
if (!parentPort) return;
|
|
46413
46456
|
const originalConsole = {
|
|
@@ -46417,6 +46460,7 @@ function setupLogRelay() {
|
|
|
46417
46460
|
error: console.error,
|
|
46418
46461
|
debug: console.debug
|
|
46419
46462
|
};
|
|
46463
|
+
originalLog = originalConsole.log;
|
|
46420
46464
|
const createLogRelay = (level) => {
|
|
46421
46465
|
return (...args) => {
|
|
46422
46466
|
parentPort.postMessage({
|
|
@@ -46424,7 +46468,9 @@ function setupLogRelay() {
|
|
|
46424
46468
|
level,
|
|
46425
46469
|
args
|
|
46426
46470
|
});
|
|
46427
|
-
|
|
46471
|
+
if (DEBUG_ENABLED3) {
|
|
46472
|
+
originalConsole[level](...args);
|
|
46473
|
+
}
|
|
46428
46474
|
};
|
|
46429
46475
|
};
|
|
46430
46476
|
console.log = createLogRelay("log");
|
|
@@ -46445,15 +46491,15 @@ function runWorker(bot2) {
|
|
|
46445
46491
|
console.error(`Invalid message received:`, message);
|
|
46446
46492
|
return;
|
|
46447
46493
|
}
|
|
46448
|
-
|
|
46494
|
+
debugLog3(`[Worker] Received task ${taskId}`);
|
|
46449
46495
|
try {
|
|
46450
46496
|
parentPort.postMessage({
|
|
46451
46497
|
type: "ack",
|
|
46452
46498
|
taskId
|
|
46453
46499
|
});
|
|
46454
|
-
|
|
46500
|
+
debugLog3(`[Worker] Processing event for task ${taskId}...`);
|
|
46455
46501
|
await bot2.handler(event);
|
|
46456
|
-
|
|
46502
|
+
debugLog3(`[Worker] Task ${taskId} completed successfully`);
|
|
46457
46503
|
parentPort.postMessage({
|
|
46458
46504
|
type: "complete",
|
|
46459
46505
|
taskId
|
|
@@ -46470,7 +46516,7 @@ function runWorker(bot2) {
|
|
|
46470
46516
|
const checkInterval = setInterval(() => {
|
|
46471
46517
|
const timeRemaining = expiryTime - Date.now();
|
|
46472
46518
|
if (timeRemaining <= 0) {
|
|
46473
|
-
|
|
46519
|
+
debugLog3(`[Worker] Lifetime expired, shutting down...`);
|
|
46474
46520
|
clearInterval(checkInterval);
|
|
46475
46521
|
clearInterval(logInterval);
|
|
46476
46522
|
process.exit(0);
|
|
@@ -46483,13 +46529,13 @@ function runWorker(bot2) {
|
|
|
46483
46529
|
}
|
|
46484
46530
|
const minutes = Math.floor(timeRemaining / 6e4);
|
|
46485
46531
|
const seconds = Math.floor(timeRemaining % 6e4 / 1e3);
|
|
46486
|
-
|
|
46532
|
+
debugLog3(`[Worker] Time remaining: ${minutes}m ${seconds}s`);
|
|
46487
46533
|
}, 3e4);
|
|
46488
46534
|
process.on("exit", () => {
|
|
46489
46535
|
clearInterval(checkInterval);
|
|
46490
46536
|
clearInterval(logInterval);
|
|
46491
46537
|
});
|
|
46492
|
-
|
|
46538
|
+
debugLog3(`[Worker] Ready to process tasks`);
|
|
46493
46539
|
}
|
|
46494
46540
|
|
|
46495
46541
|
// src/workers/index.ts
|