@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.mjs CHANGED
@@ -1027,6 +1027,8 @@ var init_mesh_ledger = __esm({
1027
1027
  // src/mesh/mesh-work-queue.ts
1028
1028
  var mesh_work_queue_exports = {};
1029
1029
  __export(mesh_work_queue_exports, {
1030
+ ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
1031
+ HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
1030
1032
  cancelTask: () => cancelTask,
1031
1033
  claimNextTask: () => claimNextTask,
1032
1034
  enqueueTask: () => enqueueTask,
@@ -1186,6 +1188,15 @@ function getMeshQueueStats(meshId) {
1186
1188
  completed,
1187
1189
  failed,
1188
1190
  cancelled,
1191
+ activeCounts: {
1192
+ pending,
1193
+ assigned
1194
+ },
1195
+ historicalCounts: {
1196
+ completed,
1197
+ failed,
1198
+ cancelled
1199
+ },
1189
1200
  activeAssignments: queue.filter((q) => q.status === "assigned").map((q) => ({
1190
1201
  id: q.id,
1191
1202
  nodeId: q.assignedNodeId,
@@ -1194,10 +1205,13 @@ function getMeshQueueStats(meshId) {
1194
1205
  }))
1195
1206
  };
1196
1207
  }
1208
+ var ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES;
1197
1209
  var init_mesh_work_queue = __esm({
1198
1210
  "src/mesh/mesh-work-queue.ts"() {
1199
1211
  "use strict";
1200
1212
  init_mesh_ledger();
1213
+ ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
1214
+ HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
1201
1215
  }
1202
1216
  });
1203
1217
 
@@ -7119,26 +7133,8 @@ async function syncMeshes(transport) {
7119
7133
  }
7120
7134
  }
7121
7135
  }
7122
- if (transport.syncMeshLedger) {
7123
- for (const local of localMeshes) {
7124
- try {
7125
- await syncMeshLedger(local.id, transport);
7126
- } catch (e) {
7127
- result.errors.push(`Ledger sync failed for "${local.name}": ${e.message}`);
7128
- }
7129
- }
7130
- }
7131
7136
  return result;
7132
7137
  }
7133
- async function syncMeshLedger(meshId, transport) {
7134
- if (!transport.syncMeshLedger) return;
7135
- const { readLedgerEntries: readLedgerEntries2, appendRemoteLedgerEntries: appendRemoteLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
7136
- const localEntries = readLedgerEntries2(meshId);
7137
- const res = await transport.syncMeshLedger(meshId, { newEntries: localEntries });
7138
- if (res.missingEntries && res.missingEntries.length > 0) {
7139
- appendRemoteLedgerEntries2(meshId, res.missingEntries);
7140
- }
7141
- }
7142
7138
 
7143
7139
  // src/index.ts
7144
7140
  init_mesh_ledger();
@@ -24684,10 +24680,21 @@ var DaemonCommandRouter = class {
24684
24680
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
24685
24681
  if (!meshId) return { success: false, error: "meshId required" };
24686
24682
  try {
24687
- const { getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
24683
+ const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
24688
24684
  const status = Array.isArray(args?.status) ? args.status.map((s) => typeof s === "string" ? s.trim() : "").filter(Boolean) : void 0;
24689
24685
  const queue = getQueue2(meshId, { status });
24690
- return { success: true, queue };
24686
+ const summary = getMeshQueueStats2(meshId);
24687
+ return {
24688
+ success: true,
24689
+ queue,
24690
+ summary,
24691
+ sourceOfTruth: {
24692
+ kind: "mesh_work_queue_file",
24693
+ activeStatuses: ["pending", "assigned"],
24694
+ historicalStatuses: ["completed", "failed", "cancelled"],
24695
+ notes: "pending/assigned are active work; completed/failed/cancelled are historical records."
24696
+ }
24697
+ };
24691
24698
  } catch (e) {
24692
24699
  return { success: false, error: e.message };
24693
24700
  }