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

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 ? "a77fca338e386be4785dcfb7e765826155817728" : void 0) ?? "unknown";
30112
+ const commitShort = readInjected(true ? "a77fca33" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30113
+ const version2 = readInjected(true ? "0.9.82-rc.399" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30114
+ const builtAt = readInjected(true ? "2026-06-27T10:13:09.933Z" : 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}`);
@@ -70005,7 +70017,8 @@ ${body}
70005
70017
  const previousStatus = this.lastStatus;
70006
70018
  if (newStatus !== this.lastStatus) {
70007
70019
  LOG2.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
70008
- if (this.lastStatus === "idle" && newStatus === "generating") {
70020
+ const startingToGeneratingWithActiveTurn = this.lastStatus === "starting" && newStatus === "generating" && this.hasAdapterPendingResponse();
70021
+ if (this.lastStatus === "idle" && newStatus === "generating" || startingToGeneratingWithActiveTurn) {
70009
70022
  if (this.completedDebouncePending && this.generatingStartedAt === 0) {
70010
70023
  LOG2.debug("CLI", `[${this.type}] ignoring post-completion PTY generating blip (generatingStartedAt=0)`);
70011
70024
  return;
@@ -82592,6 +82605,64 @@ ${mergeTreeErr?.stderr || ""}`;
82592
82605
  this.invalidateAggregateMeshStatus(meshId);
82593
82606
  return true;
82594
82607
  }
82608
+ /**
82609
+ * WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
82610
+ * terminal state (complete / failed) in THIS daemon's mesh view.
82611
+ *
82612
+ * Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
82613
+ * source node's daemon (the worktree's machine). persistWorktreeSetupState
82614
+ * therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
82615
+ * mesh object — never on the coordinator's. The coordinator only ever holds the
82616
+ * 'running' state it stamped from the forwarded clone reply. The claim path's
82617
+ * bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
82618
+ * reads the coordinator's mesh via getMeshWithCache, sees status==='running'
82619
+ * forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
82620
+ * (triggerMeshQueue) loops against a gate that never opens: claim never lands,
82621
+ * the idle session is re-registered each tick, and auto-launch keeps spawning
82622
+ * fresh sessions (runaway worktree-session multiplication).
82623
+ *
82624
+ * Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
82625
+ * queue re-fire so the gate sees the terminal state and the deferred claim can
82626
+ * finally land. Updates the inline cache (clone worktree nodes are inline-only)
82627
+ * and, when the node also exists in local config, persists there too; both paths
82628
+ * invalidate the aggregate status cache. Best-effort and idempotent.
82629
+ */
82630
+ markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
82631
+ if (!meshId || !nodeId) return;
82632
+ const stamp = (mesh) => {
82633
+ if (!mesh || !Array.isArray(mesh.nodes)) return false;
82634
+ const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
82635
+ if (!node) return false;
82636
+ const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
82637
+ if (prev.status === status) return false;
82638
+ node.worktreeBootstrap = {
82639
+ ...prev,
82640
+ status,
82641
+ completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
82642
+ };
82643
+ return true;
82644
+ };
82645
+ let changed = false;
82646
+ try {
82647
+ const cached3 = this.getCachedInlineMesh(meshId);
82648
+ if (cached3 && stamp(cached3)) {
82649
+ cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
82650
+ this.inlineMeshCache.set(meshId, cached3);
82651
+ changed = true;
82652
+ }
82653
+ } catch {
82654
+ }
82655
+ if (changed) this.invalidateAggregateMeshStatus(meshId);
82656
+ void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
82657
+ const local = getMesh2(meshId);
82658
+ if (local && stamp(local)) {
82659
+ const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
82660
+ if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
82661
+ this.invalidateAggregateMeshStatus(meshId);
82662
+ }
82663
+ }).catch(() => {
82664
+ });
82665
+ }
82595
82666
  tombstoneRemovedInlineMeshNode(meshId, nodeId) {
82596
82667
  if (!nodeId) return;
82597
82668
  let set2 = this.removedInlineMeshNodeIds.get(meshId);