@adhdev/daemon-standalone 0.8.96 → 0.8.97

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
@@ -29702,6 +29702,28 @@ var require_dist2 = __commonJS({
29702
29702
  ProviderCliAdapter: () => ProviderCliAdapter,
29703
29703
  normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
29704
29704
  });
29705
+ function normalizeComparableTranscriptText(value) {
29706
+ return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
29707
+ }
29708
+ function parsedTranscriptIsRicherThanCommitted(parsedMessages, committedMessages) {
29709
+ if (!Array.isArray(parsedMessages) || !Array.isArray(committedMessages)) return false;
29710
+ if (parsedMessages.length > committedMessages.length) return true;
29711
+ if (parsedMessages.length !== committedMessages.length) return false;
29712
+ for (let index = 0; index < parsedMessages.length; index += 1) {
29713
+ const parsed = parsedMessages[index];
29714
+ const committed = committedMessages[index];
29715
+ if (!parsed || !committed) return false;
29716
+ if ((parsed.role || "") !== (committed.role || "")) return false;
29717
+ if (parsed.id && committed.id && String(parsed.id) !== String(committed.id)) return false;
29718
+ if (typeof parsed.index === "number" && typeof committed.index === "number" && parsed.index !== committed.index) return false;
29719
+ const parsedText = normalizeComparableTranscriptText(parsed.content);
29720
+ const committedText = normalizeComparableTranscriptText(committed.content);
29721
+ if (!parsedText || !committedText || parsedText === committedText) continue;
29722
+ if (parsedText.length > committedText.length && parsedText.startsWith(committedText)) return true;
29723
+ return false;
29724
+ }
29725
+ return false;
29726
+ }
29705
29727
  var os10;
29706
29728
  var ProviderCliAdapter;
29707
29729
  var init_provider_cli_adapter = __esm2({
@@ -31030,7 +31052,7 @@ var require_dist2 = __commonJS({
31030
31052
  }));
31031
31053
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
31032
31054
  const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
31033
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
31055
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
31034
31056
  if (shouldAdoptParsedIdleReplay) {
31035
31057
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
31036
31058
  committedMessages: this.committedMessages,
@@ -40436,6 +40458,8 @@ ${effect.notification.body || ""}`.trim();
40436
40458
  generatingDebounceTimer = null;
40437
40459
  generatingDebouncePending = null;
40438
40460
  lastApprovalEventAt = 0;
40461
+ autoApproveBusy = false;
40462
+ autoApproveBusyTimer = null;
40439
40463
  controlValues = {};
40440
40464
  summaryMetadata = void 0;
40441
40465
  appliedEffectKeys = /* @__PURE__ */ new Set();
@@ -40727,7 +40751,13 @@ ${effect.notification.body || ""}`.trim();
40727
40751
  const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
40728
40752
  const rawStatus = adapterStatus.status;
40729
40753
  const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
40730
- if (autoApproveActive) {
40754
+ if (autoApproveActive && !this.autoApproveBusy) {
40755
+ this.autoApproveBusy = true;
40756
+ if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
40757
+ this.autoApproveBusyTimer = setTimeout(() => {
40758
+ this.autoApproveBusy = false;
40759
+ this.autoApproveBusyTimer = null;
40760
+ }, 2e3);
40731
40761
  const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(adapterStatus.activeModal?.buttons, this.provider);
40732
40762
  this.recordAutoApproval(adapterStatus.activeModal?.message, buttonLabel, now);
40733
40763
  setTimeout(() => {