@adhdev/daemon-standalone 0.9.77-rc.22 → 0.9.77-rc.24

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
@@ -32582,6 +32582,15 @@ Follow these recovery rules:
32582
32582
  tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType);
32583
32583
  }
32584
32584
  }
32585
+ for (const [key, idle] of remoteIdleSessions.entries()) {
32586
+ const node = mesh.nodes.find((n) => n.id === idle.nodeId);
32587
+ if (node) {
32588
+ const assigned = tryAssignQueueTask(components, meshId, idle.nodeId, idle.sessionId, idle.providerType);
32589
+ if (assigned) {
32590
+ remoteIdleSessions.delete(key);
32591
+ }
32592
+ }
32593
+ }
32585
32594
  }
32586
32595
  function buildMeshSystemMessage(args) {
32587
32596
  const metadata = formatCompletionMetadata(args.metadataEvent);
@@ -32645,12 +32654,26 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32645
32654
  const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32646
32655
  const providerType = readNonEmptyString(args.metadataEvent.providerType);
32647
32656
  if (sessionId && nodeId && providerType) {
32657
+ remoteIdleSessions.set(`${nodeId}:${sessionId}`, { nodeId, sessionId, providerType });
32648
32658
  setTimeout(() => {
32649
- tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
32659
+ const assigned = tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
32660
+ if (assigned) {
32661
+ remoteIdleSessions.delete(`${nodeId}:${sessionId}`);
32662
+ }
32650
32663
  }, 500);
32651
32664
  }
32665
+ } else if (args.event === "agent:generating_started") {
32666
+ const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
32667
+ const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32668
+ if (sessionId && nodeId) {
32669
+ remoteIdleSessions.delete(`${nodeId}:${sessionId}`);
32670
+ }
32652
32671
  } else if (args.event === "agent:stopped") {
32653
32672
  const sessionId = readNonEmptyString(args.metadataEvent.targetSessionId);
32673
+ const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
32674
+ if (sessionId && nodeId) {
32675
+ remoteIdleSessions.delete(`${nodeId}:${sessionId}`);
32676
+ }
32654
32677
  if (sessionId) {
32655
32678
  updateSessionTaskStatus(args.meshId, sessionId, "failed");
32656
32679
  }
@@ -32817,6 +32840,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32817
32840
  });
32818
32841
  });
32819
32842
  }
32843
+ var remoteIdleSessions;
32820
32844
  var MAX_PENDING_EVENTS;
32821
32845
  var pendingMeshCoordinatorEvents;
32822
32846
  var MESH_COORDINATOR_EVENTS;
@@ -32828,6 +32852,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
32828
32852
  init_logger();
32829
32853
  init_mesh_ledger();
32830
32854
  init_mesh_work_queue();
32855
+ remoteIdleSessions = /* @__PURE__ */ new Map();
32831
32856
  MAX_PENDING_EVENTS = 50;
32832
32857
  pendingMeshCoordinatorEvents = [];
32833
32858
  MESH_COORDINATOR_EVENTS = /* @__PURE__ */ new Set([