@adhdev/daemon-standalone 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 CHANGED
@@ -32532,7 +32532,9 @@ 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) return false;
32535
+ if (!task) {
32536
+ return false;
32537
+ }
32536
32538
  LOG2.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
32537
32539
  components.cliManager.handleCliCommand("agent_command", {
32538
32540
  targetSessionId: sessionId,
@@ -32610,7 +32612,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32610
32612
  function injectMeshSystemMessage(components, args) {
32611
32613
  if (args.event === "agent:generating_completed") {
32612
32614
  const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
32613
- const nodeId = readNonEmptyString(args.metadataEvent.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32615
+ const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32614
32616
  const providerType = readNonEmptyString(args.metadataEvent.providerType);
32615
32617
  if (sessionId) {
32616
32618
  updateSessionTaskStatus(args.meshId, sessionId, "completed");
@@ -32622,7 +32624,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32622
32624
  }
32623
32625
  } else if (args.event === "agent:ready") {
32624
32626
  const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
32625
- const nodeId = readNonEmptyString(args.metadataEvent.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32627
+ const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32626
32628
  const providerType = readNonEmptyString(args.metadataEvent.providerType);
32627
32629
  if (sessionId && nodeId && providerType) {
32628
32630
  setTimeout(() => {
@@ -32640,7 +32642,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32640
32642
  try {
32641
32643
  appendLedgerEntry(args.meshId, {
32642
32644
  kind: ledgerKind,
32643
- nodeId: readNonEmptyString(args.metadataEvent.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
32645
+ nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
32644
32646
  sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
32645
32647
  providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
32646
32648
  payload: {
@@ -32660,7 +32662,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32660
32662
  const maxRetries = mesh?.policy?.maxTaskRetries ?? 1;
32661
32663
  recoveryContext = getSessionRecoveryContext(args.meshId, {
32662
32664
  sessionId: readNonEmptyString(args.metadataEvent.targetSessionId) || void 0,
32663
- nodeId: readNonEmptyString(args.metadataEvent.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
32665
+ nodeId: readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0,
32664
32666
  maxRetries
32665
32667
  });
32666
32668
  recoveryContext.failedProviderType = readNonEmptyString(args.metadataEvent.providerType) || null;
@@ -32755,6 +32757,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32755
32757
  const nodeLabel = nodeId ? `Node '${nodeId}'` : workspace ? `Agent at ${workspace}` : "Remote agent";
32756
32758
  return injectMeshSystemMessage(components, {
32757
32759
  meshId,
32760
+ nodeId,
32758
32761
  nodeLabel,
32759
32762
  event: eventName,
32760
32763
  metadataEvent: {
@@ -32784,10 +32787,12 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32784
32787
  if (!meshId) return;
32785
32788
  const targetNode = mesh?.nodes?.find((n) => n.workspace === workspace);
32786
32789
  const runtimeNodeId = readNonEmptyString(settings.meshNodeId);
32790
+ const resolvedNodeId = targetNode?.id || runtimeNodeId;
32787
32791
  const nodeLabel = targetNode ? `Node '${targetNode.id}'` : runtimeNodeId ? `Node '${runtimeNodeId}'` : `Agent at ${workspace}`;
32788
32792
  injectMeshSystemMessage(components, {
32789
32793
  meshId,
32790
32794
  sourceInstanceId: instanceId,
32795
+ nodeId: resolvedNodeId,
32791
32796
  nodeLabel,
32792
32797
  event: event.event,
32793
32798
  metadataEvent: event