@adhdev/daemon-core 0.9.77-rc.33 → 0.9.77-rc.34
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.d.ts +1 -1
- package/dist/index.js +75 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -1
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +26 -1
- package/package.json +1 -1
- package/src/commands/router.ts +35 -0
- package/src/index.ts +1 -1
- package/src/mesh/mesh-work-queue.ts +69 -1
package/dist/index.mjs
CHANGED
|
@@ -975,10 +975,12 @@ var init_mesh_ledger = __esm({
|
|
|
975
975
|
// src/mesh/mesh-work-queue.ts
|
|
976
976
|
var mesh_work_queue_exports = {};
|
|
977
977
|
__export(mesh_work_queue_exports, {
|
|
978
|
+
cancelTask: () => cancelTask,
|
|
978
979
|
claimNextTask: () => claimNextTask,
|
|
979
980
|
enqueueTask: () => enqueueTask,
|
|
980
981
|
getMeshQueueStats: () => getMeshQueueStats,
|
|
981
982
|
getQueue: () => getQueue,
|
|
983
|
+
requeueTask: () => requeueTask,
|
|
982
984
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
983
985
|
updateTaskStatus: () => updateTaskStatus
|
|
984
986
|
});
|
|
@@ -1056,6 +1058,40 @@ function updateTaskStatus(meshId, taskId, status) {
|
|
|
1056
1058
|
writeQueue(meshId, queue);
|
|
1057
1059
|
return queue[idx];
|
|
1058
1060
|
}
|
|
1061
|
+
function cancelTask(meshId, taskId, opts) {
|
|
1062
|
+
const queue = readQueue(meshId);
|
|
1063
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
1064
|
+
if (idx === -1) return null;
|
|
1065
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1066
|
+
queue[idx].status = "cancelled";
|
|
1067
|
+
queue[idx].updatedAt = now;
|
|
1068
|
+
queue[idx].cancelledAt = now;
|
|
1069
|
+
if (opts?.reason) queue[idx].cancelReason = opts.reason;
|
|
1070
|
+
writeQueue(meshId, queue);
|
|
1071
|
+
return queue[idx];
|
|
1072
|
+
}
|
|
1073
|
+
function requeueTask(meshId, taskId, opts) {
|
|
1074
|
+
const queue = readQueue(meshId);
|
|
1075
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
1076
|
+
if (idx === -1) return null;
|
|
1077
|
+
const entry = queue[idx];
|
|
1078
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1079
|
+
entry.status = "pending";
|
|
1080
|
+
delete entry.assignedNodeId;
|
|
1081
|
+
delete entry.assignedSessionId;
|
|
1082
|
+
delete entry.cancelledAt;
|
|
1083
|
+
delete entry.cancelReason;
|
|
1084
|
+
if (opts?.clearTargetNode) delete entry.targetNodeId;
|
|
1085
|
+
if (typeof opts?.targetNodeId === "string") entry.targetNodeId = opts.targetNodeId;
|
|
1086
|
+
if (opts?.clearTargetSession !== false) delete entry.targetSessionId;
|
|
1087
|
+
if (typeof opts?.targetSessionId === "string") entry.targetSessionId = opts.targetSessionId;
|
|
1088
|
+
entry.updatedAt = now;
|
|
1089
|
+
entry.requeuedAt = now;
|
|
1090
|
+
entry.requeueCount = (entry.requeueCount || 0) + 1;
|
|
1091
|
+
if (opts?.reason) entry.requeueReason = opts.reason;
|
|
1092
|
+
writeQueue(meshId, queue);
|
|
1093
|
+
return entry;
|
|
1094
|
+
}
|
|
1059
1095
|
function updateSessionTaskStatus(meshId, sessionId, status) {
|
|
1060
1096
|
const queue = readQueue(meshId);
|
|
1061
1097
|
for (let i = queue.length - 1; i >= 0; i--) {
|
|
@@ -1074,7 +1110,8 @@ function getMeshQueueStats(meshId) {
|
|
|
1074
1110
|
pending: queue.filter((q) => q.status === "pending").length,
|
|
1075
1111
|
assigned: queue.filter((q) => q.status === "assigned").length,
|
|
1076
1112
|
completed: queue.filter((q) => q.status === "completed").length,
|
|
1077
|
-
failed: queue.filter((q) => q.status === "failed").length
|
|
1113
|
+
failed: queue.filter((q) => q.status === "failed").length,
|
|
1114
|
+
cancelled: queue.filter((q) => q.status === "cancelled").length
|
|
1078
1115
|
};
|
|
1079
1116
|
}
|
|
1080
1117
|
var init_mesh_work_queue = __esm({
|
|
@@ -23699,6 +23736,39 @@ var DaemonCommandRouter = class {
|
|
|
23699
23736
|
return { success: false, error: e.message };
|
|
23700
23737
|
}
|
|
23701
23738
|
}
|
|
23739
|
+
case "cancel_mesh_queue_task": {
|
|
23740
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
23741
|
+
const taskId = typeof args?.taskId === "string" ? args.taskId.trim() : "";
|
|
23742
|
+
if (!meshId || !taskId) return { success: false, error: "meshId and taskId required" };
|
|
23743
|
+
try {
|
|
23744
|
+
const { cancelTask: cancelTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
23745
|
+
const reason = typeof args?.reason === "string" ? args.reason : void 0;
|
|
23746
|
+
const task = cancelTask2(meshId, taskId, { reason });
|
|
23747
|
+
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
23748
|
+
return { success: true, task };
|
|
23749
|
+
} catch (e) {
|
|
23750
|
+
return { success: false, error: e.message };
|
|
23751
|
+
}
|
|
23752
|
+
}
|
|
23753
|
+
case "requeue_mesh_queue_task": {
|
|
23754
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
23755
|
+
const taskId = typeof args?.taskId === "string" ? args.taskId.trim() : "";
|
|
23756
|
+
if (!meshId || !taskId) return { success: false, error: "meshId and taskId required" };
|
|
23757
|
+
try {
|
|
23758
|
+
const { requeueTask: requeueTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
23759
|
+
const task = requeueTask2(meshId, taskId, {
|
|
23760
|
+
reason: typeof args?.reason === "string" ? args.reason : void 0,
|
|
23761
|
+
targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
|
|
23762
|
+
targetSessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : void 0,
|
|
23763
|
+
clearTargetNode: args?.clearTargetNode === true,
|
|
23764
|
+
clearTargetSession: args?.clearTargetSession !== false
|
|
23765
|
+
});
|
|
23766
|
+
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
23767
|
+
return { success: true, task };
|
|
23768
|
+
} catch (e) {
|
|
23769
|
+
return { success: false, error: e.message };
|
|
23770
|
+
}
|
|
23771
|
+
}
|
|
23702
23772
|
case "add_mesh_node": {
|
|
23703
23773
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
23704
23774
|
const workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
|
|
@@ -32349,6 +32419,7 @@ export {
|
|
|
32349
32419
|
buildThoughtChatMessage,
|
|
32350
32420
|
buildToolChatMessage,
|
|
32351
32421
|
buildUserChatMessage,
|
|
32422
|
+
cancelTask,
|
|
32352
32423
|
claimNextTask,
|
|
32353
32424
|
classifyChatMessageVisibility,
|
|
32354
32425
|
classifyHotChatSessionsForSubscriptionFlush,
|
|
@@ -32460,6 +32531,7 @@ export {
|
|
|
32460
32531
|
registerExtensionProviders,
|
|
32461
32532
|
removeNode,
|
|
32462
32533
|
removeWorktree,
|
|
32534
|
+
requeueTask,
|
|
32463
32535
|
resetConfig,
|
|
32464
32536
|
resetDebugRuntimeConfig,
|
|
32465
32537
|
resetState,
|