@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.js
CHANGED
|
@@ -1317,7 +1317,9 @@ function formatCompletionMetadata(event) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
1319
1319
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
1320
|
-
if (!task)
|
|
1320
|
+
if (!task) {
|
|
1321
|
+
return false;
|
|
1322
|
+
}
|
|
1321
1323
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
1322
1324
|
components.cliManager.handleCliCommand("agent_command", {
|
|
1323
1325
|
targetSessionId: sessionId,
|
|
@@ -1395,7 +1397,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
1395
1397
|
function injectMeshSystemMessage(components, args) {
|
|
1396
1398
|
if (args.event === "agent:generating_completed") {
|
|
1397
1399
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
1398
|
-
const nodeId = readNonEmptyString(args.
|
|
1400
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
1399
1401
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1400
1402
|
if (sessionId) {
|
|
1401
1403
|
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
@@ -1407,7 +1409,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1407
1409
|
}
|
|
1408
1410
|
} else if (args.event === "agent:ready") {
|
|
1409
1411
|
const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
|
|
1410
|
-
const nodeId = readNonEmptyString(args.
|
|
1412
|
+
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
1411
1413
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1412
1414
|
if (sessionId && nodeId && providerType) {
|
|
1413
1415
|
setTimeout(() => {
|
|
@@ -1425,7 +1427,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1425
1427
|
try {
|
|
1426
1428
|
appendLedgerEntry(args.meshId, {
|
|
1427
1429
|
kind: ledgerKind,
|
|
1428
|
-
nodeId: readNonEmptyString(args.
|
|
1430
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
1429
1431
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
1430
1432
|
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
1431
1433
|
payload: {
|
|
@@ -1445,7 +1447,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1445
1447
|
const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
|
|
1446
1448
|
recoveryContext = getSessionRecoveryContext(args.meshId, {
|
|
1447
1449
|
sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
|
|
1448
|
-
nodeId: readNonEmptyString(args.
|
|
1450
|
+
nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
|
|
1449
1451
|
maxRetries
|
|
1450
1452
|
});
|
|
1451
1453
|
recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
|
|
@@ -1540,6 +1542,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
1540
1542
|
const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
|
|
1541
1543
|
return injectMeshSystemMessage(components, {
|
|
1542
1544
|
meshId,
|
|
1545
|
+
nodeId,
|
|
1543
1546
|
nodeLabel,
|
|
1544
1547
|
event: eventName,
|
|
1545
1548
|
metadataEvent: {
|
|
@@ -1569,10 +1572,12 @@ function setupMeshEventForwarding(components) {
|
|
|
1569
1572
|
if (!meshId) return;
|
|
1570
1573
|
const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
|
|
1571
1574
|
const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
|
|
1575
|
+
const resolvedNodeId = targetNode?.id || runtimeNodeId;
|
|
1572
1576
|
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
|
|
1573
1577
|
injectMeshSystemMessage(components, {
|
|
1574
1578
|
meshId,
|
|
1575
1579
|
sourceInstanceId: instanceId,
|
|
1580
|
+
nodeId: resolvedNodeId,
|
|
1576
1581
|
nodeLabel,
|
|
1577
1582
|
event: event.event,
|
|
1578
1583
|
metadataEvent: event
|