@adhdev/daemon-standalone 0.9.82-rc.394 → 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
@@ -30108,10 +30108,10 @@ var require_dist3 = __commonJS({
30108
30108
  }
30109
30109
  function getDaemonBuildInfo() {
30110
30110
  if (cached2) return cached2;
30111
- const commit = readInjected(true ? "5de1627a0f2a92574b4ea1508d43ab920c3cb238" : void 0) ?? "unknown";
30112
- const commitShort = readInjected(true ? "5de1627a" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
- const version2 = readInjected(true ? "0.9.82-rc.394" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
- const builtAt = readInjected(true ? "2026-06-27T06:02:02.142Z" : void 0);
30111
+ const commit = readInjected(true ? "109c5230408ea2b33e9083395b42b1c3e894aed2" : void 0) ?? "unknown";
30112
+ const commitShort = readInjected(true ? "109c5230" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
+ const version2 = readInjected(true ? "0.9.82-rc.396" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
+ const builtAt = readInjected(true ? "2026-06-27T07:16:08.131Z" : void 0);
30115
30115
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30116
30116
  return cached2;
30117
30117
  }
@@ -39649,27 +39649,32 @@ Next step: ${nextStep}`;
39649
39649
  updateDirectDispatchStatus(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed", args.taskId);
39650
39650
  markSessionDeliveriesTerminal(args.meshId, args.sessionId, kind === "task_completed" ? "completed" : "failed");
39651
39651
  setImmediate(() => cleanupTerminalDirectDispatches());
39652
+ const eventName = kind === "task_completed" ? "agent:generating_completed" : "agent:stopped";
39653
+ const nodeLabel = nodeId ? `Node '${nodeId}'` : "Remote agent";
39654
+ const metadataEvent = {
39655
+ targetSessionId: args.sessionId,
39656
+ providerType: providerType || void 0,
39657
+ providerSessionId: readNonEmptyString2(args.providerSessionId),
39658
+ finalSummary,
39659
+ taskId: args.taskId,
39660
+ workerResult,
39661
+ completionDiagnostic: {
39662
+ reason: "direct_task_transcript_reconciliation",
39663
+ terminalLedgerKind: kind,
39664
+ terminalLedgerId: entry.id
39665
+ }
39666
+ };
39667
+ const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
39652
39668
  queuePendingMeshCoordinatorEvent({
39653
- event: kind === "task_completed" ? "agent:generating_completed" : "agent:stopped",
39669
+ event: eventName,
39654
39670
  meshId: args.meshId,
39655
- nodeLabel: nodeId ? `Node '${nodeId}'` : "Remote agent",
39671
+ nodeLabel,
39656
39672
  nodeId: nodeId || void 0,
39657
- metadataEvent: {
39658
- targetSessionId: args.sessionId,
39659
- providerType: providerType || void 0,
39660
- providerSessionId: readNonEmptyString2(args.providerSessionId),
39661
- finalSummary,
39662
- taskId: args.taskId,
39663
- workerResult,
39664
- completionDiagnostic: {
39665
- reason: "direct_task_transcript_reconciliation",
39666
- terminalLedgerKind: kind,
39667
- terminalLedgerId: entry.id
39668
- }
39669
- },
39670
- coordinatorMessage: void 0,
39673
+ metadataEvent,
39674
+ coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
39671
39675
  queuedAt: Date.now(),
39672
- ...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {}
39676
+ ...readNonEmptyString2(args.targetCoordinatorDaemonId) ? { targetCoordinatorDaemonId: readNonEmptyString2(args.targetCoordinatorDaemonId) } : {},
39677
+ ...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
39673
39678
  });
39674
39679
  return { reconciled: true, kind, workerResult, ledgerEntryId: entry.id };
39675
39680
  }
@@ -40566,6 +40571,11 @@ Next step: ${nextStep}`;
40566
40571
  function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
40567
40572
  const mesh = getMeshWithCache(components, meshId);
40568
40573
  const node = mesh?.nodes.find((n) => readMeshNodeId(n) === nodeId);
40574
+ const gateNode = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
40575
+ if (gateNode?.worktreeBootstrap?.status === "running") {
40576
+ LOG2.info("MeshQueue", `Gating queue claim for worktree node ${nodeId} (${sessionId}): worktree bootstrap still running \u2014 task left pending; claim re-fires once bootstrap reaches a terminal state (guards against dispatching into a half-built worktree \u2192 empty session)`);
40577
+ return false;
40578
+ }
40569
40579
  const localClaimAdapter = components.cliManager?.adapters?.get(sessionId);
40570
40580
  let claimInstanceWorkspace = "";
40571
40581
  let claimStampedNodeId = "";
@@ -45026,7 +45036,19 @@ ${cleanBody}`;
45026
45036
  return localIds.some((id) => daemonIdsEquivalent(id, requested));
45027
45037
  }
45028
45038
  function injectPendingIntoCoordinator(coordinator, pending) {
45029
- if (!coordinator || !pending.coordinatorMessage) return;
45039
+ if (!coordinator) return;
45040
+ let coordinatorMessage = pending.coordinatorMessage;
45041
+ if (!coordinatorMessage) {
45042
+ if (!shouldForceInjectMeshEvent(pending.event)) return;
45043
+ const metadataEvent = pending.metadataEvent && typeof pending.metadataEvent === "object" ? pending.metadataEvent : {};
45044
+ coordinatorMessage = buildMeshSystemMessage({
45045
+ event: pending.event,
45046
+ nodeLabel: pending.nodeLabel,
45047
+ metadataEvent
45048
+ });
45049
+ if (!coordinatorMessage) return;
45050
+ LOG2.warn("MeshReconcile", `Lazily synthesized missing coordinatorMessage for ${pending.event} (mesh ${pending.meshId}) at inject time \u2014 a queued terminal event arrived message-less`);
45051
+ }
45030
45052
  const force = shouldForceInjectMeshEvent(pending.event);
45031
45053
  traceMeshEventStage("surfaced", {
45032
45054
  taskId: pending.metadataEvent?.taskId,
@@ -45036,7 +45058,7 @@ ${cleanBody}`;
45036
45058
  event: pending.event
45037
45059
  }, force ? "force-inject" : "inject");
45038
45060
  coordinator.onEvent("send_message", {
45039
- input: { text: pending.coordinatorMessage, textFallback: pending.coordinatorMessage },
45061
+ input: { text: coordinatorMessage, textFallback: coordinatorMessage },
45040
45062
  ...force ? { force: true } : {}
45041
45063
  });
45042
45064
  }