@adhdev/daemon-standalone 1.0.49-rc.6 → 1.0.49-rc.8

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
@@ -37056,10 +37056,10 @@ var require_dist3 = __commonJS({
37056
37056
  }
37057
37057
  function getDaemonBuildInfo() {
37058
37058
  if (cached2) return cached2;
37059
- const commit = readInjected(true ? "21db9be61179f54103c284dc170a085b6ae3537e" : void 0) ?? "unknown";
37060
- const commitShort = readInjected(true ? "21db9be6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
37061
- const version2 = readInjected(true ? "1.0.49-rc.6" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
37062
- const builtAt = readInjected(true ? "2026-08-14T14:46:33.356Z" : void 0);
37059
+ const commit = readInjected(true ? "b4c4824f7d9b919bc149d6134c2e9720442d677c" : void 0) ?? "unknown";
37060
+ const commitShort = readInjected(true ? "b4c4824f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
37061
+ const version2 = readInjected(true ? "1.0.49-rc.8" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
37062
+ const builtAt = readInjected(true ? "2026-08-14T16:54:52.142Z" : void 0);
37063
37063
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
37064
37064
  return cached2;
37065
37065
  }
@@ -68848,6 +68848,17 @@ ${cleanBody}`;
68848
68848
  return void 0;
68849
68849
  }
68850
68850
  }
68851
+ function localGeneratingLabelIsContradicted(components, sessionId) {
68852
+ try {
68853
+ const probe = resolveLiveTurnPendingEvidence(components, sessionId);
68854
+ if (!probe) return false;
68855
+ if (probe()) return false;
68856
+ LOG2.info("MeshReconcile", `Session ${sessionId} reports FSM status 'generating' but its adapter has no live turn evidence \u2014 treating the label as stale so the early transcript-evidence rescue may evaluate it (the completion arm was likely orphaned by a continuity cancel)`);
68857
+ return true;
68858
+ } catch {
68859
+ return false;
68860
+ }
68861
+ }
68851
68862
  async function evaluateEarlyIdleTranscriptArm(components, mesh, store, row, localDaemonId, selfIds = []) {
68852
68863
  const sessionId = readNonEmptyString(row.assignedSessionId);
68853
68864
  if (!sessionId) return false;
@@ -68863,7 +68874,9 @@ ${cleanBody}`;
68863
68874
  }
68864
68875
  }
68865
68876
  const verdict = resolveSessionBusyVerdict(components, sessionId);
68866
- if (verdict === "GENERATING") return false;
68877
+ if (verdict === "GENERATING" && !localGeneratingLabelIsContradicted(components, sessionId)) {
68878
+ return false;
68879
+ }
68867
68880
  if (verdict === "UNKNOWN") {
68868
68881
  const nodeId = readNonEmptyString(row.assignedNodeId);
68869
68882
  const node = (mesh.nodes ?? []).find((n) => n.id === nodeId);
@@ -97080,6 +97093,8 @@ ${marker}`,
97080
97093
  var CANON_C_MISSING_ASSISTANT_MIN_ELAPSED_MS = 2e4;
97081
97094
  var MISSING_ASSISTANT_TRANSCRIPT_GROWTH_QUIET_MS = 6e4;
97082
97095
  var NATIVE_HISTORY_MESH_IDLE_SETTLE_MS = 4e3;
97096
+ var CANCELLED_COMPLETION_RECHECK_MS = 1500;
97097
+ var CANCELLED_COMPLETION_RECHECK_MAX_ATTEMPTS = 4;
97083
97098
  var PTY_PARSED_FINAL_ASSISTANT_QUIET_DWELL_MS = 1200;
97084
97099
  var ANTIGRAVITY_HOLD_QUIET_DWELL_MS = 3e3;
97085
97100
  var ANTIGRAVITY_HOLD_HARD_CAP_MS = 5 * 6e4;
@@ -98629,6 +98644,64 @@ ${buttons.join("\n")}`;
98629
98644
  host.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
98630
98645
  }
98631
98646
  }
98647
+ init_logger();
98648
+ function armCancelledCompletionRecheck(host, pending, reason) {
98649
+ if (reason === "new_pty_output") return;
98650
+ const now = Date.now();
98651
+ const prior = host.cancelledCompletionRecheck;
98652
+ const carriedPending = prior?.pending ?? pending;
98653
+ const attempts = prior ? prior.attempts : 0;
98654
+ if (attempts >= CANCELLED_COMPLETION_RECHECK_MAX_ATTEMPTS) {
98655
+ clearCancelledCompletionRecheck(host);
98656
+ LOG2.debug("CLI", `[${host.type}] cancelled-completion recheck budget exhausted (${reason}) \u2014 deferring to the next FSM completion edge`);
98657
+ return;
98658
+ }
98659
+ host.cancelledCompletionRecheck = {
98660
+ pending: carriedPending,
98661
+ reason,
98662
+ attempts,
98663
+ firstCancelledAt: prior?.firstCancelledAt ?? now
98664
+ };
98665
+ if (host.cancelledCompletionRecheckTimer) clearTimeout(host.cancelledCompletionRecheckTimer);
98666
+ host.cancelledCompletionRecheckTimer = setTimeout(
98667
+ () => runCancelledCompletionRecheck(host),
98668
+ CANCELLED_COMPLETION_RECHECK_MS
98669
+ );
98670
+ }
98671
+ function clearCancelledCompletionRecheck(host) {
98672
+ if (host.cancelledCompletionRecheckTimer) {
98673
+ clearTimeout(host.cancelledCompletionRecheckTimer);
98674
+ host.cancelledCompletionRecheckTimer = null;
98675
+ }
98676
+ host.cancelledCompletionRecheck = null;
98677
+ }
98678
+ function runCancelledCompletionRecheck(host) {
98679
+ host.cancelledCompletionRecheckTimer = null;
98680
+ const watch3 = host.cancelledCompletionRecheck;
98681
+ if (!watch3) return;
98682
+ if (host.completedDebouncePending) {
98683
+ clearCancelledCompletionRecheck(host);
98684
+ return;
98685
+ }
98686
+ watch3.attempts += 1;
98687
+ LOG2.info("CLI", `[${host.type}] re-checking completion cancelled by ${watch3.reason} (attempt ${watch3.attempts}/${CANCELLED_COMPLETION_RECHECK_MAX_ATTEMPTS}, ${Date.now() - watch3.firstCancelledAt}ms since cancel)`);
98688
+ if (host.completionTraceOn()) host.recordCompletionGateTrace("cancel_recheck", {
98689
+ reason: watch3.reason,
98690
+ attempt: watch3.attempts,
98691
+ sinceCancelMs: Date.now() - watch3.firstCancelledAt,
98692
+ busyEpoch: host.busyEpoch
98693
+ });
98694
+ const lastOutputAt = host.adapter.getStatus({ allowParse: false })?.lastOutputAt;
98695
+ host.completedDebouncePending = {
98696
+ ...watch3.pending,
98697
+ busyEpochAtArm: host.busyEpoch,
98698
+ lastOutputAtArm: typeof lastOutputAt === "number" && Number.isFinite(lastOutputAt) ? lastOutputAt : watch3.pending.lastOutputAtArm
98699
+ };
98700
+ host.flushCompletedDebounceIfFinalized();
98701
+ if (host.cancelledCompletionRecheck === watch3 && host.completedDebouncePending) {
98702
+ clearCancelledCompletionRecheck(host);
98703
+ }
98704
+ }
98632
98705
  init_contracts2();
98633
98706
  var MAX_TRACKED_MESSAGES = 2e3;
98634
98707
  function hasUsableTimestamp(message) {
@@ -99788,11 +99861,20 @@ ${buttons.join("\n")}`;
99788
99861
  clearTimeout(this.autoApproveBusyTimer);
99789
99862
  this.autoApproveBusyTimer = null;
99790
99863
  }
99864
+ this.clearCancelledCompletionRecheck();
99791
99865
  this.appliedEffectKeys.clear();
99792
99866
  closeSqliteProbeCache(this.sqliteProbeCache);
99793
99867
  }
99794
99868
  completedDebounceTimer = null;
99795
99869
  completedDebouncePending = null;
99870
+ /**
99871
+ * (CANCEL-BLIP-ORPHAN) Re-verification watch for an arm the continuity cancel just
99872
+ * deleted — the cancelled arm's snapshot plus a bounded recheck budget, so a
99873
+ * sub-second PTY blip cannot permanently orphan the completion. Full rationale:
99874
+ * completion/cancel-recheck.ts.
99875
+ */
99876
+ cancelledCompletionRecheck = null;
99877
+ cancelledCompletionRecheckTimer = null;
99796
99878
  lastExternalCompletionProbe = null;
99797
99879
  // (NATIVE-TURN-SIGNAL) Terminal markers from the last native transcript read. Refreshed
99798
99880
  // on every completion probe; null when the provider surfaces none.
@@ -100239,6 +100321,17 @@ ${buttons.join("\n")}`;
100239
100321
  if (this.completedDebounceTimer) clearTimeout(this.completedDebounceTimer);
100240
100322
  this.completedDebounceTimer = setTimeout(() => this.flushCompletedDebounceIfFinalized(), delayMs);
100241
100323
  }
100324
+ /**
100325
+ * (CANCEL-BLIP-ORPHAN) Post-cancel completion re-verification. The judgment and its
100326
+ * full rationale live in completion/cancel-recheck.ts; these are the host-dispatched
100327
+ * seams, matching the status-transition / evidence / stall-rescue moves.
100328
+ */
100329
+ armCancelledCompletionRecheck(pending, reason) {
100330
+ armCancelledCompletionRecheck(this, pending, reason);
100331
+ }
100332
+ clearCancelledCompletionRecheck() {
100333
+ clearCancelledCompletionRecheck(this);
100334
+ }
100242
100335
  // EVTTRACE (observation-only): is this a mesh worker session whose completion
100243
100336
  // events must route to a coordinator? Used purely to gate trace logging so a
100244
100337
  // non-mesh CLI session's completions don't add EvtTrace noise. No decision logic.
@@ -100770,6 +100863,7 @@ ${buttons.join("\n")}`;
100770
100863
  if (this.completionTraceOn()) this.recordCompletionGateTrace("cancel", { blockReason: decision.reason, ...decision.trace });
100771
100864
  this.completedDebouncePending = null;
100772
100865
  this.completedDebounceTimer = null;
100866
+ this.armCancelledCompletionRecheck(pending, decision.reason);
100773
100867
  return;
100774
100868
  }
100775
100869
  this.applyCompletionArmPatch(pending, decision.armPatch);
@@ -100827,6 +100921,7 @@ ${buttons.join("\n")}`;
100827
100921
  });
100828
100922
  this.completedDebouncePending = null;
100829
100923
  this.completedDebounceTimer = null;
100924
+ this.clearCancelledCompletionRecheck();
100830
100925
  this.generatingStartedAt = 0;
100831
100926
  this.lastApprovalEventFingerprint = "";
100832
100927
  this.markCurrentTurnStartupGraceCollapseSatisfied();
@@ -100881,6 +100976,7 @@ ${buttons.join("\n")}`;
100881
100976
  });
100882
100977
  this.completedDebouncePending = null;
100883
100978
  this.completedDebounceTimer = null;
100979
+ this.clearCancelledCompletionRecheck();
100884
100980
  this.generatingStartedAt = 0;
100885
100981
  this.lastApprovalEventFingerprint = "";
100886
100982
  this.markCurrentTurnStartupGraceCollapseSatisfied();