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