@adhdev/daemon-core 0.9.82-rc.382 → 0.9.82-rc.384
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/commands/router.d.ts +11 -1
- package/dist/index.js +58 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/router.ts +50 -17
- package/src/mesh/mesh-reconcile-loop.ts +74 -30
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 ? "6cca365bcea9757dd350c6bac460ca5a169a9280" : void 0) ?? "unknown";
|
|
382
|
+
const commitShort = readInjected(true ? "6cca365b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
383
|
+
const version = readInjected(true ? "0.9.82-rc.384" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
384
|
+
const builtAt = readInjected(true ? "2026-06-25T15:21:26.360Z" : void 0);
|
|
385
385
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
386
386
|
return cached;
|
|
387
387
|
}
|
|
@@ -15152,8 +15152,7 @@ async function runMeshReconcileTick(components) {
|
|
|
15152
15152
|
const idleCoordinators = meshCoordinators.filter((c) => c.idle);
|
|
15153
15153
|
const generatingCoordinators = meshCoordinators.filter((c) => !c.idle && !c.modalParked);
|
|
15154
15154
|
const modalParkedCoordinators = meshCoordinators.filter((c) => !c.idle && c.modalParked);
|
|
15155
|
-
const targetCoordinators = idleCoordinators
|
|
15156
|
-
const forceOnly = idleCoordinators.length === 0;
|
|
15155
|
+
const targetCoordinators = idleCoordinators;
|
|
15157
15156
|
if (targetCoordinators.length === 0) {
|
|
15158
15157
|
if (modalParkedCoordinators.length > 0) {
|
|
15159
15158
|
const liveSessionIds = new Set(
|
|
@@ -15220,6 +15219,23 @@ async function runMeshReconcileTick(components) {
|
|
|
15220
15219
|
modalParkedCoordinators.length
|
|
15221
15220
|
);
|
|
15222
15221
|
}
|
|
15222
|
+
} else if (generatingCoordinators.length > 0) {
|
|
15223
|
+
let hasPending = true;
|
|
15224
|
+
if (store) {
|
|
15225
|
+
try {
|
|
15226
|
+
hasPending = store.pendingEventCount(meshId) > 0;
|
|
15227
|
+
} catch {
|
|
15228
|
+
}
|
|
15229
|
+
}
|
|
15230
|
+
if (hasPending) {
|
|
15231
|
+
LOG.info("MeshReconcile", `Reconcile skip \u2192 generating: holding pending event(s) for mesh ${meshId} (${generatingCoordinators.length} coordinator(s) busy; events left queued for the next idle tick)`);
|
|
15232
|
+
recordHeldTerminalEventsToLedger(
|
|
15233
|
+
meshId,
|
|
15234
|
+
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId ? [localDaemonId] : [],
|
|
15235
|
+
"generating_no_idle_coordinator",
|
|
15236
|
+
generatingCoordinators.length
|
|
15237
|
+
);
|
|
15238
|
+
}
|
|
15223
15239
|
}
|
|
15224
15240
|
continue;
|
|
15225
15241
|
}
|
|
@@ -15233,16 +15249,14 @@ async function runMeshReconcileTick(components) {
|
|
|
15233
15249
|
try {
|
|
15234
15250
|
pendingEvents = drainPendingMeshCoordinatorEvents(
|
|
15235
15251
|
meshId,
|
|
15236
|
-
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId
|
|
15237
|
-
forceOnly ? { onlyEvents: MESH_FORCE_INJECT_EVENTS } : void 0
|
|
15252
|
+
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId
|
|
15238
15253
|
);
|
|
15239
15254
|
} catch (e) {
|
|
15240
15255
|
LOG.warn("MeshReconcile", `Drain failed for mesh ${meshId}: ${e?.message || e}`);
|
|
15241
15256
|
continue;
|
|
15242
15257
|
}
|
|
15243
15258
|
if (pendingEvents.length === 0) continue;
|
|
15244
|
-
|
|
15245
|
-
LOG.info("MeshReconcile", `Reconcile ${mode}: ${pendingEvents.length} pending event(s) \u2192 ${targetCoordinators.length} coordinator(s) for mesh ${meshId}`);
|
|
15259
|
+
LOG.info("MeshReconcile", `Reconcile inject \u2192 idle: ${pendingEvents.length} pending event(s) \u2192 ${targetCoordinators.length} coordinator(s) for mesh ${meshId}`);
|
|
15246
15260
|
for (const pending of pendingEvents) {
|
|
15247
15261
|
const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
|
|
15248
15262
|
if (wantSession) {
|
|
@@ -52064,17 +52078,40 @@ var DaemonCommandRouter = class {
|
|
|
52064
52078
|
* the wider plural-shape scan so a controlbar/modal command targeting a non-primary remote
|
|
52065
52079
|
* session still resolves its owner — the singular readCachedInlineMeshActiveSessions semantics
|
|
52066
52080
|
* other consumers depend on stay untouched.
|
|
52081
|
+
*
|
|
52082
|
+
* CANCEL-STOP-RELAY: the session-id cache scan above only matches when the coordinator's
|
|
52083
|
+
* cached status snapshot already lists the worker's session id in a recognized active-sessions
|
|
52084
|
+
* shape. A worktree-clone worker session whose id form/timing differs from the cached snapshot
|
|
52085
|
+
* (or is simply not yet reflected) misses the scan, so a stop that carries the authoritative
|
|
52086
|
+
* owning nodeId (mesh_queue_cancel knows assignedNodeId) used to silently fail to forward.
|
|
52087
|
+
* `ownerNodeIdHint` adds a deterministic fallback: when the session-id scan misses, resolve the
|
|
52088
|
+
* owner daemonId by matching the node by id (meshNodeIdMatches — same form-tolerant compare the
|
|
52089
|
+
* rest of the router uses, no new raw compare). The same self-loopback guard applies to both
|
|
52090
|
+
* paths, so a coordinator-hosted node is still never force-forwarded to a remote form of itself.
|
|
52067
52091
|
*/
|
|
52068
|
-
resolveRemoteMeshSessionOwnerDaemonId(sessionId) {
|
|
52092
|
+
resolveRemoteMeshSessionOwnerDaemonId(sessionId, ownerNodeIdHint) {
|
|
52069
52093
|
const trimmed = typeof sessionId === "string" ? sessionId.trim() : "";
|
|
52070
|
-
|
|
52094
|
+
const nodeHint = typeof ownerNodeIdHint === "string" ? ownerNodeIdHint.trim() : "";
|
|
52095
|
+
if (!trimmed && !nodeHint) return void 0;
|
|
52071
52096
|
const selfDaemonId = this.deps.statusInstanceId;
|
|
52072
|
-
|
|
52073
|
-
|
|
52074
|
-
const
|
|
52075
|
-
|
|
52076
|
-
|
|
52077
|
-
|
|
52097
|
+
const candidates = this.collectMeshSessionOwnerCandidateNodes();
|
|
52098
|
+
if (trimmed) {
|
|
52099
|
+
for (const node of candidates) {
|
|
52100
|
+
if (!collectMeshNodeHostedSessionIds(node).has(trimmed)) continue;
|
|
52101
|
+
const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
|
|
52102
|
+
if (!nodeDaemonId) continue;
|
|
52103
|
+
if (selfDaemonId && daemonIdsEquivalent(nodeDaemonId, selfDaemonId)) return void 0;
|
|
52104
|
+
return nodeDaemonId;
|
|
52105
|
+
}
|
|
52106
|
+
}
|
|
52107
|
+
if (nodeHint) {
|
|
52108
|
+
for (const node of candidates) {
|
|
52109
|
+
if (!meshNodeIdMatches(node, nodeHint)) continue;
|
|
52110
|
+
const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
|
|
52111
|
+
if (!nodeDaemonId) continue;
|
|
52112
|
+
if (selfDaemonId && daemonIdsEquivalent(nodeDaemonId, selfDaemonId)) return void 0;
|
|
52113
|
+
return nodeDaemonId;
|
|
52114
|
+
}
|
|
52078
52115
|
}
|
|
52079
52116
|
return void 0;
|
|
52080
52117
|
}
|
|
@@ -54208,7 +54245,9 @@ ${hintLines.join("\n")}` : "",
|
|
|
54208
54245
|
const localInstance = this.deps.instanceManager?.getInstance(targetSessionId);
|
|
54209
54246
|
const localRegistry = this.deps.sessionRegistry?.get?.(targetSessionId);
|
|
54210
54247
|
if (!localInstance && !localRegistry) {
|
|
54211
|
-
const
|
|
54248
|
+
const meshContext = readObjectRecord(args?.meshContext);
|
|
54249
|
+
const ownerNodeIdHint = readStringValue(meshContext.nodeId);
|
|
54250
|
+
const ownerDaemonId = this.resolveRemoteMeshSessionOwnerDaemonId(targetSessionId, ownerNodeIdHint);
|
|
54212
54251
|
if (ownerDaemonId) {
|
|
54213
54252
|
LOG.info("Mesh", `[Mesh] Forwarding session-scoped '${cmd}' for remote worker session ${targetSessionId.split("_")[0]} \u2192 daemon ${ownerDaemonId.slice(0, 12)}`);
|
|
54214
54253
|
const forwarded = await this.deps.dispatchMeshCommand(ownerDaemonId, cmd, {
|