@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.mjs CHANGED
@@ -437,10 +437,10 @@ function readInjected(value) {
437
437
  }
438
438
  function getDaemonBuildInfo() {
439
439
  if (cached) return cached;
440
- const commit = readInjected(true ? "2a9ab536171fcf675788ac5b41596e740046bbfa" : void 0) ?? "unknown";
441
- const commitShort = readInjected(true ? "2a9ab536" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
442
- const version = readInjected(true ? "1.0.18-rc.13" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
443
- const builtAt = readInjected(true ? "2026-07-22T14:01:45.066Z" : void 0);
440
+ const commit = readInjected(true ? "a44f4a2814c4db171a9ebb0f6fcfb0798203aebb" : void 0) ?? "unknown";
441
+ const commitShort = readInjected(true ? "a44f4a28" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
442
+ const version = readInjected(true ? "1.0.18-rc.14" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
443
+ const builtAt = readInjected(true ? "2026-07-22T17:37:52.683Z" : void 0);
444
444
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
445
445
  return cached;
446
446
  }
@@ -22229,34 +22229,37 @@ async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDa
22229
22229
  if (!dispatchMeshCommand) return;
22230
22230
  const meshId = mesh.id;
22231
22231
  const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
22232
- await Promise.allSettled(mesh.nodes.map(async (node) => {
22233
- const nodeDaemonId = readNonEmptyString(node.daemonId);
22234
- if (!nodeDaemonId) return;
22235
- if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
22236
- if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
22237
- const getPeerStatus = components.getMeshPeerConnectionStatus;
22238
- if (getPeerStatus) {
22239
- const peerSnapshot = getPeerStatus(nodeDaemonId);
22240
- if (!peerSnapshot || String(peerSnapshot.state) !== "connected") return;
22241
- }
22242
- for (const pendingEventArgs of pulls) {
22243
- let events;
22232
+ await Promise.allSettled(mesh.nodes.map((node) => pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls)));
22233
+ }
22234
+ async function pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls) {
22235
+ const dispatchMeshCommand = components.dispatchMeshCommand;
22236
+ if (!dispatchMeshCommand) return;
22237
+ const nodeDaemonId = readNonEmptyString(node.daemonId);
22238
+ if (!nodeDaemonId) return;
22239
+ if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
22240
+ if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
22241
+ const getPeerStatus = components.getMeshPeerConnectionStatus;
22242
+ if (getPeerStatus) {
22243
+ const peerSnapshot = getPeerStatus(nodeDaemonId);
22244
+ if (!peerSnapshot || String(peerSnapshot.state) !== "connected") return;
22245
+ }
22246
+ for (const pendingEventArgs of pulls) {
22247
+ let events;
22248
+ try {
22249
+ events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
22250
+ } catch {
22251
+ break;
22252
+ }
22253
+ const list = extractPendingEvents(events).filter((e) => readNonEmptyString(e?.meshId) === meshId);
22254
+ for (const event of list) {
22255
+ const payload = buildForwardPayloadFromPending(event);
22256
+ if (!payload.event || !payload.meshId) continue;
22244
22257
  try {
22245
- events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
22258
+ handleMeshForwardEvent(components, payload);
22246
22259
  } catch {
22247
- break;
22248
- }
22249
- const list = extractPendingEvents(events).filter((e) => readNonEmptyString(e?.meshId) === meshId);
22250
- for (const event of list) {
22251
- const payload = buildForwardPayloadFromPending(event);
22252
- if (!payload.event || !payload.meshId) continue;
22253
- try {
22254
- handleMeshForwardEvent(components, payload);
22255
- } catch {
22256
- }
22257
22260
  }
22258
22261
  }
22259
- }));
22262
+ }
22260
22263
  }
22261
22264
  function unwrapReadChatPayload(raw) {
22262
22265
  let cursor = raw;
@@ -23164,7 +23167,7 @@ function assignedRowLiveStatusIsAwaitingApproval(mesh, nodeId, sessionId) {
23164
23167
  return false;
23165
23168
  }
23166
23169
  }
23167
- async function recoverStrandedAssignedDispatches(components, mesh, store) {
23170
+ async function recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds = []) {
23168
23171
  const meshId = mesh.id;
23169
23172
  const assigned = getQueue(meshId, { status: ["assigned"] });
23170
23173
  if (!assigned.length) return;
@@ -23188,6 +23191,24 @@ async function recoverStrandedAssignedDispatches(components, mesh, store) {
23188
23191
  updateTaskStatus(meshId, row.id, status);
23189
23192
  continue;
23190
23193
  }
23194
+ const assignedNode = row.assignedNodeId ? mesh.nodes?.find((n) => meshNodeIdMatches(n, row.assignedNodeId)) : void 0;
23195
+ if (assignedNode?.daemonId) {
23196
+ try {
23197
+ await pullPendingEventsFromNode(
23198
+ components,
23199
+ meshId,
23200
+ assignedNode,
23201
+ localDaemonId,
23202
+ selfIds,
23203
+ selfIds.length > 0 ? selfIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }]
23204
+ );
23205
+ } catch {
23206
+ }
23207
+ if (store.taskDeliveryConsumed(meshId, row.id)) {
23208
+ deliveredUnconsumedUnknownStreak.delete(`${meshId}::${row.id}`);
23209
+ continue;
23210
+ }
23211
+ }
23191
23212
  const shortStreakKey = `${meshId}::${row.id}`;
23192
23213
  const verdict = row.assignedSessionId ? resolveSessionBusyVerdict(components, row.assignedSessionId) : "IDLE_CONFIRMED";
23193
23214
  if (verdict === "GENERATING") {
@@ -23446,7 +23467,7 @@ async function runMeshReconcileTick(components) {
23446
23467
  const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
23447
23468
  if (!daemonHostsMesh(mesh, selfIds)) continue;
23448
23469
  try {
23449
- await recoverStrandedAssignedDispatches(components, mesh, store);
23470
+ await recoverStrandedAssignedDispatches(components, mesh, store, localDaemonId, selfIds);
23450
23471
  } catch (e) {
23451
23472
  LOG.warn("MeshReconcile", `Assigned-stranded watchdog failed for mesh ${mesh.id}: ${e?.message || e}`);
23452
23473
  }