@adhdev/daemon-standalone 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.js +73 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +146 -3
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -25120,6 +25120,7 @@ __export(dist_exports, {
|
|
|
25120
25120
|
buildThoughtChatMessage: () => buildThoughtChatMessage,
|
|
25121
25121
|
buildToolChatMessage: () => buildToolChatMessage,
|
|
25122
25122
|
buildUserChatMessage: () => buildUserChatMessage,
|
|
25123
|
+
cancelTask: () => cancelTask,
|
|
25123
25124
|
claimNextTask: () => claimNextTask,
|
|
25124
25125
|
classifyChatMessageVisibility: () => classifyChatMessageVisibility,
|
|
25125
25126
|
classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush,
|
|
@@ -25231,6 +25232,7 @@ __export(dist_exports, {
|
|
|
25231
25232
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
25232
25233
|
removeNode: () => removeNode,
|
|
25233
25234
|
removeWorktree: () => removeWorktree,
|
|
25235
|
+
requeueTask: () => requeueTask,
|
|
25234
25236
|
resetConfig: () => resetConfig,
|
|
25235
25237
|
resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
|
|
25236
25238
|
resetState: () => resetState,
|
|
@@ -26074,6 +26076,40 @@ function updateTaskStatus(meshId, taskId, status) {
|
|
|
26074
26076
|
writeQueue(meshId, queue);
|
|
26075
26077
|
return queue[idx];
|
|
26076
26078
|
}
|
|
26079
|
+
function cancelTask(meshId, taskId, opts) {
|
|
26080
|
+
const queue = readQueue(meshId);
|
|
26081
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
26082
|
+
if (idx === -1) return null;
|
|
26083
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
26084
|
+
queue[idx].status = "cancelled";
|
|
26085
|
+
queue[idx].updatedAt = now;
|
|
26086
|
+
queue[idx].cancelledAt = now;
|
|
26087
|
+
if (opts?.reason) queue[idx].cancelReason = opts.reason;
|
|
26088
|
+
writeQueue(meshId, queue);
|
|
26089
|
+
return queue[idx];
|
|
26090
|
+
}
|
|
26091
|
+
function requeueTask(meshId, taskId, opts) {
|
|
26092
|
+
const queue = readQueue(meshId);
|
|
26093
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
26094
|
+
if (idx === -1) return null;
|
|
26095
|
+
const entry = queue[idx];
|
|
26096
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
26097
|
+
entry.status = "pending";
|
|
26098
|
+
delete entry.assignedNodeId;
|
|
26099
|
+
delete entry.assignedSessionId;
|
|
26100
|
+
delete entry.cancelledAt;
|
|
26101
|
+
delete entry.cancelReason;
|
|
26102
|
+
if (opts?.clearTargetNode) delete entry.targetNodeId;
|
|
26103
|
+
if (typeof opts?.targetNodeId === "string") entry.targetNodeId = opts.targetNodeId;
|
|
26104
|
+
if (opts?.clearTargetSession !== false) delete entry.targetSessionId;
|
|
26105
|
+
if (typeof opts?.targetSessionId === "string") entry.targetSessionId = opts.targetSessionId;
|
|
26106
|
+
entry.updatedAt = now;
|
|
26107
|
+
entry.requeuedAt = now;
|
|
26108
|
+
entry.requeueCount = (entry.requeueCount || 0) + 1;
|
|
26109
|
+
if (opts?.reason) entry.requeueReason = opts.reason;
|
|
26110
|
+
writeQueue(meshId, queue);
|
|
26111
|
+
return entry;
|
|
26112
|
+
}
|
|
26077
26113
|
function updateSessionTaskStatus(meshId, sessionId, status) {
|
|
26078
26114
|
const queue = readQueue(meshId);
|
|
26079
26115
|
for (let i = queue.length - 1; i >= 0; i--) {
|
|
@@ -26092,7 +26128,8 @@ function getMeshQueueStats(meshId) {
|
|
|
26092
26128
|
pending: queue.filter((q) => q.status === "pending").length,
|
|
26093
26129
|
assigned: queue.filter((q) => q.status === "assigned").length,
|
|
26094
26130
|
completed: queue.filter((q) => q.status === "completed").length,
|
|
26095
|
-
failed: queue.filter((q) => q.status === "failed").length
|
|
26131
|
+
failed: queue.filter((q) => q.status === "failed").length,
|
|
26132
|
+
cancelled: queue.filter((q) => q.status === "cancelled").length
|
|
26096
26133
|
};
|
|
26097
26134
|
}
|
|
26098
26135
|
function setLogLevel(level) {
|
|
@@ -41350,10 +41387,12 @@ Follow these recovery rules:
|
|
|
41350
41387
|
});
|
|
41351
41388
|
mesh_work_queue_exports = {};
|
|
41352
41389
|
__export2(mesh_work_queue_exports, {
|
|
41390
|
+
cancelTask: () => cancelTask,
|
|
41353
41391
|
claimNextTask: () => claimNextTask,
|
|
41354
41392
|
enqueueTask: () => enqueueTask,
|
|
41355
41393
|
getMeshQueueStats: () => getMeshQueueStats,
|
|
41356
41394
|
getQueue: () => getQueue,
|
|
41395
|
+
requeueTask: () => requeueTask,
|
|
41357
41396
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
41358
41397
|
updateTaskStatus: () => updateTaskStatus
|
|
41359
41398
|
});
|
|
@@ -53146,6 +53185,39 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53146
53185
|
return { success: false, error: e.message };
|
|
53147
53186
|
}
|
|
53148
53187
|
}
|
|
53188
|
+
case "cancel_mesh_queue_task": {
|
|
53189
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
53190
|
+
const taskId = typeof args?.taskId === "string" ? args.taskId.trim() : "";
|
|
53191
|
+
if (!meshId || !taskId) return { success: false, error: "meshId and taskId required" };
|
|
53192
|
+
try {
|
|
53193
|
+
const { cancelTask: cancelTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
53194
|
+
const reason = typeof args?.reason === "string" ? args.reason : void 0;
|
|
53195
|
+
const task = cancelTask2(meshId, taskId, { reason });
|
|
53196
|
+
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
53197
|
+
return { success: true, task };
|
|
53198
|
+
} catch (e) {
|
|
53199
|
+
return { success: false, error: e.message };
|
|
53200
|
+
}
|
|
53201
|
+
}
|
|
53202
|
+
case "requeue_mesh_queue_task": {
|
|
53203
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
53204
|
+
const taskId = typeof args?.taskId === "string" ? args.taskId.trim() : "";
|
|
53205
|
+
if (!meshId || !taskId) return { success: false, error: "meshId and taskId required" };
|
|
53206
|
+
try {
|
|
53207
|
+
const { requeueTask: requeueTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
53208
|
+
const task = requeueTask2(meshId, taskId, {
|
|
53209
|
+
reason: typeof args?.reason === "string" ? args.reason : void 0,
|
|
53210
|
+
targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
|
|
53211
|
+
targetSessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : void 0,
|
|
53212
|
+
clearTargetNode: args?.clearTargetNode === true,
|
|
53213
|
+
clearTargetSession: args?.clearTargetSession !== false
|
|
53214
|
+
});
|
|
53215
|
+
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
53216
|
+
return { success: true, task };
|
|
53217
|
+
} catch (e) {
|
|
53218
|
+
return { success: false, error: e.message };
|
|
53219
|
+
}
|
|
53220
|
+
}
|
|
53149
53221
|
case "add_mesh_node": {
|
|
53150
53222
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
53151
53223
|
const workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
|
|
@@ -57722,18 +57794,46 @@ var MESH_ENQUEUE_TASK_TOOL = {
|
|
|
57722
57794
|
};
|
|
57723
57795
|
var MESH_VIEW_QUEUE_TOOL = {
|
|
57724
57796
|
name: "mesh_view_queue",
|
|
57725
|
-
description: "View the current status of the mesh work queue (pending, assigned, completed, failed tasks).",
|
|
57797
|
+
description: "View the current status of the mesh work queue (pending, assigned, completed, failed, cancelled tasks).",
|
|
57726
57798
|
inputSchema: {
|
|
57727
57799
|
type: "object",
|
|
57728
57800
|
properties: {
|
|
57729
57801
|
status: {
|
|
57730
57802
|
type: "array",
|
|
57731
57803
|
items: { type: "string" },
|
|
57732
|
-
description: "Filter by task status: pending, assigned, completed, failed. Returns all if omitted."
|
|
57804
|
+
description: "Filter by task status: pending, assigned, completed, failed, cancelled. Returns all if omitted."
|
|
57733
57805
|
}
|
|
57734
57806
|
}
|
|
57735
57807
|
}
|
|
57736
57808
|
};
|
|
57809
|
+
var MESH_QUEUE_CANCEL_TOOL = {
|
|
57810
|
+
name: "mesh_queue_cancel",
|
|
57811
|
+
description: "Cancel a pending/assigned/completed/failed mesh queue task without deleting audit history. Use this to retire stale queue items that target dead sessions.",
|
|
57812
|
+
inputSchema: {
|
|
57813
|
+
type: "object",
|
|
57814
|
+
properties: {
|
|
57815
|
+
task_id: { type: "string", description: "Queue task ID to cancel." },
|
|
57816
|
+
reason: { type: "string", description: "Optional operator-visible reason for cancellation." }
|
|
57817
|
+
},
|
|
57818
|
+
required: ["task_id"]
|
|
57819
|
+
}
|
|
57820
|
+
};
|
|
57821
|
+
var MESH_QUEUE_REQUEUE_TOOL = {
|
|
57822
|
+
name: "mesh_queue_requeue",
|
|
57823
|
+
description: "Return a mesh queue task to pending for retry. By default clears stale assigned owner and target session so another live session can claim it.",
|
|
57824
|
+
inputSchema: {
|
|
57825
|
+
type: "object",
|
|
57826
|
+
properties: {
|
|
57827
|
+
task_id: { type: "string", description: "Queue task ID to requeue." },
|
|
57828
|
+
reason: { type: "string", description: "Optional operator-visible reason for requeueing." },
|
|
57829
|
+
target_node_id: { type: "string", description: "Optional replacement target node ID." },
|
|
57830
|
+
target_session_id: { type: "string", description: "Optional replacement target runtime session ID." },
|
|
57831
|
+
clear_target_node: { type: "boolean", description: "When true, remove any existing target node constraint." },
|
|
57832
|
+
keep_target_session: { type: "boolean", description: "When true, preserve an existing target session if target_session_id is not provided. Defaults false to avoid stale session targets." }
|
|
57833
|
+
},
|
|
57834
|
+
required: ["task_id"]
|
|
57835
|
+
}
|
|
57836
|
+
};
|
|
57737
57837
|
var MESH_SEND_TASK_TOOL = {
|
|
57738
57838
|
name: "mesh_send_task",
|
|
57739
57839
|
description: "Legacy push-based task assignment. Enqueues a task specifically targeted at a given node. The node will pull it immediately if idle.",
|
|
@@ -57903,6 +58003,8 @@ var ALL_MESH_TOOLS = [
|
|
|
57903
58003
|
MESH_LIST_NODES_TOOL,
|
|
57904
58004
|
MESH_ENQUEUE_TASK_TOOL,
|
|
57905
58005
|
MESH_VIEW_QUEUE_TOOL,
|
|
58006
|
+
MESH_QUEUE_CANCEL_TOOL,
|
|
58007
|
+
MESH_QUEUE_REQUEUE_TOOL,
|
|
57906
58008
|
MESH_SEND_TASK_TOOL,
|
|
57907
58009
|
MESH_READ_CHAT_TOOL,
|
|
57908
58010
|
MESH_READ_DEBUG_TOOL,
|
|
@@ -58084,6 +58186,41 @@ async function meshViewQueue(ctx, args) {
|
|
|
58084
58186
|
return JSON.stringify({ success: false, error: e.message });
|
|
58085
58187
|
}
|
|
58086
58188
|
}
|
|
58189
|
+
async function meshQueueCancel(ctx, args) {
|
|
58190
|
+
try {
|
|
58191
|
+
const taskId = (args.task_id || args.taskId || "").trim();
|
|
58192
|
+
if (!taskId) return JSON.stringify({ success: false, error: "task_id required" });
|
|
58193
|
+
const task = cancelTask(ctx.mesh.id, taskId, { reason: args.reason });
|
|
58194
|
+
if (!task) return JSON.stringify({ success: false, error: `Queue task '${taskId}' not found` });
|
|
58195
|
+
return JSON.stringify({ success: true, task }, null, 2);
|
|
58196
|
+
} catch (e) {
|
|
58197
|
+
return JSON.stringify({ success: false, error: e.message });
|
|
58198
|
+
}
|
|
58199
|
+
}
|
|
58200
|
+
async function meshQueueRequeue(ctx, args) {
|
|
58201
|
+
try {
|
|
58202
|
+
const taskId = (args.task_id || args.taskId || "").trim();
|
|
58203
|
+
if (!taskId) return JSON.stringify({ success: false, error: "task_id required" });
|
|
58204
|
+
const targetNodeId = (args.target_node_id || args.targetNodeId || "").trim() || void 0;
|
|
58205
|
+
const targetSessionId = (args.target_session_id || args.targetSessionId || "").trim() || void 0;
|
|
58206
|
+
const keepTargetSession = args.keep_target_session === true || args.keepTargetSession === true;
|
|
58207
|
+
const task = requeueTask(ctx.mesh.id, taskId, {
|
|
58208
|
+
reason: args.reason,
|
|
58209
|
+
targetNodeId,
|
|
58210
|
+
targetSessionId,
|
|
58211
|
+
clearTargetNode: args.clear_target_node === true || args.clearTargetNode === true,
|
|
58212
|
+
clearTargetSession: targetSessionId ? false : !keepTargetSession
|
|
58213
|
+
});
|
|
58214
|
+
if (!task) return JSON.stringify({ success: false, error: `Queue task '${taskId}' not found` });
|
|
58215
|
+
if (isLocalTransport(ctx.transport)) {
|
|
58216
|
+
ctx.transport.command("trigger_mesh_queue", { meshId: ctx.mesh.id }).catch(() => {
|
|
58217
|
+
});
|
|
58218
|
+
}
|
|
58219
|
+
return JSON.stringify({ success: true, task }, null, 2);
|
|
58220
|
+
} catch (e) {
|
|
58221
|
+
return JSON.stringify({ success: false, error: e.message });
|
|
58222
|
+
}
|
|
58223
|
+
}
|
|
58087
58224
|
async function meshSendTask(ctx, args) {
|
|
58088
58225
|
const node = await findNodeWithRefresh(ctx, args.node_id);
|
|
58089
58226
|
if (node.policy?.readOnly) {
|
|
@@ -60292,6 +60429,12 @@ async function startMcpServer(opts) {
|
|
|
60292
60429
|
case "mesh_view_queue":
|
|
60293
60430
|
text = await meshViewQueue(meshCtx, a);
|
|
60294
60431
|
break;
|
|
60432
|
+
case "mesh_queue_cancel":
|
|
60433
|
+
text = await meshQueueCancel(meshCtx, a);
|
|
60434
|
+
break;
|
|
60435
|
+
case "mesh_queue_requeue":
|
|
60436
|
+
text = await meshQueueRequeue(meshCtx, a);
|
|
60437
|
+
break;
|
|
60295
60438
|
case "mesh_send_task":
|
|
60296
60439
|
text = await meshSendTask(meshCtx, a);
|
|
60297
60440
|
break;
|