@adhdev/daemon-core 1.0.18-rc.13 → 1.0.18-rc.14
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 +51 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -30
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-remote-event-pull.d.ts +3 -0
- package/package.json +3 -3
- package/src/mesh/mesh-reconcile-loop.ts +43 -2
- package/src/mesh/mesh-remote-event-pull.ts +68 -47
package/dist/index.js
CHANGED
|
@@ -442,10 +442,10 @@ function readInjected(value) {
|
|
|
442
442
|
}
|
|
443
443
|
function getDaemonBuildInfo() {
|
|
444
444
|
if (cached) return cached;
|
|
445
|
-
const commit = readInjected(true ? "
|
|
446
|
-
const commitShort = readInjected(true ? "
|
|
447
|
-
const version = readInjected(true ? "1.0.18-rc.
|
|
448
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
445
|
+
const commit = readInjected(true ? "a44f4a2814c4db171a9ebb0f6fcfb0798203aebb" : void 0) ?? "unknown";
|
|
446
|
+
const commitShort = readInjected(true ? "a44f4a28" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
447
|
+
const version = readInjected(true ? "1.0.18-rc.14" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
448
|
+
const builtAt = readInjected(true ? "2026-07-22T17:37:52.683Z" : void 0);
|
|
449
449
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
450
450
|
return cached;
|
|
451
451
|
}
|
|
@@ -22227,34 +22227,37 @@ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDa
|
|
|
22227
22227
|
if (!dispatchMeshCommand) return;
|
|
22228
22228
|
const meshId = mesh.id;
|
|
22229
22229
|
const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
22230
|
-
await Promise.allSettled(mesh.nodes.map(
|
|
22231
|
-
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22230
|
+
await Promise.allSettled(mesh.nodes.map((node) => pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls)));
|
|
22231
|
+
}
|
|
22232
|
+
async function pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls) {
|
|
22233
|
+
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
22234
|
+
if (!dispatchMeshCommand) return;
|
|
22235
|
+
const nodeDaemonId = readNonEmptyString(node.daemonId);
|
|
22236
|
+
if (!nodeDaemonId) return;
|
|
22237
|
+
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
|
|
22238
|
+
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
|
|
22239
|
+
const getPeerStatus = components.getMeshPeerConnectionStatus;
|
|
22240
|
+
if (getPeerStatus) {
|
|
22241
|
+
const peerSnapshot = getPeerStatus(nodeDaemonId);
|
|
22242
|
+
if (!peerSnapshot || String(peerSnapshot.state) !== "connected") return;
|
|
22243
|
+
}
|
|
22244
|
+
for (const pendingEventArgs of pulls) {
|
|
22245
|
+
let events;
|
|
22246
|
+
try {
|
|
22247
|
+
events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
|
|
22248
|
+
} catch {
|
|
22249
|
+
break;
|
|
22250
|
+
}
|
|
22251
|
+
const list = extractPendingEvents(events).filter((e) => readNonEmptyString(e?.meshId) === meshId);
|
|
22252
|
+
for (const event of list) {
|
|
22253
|
+
const payload = buildForwardPayloadFromPending(event);
|
|
22254
|
+
if (!payload.event || !payload.meshId) continue;
|
|
22242
22255
|
try {
|
|
22243
|
-
|
|
22256
|
+
handleMeshForwardEvent(components, payload);
|
|
22244
22257
|
} catch {
|
|
22245
|
-
break;
|
|
22246
|
-
}
|
|
22247
|
-
const list = extractPendingEvents(events).filter((e) => readNonEmptyString(e?.meshId) === meshId);
|
|
22248
|
-
for (const event of list) {
|
|
22249
|
-
const payload = buildForwardPayloadFromPending(event);
|
|
22250
|
-
if (!payload.event || !payload.meshId) continue;
|
|
22251
|
-
try {
|
|
22252
|
-
handleMeshForwardEvent(components, payload);
|
|
22253
|
-
} catch {
|
|
22254
|
-
}
|
|
22255
22258
|
}
|
|
22256
22259
|
}
|
|
22257
|
-
}
|
|
22260
|
+
}
|
|
22258
22261
|
}
|
|
22259
22262
|
function unwrapReadChatPayload(raw) {
|
|
22260
22263
|
let cursor = raw;
|
|
@@ -23156,7 +23159,7 @@ function assignedRowLiveStatusIsAwaitingApproval(mesh, nodeId, sessionId) {
|
|
|
23156
23159
|
return false;
|
|
23157
23160
|
}
|
|
23158
23161
|
}
|
|
23159
|
-
async function recoverStrandedAssignedDispatches(components, mesh, store) {
|
|
23162
|
+
async function recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds = []) {
|
|
23160
23163
|
const meshId = mesh.id;
|
|
23161
23164
|
const assigned = getQueue(meshId, { status: ["assigned"] });
|
|
23162
23165
|
if (!assigned.length) return;
|
|
@@ -23180,6 +23183,24 @@ async function recoverStrandedAssignedDispatches(components, mesh, store) {
|
|
|
23180
23183
|
updateTaskStatus(meshId, row.id, status);
|
|
23181
23184
|
continue;
|
|
23182
23185
|
}
|
|
23186
|
+
const assignedNode = row.assignedNodeId ? mesh.nodes?.find((n) => meshNodeIdMatches(n, row.assignedNodeId)) : void 0;
|
|
23187
|
+
if (assignedNode?.daemonId) {
|
|
23188
|
+
try {
|
|
23189
|
+
await pullPendingEventsFromNode(
|
|
23190
|
+
components,
|
|
23191
|
+
meshId,
|
|
23192
|
+
assignedNode,
|
|
23193
|
+
localDaemonId,
|
|
23194
|
+
selfIds,
|
|
23195
|
+
selfIds.length > 0 ? selfIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }]
|
|
23196
|
+
);
|
|
23197
|
+
} catch {
|
|
23198
|
+
}
|
|
23199
|
+
if (store.taskDeliveryConsumed(meshId, row.id)) {
|
|
23200
|
+
deliveredUnconsumedUnknownStreak.delete(`${meshId}::${row.id}`);
|
|
23201
|
+
continue;
|
|
23202
|
+
}
|
|
23203
|
+
}
|
|
23183
23204
|
const shortStreakKey = `${meshId}::${row.id}`;
|
|
23184
23205
|
const verdict = row.assignedSessionId ? resolveSessionBusyVerdict(components, row.assignedSessionId) : "IDLE_CONFIRMED";
|
|
23185
23206
|
if (verdict === "GENERATING") {
|
|
@@ -23438,7 +23459,7 @@ async function runMeshReconcileTick(components) {
|
|
|
23438
23459
|
const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
|
|
23439
23460
|
if (!daemonHostsMesh(mesh, selfIds)) continue;
|
|
23440
23461
|
try {
|
|
23441
|
-
await recoverStrandedAssignedDispatches(components, mesh, store);
|
|
23462
|
+
await recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds);
|
|
23442
23463
|
} catch (e) {
|
|
23443
23464
|
LOG.warn("MeshReconcile", `Assigned-stranded watchdog failed for mesh ${mesh.id}: ${e?.message || e}`);
|
|
23444
23465
|
}
|