@adhdev/daemon-core 0.9.82-rc.286 → 0.9.82-rc.287

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
@@ -275,10 +275,10 @@ function readInjected(value) {
275
275
  }
276
276
  function getDaemonBuildInfo() {
277
277
  if (cached) return cached;
278
- const commit = readInjected(true ? "ff6934b27530406c46b2c1835f9f3708f8fa4aba" : void 0) ?? "unknown";
279
- const commitShort = readInjected(true ? "ff6934b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
280
- const version = readInjected(true ? "0.9.82-rc.286" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
281
- const builtAt = readInjected(true ? "2026-06-16T00:50:00.386Z" : void 0);
278
+ const commit = readInjected(true ? "542b47e003c32fc24f6325d1fd48a6b3ed745edd" : void 0) ?? "unknown";
279
+ const commitShort = readInjected(true ? "542b47e0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
280
+ const version = readInjected(true ? "0.9.82-rc.287" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
281
+ const builtAt = readInjected(true ? "2026-06-16T02:16:32.113Z" : void 0);
282
282
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
283
283
  return cached;
284
284
  }
@@ -8655,6 +8655,20 @@ function daemonHostsMesh(mesh, daemonIds) {
8655
8655
  if (!hostDaemonId) return true;
8656
8656
  return daemonIds.includes(hostDaemonId);
8657
8657
  }
8658
+ function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
8659
+ const ids = new Set(drainDaemonIds);
8660
+ for (const node of mesh.nodes) {
8661
+ const nodeDaemonId = readNonEmptyString2(node.daemonId);
8662
+ const nodeMachineId = readNonEmptyString2(node.machineId);
8663
+ const isSelf = nodeDaemonId && drainDaemonIds.includes(nodeDaemonId) || nodeMachineId && drainDaemonIds.includes(nodeMachineId);
8664
+ if (!isSelf) continue;
8665
+ if (nodeDaemonId) ids.add(nodeDaemonId);
8666
+ if (nodeMachineId) ids.add(nodeMachineId);
8667
+ }
8668
+ const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
8669
+ if (hostDaemonId && ids.has(hostDaemonId)) ids.add(hostDaemonId);
8670
+ return [...ids];
8671
+ }
8658
8672
  function findLiveCoordinators(components) {
8659
8673
  const out = [];
8660
8674
  for (const inst of components.instanceManager.getByCategory("cli")) {
@@ -8688,9 +8702,10 @@ async function runMeshReconcileTick(components) {
8688
8702
  })();
8689
8703
  if (dispatchMeshCommand) {
8690
8704
  for (const mesh of listMeshes()) {
8691
- if (!daemonHostsMesh(mesh, drainDaemonIds)) continue;
8705
+ const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
8706
+ if (!daemonHostsMesh(mesh, selfIds)) continue;
8692
8707
  try {
8693
- await pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds);
8708
+ await pullRemoteNodeQueues(components, mesh, localDaemonId, selfIds);
8694
8709
  } catch (e) {
8695
8710
  LOG.warn("MeshReconcile", `Remote node pull failed for mesh ${mesh.id}: ${e?.message || e}`);
8696
8711
  }
@@ -8738,15 +8753,16 @@ async function runMeshReconcileTick(components) {
8738
8753
  }
8739
8754
  }
8740
8755
  }
8741
- async function pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds) {
8756
+ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
8742
8757
  const dispatchMeshCommand = components.dispatchMeshCommand;
8743
8758
  if (!dispatchMeshCommand) return;
8744
8759
  const meshId = mesh.id;
8745
- const pulls = drainDaemonIds.length > 0 ? drainDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
8760
+ const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
8746
8761
  for (const node of mesh.nodes) {
8747
8762
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
8748
8763
  if (!nodeDaemonId) continue;
8749
8764
  if (localDaemonId && nodeDaemonId === localDaemonId) continue;
8765
+ if (candidateDaemonIds.includes(nodeDaemonId)) continue;
8750
8766
  for (const pendingEventArgs of pulls) {
8751
8767
  let events;
8752
8768
  try {