@adhdev/daemon-standalone 0.9.82-rc.284 → 0.9.82-rc.286

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
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
29983
29983
  }
29984
29984
  function getDaemonBuildInfo() {
29985
29985
  if (cached2) return cached2;
29986
- const commit = readInjected(true ? "746fc68e4c297b988b76207bb8c63ab6062a38e1" : void 0) ?? "unknown";
29987
- const commitShort = readInjected(true ? "746fc68e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29988
- const version2 = readInjected(true ? "0.9.82-rc.284" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29989
- const builtAt = readInjected(true ? "2026-06-15T13:40:25.431Z" : void 0);
29986
+ const commit = readInjected(true ? "ff6934b27530406c46b2c1835f9f3708f8fa4aba" : void 0) ?? "unknown";
29987
+ const commitShort = readInjected(true ? "ff6934b2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29988
+ const version2 = readInjected(true ? "0.9.82-rc.286" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29989
+ const builtAt = readInjected(true ? "2026-06-16T00:50:27.543Z" : void 0);
29990
29990
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
29991
29991
  return cached2;
29992
29992
  }
@@ -38418,6 +38418,14 @@ Next step: ${nextStep}`;
38418
38418
  if (machineId) ids.add(machineId);
38419
38419
  return [...ids];
38420
38420
  }
38421
+ function daemonHostsMesh(mesh, daemonIds) {
38422
+ const host = mesh.meshHost;
38423
+ if (!host) return true;
38424
+ if (host.role && host.role !== "host") return false;
38425
+ const hostDaemonId = readNonEmptyString2(host.hostDaemonId);
38426
+ if (!hostDaemonId) return true;
38427
+ return daemonIds.includes(hostDaemonId);
38428
+ }
38421
38429
  function findLiveCoordinators(components) {
38422
38430
  const out = [];
38423
38431
  for (const inst of components.instanceManager.getByCategory("cli")) {
@@ -38439,16 +38447,6 @@ Next step: ${nextStep}`;
38439
38447
  });
38440
38448
  }
38441
38449
  async function runMeshReconcileTick(components) {
38442
- const coordinators = findLiveCoordinators(components);
38443
- if (coordinators.length === 0) {
38444
- return;
38445
- }
38446
- const byMesh = /* @__PURE__ */ new Map();
38447
- for (const c of coordinators) {
38448
- const list = byMesh.get(c.meshId);
38449
- if (list) list.push(c);
38450
- else byMesh.set(c.meshId, [c]);
38451
- }
38452
38450
  const localDaemonId = readNonEmptyString2(loadConfig2().machineId) || void 0;
38453
38451
  const drainDaemonIds = resolveCoordinatorDaemonIds(components);
38454
38452
  const dispatchMeshCommand = components.dispatchMeshCommand;
@@ -38459,14 +38457,27 @@ Next step: ${nextStep}`;
38459
38457
  return void 0;
38460
38458
  }
38461
38459
  })();
38462
- for (const [meshId, meshCoordinators] of byMesh) {
38463
- if (dispatchMeshCommand) {
38460
+ if (dispatchMeshCommand) {
38461
+ for (const mesh of listMeshes()) {
38462
+ if (!daemonHostsMesh(mesh, drainDaemonIds)) continue;
38464
38463
  try {
38465
- await pullRemoteNodeQueues(components, meshId, localDaemonId);
38464
+ await pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds);
38466
38465
  } catch (e) {
38467
- LOG2.warn("MeshReconcile", `Remote node pull failed for mesh ${meshId}: ${e?.message || e}`);
38466
+ LOG2.warn("MeshReconcile", `Remote node pull failed for mesh ${mesh.id}: ${e?.message || e}`);
38468
38467
  }
38469
38468
  }
38469
+ }
38470
+ const coordinators = findLiveCoordinators(components);
38471
+ if (coordinators.length === 0) {
38472
+ return;
38473
+ }
38474
+ const byMesh = /* @__PURE__ */ new Map();
38475
+ for (const c of coordinators) {
38476
+ const list = byMesh.get(c.meshId);
38477
+ if (list) list.push(c);
38478
+ else byMesh.set(c.meshId, [c]);
38479
+ }
38480
+ for (const [meshId, meshCoordinators] of byMesh) {
38470
38481
  const idleCoordinators = meshCoordinators.filter((c) => c.idle);
38471
38482
  const generatingCoordinators = meshCoordinators.filter((c) => !c.idle);
38472
38483
  const targetCoordinators = idleCoordinators.length > 0 ? idleCoordinators : generatingCoordinators;
@@ -38498,32 +38509,30 @@ Next step: ${nextStep}`;
38498
38509
  }
38499
38510
  }
38500
38511
  }
38501
- async function pullRemoteNodeQueues(components, meshId, localDaemonId) {
38512
+ async function pullRemoteNodeQueues(components, mesh, localDaemonId, drainDaemonIds) {
38502
38513
  const dispatchMeshCommand = components.dispatchMeshCommand;
38503
38514
  if (!dispatchMeshCommand) return;
38504
- const mesh = listMeshes().find((m) => m.id === meshId);
38505
- if (!mesh) return;
38506
- const pendingEventArgs = {
38507
- meshId,
38508
- ...localDaemonId ? { coordinatorDaemonId: localDaemonId } : {}
38509
- };
38515
+ const meshId = mesh.id;
38516
+ const pulls = drainDaemonIds.length > 0 ? drainDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
38510
38517
  for (const node of mesh.nodes) {
38511
38518
  const nodeDaemonId = readNonEmptyString2(node.daemonId);
38512
38519
  if (!nodeDaemonId) continue;
38513
38520
  if (localDaemonId && nodeDaemonId === localDaemonId) continue;
38514
- let events;
38515
- try {
38516
- events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
38517
- } catch {
38518
- continue;
38519
- }
38520
- const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
38521
- for (const event of list) {
38522
- const payload = buildForwardPayloadFromPending(event);
38523
- if (!payload.event || !payload.meshId) continue;
38521
+ for (const pendingEventArgs of pulls) {
38522
+ let events;
38524
38523
  try {
38525
- handleMeshForwardEvent(components, payload);
38524
+ events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
38526
38525
  } catch {
38526
+ break;
38527
+ }
38528
+ const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
38529
+ for (const event of list) {
38530
+ const payload = buildForwardPayloadFromPending(event);
38531
+ if (!payload.event || !payload.meshId) continue;
38532
+ try {
38533
+ handleMeshForwardEvent(components, payload);
38534
+ } catch {
38535
+ }
38527
38536
  }
38528
38537
  }
38529
38538
  }