@adhdev/daemon-standalone 0.9.82-rc.384 → 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
@@ -30108,10 +30108,10 @@ var require_dist3 = __commonJS({
30108
30108
  }
30109
30109
  function getDaemonBuildInfo() {
30110
30110
  if (cached2) return cached2;
30111
- const commit = readInjected(true ? "6cca365bcea9757dd350c6bac460ca5a169a9280" : void 0) ?? "unknown";
30112
- const commitShort = readInjected(true ? "6cca365b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
- const version2 = readInjected(true ? "0.9.82-rc.384" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
- const builtAt = readInjected(true ? "2026-06-25T15:23:09.439Z" : void 0);
30111
+ const commit = readInjected(true ? "3aa3e12839017da30b44a64ca6c20f0c9730fae2" : void 0) ?? "unknown";
30112
+ const commitShort = readInjected(true ? "3aa3e128" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
+ const version2 = readInjected(true ? "0.9.82-rc.385" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
+ const builtAt = readInjected(true ? "2026-06-25T16:17:00.115Z" : void 0);
30115
30115
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30116
30116
  return cached2;
30117
30117
  }
@@ -44781,6 +44781,32 @@ ${cleanBody}`;
44781
44781
  }
44782
44782
  return out;
44783
44783
  }
44784
+ function resolveCoordinatorDrainDeliverability(components, meshId) {
44785
+ const coordinators = findLiveCoordinators(components).filter((c) => c.meshId === meshId);
44786
+ if (coordinators.length === 0) {
44787
+ return { hasLiveCliCoordinator: false, deliverableNow: false, holdForReconcile: false };
44788
+ }
44789
+ const hasIdle = coordinators.some((c) => c.idle);
44790
+ return {
44791
+ hasLiveCliCoordinator: true,
44792
+ deliverableNow: hasIdle,
44793
+ // A live CLI coordinator exists but none is idle → the reconcile loop is
44794
+ // holding the events; the poll must not steal them.
44795
+ holdForReconcile: !hasIdle
44796
+ };
44797
+ }
44798
+ function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId) {
44799
+ if (!meshId) return false;
44800
+ const deliverability = resolveCoordinatorDrainDeliverability(components, meshId);
44801
+ if (!deliverability.holdForReconcile) return false;
44802
+ const requested = readNonEmptyString2(requestedCoordinatorDaemonId);
44803
+ if (!requested) return true;
44804
+ const localIds = expandDaemonIdForms([
44805
+ readNonEmptyString2(components.statusInstanceId),
44806
+ readNonEmptyString2(loadConfig2().machineId)
44807
+ ]);
44808
+ return localIds.some((id) => daemonIdsEquivalent(id, requested));
44809
+ }
44784
44810
  function injectPendingIntoCoordinator(coordinator, pending) {
44785
44811
  if (!coordinator || !pending.coordinatorMessage) return;
44786
44812
  const force = shouldForceInjectMeshEvent(pending.event);
@@ -45502,9 +45528,11 @@ ${cleanBody}`;
45502
45528
  isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
45503
45529
  queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
45504
45530
  reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
45531
+ resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
45505
45532
  runMeshReconcileTick: () => runMeshReconcileTick,
45506
45533
  setupMeshEventForwarding: () => setupMeshEventForwarding,
45507
45534
  setupMeshReconcileLoop: () => setupMeshReconcileLoop,
45535
+ shouldHoldPendingDrainForBusyLocalCoordinator: () => shouldHoldPendingDrainForBusyLocalCoordinator,
45508
45536
  triggerMeshQueue: () => triggerMeshQueue,
45509
45537
  tryAssignQueueTask: () => tryAssignQueueTask
45510
45538
  });
@@ -78071,9 +78099,12 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
78071
78099
  mesh_forward_event: async (ctx, args) => {
78072
78100
  return handleMeshForwardEvent({ instanceManager: ctx.deps.instanceManager }, args);
78073
78101
  },
78074
- get_pending_mesh_events: async (_ctx, args) => {
78102
+ get_pending_mesh_events: async (ctx, args) => {
78075
78103
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
78076
78104
  const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
78105
+ if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
78106
+ return { success: true, events: [], heldForBusyLocalCoordinator: true };
78107
+ }
78077
78108
  const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
78078
78109
  return { success: true, events };
78079
78110
  },