@adhdev/daemon-core 0.9.82-rc.404 → 0.9.82-rc.406

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.
@@ -59,6 +59,7 @@ export declare class CliStateEngine {
59
59
  isWaitingForResponse: boolean;
60
60
  currentTurnScope: TurnParseScope | null;
61
61
  currentTurnTaskId: string | null;
62
+ currentTurnStartedAt: number;
62
63
  activeModal: {
63
64
  message: string;
64
65
  buttons: string[];
@@ -231,6 +231,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
231
231
  get currentTurnScope(): TurnParseScope | null;
232
232
  set currentTurnScope(v: TurnParseScope | null);
233
233
  get currentTurnTaskId(): string | null;
234
+ get currentTurnStartedAt(): number;
234
235
  get responseEpoch(): number;
235
236
  set responseEpoch(v: number);
236
237
  get submitRetryUsed(): boolean;
package/dist/index.js CHANGED
@@ -399,10 +399,10 @@ function readInjected(value) {
399
399
  }
400
400
  function getDaemonBuildInfo() {
401
401
  if (cached) return cached;
402
- const commit = readInjected(true ? "056bddcd4112e4c90d82fdaab60557ccc7acf2a3" : void 0) ?? "unknown";
403
- const commitShort = readInjected(true ? "056bddcd" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
404
- const version = readInjected(true ? "0.9.82-rc.404" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
405
- const builtAt = readInjected(true ? "2026-06-27T19:00:01.532Z" : void 0);
402
+ const commit = readInjected(true ? "1a663e37a08bce5e83cc14be4663d33ad60e81c9" : void 0) ?? "unknown";
403
+ const commitShort = readInjected(true ? "1a663e37" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
404
+ const version = readInjected(true ? "0.9.82-rc.406" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
405
+ const builtAt = readInjected(true ? "2026-06-28T04:52:22.784Z" : void 0);
406
406
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
407
407
  return cached;
408
408
  }
@@ -19664,6 +19664,13 @@ var init_cli_state_engine = __esm({
19664
19664
  // queued in pendingOutbound and only flushed asynchronously after idle), so the
19665
19665
  // completion event carries the correct id instead of the racy session scalar.
19666
19666
  currentTurnTaskId = null;
19667
+ // GENERATING-BOUNDARY (R4d): wall-clock when the most recently STARTED turn began
19668
+ // (set by onTurnStarted, persists past completion until the next turn starts).
19669
+ // The startup-grace idle-stayed synthesis anchors its window on when the FIRST turn
19670
+ // STARTED — not on when it finished — so a turn dispatched a few seconds after the
19671
+ // grace collapse and then running for a non-trivial duration is still attributed to
19672
+ // the startup collapse even though its COMPLETION lands past a now-anchored window.
19673
+ currentTurnStartedAt = 0;
19667
19674
  activeModal = null;
19668
19675
  // ── Approval ─────────────────────────────────────
19669
19676
  lastApprovalResolvedAt = 0;
@@ -19774,6 +19781,7 @@ var init_cli_state_engine = __esm({
19774
19781
  this.clearIdleFinishCandidate("send_message");
19775
19782
  this.currentTurnScope = turnScope;
19776
19783
  this.currentTurnTaskId = typeof turnScope.taskId === "string" && turnScope.taskId.trim() ? turnScope.taskId : null;
19784
+ this.currentTurnStartedAt = Date.now();
19777
19785
  this.responseEpoch += 1;
19778
19786
  }
19779
19787
  /** Called when PTY exits */
@@ -22252,6 +22260,13 @@ ${lastSnapshot}`;
22252
22260
  get currentTurnTaskId() {
22253
22261
  return this.engine.currentTurnTaskId;
22254
22262
  }
22263
+ // R4d: wall-clock when the most recently started turn began (persists past settle).
22264
+ // The provider instance's startup-grace idle-stayed synthesis anchors its window on
22265
+ // this so a delayed-dispatch first turn whose duration overruns the now-anchored
22266
+ // window is still attributed to the startup collapse.
22267
+ get currentTurnStartedAt() {
22268
+ return this.engine.currentTurnStartedAt;
22269
+ }
22255
22270
  get responseEpoch() {
22256
22271
  return this.engine.responseEpoch;
22257
22272
  }
@@ -39964,6 +39979,16 @@ var CliProviderInstance = class _CliProviderInstance {
39964
39979
  // steadily while the session sits idle, so this guard makes the synthesis fire
39965
39980
  // AT MOST ONCE per collapsed turn.
39966
39981
  fastCollapseSynthesizedTaskId = null;
39982
+ // GENERATING-BOUNDARY (R4c): the wall-clock moment the FSM's starting→idle
39983
+ // startup-grace collapse was observed (set ONCE, on the first starting→idle
39984
+ // transition this boot). The idle-stayed collapse window is anchored on THIS,
39985
+ // not on instance/boot time (this.startedAt): the FSM spends the full 8s
39986
+ // startup-grace sitting in 'starting' before collapsing, and a turn can be
39987
+ // dispatched a few seconds AFTER the collapse — measuring the window from boot
39988
+ // would have it already closed by the time that turn lands+completes (the live
39989
+ // R4b miss: collapse at boot+8s, dispatch at boot+12.4s > the 12s boot window).
39990
+ // Anchoring on the collapse moment makes the window cover dispatch-delay+turn.
39991
+ startupGraceCollapseAt = null;
39967
39992
  settings = {};
39968
39993
  monitor;
39969
39994
  generatingDebounceTimer = null;
@@ -41315,6 +41340,7 @@ var CliProviderInstance = class _CliProviderInstance {
41315
41340
  }
41316
41341
  } else if (newStatus === "idle" && this.lastStatus === "starting") {
41317
41342
  this.emitAgentReadyOnce(chatTitle, now);
41343
+ if (this.startupGraceCollapseAt === null) this.startupGraceCollapseAt = now;
41318
41344
  this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_fast_collapse");
41319
41345
  } else if (newStatus === "error") {
41320
41346
  if (this.generatingDebounceTimer) {
@@ -41354,7 +41380,11 @@ var CliProviderInstance = class _CliProviderInstance {
41354
41380
  }
41355
41381
  this.lastStatus = newStatus;
41356
41382
  }
41357
- if (newStatus === "idle" && previousStatus === "idle" && now - this.startedAt < STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS) {
41383
+ const firstTurnStartedAt = typeof this.adapter?.currentTurnStartedAt === "number" ? this.adapter.currentTurnStartedAt : 0;
41384
+ const collapsedAt = this.startupGraceCollapseAt;
41385
+ const turnStartedWithinCollapseWindow = collapsedAt !== null && firstTurnStartedAt > 0 && firstTurnStartedAt >= collapsedAt && firstTurnStartedAt - collapsedAt < STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS;
41386
+ const nowWithinCollapseWindow = collapsedAt !== null && now - collapsedAt < STARTUP_GRACE_IDLE_COLLAPSE_WINDOW_MS;
41387
+ if (newStatus === "idle" && previousStatus === "idle" && (turnStartedWithinCollapseWindow || nowWithinCollapseWindow)) {
41358
41388
  this.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_idle_turn_collapse");
41359
41389
  }
41360
41390
  if (newStatus === "idle" && adapterStatus.fsmReadySeen === true && !this.agentReadyEmitted) {