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/index.js CHANGED
@@ -11321,6 +11321,28 @@ __export(provider_cli_adapter_exports, {
11321
11321
  ProviderCliAdapter: () => ProviderCliAdapter,
11322
11322
  normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
11323
11323
  });
11324
+ function normalizeComparableTranscriptText(value) {
11325
+ return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
11326
+ }
11327
+ function parsedTranscriptIsRicherThanCommitted(parsedMessages, committedMessages) {
11328
+ if (!Array.isArray(parsedMessages) || !Array.isArray(committedMessages)) return false;
11329
+ if (parsedMessages.length > committedMessages.length) return true;
11330
+ if (parsedMessages.length !== committedMessages.length) return false;
11331
+ for (let index = 0; index < parsedMessages.length; index += 1) {
11332
+ const parsed = parsedMessages[index];
11333
+ const committed = committedMessages[index];
11334
+ if (!parsed || !committed) return false;
11335
+ if ((parsed.role || "") !== (committed.role || "")) return false;
11336
+ if (parsed.id && committed.id && String(parsed.id) !== String(committed.id)) return false;
11337
+ if (typeof parsed.index === "number" && typeof committed.index === "number" && parsed.index !== committed.index) return false;
11338
+ const parsedText = normalizeComparableTranscriptText(parsed.content);
11339
+ const committedText = normalizeComparableTranscriptText(committed.content);
11340
+ if (!parsedText || !committedText || parsedText === committedText) continue;
11341
+ if (parsedText.length > committedText.length && parsedText.startsWith(committedText)) return true;
11342
+ return false;
11343
+ }
11344
+ return false;
11345
+ }
11324
11346
  var os12, ProviderCliAdapter;
11325
11347
  var init_provider_cli_adapter = __esm({
11326
11348
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
@@ -12648,7 +12670,7 @@ var init_provider_cli_adapter = __esm({
12648
12670
  }));
12649
12671
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
12650
12672
  const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
12651
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
12673
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
12652
12674
  if (shouldAdoptParsedIdleReplay) {
12653
12675
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
12654
12676
  committedMessages: this.committedMessages,
@@ -13526,6 +13548,8 @@ var init_cli_provider_instance = __esm({
13526
13548
  generatingDebounceTimer = null;
13527
13549
  generatingDebouncePending = null;
13528
13550
  lastApprovalEventAt = 0;
13551
+ autoApproveBusy = false;
13552
+ autoApproveBusyTimer = null;
13529
13553
  controlValues = {};
13530
13554
  summaryMetadata = void 0;
13531
13555
  appliedEffectKeys = /* @__PURE__ */ new Set();
@@ -13817,7 +13841,13 @@ var init_cli_provider_instance = __esm({
13817
13841
  const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
13818
13842
  const rawStatus = adapterStatus.status;
13819
13843
  const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
13820
- if (autoApproveActive) {
13844
+ if (autoApproveActive && !this.autoApproveBusy) {
13845
+ this.autoApproveBusy = true;
13846
+ if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
13847
+ this.autoApproveBusyTimer = setTimeout(() => {
13848
+ this.autoApproveBusy = false;
13849
+ this.autoApproveBusyTimer = null;
13850
+ }, 2e3);
13821
13851
  const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(adapterStatus.activeModal?.buttons, this.provider);
13822
13852
  this.recordAutoApproval(adapterStatus.activeModal?.message, buttonLabel, now);
13823
13853
  setTimeout(() => {
@@ -14183,7 +14213,7 @@ ${effect.notification.body || ""}`.trim();
14183
14213
  const rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
14184
14214
  if (!rebuilt) return false;
14185
14215
  this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
14186
- const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
14216
+ const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
14187
14217
  this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
14188
14218
  role: message.role,
14189
14219
  content: message.content,
@@ -14200,7 +14230,7 @@ ${effect.notification.body || ""}`.trim();
14200
14230
  if (!this.providerSessionId) return;
14201
14231
  this.syncCanonicalHermesSavedHistoryIfNeeded();
14202
14232
  this.historyWriter.compactHistorySession(this.type, this.providerSessionId);
14203
- const restoredHistory = readChatHistory(this.type, 0, 200, this.providerSessionId);
14233
+ const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
14204
14234
  this.historyWriter.seedSessionHistory(
14205
14235
  this.type,
14206
14236
  restoredHistory.messages,
@@ -55097,7 +55127,7 @@ var init_adhdev_daemon = __esm({
55097
55127
  init_version();
55098
55128
  init_src();
55099
55129
  init_runtime_defaults();
55100
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.95" });
55130
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.97" });
55101
55131
  AdhdevDaemon = class _AdhdevDaemon {
55102
55132
  localHttpServer = null;
55103
55133
  localWss = null;