@adhdev/daemon-core 0.9.77-rc.46 → 0.9.77-rc.48
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 +27 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -20
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-sync.d.ts +4 -12
- package/dist/mesh/mesh-work-queue.d.ts +8 -0
- package/dist/shared-types.d.ts +18 -0
- package/package.json +1 -1
- package/src/commands/router.ts +13 -2
- package/src/mesh/mesh-sync.ts +4 -34
- package/src/mesh/mesh-work-queue.ts +18 -0
- package/src/shared-types.ts +18 -0
package/dist/index.js
CHANGED
|
@@ -1032,6 +1032,8 @@ var init_mesh_ledger = __esm({
|
|
|
1032
1032
|
// src/mesh/mesh-work-queue.ts
|
|
1033
1033
|
var mesh_work_queue_exports = {};
|
|
1034
1034
|
__export(mesh_work_queue_exports, {
|
|
1035
|
+
ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
|
|
1036
|
+
HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
|
|
1035
1037
|
cancelTask: () => cancelTask,
|
|
1036
1038
|
claimNextTask: () => claimNextTask,
|
|
1037
1039
|
enqueueTask: () => enqueueTask,
|
|
@@ -1188,6 +1190,15 @@ function getMeshQueueStats(meshId) {
|
|
|
1188
1190
|
completed,
|
|
1189
1191
|
failed,
|
|
1190
1192
|
cancelled,
|
|
1193
|
+
activeCounts: {
|
|
1194
|
+
pending,
|
|
1195
|
+
assigned
|
|
1196
|
+
},
|
|
1197
|
+
historicalCounts: {
|
|
1198
|
+
completed,
|
|
1199
|
+
failed,
|
|
1200
|
+
cancelled
|
|
1201
|
+
},
|
|
1191
1202
|
activeAssignments: queue.filter((q) => q.status === "assigned").map((q) => ({
|
|
1192
1203
|
id: q.id,
|
|
1193
1204
|
nodeId: q.assignedNodeId,
|
|
@@ -1196,7 +1207,7 @@ function getMeshQueueStats(meshId) {
|
|
|
1196
1207
|
}))
|
|
1197
1208
|
};
|
|
1198
1209
|
}
|
|
1199
|
-
var import_fs4, import_path4, import_crypto5;
|
|
1210
|
+
var import_fs4, import_path4, import_crypto5, ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES;
|
|
1200
1211
|
var init_mesh_work_queue = __esm({
|
|
1201
1212
|
"src/mesh/mesh-work-queue.ts"() {
|
|
1202
1213
|
"use strict";
|
|
@@ -1204,6 +1215,8 @@ var init_mesh_work_queue = __esm({
|
|
|
1204
1215
|
import_path4 = require("path");
|
|
1205
1216
|
import_crypto5 = require("crypto");
|
|
1206
1217
|
init_mesh_ledger();
|
|
1218
|
+
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
1219
|
+
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
1207
1220
|
}
|
|
1208
1221
|
});
|
|
1209
1222
|
|
|
@@ -7349,26 +7362,8 @@ async function syncMeshes(transport) {
|
|
|
7349
7362
|
}
|
|
7350
7363
|
}
|
|
7351
7364
|
}
|
|
7352
|
-
if (transport.syncMeshLedger) {
|
|
7353
|
-
for (const local of localMeshes) {
|
|
7354
|
-
try {
|
|
7355
|
-
await syncMeshLedger(local.id, transport);
|
|
7356
|
-
} catch (e) {
|
|
7357
|
-
result.errors.push(`Ledger sync failed for "${local.name}": ${e.message}`);
|
|
7358
|
-
}
|
|
7359
|
-
}
|
|
7360
|
-
}
|
|
7361
7365
|
return result;
|
|
7362
7366
|
}
|
|
7363
|
-
async function syncMeshLedger(meshId, transport) {
|
|
7364
|
-
if (!transport.syncMeshLedger) return;
|
|
7365
|
-
const { readLedgerEntries: readLedgerEntries2, appendRemoteLedgerEntries: appendRemoteLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
7366
|
-
const localEntries = readLedgerEntries2(meshId);
|
|
7367
|
-
const res = await transport.syncMeshLedger(meshId, { newEntries: localEntries });
|
|
7368
|
-
if (res.missingEntries && res.missingEntries.length > 0) {
|
|
7369
|
-
appendRemoteLedgerEntries2(meshId, res.missingEntries);
|
|
7370
|
-
}
|
|
7371
|
-
}
|
|
7372
7367
|
|
|
7373
7368
|
// src/index.ts
|
|
7374
7369
|
init_mesh_ledger();
|
|
@@ -24909,10 +24904,21 @@ var DaemonCommandRouter = class {
|
|
|
24909
24904
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
24910
24905
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
24911
24906
|
try {
|
|
24912
|
-
const { getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
24907
|
+
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
24913
24908
|
const status = Array.isArray(args?.status) ? args.status.map((s) => typeof s === "string" ? s.trim() : "").filter(Boolean) : void 0;
|
|
24914
24909
|
const queue = getQueue2(meshId, { status });
|
|
24915
|
-
|
|
24910
|
+
const summary = getMeshQueueStats2(meshId);
|
|
24911
|
+
return {
|
|
24912
|
+
success: true,
|
|
24913
|
+
queue,
|
|
24914
|
+
summary,
|
|
24915
|
+
sourceOfTruth: {
|
|
24916
|
+
kind: "mesh_work_queue_file",
|
|
24917
|
+
activeStatuses: ["pending", "assigned"],
|
|
24918
|
+
historicalStatuses: ["completed", "failed", "cancelled"],
|
|
24919
|
+
notes: "pending/assigned are active work; completed/failed/cancelled are historical records."
|
|
24920
|
+
}
|
|
24921
|
+
};
|
|
24916
24922
|
} catch (e) {
|
|
24917
24923
|
return { success: false, error: e.message };
|
|
24918
24924
|
}
|