@danhachuel/thunderbolt 0.5.65 → 0.5.67
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/package.json +1 -1
- package/scripts/cli.mjs +24 -16
package/package.json
CHANGED
package/scripts/cli.mjs
CHANGED
|
@@ -67,6 +67,21 @@ function configuredMoneyPrinterPath() {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
function readStateJson(filename, fallback = []) {
|
|
71
|
+
try { return JSON.parse(readFileSync(join(thunderboltHome, "storage", "state", filename), "utf8")); }
|
|
72
|
+
catch { return fallback; }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function hasScheduledAutomation() {
|
|
76
|
+
const channels = readStateJson("channels.json", []);
|
|
77
|
+
return Array.isArray(channels) && channels.some((channel) => channel && channel.automation_on === true);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function hasPendingPipelineWork() {
|
|
81
|
+
const tasks = readStateJson("tasks.json", []);
|
|
82
|
+
return Array.isArray(tasks) && tasks.some((task) => ["queued", "pending", "processing", "running", "in_progress"].includes(String(task?.state || task?.status || "").toLowerCase()));
|
|
83
|
+
}
|
|
84
|
+
|
|
70
85
|
function ensureRuntimeStorage() {
|
|
71
86
|
const storageRoot = process.env.THUNDERBOLT_STORAGE_DIR || join(thunderboltHome, "storage");
|
|
72
87
|
const directories = [
|
|
@@ -261,18 +276,11 @@ proxy.on("error", (error) => {
|
|
|
261
276
|
proxy.listen(publicPort, "127.0.0.1", () => {
|
|
262
277
|
console.log(`Thunderbolt: interface disponível em http://localhost:${publicPort}/`);
|
|
263
278
|
});
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
270
|
-
const pipelineWorker = spawn(python, ["-m", "hermes_ui.pipeline_worker"], {
|
|
271
|
-
cwd: root,
|
|
272
|
-
stdio: "inherit",
|
|
273
|
-
env: runtimeEnv,
|
|
274
|
-
windowsHide: false,
|
|
275
|
-
});
|
|
279
|
+
// Workers contínuos só devem ser iniciados explicitamente com `worker` ou
|
|
280
|
+
// `pipeline-worker`; o arranque normal da interface não cria processos Python
|
|
281
|
+
// em background nem faz polling periódico.
|
|
282
|
+
const worker = null;
|
|
283
|
+
const pipelineWorker = null;
|
|
276
284
|
const restartExitCode = 75;
|
|
277
285
|
let shuttingDown = false;
|
|
278
286
|
let child;
|
|
@@ -315,10 +323,10 @@ startStreamlit();
|
|
|
315
323
|
const stopWorker = () => {
|
|
316
324
|
shuttingDown = true;
|
|
317
325
|
proxy.close();
|
|
318
|
-
if (!worker.killed) worker.kill();
|
|
319
|
-
if (!pipelineWorker.killed) pipelineWorker.kill();
|
|
326
|
+
if (worker && !worker.killed) worker.kill();
|
|
327
|
+
if (pipelineWorker && !pipelineWorker.killed) pipelineWorker.kill();
|
|
320
328
|
};
|
|
321
329
|
process.on("SIGINT", stopWorker);
|
|
322
330
|
process.on("SIGTERM", stopWorker);
|
|
323
|
-
worker
|
|
324
|
-
pipelineWorker
|
|
331
|
+
worker?.on("error", (error) => console.error(`Thunderbolt worker: ${error.message}`));
|
|
332
|
+
pipelineWorker?.on("error", (error) => console.error(`Thunderbolt pipeline worker: ${error.message}`));
|