@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.js +43 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -9
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +11 -0
- package/dist/shared-types.d.ts +24 -0
- package/package.json +1 -1
- package/src/commands/router.ts +13 -2
- package/src/config/config.ts +2 -1
- package/src/config/workspaces.ts +1 -1
- package/src/mesh/mesh-work-queue.ts +34 -5
- package/src/shared-types.ts +24 -0
package/dist/index.js
CHANGED
|
@@ -322,7 +322,8 @@ function ensureMachineId(config) {
|
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
function getConfigDir() {
|
|
325
|
-
const
|
|
325
|
+
const override = process.env.ADHDEV_CONFIG_DIR;
|
|
326
|
+
const dir = override && override.trim() ? override.trim() : (0, import_path.join)((0, import_os.homedir)(), ".adhdev");
|
|
326
327
|
if (!(0, import_fs.existsSync)(dir)) {
|
|
327
328
|
(0, import_fs.mkdirSync)(dir, { recursive: true });
|
|
328
329
|
}
|
|
@@ -1031,6 +1032,8 @@ var init_mesh_ledger = __esm({
|
|
|
1031
1032
|
// src/mesh/mesh-work-queue.ts
|
|
1032
1033
|
var mesh_work_queue_exports = {};
|
|
1033
1034
|
__export(mesh_work_queue_exports, {
|
|
1035
|
+
ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
|
|
1036
|
+
HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
|
|
1034
1037
|
cancelTask: () => cancelTask,
|
|
1035
1038
|
claimNextTask: () => claimNextTask,
|
|
1036
1039
|
enqueueTask: () => enqueueTask,
|
|
@@ -1173,12 +1176,29 @@ function updateSessionTaskStatus(meshId, sessionId, status) {
|
|
|
1173
1176
|
}
|
|
1174
1177
|
function getMeshQueueStats(meshId) {
|
|
1175
1178
|
const queue = readQueue(meshId);
|
|
1179
|
+
const pending = queue.filter((q) => q.status === "pending").length;
|
|
1180
|
+
const assigned = queue.filter((q) => q.status === "assigned").length;
|
|
1181
|
+
const completed = queue.filter((q) => q.status === "completed").length;
|
|
1182
|
+
const failed = queue.filter((q) => q.status === "failed").length;
|
|
1183
|
+
const cancelled = queue.filter((q) => q.status === "cancelled").length;
|
|
1176
1184
|
return {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1185
|
+
total: queue.length,
|
|
1186
|
+
active: pending + assigned,
|
|
1187
|
+
historical: completed + failed + cancelled,
|
|
1188
|
+
pending,
|
|
1189
|
+
assigned,
|
|
1190
|
+
completed,
|
|
1191
|
+
failed,
|
|
1192
|
+
cancelled,
|
|
1193
|
+
activeCounts: {
|
|
1194
|
+
pending,
|
|
1195
|
+
assigned
|
|
1196
|
+
},
|
|
1197
|
+
historicalCounts: {
|
|
1198
|
+
completed,
|
|
1199
|
+
failed,
|
|
1200
|
+
cancelled
|
|
1201
|
+
},
|
|
1182
1202
|
activeAssignments: queue.filter((q) => q.status === "assigned").map((q) => ({
|
|
1183
1203
|
id: q.id,
|
|
1184
1204
|
nodeId: q.assignedNodeId,
|
|
@@ -1187,7 +1207,7 @@ function getMeshQueueStats(meshId) {
|
|
|
1187
1207
|
}))
|
|
1188
1208
|
};
|
|
1189
1209
|
}
|
|
1190
|
-
var import_fs4, import_path4, import_crypto5;
|
|
1210
|
+
var import_fs4, import_path4, import_crypto5, ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES;
|
|
1191
1211
|
var init_mesh_work_queue = __esm({
|
|
1192
1212
|
"src/mesh/mesh-work-queue.ts"() {
|
|
1193
1213
|
"use strict";
|
|
@@ -1195,6 +1215,8 @@ var init_mesh_work_queue = __esm({
|
|
|
1195
1215
|
import_path4 = require("path");
|
|
1196
1216
|
import_crypto5 = require("crypto");
|
|
1197
1217
|
init_mesh_ledger();
|
|
1218
|
+
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
1219
|
+
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
1198
1220
|
}
|
|
1199
1221
|
});
|
|
1200
1222
|
|
|
@@ -6957,7 +6979,7 @@ function addWorkspaceEntry(config, rawPath, label, options) {
|
|
|
6957
6979
|
}
|
|
6958
6980
|
}
|
|
6959
6981
|
const v = validateWorkspacePath(abs);
|
|
6960
|
-
if (
|
|
6982
|
+
if (v.ok !== true) return { error: v.error };
|
|
6961
6983
|
const list = [...config.workspaces || []];
|
|
6962
6984
|
if (list.some((w) => path5.resolve(w.path) === abs)) {
|
|
6963
6985
|
return { error: "Workspace already in list" };
|
|
@@ -24900,10 +24922,21 @@ var DaemonCommandRouter = class {
|
|
|
24900
24922
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
24901
24923
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
24902
24924
|
try {
|
|
24903
|
-
const { getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
24925
|
+
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
24904
24926
|
const status = Array.isArray(args?.status) ? args.status.map((s) => typeof s === "string" ? s.trim() : "").filter(Boolean) : void 0;
|
|
24905
24927
|
const queue = getQueue2(meshId, { status });
|
|
24906
|
-
|
|
24928
|
+
const summary = getMeshQueueStats2(meshId);
|
|
24929
|
+
return {
|
|
24930
|
+
success: true,
|
|
24931
|
+
queue,
|
|
24932
|
+
summary,
|
|
24933
|
+
sourceOfTruth: {
|
|
24934
|
+
kind: "mesh_work_queue_file",
|
|
24935
|
+
activeStatuses: ["pending", "assigned"],
|
|
24936
|
+
historicalStatuses: ["completed", "failed", "cancelled"],
|
|
24937
|
+
notes: "pending/assigned are active work; completed/failed/cancelled are historical records."
|
|
24938
|
+
}
|
|
24939
|
+
};
|
|
24907
24940
|
} catch (e) {
|
|
24908
24941
|
return { success: false, error: e.message };
|
|
24909
24942
|
}
|