adhdev 0.8.90 → 0.8.92

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
@@ -7830,10 +7830,11 @@ async function handleReadChat(h, args) {
7830
7830
  const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
7831
7831
  const adapterStatus = adapter.getStatus();
7832
7832
  const shouldPreferAdapterMessages = Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
7833
+ const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
7833
7834
  const status = parsedRecord ? {
7834
7835
  ...parsedRecord,
7835
7836
  messages: shouldPreferAdapterMessages ? adapterStatus.messages : parsedRecord.messages,
7836
- status: adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
7837
+ status: parsedShowsApproval ? parsedRecord.status : adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
7837
7838
  activeModal: parsedRecord.activeModal || adapterStatus.activeModal
7838
7839
  } : adapterStatus;
7839
7840
  const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
@@ -12255,8 +12256,10 @@ var init_provider_cli_adapter = __esm({
12255
12256
  accumulatedRawBuffer = "";
12256
12257
  /** Current visible terminal screen snapshot */
12257
12258
  terminalScreen = new TerminalScreen(24, 80);
12258
- /** Max accumulated buffer size (last 50KB) */
12259
- static MAX_ACCUMULATED_BUFFER = 5e4;
12259
+ /** Max accumulated buffer size. Sized to comfortably hold a single long
12260
+ * Hermes turn (tool calls + reasoning + final bubble) without the
12261
+ * rolling window pushing the turn's ╭─ opening line out of view. */
12262
+ static MAX_ACCUMULATED_BUFFER = 262144;
12260
12263
  currentTurnScope = null;
12261
12264
  traceEntries = [];
12262
12265
  traceSeq = 0;
@@ -12538,8 +12541,20 @@ var init_provider_cli_adapter = __esm({
12538
12541
  }
12539
12542
  }
12540
12543
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
12544
+ const prevAccumulatedLen = this.accumulatedBuffer.length;
12545
+ const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
12541
12546
  this.accumulatedBuffer = (this.accumulatedBuffer + cleanData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
12542
12547
  this.accumulatedRawBuffer = (this.accumulatedRawBuffer + rawData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
12548
+ if (this.currentTurnScope) {
12549
+ const droppedClean = prevAccumulatedLen + cleanData.length - this.accumulatedBuffer.length;
12550
+ const droppedRaw = prevAccumulatedRawLen + rawData.length - this.accumulatedRawBuffer.length;
12551
+ if (droppedClean > 0) {
12552
+ this.currentTurnScope.bufferStart = Math.max(0, this.currentTurnScope.bufferStart - droppedClean);
12553
+ }
12554
+ if (droppedRaw > 0) {
12555
+ this.currentTurnScope.rawBufferStart = Math.max(0, this.currentTurnScope.rawBufferStart - droppedRaw);
12556
+ }
12557
+ }
12543
12558
  this.resolveStartupState("output");
12544
12559
  this.scheduleSettle();
12545
12560
  }
@@ -12848,14 +12863,15 @@ var init_provider_cli_adapter = __esm({
12848
12863
  return;
12849
12864
  }
12850
12865
  const startupModal = this.getStartupConfirmationModal(screenText);
12851
- const modal = this.runParseApproval(tail) || startupModal;
12852
- const rawScriptStatus = this.runDetectStatus(tail);
12853
- const scriptStatus = startupModal ? "waiting_approval" : rawScriptStatus;
12854
12866
  const parsedTranscript = this.parseCurrentTranscript(
12855
12867
  this.committedMessages,
12856
12868
  this.responseBuffer,
12857
12869
  this.currentTurnScope
12858
12870
  );
12871
+ const parsedModal = parsedTranscript?.activeModal && Array.isArray(parsedTranscript.activeModal.buttons) && parsedTranscript.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsedTranscript.activeModal : null;
12872
+ const modal = this.runParseApproval(tail) || parsedModal || startupModal;
12873
+ const rawScriptStatus = this.runDetectStatus(tail);
12874
+ const scriptStatus = startupModal ? "waiting_approval" : parsedModal && parsedTranscript?.status === "waiting_approval" ? "waiting_approval" : rawScriptStatus;
12859
12875
  const parsedMessages = Array.isArray(parsedTranscript?.messages) ? normalizeCliParsedMessages(parsedTranscript.messages, {
12860
12876
  committedMessages: this.committedMessages,
12861
12877
  scope: this.currentTurnScope,
@@ -12865,6 +12881,7 @@ var init_provider_cli_adapter = __esm({
12865
12881
  return;
12866
12882
  }
12867
12883
  const lastParsedAssistant = [...parsedMessages].reverse().find((message) => message.role === "assistant");
12884
+ const parsedShowsLiveAssistantProgress = parsedTranscript?.status === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
12868
12885
  const normalizedPromptSnippet = normalizePromptText(this.submitRetryPromptSnippet || this.currentTurnScope?.prompt || "");
12869
12886
  this.recordTrace("settled", {
12870
12887
  tail: summarizeCliTraceText(tail, 500),
@@ -13019,7 +13036,7 @@ var init_provider_cli_adapter = __esm({
13019
13036
  const effectiveScreenText = screenText || this.accumulatedBuffer;
13020
13037
  const noActiveTurn = !this.currentTurnScope;
13021
13038
  const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText) || /accept edits on/i.test(effectiveScreenText) && (/Update available!/i.test(screenText) || /\/effort/i.test(screenText) || /^.*➜\s+\S+/m.test(effectiveScreenText));
13022
- if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome) {
13039
+ if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
13023
13040
  return;
13024
13041
  }
13025
13042
  if (prevStatus === "waiting_approval") {
@@ -38248,6 +38265,10 @@ var init_reporter = __esm({
38248
38265
  }
38249
38266
  }
38250
38267
  onStatusChange() {
38268
+ if (this.deps.p2p?.isConnected) {
38269
+ this.resetP2PHash();
38270
+ this.sendUnifiedStatusReport({ p2pOnly: true, reason: "status-change" }).catch((e) => LOG.warn("Status", `Immediate P2P status send failed: ${e?.message}`));
38271
+ }
38251
38272
  this.throttledReport();
38252
38273
  }
38253
38274
  throttledReport() {
@@ -38345,10 +38366,12 @@ var init_reporter = __esm({
38345
38366
  }
38346
38367
  async sendUnifiedStatusReport(opts) {
38347
38368
  const { serverConn, p2p } = this.deps;
38348
- if (!serverConn?.isConnected()) return;
38369
+ const serverConnected = !!serverConn?.isConnected();
38370
+ const p2pConnected = !!p2p?.isConnected;
38371
+ if (!serverConnected && !p2pConnected) return;
38349
38372
  this.lastStatusSentAt = Date.now();
38350
38373
  const now = this.lastStatusSentAt;
38351
- const target = opts?.p2pOnly ? "P2P" : "P2P+Server";
38374
+ const target = opts?.p2pOnly ? "P2P" : serverConnected ? "P2P+Server" : "P2P";
38352
38375
  const allStates = this.deps.instanceManager.collectAllStates();
38353
38376
  const ideStates = allStates.filter((s) => s.category === "ide");
38354
38377
  const cliStates = allStates.filter((s) => s.category === "cli");
@@ -38427,6 +38450,7 @@ var init_reporter = __esm({
38427
38450
  ...wsPayload,
38428
38451
  timestamp: void 0
38429
38452
  }));
38453
+ if (!serverConnected || !serverConn) return;
38430
38454
  if (!opts?.forceServer && wsHash === this.lastServerStatusHash) {
38431
38455
  LOG.debug("Server", `skip duplicate status_report${opts?.reason ? ` (${opts.reason})` : ""}`);
38432
38456
  return;
@@ -86508,7 +86532,7 @@ var init_adhdev_daemon = __esm({
86508
86532
  init_version();
86509
86533
  init_src();
86510
86534
  init_runtime_defaults();
86511
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.90" });
86535
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.92" });
86512
86536
  AdhdevDaemon = class _AdhdevDaemon {
86513
86537
  localHttpServer = null;
86514
86538
  localWss = null;