@adhdev/daemon-core 0.8.96 → 0.8.98

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.mjs CHANGED
@@ -1756,6 +1756,7 @@ var init_provider_cli_config = __esm({
1756
1756
  // src/cli-adapters/provider-cli-runtime.ts
1757
1757
  import * as os9 from "os";
1758
1758
  import * as path10 from "path";
1759
+ import { DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS } from "@adhdev/session-host-core";
1759
1760
  function resolveCliSpawnPlan(options) {
1760
1761
  const { provider, runtimeSettings, workingDir, extraArgs } = options;
1761
1762
  const { spawn: spawnConfig } = provider;
@@ -1789,8 +1790,8 @@ function resolveCliSpawnPlan(options) {
1789
1790
  isWin,
1790
1791
  useShell,
1791
1792
  ptyOptions: {
1792
- cols: 80,
1793
- rows: 24,
1793
+ cols: DEFAULT_SESSION_HOST_COLS,
1794
+ rows: DEFAULT_SESSION_HOST_ROWS,
1794
1795
  cwd: workingDir,
1795
1796
  env: buildCliSpawnEnv(process.env, spawnConfig.env)
1796
1797
  }
@@ -1855,6 +1856,28 @@ __export(provider_cli_adapter_exports, {
1855
1856
  normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
1856
1857
  });
1857
1858
  import * as os10 from "os";
1859
+ function normalizeComparableTranscriptText(value) {
1860
+ return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
1861
+ }
1862
+ function parsedTranscriptIsRicherThanCommitted(parsedMessages, committedMessages) {
1863
+ if (!Array.isArray(parsedMessages) || !Array.isArray(committedMessages)) return false;
1864
+ if (parsedMessages.length > committedMessages.length) return true;
1865
+ if (parsedMessages.length !== committedMessages.length) return false;
1866
+ for (let index = 0; index < parsedMessages.length; index += 1) {
1867
+ const parsed = parsedMessages[index];
1868
+ const committed = committedMessages[index];
1869
+ if (!parsed || !committed) return false;
1870
+ if ((parsed.role || "") !== (committed.role || "")) return false;
1871
+ if (parsed.id && committed.id && String(parsed.id) !== String(committed.id)) return false;
1872
+ if (typeof parsed.index === "number" && typeof committed.index === "number" && parsed.index !== committed.index) return false;
1873
+ const parsedText = normalizeComparableTranscriptText(parsed.content);
1874
+ const committedText = normalizeComparableTranscriptText(committed.content);
1875
+ if (!parsedText || !committedText || parsedText === committedText) continue;
1876
+ if (parsedText.length > committedText.length && parsedText.startsWith(committedText)) return true;
1877
+ return false;
1878
+ }
1879
+ return false;
1880
+ }
1858
1881
  var ProviderCliAdapter;
1859
1882
  var init_provider_cli_adapter = __esm({
1860
1883
  "src/cli-adapters/provider-cli-adapter.ts"() {
@@ -3181,7 +3204,7 @@ var init_provider_cli_adapter = __esm({
3181
3204
  }));
3182
3205
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
3183
3206
  const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
3184
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
3207
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
3185
3208
  if (shouldAdoptParsedIdleReplay) {
3186
3209
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
3187
3210
  committedMessages: this.committedMessages,
@@ -12545,6 +12568,8 @@ var CliProviderInstance = class {
12545
12568
  generatingDebounceTimer = null;
12546
12569
  generatingDebouncePending = null;
12547
12570
  lastApprovalEventAt = 0;
12571
+ autoApproveBusy = false;
12572
+ autoApproveBusyTimer = null;
12548
12573
  controlValues = {};
12549
12574
  summaryMetadata = void 0;
12550
12575
  appliedEffectKeys = /* @__PURE__ */ new Set();
@@ -12836,7 +12861,13 @@ var CliProviderInstance = class {
12836
12861
  const parsedStatus = this.adapter.getScriptParsedStatus?.() || null;
12837
12862
  const rawStatus = adapterStatus.status;
12838
12863
  const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
12839
- if (autoApproveActive) {
12864
+ if (autoApproveActive && !this.autoApproveBusy) {
12865
+ this.autoApproveBusy = true;
12866
+ if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
12867
+ this.autoApproveBusyTimer = setTimeout(() => {
12868
+ this.autoApproveBusy = false;
12869
+ this.autoApproveBusyTimer = null;
12870
+ }, 2e3);
12840
12871
  const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(adapterStatus.activeModal?.buttons, this.provider);
12841
12872
  this.recordAutoApproval(adapterStatus.activeModal?.message, buttonLabel, now);
12842
12873
  setTimeout(() => {