@adhdev/daemon-core 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 +36 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -5
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +1 -1
- package/dist/mesh/mesh-reconcile-loop.d.ts +56 -0
- package/package.json +2 -2
- package/src/commands/high-family/mesh-events.ts +13 -1
- package/src/mesh/mesh-events.ts +2 -0
- package/src/mesh/mesh-reconcile-loop.ts +84 -0
package/dist/index.mjs
CHANGED
|
@@ -378,10 +378,10 @@ function readInjected(value) {
|
|
|
378
378
|
}
|
|
379
379
|
function getDaemonBuildInfo() {
|
|
380
380
|
if (cached) return cached;
|
|
381
|
-
const commit = readInjected(true ? "
|
|
382
|
-
const commitShort = readInjected(true ? "
|
|
383
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
384
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
381
|
+
const commit = readInjected(true ? "3aa3e12839017da30b44a64ca6c20f0c9730fae2" : void 0) ?? "unknown";
|
|
382
|
+
const commitShort = readInjected(true ? "3aa3e128" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
383
|
+
const version = readInjected(true ? "0.9.82-rc.385" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
384
|
+
const builtAt = readInjected(true ? "2026-06-25T16:15:39.207Z" : void 0);
|
|
385
385
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
386
386
|
return cached;
|
|
387
387
|
}
|
|
@@ -14967,6 +14967,32 @@ function findLiveCoordinators(components) {
|
|
|
14967
14967
|
}
|
|
14968
14968
|
return out;
|
|
14969
14969
|
}
|
|
14970
|
+
function resolveCoordinatorDrainDeliverability(components, meshId) {
|
|
14971
|
+
const coordinators = findLiveCoordinators(components).filter((c) => c.meshId === meshId);
|
|
14972
|
+
if (coordinators.length === 0) {
|
|
14973
|
+
return { hasLiveCliCoordinator: false, deliverableNow: false, holdForReconcile: false };
|
|
14974
|
+
}
|
|
14975
|
+
const hasIdle = coordinators.some((c) => c.idle);
|
|
14976
|
+
return {
|
|
14977
|
+
hasLiveCliCoordinator: true,
|
|
14978
|
+
deliverableNow: hasIdle,
|
|
14979
|
+
// A live CLI coordinator exists but none is idle → the reconcile loop is
|
|
14980
|
+
// holding the events; the poll must not steal them.
|
|
14981
|
+
holdForReconcile: !hasIdle
|
|
14982
|
+
};
|
|
14983
|
+
}
|
|
14984
|
+
function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId) {
|
|
14985
|
+
if (!meshId) return false;
|
|
14986
|
+
const deliverability = resolveCoordinatorDrainDeliverability(components, meshId);
|
|
14987
|
+
if (!deliverability.holdForReconcile) return false;
|
|
14988
|
+
const requested = readNonEmptyString2(requestedCoordinatorDaemonId);
|
|
14989
|
+
if (!requested) return true;
|
|
14990
|
+
const localIds = expandDaemonIdForms([
|
|
14991
|
+
readNonEmptyString2(components.statusInstanceId),
|
|
14992
|
+
readNonEmptyString2(loadConfig().machineId)
|
|
14993
|
+
]);
|
|
14994
|
+
return localIds.some((id) => daemonIdsEquivalent(id, requested));
|
|
14995
|
+
}
|
|
14970
14996
|
function injectPendingIntoCoordinator(coordinator, pending) {
|
|
14971
14997
|
if (!coordinator || !pending.coordinatorMessage) return;
|
|
14972
14998
|
const force = shouldForceInjectMeshEvent(pending.event);
|
|
@@ -15683,9 +15709,11 @@ __export(mesh_events_exports, {
|
|
|
15683
15709
|
isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
|
|
15684
15710
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
15685
15711
|
reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
|
|
15712
|
+
resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
|
|
15686
15713
|
runMeshReconcileTick: () => runMeshReconcileTick,
|
|
15687
15714
|
setupMeshEventForwarding: () => setupMeshEventForwarding,
|
|
15688
15715
|
setupMeshReconcileLoop: () => setupMeshReconcileLoop,
|
|
15716
|
+
shouldHoldPendingDrainForBusyLocalCoordinator: () => shouldHoldPendingDrainForBusyLocalCoordinator,
|
|
15689
15717
|
triggerMeshQueue: () => triggerMeshQueue,
|
|
15690
15718
|
tryAssignQueueTask: () => tryAssignQueueTask
|
|
15691
15719
|
});
|
|
@@ -48138,9 +48166,12 @@ var meshEventsHandlers = {
|
|
|
48138
48166
|
mesh_forward_event: async (ctx, args) => {
|
|
48139
48167
|
return handleMeshForwardEvent({ instanceManager: ctx.deps.instanceManager }, args);
|
|
48140
48168
|
},
|
|
48141
|
-
get_pending_mesh_events: async (
|
|
48169
|
+
get_pending_mesh_events: async (ctx, args) => {
|
|
48142
48170
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
48143
48171
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
|
|
48172
|
+
if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
|
|
48173
|
+
return { success: true, events: [], heldForBusyLocalCoordinator: true };
|
|
48174
|
+
}
|
|
48144
48175
|
const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
|
|
48145
48176
|
return { success: true, events };
|
|
48146
48177
|
},
|