@adhdev/daemon-core 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.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 ? "5e6a6bcc5ba51a08f3941445f431cb0411217547" : void 0) ?? "unknown";
382
- const commitShort = readInjected(true ? "5e6a6bcc" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
- const version = readInjected(true ? "0.9.82-rc.397" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
- const builtAt = readInjected(true ? "2026-06-27T08:32:58.380Z" : void 0);
381
+ const commit = readInjected(true ? "a77fca338e386be4785dcfb7e765826155817728" : void 0) ?? "unknown";
382
+ const commitShort = readInjected(true ? "a77fca33" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
+ const version = readInjected(true ? "0.9.82-rc.399" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
+ const builtAt = readInjected(true ? "2026-06-27T10:12:40.786Z" : void 0);
385
385
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
386
386
  return cached;
387
387
  }
@@ -14667,6 +14667,18 @@ function injectMeshSystemMessage(components, args) {
14667
14667
  completedTaskForLedger = markSessionTerminal(sessionId, "failed");
14668
14668
  }
14669
14669
  } else if (args.event === "worktree_bootstrap_complete" || args.event === "worktree_bootstrap_failed") {
14670
+ const bootstrapNodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
14671
+ if (bootstrapNodeId) {
14672
+ try {
14673
+ components.router?.markWorktreeBootstrapTerminalState?.(
14674
+ args.meshId,
14675
+ bootstrapNodeId,
14676
+ args.event === "worktree_bootstrap_failed" ? "failed" : "complete"
14677
+ );
14678
+ } catch (e) {
14679
+ LOG.warn("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
14680
+ }
14681
+ }
14670
14682
  setImmediate(() => {
14671
14683
  triggerMeshQueue(components, args.meshId).catch((e) => {
14672
14684
  LOG.warn("MeshQueue", `Queue re-fire after ${args.event} failed (mesh ${args.meshId}): ${e?.message || e}`);
@@ -40009,7 +40021,8 @@ var CliProviderInstance = class _CliProviderInstance {
40009
40021
  const previousStatus = this.lastStatus;
40010
40022
  if (newStatus !== this.lastStatus) {
40011
40023
  LOG.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
40012
- if (this.lastStatus === "idle" && newStatus === "generating") {
40024
+ const startingToGeneratingWithActiveTurn = this.lastStatus === "starting" && newStatus === "generating" && this.hasAdapterPendingResponse();
40025
+ if (this.lastStatus === "idle" && newStatus === "generating" || startingToGeneratingWithActiveTurn) {
40013
40026
  if (this.completedDebouncePending && this.generatingStartedAt === 0) {
40014
40027
  LOG.debug("CLI", `[${this.type}] ignoring post-completion PTY generating blip (generatingStartedAt=0)`);
40015
40028
  return;
@@ -52685,6 +52698,64 @@ var DaemonCommandRouter = class {
52685
52698
  this.invalidateAggregateMeshStatus(meshId);
52686
52699
  return true;
52687
52700
  }
52701
+ /**
52702
+ * WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
52703
+ * terminal state (complete / failed) in THIS daemon's mesh view.
52704
+ *
52705
+ * Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
52706
+ * source node's daemon (the worktree's machine). persistWorktreeSetupState
52707
+ * therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
52708
+ * mesh object — never on the coordinator's. The coordinator only ever holds the
52709
+ * 'running' state it stamped from the forwarded clone reply. The claim path's
52710
+ * bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
52711
+ * reads the coordinator's mesh via getMeshWithCache, sees status==='running'
52712
+ * forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
52713
+ * (triggerMeshQueue) loops against a gate that never opens: claim never lands,
52714
+ * the idle session is re-registered each tick, and auto-launch keeps spawning
52715
+ * fresh sessions (runaway worktree-session multiplication).
52716
+ *
52717
+ * Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
52718
+ * queue re-fire so the gate sees the terminal state and the deferred claim can
52719
+ * finally land. Updates the inline cache (clone worktree nodes are inline-only)
52720
+ * and, when the node also exists in local config, persists there too; both paths
52721
+ * invalidate the aggregate status cache. Best-effort and idempotent.
52722
+ */
52723
+ markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
52724
+ if (!meshId || !nodeId) return;
52725
+ const stamp = (mesh) => {
52726
+ if (!mesh || !Array.isArray(mesh.nodes)) return false;
52727
+ const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
52728
+ if (!node) return false;
52729
+ const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
52730
+ if (prev.status === status) return false;
52731
+ node.worktreeBootstrap = {
52732
+ ...prev,
52733
+ status,
52734
+ completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
52735
+ };
52736
+ return true;
52737
+ };
52738
+ let changed = false;
52739
+ try {
52740
+ const cached3 = this.getCachedInlineMesh(meshId);
52741
+ if (cached3 && stamp(cached3)) {
52742
+ cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
52743
+ this.inlineMeshCache.set(meshId, cached3);
52744
+ changed = true;
52745
+ }
52746
+ } catch {
52747
+ }
52748
+ if (changed) this.invalidateAggregateMeshStatus(meshId);
52749
+ void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
52750
+ const local = getMesh2(meshId);
52751
+ if (local && stamp(local)) {
52752
+ const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
52753
+ if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
52754
+ this.invalidateAggregateMeshStatus(meshId);
52755
+ }
52756
+ }).catch(() => {
52757
+ });
52758
+ }
52688
52759
  tombstoneRemovedInlineMeshNode(meshId, nodeId) {
52689
52760
  if (!nodeId) return;
52690
52761
  let set = this.removedInlineMeshNodeIds.get(meshId);