@adhdev/daemon-standalone 0.9.77-rc.20 → 0.9.77-rc.22
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 +31 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +31 -7
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -32532,15 +32532,35 @@ Follow these recovery rules:
|
|
|
32532
32532
|
}
|
|
32533
32533
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
32534
32534
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
32535
|
-
if (!task)
|
|
32535
|
+
if (!task) {
|
|
32536
|
+
return false;
|
|
32537
|
+
}
|
|
32536
32538
|
LOG2.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
32539
|
+
const mesh = getMesh(meshId);
|
|
32540
|
+
const node = mesh?.nodes.find((n) => n.id === nodeId);
|
|
32541
|
+
if (node?.daemonId && components.dispatchMeshCommand) {
|
|
32542
|
+
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
32543
|
+
if (!isLocalNode) {
|
|
32544
|
+
components.dispatchMeshCommand(node.daemonId, "agent_command", {
|
|
32545
|
+
targetSessionId: sessionId,
|
|
32546
|
+
cliType: providerType,
|
|
32547
|
+
action: "send_chat",
|
|
32548
|
+
message: task.message
|
|
32549
|
+
}).catch((e) => {
|
|
32550
|
+
LOG2.error("MeshQueue", `Failed to dispatch task via P2P to remote node ${nodeId}: ${e?.message}`);
|
|
32551
|
+
updateTaskStatus(meshId, task.id, "failed");
|
|
32552
|
+
});
|
|
32553
|
+
return true;
|
|
32554
|
+
}
|
|
32555
|
+
}
|
|
32537
32556
|
components.cliManager.handleCliCommand("agent_command", {
|
|
32538
32557
|
targetSessionId: sessionId,
|
|
32539
32558
|
cliType: providerType,
|
|
32540
32559
|
action: "send_chat",
|
|
32541
32560
|
message: task.message
|
|
32542
32561
|
}).catch((e) => {
|
|
32543
|
-
LOG2.error("MeshQueue", `Failed to dispatch task to node ${nodeId}: ${e?.message}`);
|
|
32562
|
+
LOG2.error("MeshQueue", `Failed to dispatch task locally to node ${nodeId}: ${e?.message}`);
|
|
32563
|
+
updateTaskStatus(meshId, task.id, "failed");
|
|
32544
32564
|
});
|
|
32545
32565
|
return true;
|
|
32546
32566
|
}
|
|
@@ -32610,7 +32630,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32610
32630
|
function injectMeshSystemMessage(components, args) {
|
|
32611
32631
|
if (args.event === "agent:generating_completed") {
|
|
32612
32632
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
32613
|
-
const nodeId = readNonEmptyString(args.
|
|
32633
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
32614
32634
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
32615
32635
|
if (sessionId) {
|
|
32616
32636
|
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
@@ -32622,7 +32642,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32622
32642
|
}
|
|
32623
32643
|
} else if (args.event === "agent:ready") {
|
|
32624
32644
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
32625
|
-
const nodeId = readNonEmptyString(args.
|
|
32645
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
32626
32646
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
32627
32647
|
if (sessionId && nodeId && providerType) {
|
|
32628
32648
|
setTimeout(() => {
|
|
@@ -32640,7 +32660,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32640
32660
|
try {
|
|
32641
32661
|
appendLedgerEntry(args.meshId, {
|
|
32642
32662
|
kind: ledgerKind,
|
|
32643
|
-
nodeId: readNonEmptyString(args.
|
|
32663
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
32644
32664
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
32645
32665
|
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
32646
32666
|
payload: {
|
|
@@ -32660,7 +32680,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32660
32680
|
const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
|
|
32661
32681
|
recoveryContext = getSessionRecoveryContext(args.meshId, {
|
|
32662
32682
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
32663
|
-
nodeId: readNonEmptyString(args.
|
|
32683
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
32664
32684
|
maxRetries
|
|
32665
32685
|
});
|
|
32666
32686
|
recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
|
|
@@ -32755,6 +32775,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32755
32775
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
32756
32776
|
return injectMeshSystemMessage(components, {
|
|
32757
32777
|
meshId,
|
|
32778
|
+
nodeId,
|
|
32758
32779
|
nodeLabel,
|
|
32759
32780
|
event: eventName,
|
|
32760
32781
|
metadataEvent: {
|
|
@@ -32784,10 +32805,12 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
32784
32805
|
if (!meshId) return;
|
|
32785
32806
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
32786
32807
|
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
32808
|
+
const resolvedNodeId = targetNode?.id || runtimeNodeId;
|
|
32787
32809
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
32788
32810
|
injectMeshSystemMessage(components, {
|
|
32789
32811
|
meshId,
|
|
32790
32812
|
sourceInstanceId: instanceId,
|
|
32813
|
+
nodeId: resolvedNodeId,
|
|
32791
32814
|
nodeLabel,
|
|
32792
32815
|
event: event.event,
|
|
32793
32816
|
metadataEvent: event
|
|
@@ -63315,7 +63338,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
63315
63338
|
cdpManagers,
|
|
63316
63339
|
sessionRegistry,
|
|
63317
63340
|
detectedIdes: detectedIdesRef,
|
|
63318
|
-
refreshProviderAvailability
|
|
63341
|
+
refreshProviderAvailability,
|
|
63342
|
+
dispatchMeshCommand: config2.dispatchMeshCommand
|
|
63319
63343
|
};
|
|
63320
63344
|
setupMeshEventForwarding(components);
|
|
63321
63345
|
return components;
|