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/index.js CHANGED
@@ -7310,10 +7310,11 @@ async function handleReadChat(h, args) {
7310
7310
  const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
7311
7311
  const adapterStatus = adapter.getStatus();
7312
7312
  const shouldPreferAdapterMessages = Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
7313
+ const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
7313
7314
  const status = parsedRecord ? {
7314
7315
  ...parsedRecord,
7315
7316
  messages: shouldPreferAdapterMessages ? adapterStatus.messages : parsedRecord.messages,
7316
- status: adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
7317
+ status: parsedShowsApproval ? parsedRecord.status : adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
7317
7318
  activeModal: parsedRecord.activeModal || adapterStatus.activeModal
7318
7319
  } : adapterStatus;
7319
7320
  const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
@@ -11314,8 +11315,10 @@ var init_provider_cli_adapter = __esm({
11314
11315
  accumulatedRawBuffer = "";
11315
11316
  /** Current visible terminal screen snapshot */
11316
11317
  terminalScreen = new TerminalScreen(24, 80);
11317
- /** Max accumulated buffer size (last 50KB) */
11318
- static MAX_ACCUMULATED_BUFFER = 5e4;
11318
+ /** Max accumulated buffer size. Sized to comfortably hold a single long
11319
+ * Hermes turn (tool calls + reasoning + final bubble) without the
11320
+ * rolling window pushing the turn's ╭─ opening line out of view. */
11321
+ static MAX_ACCUMULATED_BUFFER = 262144;
11319
11322
  currentTurnScope = null;
11320
11323
  traceEntries = [];
11321
11324
  traceSeq = 0;
@@ -11597,8 +11600,20 @@ var init_provider_cli_adapter = __esm({
11597
11600
  }
11598
11601
  }
11599
11602
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
11603
+ const prevAccumulatedLen = this.accumulatedBuffer.length;
11604
+ const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
11600
11605
  this.accumulatedBuffer = (this.accumulatedBuffer + cleanData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
11601
11606
  this.accumulatedRawBuffer = (this.accumulatedRawBuffer + rawData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
11607
+ if (this.currentTurnScope) {
11608
+ const droppedClean = prevAccumulatedLen + cleanData.length - this.accumulatedBuffer.length;
11609
+ const droppedRaw = prevAccumulatedRawLen + rawData.length - this.accumulatedRawBuffer.length;
11610
+ if (droppedClean > 0) {
11611
+ this.currentTurnScope.bufferStart = Math.max(0, this.currentTurnScope.bufferStart - droppedClean);
11612
+ }
11613
+ if (droppedRaw > 0) {
11614
+ this.currentTurnScope.rawBufferStart = Math.max(0, this.currentTurnScope.rawBufferStart - droppedRaw);
11615
+ }
11616
+ }
11602
11617
  this.resolveStartupState("output");
11603
11618
  this.scheduleSettle();
11604
11619
  }
@@ -11907,14 +11922,15 @@ var init_provider_cli_adapter = __esm({
11907
11922
  return;
11908
11923
  }
11909
11924
  const startupModal = this.getStartupConfirmationModal(screenText);
11910
- const modal = this.runParseApproval(tail) || startupModal;
11911
- const rawScriptStatus = this.runDetectStatus(tail);
11912
- const scriptStatus = startupModal ? "waiting_approval" : rawScriptStatus;
11913
11925
  const parsedTranscript = this.parseCurrentTranscript(
11914
11926
  this.committedMessages,
11915
11927
  this.responseBuffer,
11916
11928
  this.currentTurnScope
11917
11929
  );
11930
+ const parsedModal = parsedTranscript?.activeModal && Array.isArray(parsedTranscript.activeModal.buttons) && parsedTranscript.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsedTranscript.activeModal : null;
11931
+ const modal = this.runParseApproval(tail) || parsedModal || startupModal;
11932
+ const rawScriptStatus = this.runDetectStatus(tail);
11933
+ const scriptStatus = startupModal ? "waiting_approval" : parsedModal && parsedTranscript?.status === "waiting_approval" ? "waiting_approval" : rawScriptStatus;
11918
11934
  const parsedMessages = Array.isArray(parsedTranscript?.messages) ? normalizeCliParsedMessages(parsedTranscript.messages, {
11919
11935
  committedMessages: this.committedMessages,
11920
11936
  scope: this.currentTurnScope,
@@ -11924,6 +11940,7 @@ var init_provider_cli_adapter = __esm({
11924
11940
  return;
11925
11941
  }
11926
11942
  const lastParsedAssistant = [...parsedMessages].reverse().find((message) => message.role === "assistant");
11943
+ const parsedShowsLiveAssistantProgress = parsedTranscript?.status === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
11927
11944
  const normalizedPromptSnippet = normalizePromptText(this.submitRetryPromptSnippet || this.currentTurnScope?.prompt || "");
11928
11945
  this.recordTrace("settled", {
11929
11946
  tail: summarizeCliTraceText(tail, 500),
@@ -12078,7 +12095,7 @@ var init_provider_cli_adapter = __esm({
12078
12095
  const effectiveScreenText = screenText || this.accumulatedBuffer;
12079
12096
  const noActiveTurn = !this.currentTurnScope;
12080
12097
  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));
12081
- if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome) {
12098
+ if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
12082
12099
  return;
12083
12100
  }
12084
12101
  if (prevStatus === "waiting_approval") {
@@ -37307,6 +37324,10 @@ var init_reporter = __esm({
37307
37324
  }
37308
37325
  }
37309
37326
  onStatusChange() {
37327
+ if (this.deps.p2p?.isConnected) {
37328
+ this.resetP2PHash();
37329
+ this.sendUnifiedStatusReport({ p2pOnly: true, reason: "status-change" }).catch((e) => LOG.warn("Status", `Immediate P2P status send failed: ${e?.message}`));
37330
+ }
37310
37331
  this.throttledReport();
37311
37332
  }
37312
37333
  throttledReport() {
@@ -37404,10 +37425,12 @@ var init_reporter = __esm({
37404
37425
  }
37405
37426
  async sendUnifiedStatusReport(opts) {
37406
37427
  const { serverConn, p2p } = this.deps;
37407
- if (!serverConn?.isConnected()) return;
37428
+ const serverConnected = !!serverConn?.isConnected();
37429
+ const p2pConnected = !!p2p?.isConnected;
37430
+ if (!serverConnected && !p2pConnected) return;
37408
37431
  this.lastStatusSentAt = Date.now();
37409
37432
  const now = this.lastStatusSentAt;
37410
- const target = opts?.p2pOnly ? "P2P" : "P2P+Server";
37433
+ const target = opts?.p2pOnly ? "P2P" : serverConnected ? "P2P+Server" : "P2P";
37411
37434
  const allStates = this.deps.instanceManager.collectAllStates();
37412
37435
  const ideStates = allStates.filter((s) => s.category === "ide");
37413
37436
  const cliStates = allStates.filter((s) => s.category === "cli");
@@ -37486,6 +37509,7 @@ var init_reporter = __esm({
37486
37509
  ...wsPayload,
37487
37510
  timestamp: void 0
37488
37511
  }));
37512
+ if (!serverConnected || !serverConn) return;
37489
37513
  if (!opts?.forceServer && wsHash === this.lastServerStatusHash) {
37490
37514
  LOG.debug("Server", `skip duplicate status_report${opts?.reason ? ` (${opts.reason})` : ""}`);
37491
37515
  return;
@@ -54803,7 +54827,7 @@ var init_adhdev_daemon = __esm({
54803
54827
  init_version();
54804
54828
  init_src();
54805
54829
  init_runtime_defaults();
54806
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.90" });
54830
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.92" });
54807
54831
  AdhdevDaemon = class _AdhdevDaemon {
54808
54832
  localHttpServer = null;
54809
54833
  localWss = null;