@adhdev/daemon-core 0.9.77-rc.45 → 0.9.77-rc.47

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
@@ -321,7 +321,8 @@ function ensureMachineId(config) {
321
321
  };
322
322
  }
323
323
  function getConfigDir() {
324
- const dir = join2(homedir(), ".adhdev");
324
+ const override = process.env.ADHDEV_CONFIG_DIR;
325
+ const dir = override && override.trim() ? override.trim() : join2(homedir(), ".adhdev");
325
326
  if (!existsSync2(dir)) {
326
327
  mkdirSync(dir, { recursive: true });
327
328
  }
@@ -1026,6 +1027,8 @@ var init_mesh_ledger = __esm({
1026
1027
  // src/mesh/mesh-work-queue.ts
1027
1028
  var mesh_work_queue_exports = {};
1028
1029
  __export(mesh_work_queue_exports, {
1030
+ ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
1031
+ HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
1029
1032
  cancelTask: () => cancelTask,
1030
1033
  claimNextTask: () => claimNextTask,
1031
1034
  enqueueTask: () => enqueueTask,
@@ -1171,12 +1174,29 @@ function updateSessionTaskStatus(meshId, sessionId, status) {
1171
1174
  }
1172
1175
  function getMeshQueueStats(meshId) {
1173
1176
  const queue = readQueue(meshId);
1177
+ const pending = queue.filter((q) => q.status === "pending").length;
1178
+ const assigned = queue.filter((q) => q.status === "assigned").length;
1179
+ const completed = queue.filter((q) => q.status === "completed").length;
1180
+ const failed = queue.filter((q) => q.status === "failed").length;
1181
+ const cancelled = queue.filter((q) => q.status === "cancelled").length;
1174
1182
  return {
1175
- pending: queue.filter((q) => q.status === "pending").length,
1176
- assigned: queue.filter((q) => q.status === "assigned").length,
1177
- completed: queue.filter((q) => q.status === "completed").length,
1178
- failed: queue.filter((q) => q.status === "failed").length,
1179
- cancelled: queue.filter((q) => q.status === "cancelled").length,
1183
+ total: queue.length,
1184
+ active: pending + assigned,
1185
+ historical: completed + failed + cancelled,
1186
+ pending,
1187
+ assigned,
1188
+ completed,
1189
+ failed,
1190
+ cancelled,
1191
+ activeCounts: {
1192
+ pending,
1193
+ assigned
1194
+ },
1195
+ historicalCounts: {
1196
+ completed,
1197
+ failed,
1198
+ cancelled
1199
+ },
1180
1200
  activeAssignments: queue.filter((q) => q.status === "assigned").map((q) => ({
1181
1201
  id: q.id,
1182
1202
  nodeId: q.assignedNodeId,
@@ -1185,10 +1205,13 @@ function getMeshQueueStats(meshId) {
1185
1205
  }))
1186
1206
  };
1187
1207
  }
1208
+ var ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES;
1188
1209
  var init_mesh_work_queue = __esm({
1189
1210
  "src/mesh/mesh-work-queue.ts"() {
1190
1211
  "use strict";
1191
1212
  init_mesh_ledger();
1213
+ ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
1214
+ HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
1192
1215
  }
1193
1216
  });
1194
1217
 
@@ -6727,7 +6750,7 @@ function addWorkspaceEntry(config, rawPath, label, options) {
6727
6750
  }
6728
6751
  }
6729
6752
  const v = validateWorkspacePath(abs);
6730
- if (!v.ok) return { error: v.error };
6753
+ if (v.ok !== true) return { error: v.error };
6731
6754
  const list = [...config.workspaces || []];
6732
6755
  if (list.some((w) => path5.resolve(w.path) === abs)) {
6733
6756
  return { error: "Workspace already in list" };
@@ -24675,10 +24698,21 @@ var DaemonCommandRouter = class {
24675
24698
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
24676
24699
  if (!meshId) return { success: false, error: "meshId required" };
24677
24700
  try {
24678
- const { getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
24701
+ const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
24679
24702
  const status = Array.isArray(args?.status) ? args.status.map((s) => typeof s === "string" ? s.trim() : "").filter(Boolean) : void 0;
24680
24703
  const queue = getQueue2(meshId, { status });
24681
- return { success: true, queue };
24704
+ const summary = getMeshQueueStats2(meshId);
24705
+ return {
24706
+ success: true,
24707
+ queue,
24708
+ summary,
24709
+ sourceOfTruth: {
24710
+ kind: "mesh_work_queue_file",
24711
+ activeStatuses: ["pending", "assigned"],
24712
+ historicalStatuses: ["completed", "failed", "cancelled"],
24713
+ notes: "pending/assigned are active work; completed/failed/cancelled are historical records."
24714
+ }
24715
+ };
24682
24716
  } catch (e) {
24683
24717
  return { success: false, error: e.message };
24684
24718
  }