@miriad-systems/nuum 0.1.0 → 0.1.1
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/index.js +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24427,6 +24427,14 @@ function createWorkerStorage(db) {
|
|
|
24427
24427
|
completedAt: new Date().toISOString(),
|
|
24428
24428
|
error
|
|
24429
24429
|
}).where(eq(workers.id, id));
|
|
24430
|
+
},
|
|
24431
|
+
async failAllRunning(error) {
|
|
24432
|
+
const result = await db.update(workers).set({
|
|
24433
|
+
status: "failed",
|
|
24434
|
+
completedAt: new Date().toISOString(),
|
|
24435
|
+
error
|
|
24436
|
+
}).where(eq(workers.status, "running"));
|
|
24437
|
+
return result.changes;
|
|
24430
24438
|
}
|
|
24431
24439
|
};
|
|
24432
24440
|
}
|
|
@@ -24563,6 +24571,10 @@ function createStorageFromDb(db) {
|
|
|
24563
24571
|
_db: db
|
|
24564
24572
|
};
|
|
24565
24573
|
}
|
|
24574
|
+
async function cleanupStaleWorkers(storage) {
|
|
24575
|
+
const cleaned = await storage.workers.failAllRunning("Process terminated unexpectedly");
|
|
24576
|
+
return cleaned;
|
|
24577
|
+
}
|
|
24566
24578
|
async function initializeDefaultEntries(storage) {
|
|
24567
24579
|
const identity = await storage.ltm.read("identity");
|
|
24568
24580
|
if (!identity) {
|
|
@@ -46452,6 +46464,7 @@ async function runBatch(options) {
|
|
|
46452
46464
|
let storage;
|
|
46453
46465
|
try {
|
|
46454
46466
|
storage = createStorage(options.dbPath);
|
|
46467
|
+
await cleanupStaleWorkers(storage);
|
|
46455
46468
|
await initializeDefaultEntries(storage);
|
|
46456
46469
|
const statsBefore = await getMemoryStats(storage);
|
|
46457
46470
|
const presentBefore = await storage.present.get();
|
|
@@ -46913,6 +46926,7 @@ class Server {
|
|
|
46913
46926
|
this.storage = createStorage(options.dbPath);
|
|
46914
46927
|
}
|
|
46915
46928
|
async start() {
|
|
46929
|
+
await cleanupStaleWorkers(this.storage);
|
|
46916
46930
|
await initializeDefaultEntries(this.storage);
|
|
46917
46931
|
this.sessionId = await this.storage.session.getId();
|
|
46918
46932
|
await Mcp.initialize();
|
|
@@ -47178,6 +47192,7 @@ class ReplSession {
|
|
|
47178
47192
|
this.storage = createStorage(options.dbPath);
|
|
47179
47193
|
}
|
|
47180
47194
|
async start() {
|
|
47195
|
+
await cleanupStaleWorkers(this.storage);
|
|
47181
47196
|
await initializeDefaultEntries(this.storage);
|
|
47182
47197
|
this.loadHistory();
|
|
47183
47198
|
this.rl = readline2.createInterface({
|