@adhdev/daemon-core 0.9.82-rc.383 → 0.9.82-rc.385

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
@@ -383,10 +383,10 @@ function readInjected(value) {
383
383
  }
384
384
  function getDaemonBuildInfo() {
385
385
  if (cached) return cached;
386
- const commit = readInjected(true ? "6cca365bcea9757dd350c6bac460ca5a169a9280" : void 0) ?? "unknown";
387
- const commitShort = readInjected(true ? "6cca365b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
388
- const version = readInjected(true ? "0.9.82-rc.383" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
389
- const builtAt = readInjected(true ? "2026-06-25T15:14:41.579Z" : void 0);
386
+ const commit = readInjected(true ? "3aa3e12839017da30b44a64ca6c20f0c9730fae2" : void 0) ?? "unknown";
387
+ const commitShort = readInjected(true ? "3aa3e128" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
388
+ const version = readInjected(true ? "0.9.82-rc.385" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
389
+ const builtAt = readInjected(true ? "2026-06-25T16:15:39.207Z" : void 0);
390
390
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
391
391
  return cached;
392
392
  }
@@ -14972,6 +14972,32 @@ function findLiveCoordinators(components) {
14972
14972
  }
14973
14973
  return out;
14974
14974
  }
14975
+ function resolveCoordinatorDrainDeliverability(components, meshId) {
14976
+ const coordinators = findLiveCoordinators(components).filter((c) => c.meshId === meshId);
14977
+ if (coordinators.length === 0) {
14978
+ return { hasLiveCliCoordinator: false, deliverableNow: false, holdForReconcile: false };
14979
+ }
14980
+ const hasIdle = coordinators.some((c) => c.idle);
14981
+ return {
14982
+ hasLiveCliCoordinator: true,
14983
+ deliverableNow: hasIdle,
14984
+ // A live CLI coordinator exists but none is idle → the reconcile loop is
14985
+ // holding the events; the poll must not steal them.
14986
+ holdForReconcile: !hasIdle
14987
+ };
14988
+ }
14989
+ function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId) {
14990
+ if (!meshId) return false;
14991
+ const deliverability = resolveCoordinatorDrainDeliverability(components, meshId);
14992
+ if (!deliverability.holdForReconcile) return false;
14993
+ const requested = readNonEmptyString2(requestedCoordinatorDaemonId);
14994
+ if (!requested) return true;
14995
+ const localIds = expandDaemonIdForms([
14996
+ readNonEmptyString2(components.statusInstanceId),
14997
+ readNonEmptyString2(loadConfig().machineId)
14998
+ ]);
14999
+ return localIds.some((id) => daemonIdsEquivalent(id, requested));
15000
+ }
14975
15001
  function injectPendingIntoCoordinator(coordinator, pending) {
14976
15002
  if (!coordinator || !pending.coordinatorMessage) return;
14977
15003
  const force = shouldForceInjectMeshEvent(pending.event);
@@ -15688,9 +15714,11 @@ __export(mesh_events_exports, {
15688
15714
  isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
15689
15715
  queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
15690
15716
  reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
15717
+ resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
15691
15718
  runMeshReconcileTick: () => runMeshReconcileTick,
15692
15719
  setupMeshEventForwarding: () => setupMeshEventForwarding,
15693
15720
  setupMeshReconcileLoop: () => setupMeshReconcileLoop,
15721
+ shouldHoldPendingDrainForBusyLocalCoordinator: () => shouldHoldPendingDrainForBusyLocalCoordinator,
15694
15722
  triggerMeshQueue: () => triggerMeshQueue,
15695
15723
  tryAssignQueueTask: () => tryAssignQueueTask
15696
15724
  });
@@ -48514,9 +48542,12 @@ var meshEventsHandlers = {
48514
48542
  mesh_forward_event: async (ctx, args) => {
48515
48543
  return handleMeshForwardEvent({ instanceManager: ctx.deps.instanceManager }, args);
48516
48544
  },
48517
- get_pending_mesh_events: async (_ctx, args) => {
48545
+ get_pending_mesh_events: async (ctx, args) => {
48518
48546
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
48519
48547
  const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
48548
+ if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
48549
+ return { success: true, events: [], heldForBusyLocalCoordinator: true };
48550
+ }
48520
48551
  const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
48521
48552
  return { success: true, events };
48522
48553
  },