adhdev 0.8.95 → 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/cli/index.js CHANGED
@@ -12262,6 +12262,28 @@ __export(provider_cli_adapter_exports, {
12262
12262
  ProviderCliAdapter: () => ProviderCliAdapter,
12263
12263
  normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
12264
12264
  });
12265
+ function normalizeComparableTranscriptText(value) {
12266
+ return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
12267
+ }
12268
+ function parsedTranscriptIsRicherThanCommitted(parsedMessages, committedMessages) {
12269
+ if (!Array.isArray(parsedMessages) || !Array.isArray(committedMessages)) return false;
12270
+ if (parsedMessages.length > committedMessages.length) return true;
12271
+ if (parsedMessages.length !== committedMessages.length) return false;
12272
+ for (let index = 0; index < parsedMessages.length; index += 1) {
12273
+ const parsed = parsedMessages[index];
12274
+ const committed = committedMessages[index];
12275
+ if (!parsed || !committed) return false;
12276
+ if ((parsed.role || "") !== (committed.role || "")) return false;
12277
+ if (parsed.id && committed.id && String(parsed.id) !== String(committed.id)) return false;
12278
+ if (typeof parsed.index === "number" && typeof committed.index === "number" && parsed.index !== committed.index) return false;
12279
+ const parsedText = normalizeComparableTranscriptText(parsed.content);
12280
+ const committedText = normalizeComparableTranscriptText(committed.content);
12281
+ if (!parsedText || !committedText || parsedText === committedText) continue;
12282
+ if (parsedText.length > committedText.length && parsedText.startsWith(committedText)) return true;
12283
+ return false;
12284
+ }
12285
+ return false;
12286
+ }
12265
12287
  var os13, ProviderCliAdapter;
12266
12288
  var init_provider_cli_adapter = __esm({
12267
12289
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
@@ -13589,7 +13611,7 @@ var init_provider_cli_adapter = __esm({
13589
13611
  }));
13590
13612
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
13591
13613
  const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
13592
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
13614
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
13593
13615
  if (shouldAdoptParsedIdleReplay) {
13594
13616
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
13595
13617
  committedMessages: this.committedMessages,
@@ -14467,6 +14489,8 @@ var init_cli_provider_instance = __esm({
14467
14489
  generatingDebounceTimer = null;
14468
14490
  generatingDebouncePending = null;
14469
14491
  lastApprovalEventAt = 0;
14492
+ autoApproveBusy = false;
14493
+ autoApproveBusyTimer = null;
14470
14494
  controlValues = {};
14471
14495
  summaryMetadata = void 0;
14472
14496
  appliedEffectKeys = /* @__PURE__ */ new Set();
@@ -14758,7 +14782,13 @@ var init_cli_provider_instance = __esm({
14758
14782
  const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
14759
14783
  const rawStatus = adapterStatus.status;
14760
14784
  const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
14761
- if (autoApproveActive) {
14785
+ if (autoApproveActive && !this.autoApproveBusy) {
14786
+ this.autoApproveBusy = true;
14787
+ if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
14788
+ this.autoApproveBusyTimer = setTimeout(() => {
14789
+ this.autoApproveBusy = false;
14790
+ this.autoApproveBusyTimer = null;
14791
+ }, 2e3);
14762
14792
  const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(adapterStatus.activeModal?.buttons, this.provider);
14763
14793
  this.recordAutoApproval(adapterStatus.activeModal?.message, buttonLabel, now);
14764
14794
  setTimeout(() => {
@@ -15124,7 +15154,7 @@ ${effect.notification.body || ""}`.trim();
15124
15154
  const rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
15125
15155
  if (!rebuilt) return false;
15126
15156
  this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
15127
- const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
15157
+ const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
15128
15158
  this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
15129
15159
  role: message.role,
15130
15160
  content: message.content,
@@ -15141,7 +15171,7 @@ ${effect.notification.body || ""}`.trim();
15141
15171
  if (!this.providerSessionId) return;
15142
15172
  this.syncCanonicalHermesSavedHistoryIfNeeded();
15143
15173
  this.historyWriter.compactHistorySession(this.type, this.providerSessionId);
15144
- const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
15174
+ const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
15145
15175
  this.historyWriter.seedSessionHistory(
15146
15176
  this.type,
15147
15177
  restoredHistory.messages,
@@ -86802,7 +86832,7 @@ var init_adhdev_daemon = __esm({
86802
86832
  init_version();
86803
86833
  init_src();
86804
86834
  init_runtime_defaults();
86805
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.95" });
86835
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.97" });
86806
86836
  AdhdevDaemon = class _AdhdevDaemon {
86807
86837
  localHttpServer = null;
86808
86838
  localWss = null;