@adhdev/daemon-standalone 0.9.82-rc.397 → 0.9.82-rc.398

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 ? "5e6a6bcc5ba51a08f3941445f431cb0411217547" : void 0) ?? "unknown";
30112
- const commitShort = readInjected(true ? "5e6a6bcc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
- const version2 = readInjected(true ? "0.9.82-rc.397" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
- const builtAt = readInjected(true ? "2026-06-27T08:34:04.661Z" : void 0);
30111
+ const commit = readInjected(true ? "a572a9e7fe0e92e33a309d89e35299ad42aa407d" : void 0) ?? "unknown";
30112
+ const commitShort = readInjected(true ? "a572a9e7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
+ const version2 = readInjected(true ? "0.9.82-rc.398" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
+ const builtAt = readInjected(true ? "2026-06-27T09:05:37.974Z" : void 0);
30115
30115
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30116
30116
  return cached2;
30117
30117
  }
@@ -44479,6 +44479,18 @@ ${cleanBody}`;
44479
44479
  completedTaskForLedger = markSessionTerminal(sessionId, "failed");
44480
44480
  }
44481
44481
  } else if (args.event === "worktree_bootstrap_complete" || args.event === "worktree_bootstrap_failed") {
44482
+ const bootstrapNodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
44483
+ if (bootstrapNodeId) {
44484
+ try {
44485
+ components.router?.markWorktreeBootstrapTerminalState?.(
44486
+ args.meshId,
44487
+ bootstrapNodeId,
44488
+ args.event === "worktree_bootstrap_failed" ? "failed" : "complete"
44489
+ );
44490
+ } catch (e) {
44491
+ LOG2.warn("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
44492
+ }
44493
+ }
44482
44494
  setImmediate(() => {
44483
44495
  triggerMeshQueue(components, args.meshId).catch((e) => {
44484
44496
  LOG2.warn("MeshQueue", `Queue re-fire after ${args.event} failed (mesh ${args.meshId}): ${e?.message || e}`);
@@ -82592,6 +82604,64 @@ ${mergeTreeErr?.stderr || ""}`;
82592
82604
  this.invalidateAggregateMeshStatus(meshId);
82593
82605
  return true;
82594
82606
  }
82607
+ /**
82608
+ * WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
82609
+ * terminal state (complete / failed) in THIS daemon's mesh view.
82610
+ *
82611
+ * Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
82612
+ * source node's daemon (the worktree's machine). persistWorktreeSetupState
82613
+ * therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
82614
+ * mesh object — never on the coordinator's. The coordinator only ever holds the
82615
+ * 'running' state it stamped from the forwarded clone reply. The claim path's
82616
+ * bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
82617
+ * reads the coordinator's mesh via getMeshWithCache, sees status==='running'
82618
+ * forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
82619
+ * (triggerMeshQueue) loops against a gate that never opens: claim never lands,
82620
+ * the idle session is re-registered each tick, and auto-launch keeps spawning
82621
+ * fresh sessions (runaway worktree-session multiplication).
82622
+ *
82623
+ * Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
82624
+ * queue re-fire so the gate sees the terminal state and the deferred claim can
82625
+ * finally land. Updates the inline cache (clone worktree nodes are inline-only)
82626
+ * and, when the node also exists in local config, persists there too; both paths
82627
+ * invalidate the aggregate status cache. Best-effort and idempotent.
82628
+ */
82629
+ markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
82630
+ if (!meshId || !nodeId) return;
82631
+ const stamp = (mesh) => {
82632
+ if (!mesh || !Array.isArray(mesh.nodes)) return false;
82633
+ const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
82634
+ if (!node) return false;
82635
+ const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
82636
+ if (prev.status === status) return false;
82637
+ node.worktreeBootstrap = {
82638
+ ...prev,
82639
+ status,
82640
+ completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
82641
+ };
82642
+ return true;
82643
+ };
82644
+ let changed = false;
82645
+ try {
82646
+ const cached3 = this.getCachedInlineMesh(meshId);
82647
+ if (cached3 && stamp(cached3)) {
82648
+ cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
82649
+ this.inlineMeshCache.set(meshId, cached3);
82650
+ changed = true;
82651
+ }
82652
+ } catch {
82653
+ }
82654
+ if (changed) this.invalidateAggregateMeshStatus(meshId);
82655
+ void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
82656
+ const local = getMesh2(meshId);
82657
+ if (local && stamp(local)) {
82658
+ const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
82659
+ if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
82660
+ this.invalidateAggregateMeshStatus(meshId);
82661
+ }
82662
+ }).catch(() => {
82663
+ });
82664
+ }
82595
82665
  tombstoneRemovedInlineMeshNode(meshId, nodeId) {
82596
82666
  if (!nodeId) return;
82597
82667
  let set2 = this.removedInlineMeshNodeIds.get(meshId);