@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.mjs CHANGED
@@ -28910,6 +28910,12 @@ var SpecDriver = class {
28910
28910
  completionIdleKey = "";
28911
28911
  /** Previous screen lines — passed to evaluate() for `changed` condition detection. */
28912
28912
  prevScreenLines = [];
28913
+ /** Timestamp when idle was last committed (either direct or via idle_hold_ms).
28914
+ * Used to suppress immediate idle → busy re-entry from transient `changed`
28915
+ * condition blips (e.g. completion-marker counter "Completed for Xs" updating
28916
+ * every second, which triggers cursor_above:changed and bounces back to busy
28917
+ * right after an idle commit). */
28918
+ lastIdleCommittedAt = 0;
28913
28919
  /** Timestamp of the last PTY frame that changed the screen content.
28914
28920
  * Used by screen_active_hold_ms to suppress idle downshifts while
28915
28921
  * the terminal is still actively updating. */
@@ -28964,6 +28970,7 @@ var SpecDriver = class {
28964
28970
  this.adapter.resize(cmd.cols, cmd.rows);
28965
28971
  return;
28966
28972
  case "cancel":
28973
+ this.lastIdleCommittedAt = 0;
28967
28974
  this.adapter.send_keys("");
28968
28975
  return;
28969
28976
  case "shutdown":
@@ -29188,6 +29195,12 @@ var SpecDriver = class {
29188
29195
  if (screenIsActive && this.currentStateId === "busy" && evState.id === (this.spec.default_state ?? "idle")) {
29189
29196
  evState = this.lastBusyState ?? evState;
29190
29197
  }
29198
+ const idleReentryHoldMs = Math.max(screenActiveMs, 1500);
29199
+ if (evState.id === "busy" && this.currentStateId === (this.spec.default_state ?? "idle") && this.lastIdleCommittedAt > 0 && now - this.lastIdleCommittedAt < idleReentryHoldMs) {
29200
+ LOG.debug("SpecDriver", `[${this.opts.specPath.split("/").slice(-3).join("/")}] idle\u2192busy suppressed (idle_reentry_hold ageMs=${now - this.lastIdleCommittedAt} holdMs=${idleReentryHoldMs})`);
29201
+ this.scheduleBusyExpiry(idleReentryHoldMs - (now - this.lastIdleCommittedAt) + 50);
29202
+ return;
29203
+ }
29191
29204
  if (evState.id === "busy") {
29192
29205
  this.lastBusyAt = Date.now();
29193
29206
  this.lastBusyState = evState;
@@ -29223,6 +29236,7 @@ var SpecDriver = class {
29223
29236
  this.pendingIdleState = null;
29224
29237
  if (!committed) return;
29225
29238
  LOG.debug("SpecDriver", `[${this.opts.specPath.split("/").slice(-3).join("/")}] idleHold committed after ${idleHoldMs}ms`);
29239
+ this.lastIdleCommittedAt = Date.now();
29226
29240
  this.currentStateId = committed.id;
29227
29241
  this.currentEval = capturedEv;
29228
29242
  this.pushHistory(committed.id, committed.label, {
@@ -29265,6 +29279,9 @@ var SpecDriver = class {
29265
29279
  }
29266
29280
  }
29267
29281
  if (changed) {
29282
+ if (evState.id === (this.spec.default_state ?? "idle")) {
29283
+ this.lastIdleCommittedAt = Date.now();
29284
+ }
29268
29285
  this.currentStateId = evState.id;
29269
29286
  const matchedRules = extractMatchedRules(ev);
29270
29287
  let transitionReason;
@@ -29332,6 +29349,7 @@ var SpecDriver = class {
29332
29349
  this.pendingSends.push(text);
29333
29350
  return;
29334
29351
  }
29352
+ this.lastIdleCommittedAt = 0;
29335
29353
  this.actuallySendMessage(text);
29336
29354
  }
29337
29355
  actuallySendMessage(text) {