@adhdev/daemon-core 0.9.77-rc.20 → 0.9.77-rc.21
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 +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/mesh/mesh-events.ts +11 -5
package/dist/index.mjs
CHANGED
|
@@ -1311,7 +1311,9 @@ function formatCompletionMetadata(event) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
1313
1313
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
1314
|
-
if (!task)
|
|
1314
|
+
if (!task) {
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1315
1317
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
1316
1318
|
components.cliManager.handleCliCommand("agent_command", {
|
|
1317
1319
|
targetSessionId: sessionId,
|
|
@@ -1389,7 +1391,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
1389
1391
|
function injectMeshSystemMessage(components, args) {
|
|
1390
1392
|
if (args.event === "agent:generating_completed") {
|
|
1391
1393
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
1392
|
-
const nodeId = readNonEmptyString(args.
|
|
1394
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
1393
1395
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1394
1396
|
if (sessionId) {
|
|
1395
1397
|
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
@@ -1401,7 +1403,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1401
1403
|
}
|
|
1402
1404
|
} else if (args.event === "agent:ready") {
|
|
1403
1405
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
1404
|
-
const nodeId = readNonEmptyString(args.
|
|
1406
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
1405
1407
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1406
1408
|
if (sessionId && nodeId && providerType) {
|
|
1407
1409
|
setTimeout(() => {
|
|
@@ -1419,7 +1421,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1419
1421
|
try {
|
|
1420
1422
|
appendLedgerEntry(args.meshId, {
|
|
1421
1423
|
kind: ledgerKind,
|
|
1422
|
-
nodeId: readNonEmptyString(args.
|
|
1424
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
1423
1425
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
1424
1426
|
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
1425
1427
|
payload: {
|
|
@@ -1439,7 +1441,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1439
1441
|
const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
|
|
1440
1442
|
recoveryContext = getSessionRecoveryContext(args.meshId, {
|
|
1441
1443
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
1442
|
-
nodeId: readNonEmptyString(args.
|
|
1444
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
1443
1445
|
maxRetries
|
|
1444
1446
|
});
|
|
1445
1447
|
recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
|
|
@@ -1534,6 +1536,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
1534
1536
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
1535
1537
|
return injectMeshSystemMessage(components, {
|
|
1536
1538
|
meshId,
|
|
1539
|
+
nodeId,
|
|
1537
1540
|
nodeLabel,
|
|
1538
1541
|
event: eventName,
|
|
1539
1542
|
metadataEvent: {
|
|
@@ -1563,10 +1566,12 @@ function setupMeshEventForwarding(components) {
|
|
|
1563
1566
|
if (!meshId) return;
|
|
1564
1567
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
1565
1568
|
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
1569
|
+
const resolvedNodeId = targetNode?.id || runtimeNodeId;
|
|
1566
1570
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
1567
1571
|
injectMeshSystemMessage(components, {
|
|
1568
1572
|
meshId,
|
|
1569
1573
|
sourceInstanceId: instanceId,
|
|
1574
|
+
nodeId: resolvedNodeId,
|
|
1570
1575
|
nodeLabel,
|
|
1571
1576
|
event: event.event,
|
|
1572
1577
|
metadataEvent: event
|