@adhdev/daemon-core 0.9.82-rc.214 → 0.9.82-rc.215

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
@@ -29243,6 +29243,12 @@ var SpecDriver = class {
29243
29243
  completionIdleKey = "";
29244
29244
  /** Previous screen lines — passed to evaluate() for `changed` condition detection. */
29245
29245
  prevScreenLines = [];
29246
+ /** Timestamp when idle was last committed (either direct or via idle_hold_ms).
29247
+ * Used to suppress immediate idle → busy re-entry from transient `changed`
29248
+ * condition blips (e.g. completion-marker counter "Completed for Xs" updating
29249
+ * every second, which triggers cursor_above:changed and bounces back to busy
29250
+ * right after an idle commit). */
29251
+ lastIdleCommittedAt = 0;
29246
29252
  /** Timestamp of the last PTY frame that changed the screen content.
29247
29253
  * Used by screen_active_hold_ms to suppress idle downshifts while
29248
29254
  * the terminal is still actively updating. */
@@ -29297,6 +29303,7 @@ var SpecDriver = class {
29297
29303
  this.adapter.resize(cmd.cols, cmd.rows);
29298
29304
  return;
29299
29305
  case "cancel":
29306
+ this.lastIdleCommittedAt = 0;
29300
29307
  this.adapter.send_keys("");
29301
29308
  return;
29302
29309
  case "shutdown":
@@ -29521,6 +29528,12 @@ var SpecDriver = class {
29521
29528
  if (screenIsActive && this.currentStateId === "busy" && evState.id === (this.spec.default_state ?? "idle")) {
29522
29529
  evState = this.lastBusyState ?? evState;
29523
29530
  }
29531
+ const idleReentryHoldMs = Math.max(screenActiveMs, 1500);
29532
+ if (evState.id === "busy" && this.currentStateId === (this.spec.default_state ?? "idle") && this.lastIdleCommittedAt > 0 && now - this.lastIdleCommittedAt < idleReentryHoldMs) {
29533
+ LOG.debug("SpecDriver", `[${this.opts.specPath.split("/").slice(-3).join("/")}] idle\u2192busy suppressed (idle_reentry_hold ageMs=${now - this.lastIdleCommittedAt} holdMs=${idleReentryHoldMs})`);
29534
+ this.scheduleBusyExpiry(idleReentryHoldMs - (now - this.lastIdleCommittedAt) + 50);
29535
+ return;
29536
+ }
29524
29537
  if (evState.id === "busy") {
29525
29538
  this.lastBusyAt = Date.now();
29526
29539
  this.lastBusyState = evState;
@@ -29556,6 +29569,7 @@ var SpecDriver = class {
29556
29569
  this.pendingIdleState = null;
29557
29570
  if (!committed) return;
29558
29571
  LOG.debug("SpecDriver", `[${this.opts.specPath.split("/").slice(-3).join("/")}] idleHold committed after ${idleHoldMs}ms`);
29572
+ this.lastIdleCommittedAt = Date.now();
29559
29573
  this.currentStateId = committed.id;
29560
29574
  this.currentEval = capturedEv;
29561
29575
  this.pushHistory(committed.id, committed.label, {
@@ -29598,6 +29612,9 @@ var SpecDriver = class {
29598
29612
  }
29599
29613
  }
29600
29614
  if (changed) {
29615
+ if (evState.id === (this.spec.default_state ?? "idle")) {
29616
+ this.lastIdleCommittedAt = Date.now();
29617
+ }
29601
29618
  this.currentStateId = evState.id;
29602
29619
  const matchedRules = extractMatchedRules(ev);
29603
29620
  let transitionReason;
@@ -29665,6 +29682,7 @@ var SpecDriver = class {
29665
29682
  this.pendingSends.push(text);
29666
29683
  return;
29667
29684
  }
29685
+ this.lastIdleCommittedAt = 0;
29668
29686
  this.actuallySendMessage(text);
29669
29687
  }
29670
29688
  actuallySendMessage(text) {