@adhdev/daemon-core 0.9.82-rc.385 → 0.9.82-rc.386

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 ? "3aa3e12839017da30b44a64ca6c20f0c9730fae2" : void 0) ?? "unknown";
382
- const commitShort = readInjected(true ? "3aa3e128" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
- const version = readInjected(true ? "0.9.82-rc.385" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
- const builtAt = readInjected(true ? "2026-06-25T16:15:39.207Z" : void 0);
381
+ const commit = readInjected(true ? "fad1d175ca84a75f52bd0c1d88125fbb783ad241" : void 0) ?? "unknown";
382
+ const commitShort = readInjected(true ? "fad1d175" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
383
+ const version = readInjected(true ? "0.9.82-rc.386" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
384
+ const builtAt = readInjected(true ? "2026-06-26T00:12:44.100Z" : void 0);
385
385
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
386
386
  return cached;
387
387
  }
@@ -35833,6 +35833,17 @@ var FsmDriver = class {
35833
35833
  hasIdleHoldPending() {
35834
35834
  return (this.lastFsmEval?.transitions ?? []).some((t) => !t.holdSatisfied && t.condResult);
35835
35835
  }
35836
+ /**
35837
+ * True once the machine has reached its first non-initial idle state (the
35838
+ * prompt is genuinely drawn — see maybeMarkReady). The cli-adapter surfaces
35839
+ * this on its idle status so CliProviderInstance can re-arm the queue-claim
35840
+ * agent:ready on the first genuine ready, independent of the boot-time
35841
+ * starting→idle one-shot (which is consumed too early for specs whose
35842
+ * initial state already reports idle).
35843
+ */
35844
+ hasSeenReady() {
35845
+ return this.readySeenOnce;
35846
+ }
35836
35847
  getCompletionIdleDebounceState() {
35837
35848
  const out = outgoingTransitions(this.spec, this.currentStateId);
35838
35849
  const toReady = this.lastFsmEval?.transitions.find((t, i) => {
@@ -37499,7 +37510,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
37499
37510
  if (state.status === "generating") {
37500
37511
  return { status: "generating", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, ...sessionFields };
37501
37512
  }
37502
- return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, ...sessionFields };
37513
+ return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, fsmReadySeen: this.driver.hasSeenReady?.() ?? false, ...sessionFields };
37503
37514
  }
37504
37515
  maybeRefreshNativeHistory() {
37505
37516
  }
@@ -38544,6 +38555,14 @@ var CliProviderInstance = class _CliProviderInstance {
38544
38555
  context = null;
38545
38556
  events = [];
38546
38557
  lastStatus = "starting";
38558
+ // Idempotency guard for the queue-claim agent:ready event. agent:ready is the
38559
+ // sole signal the mesh coordinator's tryAssignQueueTask waits on to hand a
38560
+ // queued task to this worker. It is emitted in two places: the boot-time
38561
+ // starting→idle one-shot, and the readySeen re-arm below. This flag makes the
38562
+ // event fire AT MOST ONCE per session so a worker is never claimed twice and a
38563
+ // queued task is never double-dispatched/double-injected. Whichever path fires
38564
+ // first sets it; the other becomes a no-op.
38565
+ agentReadyEmitted = false;
38547
38566
  generatingStartedAt = 0;
38548
38567
  settings = {};
38549
38568
  monitor;
@@ -39624,6 +39643,17 @@ var CliProviderInstance = class _CliProviderInstance {
39624
39643
  } catch {
39625
39644
  }
39626
39645
  }
39646
+ /**
39647
+ * Emit the queue-claim agent:ready event at most once per session. Both the
39648
+ * boot-time starting→idle one-shot and the fsmReadySeen re-arm call this; the
39649
+ * agentReadyEmitted guard ensures the second caller is a no-op so a worker is
39650
+ * never claimed twice and a queued task is never double-dispatched.
39651
+ */
39652
+ emitAgentReadyOnce(chatTitle, now) {
39653
+ if (this.agentReadyEmitted) return;
39654
+ this.agentReadyEmitted = true;
39655
+ this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
39656
+ }
39627
39657
  detectStatusTransition() {
39628
39658
  const now = Date.now();
39629
39659
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
@@ -39776,7 +39806,7 @@ var CliProviderInstance = class _CliProviderInstance {
39776
39806
  this.scheduleCompletedDebounceFlush(flushDelay);
39777
39807
  }
39778
39808
  } else if (newStatus === "idle" && this.lastStatus === "starting") {
39779
- this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
39809
+ this.emitAgentReadyOnce(chatTitle, now);
39780
39810
  } else if (newStatus === "error") {
39781
39811
  if (this.generatingDebounceTimer) {
39782
39812
  clearTimeout(this.generatingDebounceTimer);
@@ -39815,6 +39845,9 @@ var CliProviderInstance = class _CliProviderInstance {
39815
39845
  }
39816
39846
  this.lastStatus = newStatus;
39817
39847
  }
39848
+ if (newStatus === "idle" && adapterStatus.fsmReadySeen === true && !this.agentReadyEmitted) {
39849
+ this.emitAgentReadyOnce(chatTitle, now);
39850
+ }
39818
39851
  this.applyProviderResponse(parsedStatus, {
39819
39852
  phase: newStatus === "idle" && (previousStatus === "generating" || previousStatus === "waiting_approval") ? "turn_completed" : "immediate"
39820
39853
  });