@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/package.json
CHANGED
|
@@ -26258,15 +26258,35 @@ function formatCompletionMetadata(event) {
|
|
|
26258
26258
|
}
|
|
26259
26259
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
26260
26260
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
26261
|
-
if (!task)
|
|
26261
|
+
if (!task) {
|
|
26262
|
+
return false;
|
|
26263
|
+
}
|
|
26262
26264
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
26265
|
+
const mesh = getMesh(meshId);
|
|
26266
|
+
const node = mesh?.nodes.find((n) => n.id === nodeId);
|
|
26267
|
+
if (node?.daemonId && components.dispatchMeshCommand) {
|
|
26268
|
+
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
26269
|
+
if (!isLocalNode) {
|
|
26270
|
+
components.dispatchMeshCommand(node.daemonId, "agent_command", {
|
|
26271
|
+
targetSessionId: sessionId,
|
|
26272
|
+
cliType: providerType,
|
|
26273
|
+
action: "send_chat",
|
|
26274
|
+
message: task.message
|
|
26275
|
+
}).catch((e) => {
|
|
26276
|
+
LOG.error("MeshQueue", `Failed to dispatch task via P2P to remote node ${nodeId}: ${e?.message}`);
|
|
26277
|
+
updateTaskStatus(meshId, task.id, "failed");
|
|
26278
|
+
});
|
|
26279
|
+
return true;
|
|
26280
|
+
}
|
|
26281
|
+
}
|
|
26263
26282
|
components.cliManager.handleCliCommand("agent_command", {
|
|
26264
26283
|
targetSessionId: sessionId,
|
|
26265
26284
|
cliType: providerType,
|
|
26266
26285
|
action: "send_chat",
|
|
26267
26286
|
message: task.message
|
|
26268
26287
|
}).catch((e) => {
|
|
26269
|
-
LOG.error("MeshQueue", `Failed to dispatch task to node ${nodeId}: ${e?.message}`);
|
|
26288
|
+
LOG.error("MeshQueue", `Failed to dispatch task locally to node ${nodeId}: ${e?.message}`);
|
|
26289
|
+
updateTaskStatus(meshId, task.id, "failed");
|
|
26270
26290
|
});
|
|
26271
26291
|
return true;
|
|
26272
26292
|
}
|
|
@@ -26336,7 +26356,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
26336
26356
|
function injectMeshSystemMessage(components, args) {
|
|
26337
26357
|
if (args.event === "agent:generating_completed") {
|
|
26338
26358
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
26339
|
-
const nodeId = readNonEmptyString(args.
|
|
26359
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
26340
26360
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
26341
26361
|
if (sessionId) {
|
|
26342
26362
|
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
@@ -26348,7 +26368,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26348
26368
|
}
|
|
26349
26369
|
} else if (args.event === "agent:ready") {
|
|
26350
26370
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
26351
|
-
const nodeId = readNonEmptyString(args.
|
|
26371
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
26352
26372
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
26353
26373
|
if (sessionId && nodeId && providerType) {
|
|
26354
26374
|
setTimeout(() => {
|
|
@@ -26366,7 +26386,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26366
26386
|
try {
|
|
26367
26387
|
appendLedgerEntry(args.meshId, {
|
|
26368
26388
|
kind: ledgerKind,
|
|
26369
|
-
nodeId: readNonEmptyString(args.
|
|
26389
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
26370
26390
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
26371
26391
|
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
26372
26392
|
payload: {
|
|
@@ -26386,7 +26406,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26386
26406
|
const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
|
|
26387
26407
|
recoveryContext = getSessionRecoveryContext(args.meshId, {
|
|
26388
26408
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
26389
|
-
nodeId: readNonEmptyString(args.
|
|
26409
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
26390
26410
|
maxRetries
|
|
26391
26411
|
});
|
|
26392
26412
|
recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
|
|
@@ -26481,6 +26501,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
26481
26501
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
26482
26502
|
return injectMeshSystemMessage(components, {
|
|
26483
26503
|
meshId,
|
|
26504
|
+
nodeId,
|
|
26484
26505
|
nodeLabel,
|
|
26485
26506
|
event: eventName,
|
|
26486
26507
|
metadataEvent: {
|
|
@@ -26510,10 +26531,12 @@ function setupMeshEventForwarding(components) {
|
|
|
26510
26531
|
if (!meshId) return;
|
|
26511
26532
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
26512
26533
|
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
26534
|
+
const resolvedNodeId = targetNode?.id || runtimeNodeId;
|
|
26513
26535
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
26514
26536
|
injectMeshSystemMessage(components, {
|
|
26515
26537
|
meshId,
|
|
26516
26538
|
sourceInstanceId: instanceId,
|
|
26539
|
+
nodeId: resolvedNodeId,
|
|
26517
26540
|
nodeLabel,
|
|
26518
26541
|
event: event.event,
|
|
26519
26542
|
metadataEvent: event
|
|
@@ -40874,7 +40897,8 @@ async function initDaemonComponents(config2) {
|
|
|
40874
40897
|
cdpManagers,
|
|
40875
40898
|
sessionRegistry,
|
|
40876
40899
|
detectedIdes: detectedIdesRef,
|
|
40877
|
-
refreshProviderAvailability
|
|
40900
|
+
refreshProviderAvailability,
|
|
40901
|
+
dispatchMeshCommand: config2.dispatchMeshCommand
|
|
40878
40902
|
};
|
|
40879
40903
|
setupMeshEventForwarding(components);
|
|
40880
40904
|
return components;
|