@adhdev/daemon-core 0.9.82-rc.395 → 0.9.82-rc.396

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
@@ -378,10 +378,10 @@ function readInjected(value) {
378
378
  }
379
379
  function getDaemonBuildInfo() {
380
380
  if (cached) return cached;
381
- const commit = readInjected(true ? "dea560a6fcafcb5579e0a62e3a2461d6af9aa289" : void 0) ?? "unknown";
382
- const commitShort = readInjected(true ? "dea560a6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
- const version = readInjected(true ? "0.9.82-rc.395" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
- const builtAt = readInjected(true ? "2026-06-27T06:46:26.696Z" : void 0);
381
+ const commit = readInjected(true ? "109c5230408ea2b33e9083395b42b1c3e894aed2" : void 0) ?? "unknown";
382
+ const commitShort = readInjected(true ? "109c5230" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
+ const version = readInjected(true ? "0.9.82-rc.396" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
+ const builtAt = readInjected(true ? "2026-06-27T07:15:39.648Z" : void 0);
385
385
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
386
386
  return cached;
387
387
  }
@@ -9859,27 +9859,32 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
9859
9859
  updateDirectDispatchStatus(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed", args.taskId);
9860
9860
  markSessionDeliveriesTerminal(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed");
9861
9861
  setImmediate(() => cleanupTerminalDirectDispatches());
9862
+ const eventName = kind === "task_completed" ? "agent:generating_completed" : "agent:stopped";
9863
+ const nodeLabel = nodeId ? `Node '${nodeId}'` : "Remote agent";
9864
+ const metadataEvent = {
9865
+ targetSessionId: args.sessionId,
9866
+ providerType: providerType || void 0,
9867
+ providerSessionId: readNonEmptyString2(args.providerSessionId),
9868
+ finalSummary,
9869
+ taskId: args.taskId,
9870
+ workerResult,
9871
+ completionDiagnostic: {
9872
+ reason: "direct_task_transcript_reconciliation",
9873
+ terminalLedgerKind: kind,
9874
+ terminalLedgerId: entry.id
9875
+ }
9876
+ };
9877
+ const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
9862
9878
  queuePendingMeshCoordinatorEvent({
9863
- event: kind === "task_completed" ? "agent:generating_completed" : "agent:stopped",
9879
+ event: eventName,
9864
9880
  meshId: args.meshId,
9865
- nodeLabel: nodeId ? `Node '${nodeId}'` : "Remote agent",
9881
+ nodeLabel,
9866
9882
  nodeId: nodeId || void 0,
9867
- metadataEvent: {
9868
- targetSessionId: args.sessionId,
9869
- providerType: providerType || void 0,
9870
- providerSessionId: readNonEmptyString2(args.providerSessionId),
9871
- finalSummary,
9872
- taskId: args.taskId,
9873
- workerResult,
9874
- completionDiagnostic: {
9875
- reason: "direct_task_transcript_reconciliation",
9876
- terminalLedgerKind: kind,
9877
- terminalLedgerId: entry.id
9878
- }
9879
- },
9880
- coordinatorMessage: void 0,
9883
+ metadataEvent,
9884
+ coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
9881
9885
  queuedAt: Date.now(),
9882
- ...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {}
9886
+ ...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {},
9887
+ ...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
9883
9888
  });
9884
9889
  return { reconciled: true, kind, workerResult, ledgerEntryId: entry.id };
9885
9890
  }
@@ -15217,7 +15222,19 @@ function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, reque
15217
15222
  return localIds.some((id) => daemonIdsEquivalent(id, requested));
15218
15223
  }
15219
15224
  function injectPendingIntoCoordinator(coordinator, pending) {
15220
- if (!coordinator || !pending.coordinatorMessage) return;
15225
+ if (!coordinator) return;
15226
+ let coordinatorMessage = pending.coordinatorMessage;
15227
+ if (!coordinatorMessage) {
15228
+ if (!shouldForceInjectMeshEvent(pending.event)) return;
15229
+ const metadataEvent = pending.metadataEvent && typeof pending.metadataEvent === "object" ? pending.metadataEvent : {};
15230
+ coordinatorMessage = buildMeshSystemMessage({
15231
+ event: pending.event,
15232
+ nodeLabel: pending.nodeLabel,
15233
+ metadataEvent
15234
+ });
15235
+ if (!coordinatorMessage) return;
15236
+ LOG.warn("MeshReconcile", `Lazily synthesized missing coordinatorMessage for ${pending.event} (mesh ${pending.meshId}) at inject time \u2014 a queued terminal event arrived message-less`);
15237
+ }
15221
15238
  const force = shouldForceInjectMeshEvent(pending.event);
15222
15239
  traceMeshEventStage("surfaced", {
15223
15240
  taskId: pending.metadataEvent?.taskId,
@@ -15227,7 +15244,7 @@ function injectPendingIntoCoordinator(coordinator, pending) {
15227
15244
  event: pending.event
15228
15245
  }, force ? "force-inject" : "inject");
15229
15246
  coordinator.onEvent("send_message", {
15230
- input: { text: pending.coordinatorMessage, textFallback: pending.coordinatorMessage },
15247
+ input: { text: coordinatorMessage, textFallback: coordinatorMessage },
15231
15248
  ...force ? { force: true } : {}
15232
15249
  });
15233
15250
  }