@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.mjs CHANGED
@@ -270,10 +270,10 @@ function readInjected(value) {
270
270
  }
271
271
  function getDaemonBuildInfo() {
272
272
  if (cached) return cached;
273
- const commit = readInjected(true ? "ff6934b27530406c46b2c1835f9f3708f8fa4aba" : void 0) ?? "unknown";
274
- const commitShort = readInjected(true ? "ff6934b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
275
- const version = readInjected(true ? "0.9.82-rc.286" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
276
- const builtAt = readInjected(true ? "2026-06-16T00:50:00.386Z" : void 0);
273
+ const commit = readInjected(true ? "542b47e003c32fc24f6325d1fd48a6b3ed745edd" : void 0) ?? "unknown";
274
+ const commitShort = readInjected(true ? "542b47e0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
275
+ const version = readInjected(true ? "0.9.82-rc.287" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
276
+ const builtAt = readInjected(true ? "2026-06-16T02:16:32.113Z" : void 0);
277
277
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
278
278
  return cached;
279
279
  }
@@ -8648,6 +8648,20 @@ function daemonHostsMesh(mesh, daemonIds) {
8648
8648
  if (!hostDaemonId) return true;
8649
8649
  return daemonIds.includes(hostDaemonId);
8650
8650
  }
8651
+ function resolveCoordinatorSelfIds(mesh, drainDaemonIds) {
8652
+ const ids = new Set(drainDaemonIds);
8653
+ for (const node of mesh.nodes) {
8654
+ const nodeDaemonId = readNonEmptyString2(node.daemonId);
8655
+ const nodeMachineId = readNonEmptyString2(node.machineId);
8656
+ const isSelf = nodeDaemonId && drainDaemonIds.includes(nodeDaemonId) || nodeMachineId && drainDaemonIds.includes(nodeMachineId);
8657
+ if (!isSelf) continue;
8658
+ if (nodeDaemonId) ids.add(nodeDaemonId);
8659
+ if (nodeMachineId) ids.add(nodeMachineId);
8660
+ }
8661
+ const hostDaemonId = readNonEmptyString2(mesh.meshHost?.hostDaemonId);
8662
+ if (hostDaemonId && ids.has(hostDaemonId)) ids.add(hostDaemonId);
8663
+ return [...ids];
8664
+ }
8651
8665
  function findLiveCoordinators(components) {
8652
8666
  const out = [];
8653
8667
  for (const inst of components.instanceManager.getByCategory("cli")) {
@@ -8681,9 +8695,10 @@ async function runMeshReconcileTick(components) {
8681
8695
  })();
8682
8696
  if (dispatchMeshCommand) {
8683
8697
  for (const mesh of listMeshes()) {
8684
- if (!daemonHostsMesh(mesh, drainDaemonIds)) continue;
8698
+ const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
8699
+ if (!daemonHostsMesh(mesh, selfIds)) continue;
8685
8700
  try {
8686
- await pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds);
8701
+ await pullRemoteNodeQueues(components, mesh, localDaemonId, selfIds);
8687
8702
  } catch (e) {
8688
8703
  LOG.warn("MeshReconcile", `Remote node pull failed for mesh ${mesh.id}: ${e?.message || e}`);
8689
8704
  }
@@ -8731,15 +8746,16 @@ async function runMeshReconcileTick(components) {
8731
8746
  }
8732
8747
  }
8733
8748
  }
8734
- async function pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds) {
8749
+ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
8735
8750
  const dispatchMeshCommand = components.dispatchMeshCommand;
8736
8751
  if (!dispatchMeshCommand) return;
8737
8752
  const meshId = mesh.id;
8738
- const pulls = drainDaemonIds.length > 0 ? drainDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
8753
+ const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
8739
8754
  for (const node of mesh.nodes) {
8740
8755
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
8741
8756
  if (!nodeDaemonId) continue;
8742
8757
  if (localDaemonId && nodeDaemonId === localDaemonId) continue;
8758
+ if (candidateDaemonIds.includes(nodeDaemonId)) continue;
8743
8759
  for (const pendingEventArgs of pulls) {
8744
8760
  let events;
8745
8761
  try {