@adhdev/daemon-standalone 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
@@ -29825,8 +29825,10 @@ var require_dist2 = __commonJS({
29825
29825
  accumulatedRawBuffer = "";
29826
29826
  /** Current visible terminal screen snapshot */
29827
29827
  terminalScreen = new TerminalScreen(24, 80);
29828
- /** Max accumulated buffer size (last 50KB) */
29829
- static MAX_ACCUMULATED_BUFFER = 5e4;
29828
+ /** Max accumulated buffer size. Sized to comfortably hold a single long
29829
+ * Hermes turn (tool calls + reasoning + final bubble) without the
29830
+ * rolling window pushing the turn's ╭─ opening line out of view. */
29831
+ static MAX_ACCUMULATED_BUFFER = 262144;
29830
29832
  currentTurnScope = null;
29831
29833
  traceEntries = [];
29832
29834
  traceSeq = 0;
@@ -30108,8 +30110,20 @@ var require_dist2 = __commonJS({
30108
30110
  }
30109
30111
  }
30110
30112
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
30113
+ const prevAccumulatedLen = this.accumulatedBuffer.length;
30114
+ const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
30111
30115
  this.accumulatedBuffer = (this.accumulatedBuffer + cleanData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30112
30116
  this.accumulatedRawBuffer = (this.accumulatedRawBuffer + rawData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30117
+ if (this.currentTurnScope) {
30118
+ const droppedClean = prevAccumulatedLen + cleanData.length - this.accumulatedBuffer.length;
30119
+ const droppedRaw = prevAccumulatedRawLen + rawData.length - this.accumulatedRawBuffer.length;
30120
+ if (droppedClean > 0) {
30121
+ this.currentTurnScope.bufferStart = Math.max(0, this.currentTurnScope.bufferStart - droppedClean);
30122
+ }
30123
+ if (droppedRaw > 0) {
30124
+ this.currentTurnScope.rawBufferStart = Math.max(0, this.currentTurnScope.rawBufferStart - droppedRaw);
30125
+ }
30126
+ }
30113
30127
  this.resolveStartupState("output");
30114
30128
  this.scheduleSettle();
30115
30129
  }
@@ -30418,14 +30432,15 @@ var require_dist2 = __commonJS({
30418
30432
  return;
30419
30433
  }
30420
30434
  const startupModal = this.getStartupConfirmationModal(screenText);
30421
- const modal = this.runParseApproval(tail) || startupModal;
30422
- const rawScriptStatus = this.runDetectStatus(tail);
30423
- const scriptStatus = startupModal ? "waiting_approval" : rawScriptStatus;
30424
30435
  const parsedTranscript = this.parseCurrentTranscript(
30425
30436
  this.committedMessages,
30426
30437
  this.responseBuffer,
30427
30438
  this.currentTurnScope
30428
30439
  );
30440
+ const parsedModal = parsedTranscript?.activeModal && Array.isArray(parsedTranscript.activeModal.buttons) && parsedTranscript.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsedTranscript.activeModal : null;
30441
+ const modal = this.runParseApproval(tail) || parsedModal || startupModal;
30442
+ const rawScriptStatus = this.runDetectStatus(tail);
30443
+ const scriptStatus = startupModal ? "waiting_approval" : parsedModal && parsedTranscript?.status === "waiting_approval" ? "waiting_approval" : rawScriptStatus;
30429
30444
  const parsedMessages = Array.isArray(parsedTranscript?.messages) ? normalizeCliParsedMessages(parsedTranscript.messages, {
30430
30445
  committedMessages: this.committedMessages,
30431
30446
  scope: this.currentTurnScope,
@@ -30435,6 +30450,7 @@ var require_dist2 = __commonJS({
30435
30450
  return;
30436
30451
  }
30437
30452
  const lastParsedAssistant = [...parsedMessages].reverse().find((message) => message.role === "assistant");
30453
+ const parsedShowsLiveAssistantProgress = parsedTranscript?.status === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
30438
30454
  const normalizedPromptSnippet = normalizePromptText(this.submitRetryPromptSnippet || this.currentTurnScope?.prompt || "");
30439
30455
  this.recordTrace("settled", {
30440
30456
  tail: summarizeCliTraceText(tail, 500),
@@ -30589,7 +30605,7 @@ var require_dist2 = __commonJS({
30589
30605
  const effectiveScreenText = screenText || this.accumulatedBuffer;
30590
30606
  const noActiveTurn = !this.currentTurnScope;
30591
30607
  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));
30592
- if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome) {
30608
+ if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
30593
30609
  return;
30594
30610
  }
30595
30611
  if (prevStatus === "waiting_approval") {
@@ -37907,10 +37923,11 @@ ${effect.notification.body || ""}`.trim();
37907
37923
  const parsedRecord = parsedStatus && typeof parsedStatus === "object" ? parsedStatus : null;
37908
37924
  const adapterStatus = adapter.getStatus();
37909
37925
  const shouldPreferAdapterMessages = Array.isArray(adapterStatus.messages) && adapterStatus.messages.length > 0 && Array.isArray(parsedRecord?.messages) && adapterStatus.messages.length > parsedRecord.messages.length;
37926
+ const parsedShowsApproval = hasNonEmptyModalButtons(parsedRecord?.activeModal) && parsedRecord?.status === "waiting_approval";
37910
37927
  const status = parsedRecord ? {
37911
37928
  ...parsedRecord,
37912
37929
  messages: shouldPreferAdapterMessages ? adapterStatus.messages : parsedRecord.messages,
37913
- status: adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
37930
+ status: parsedShowsApproval ? parsedRecord.status : adapterStatus.status !== "idle" ? adapterStatus.status : parsedRecord.status || adapterStatus.status,
37914
37931
  activeModal: parsedRecord.activeModal || adapterStatus.activeModal
37915
37932
  } : adapterStatus;
37916
37933
  const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
@@ -46030,6 +46047,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
46030
46047
  }
46031
46048
  }
46032
46049
  onStatusChange() {
46050
+ if (this.deps.p2p?.isConnected) {
46051
+ this.resetP2PHash();
46052
+ this.sendUnifiedStatusReport({ p2pOnly: true, reason: "status-change" }).catch((e) => LOG2.warn("Status", `Immediate P2P status send failed: ${e?.message}`));
46053
+ }
46033
46054
  this.throttledReport();
46034
46055
  }
46035
46056
  throttledReport() {
@@ -46127,10 +46148,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
46127
46148
  }
46128
46149
  async sendUnifiedStatusReport(opts) {
46129
46150
  const { serverConn, p2p } = this.deps;
46130
- if (!serverConn?.isConnected()) return;
46151
+ const serverConnected = !!serverConn?.isConnected();
46152
+ const p2pConnected = !!p2p?.isConnected;
46153
+ if (!serverConnected && !p2pConnected) return;
46131
46154
  this.lastStatusSentAt = Date.now();
46132
46155
  const now = this.lastStatusSentAt;
46133
- const target = opts?.p2pOnly ? "P2P" : "P2P+Server";
46156
+ const target = opts?.p2pOnly ? "P2P" : serverConnected ? "P2P+Server" : "P2P";
46134
46157
  const allStates = this.deps.instanceManager.collectAllStates();
46135
46158
  const ideStates = allStates.filter((s15) => s15.category === "ide");
46136
46159
  const cliStates = allStates.filter((s15) => s15.category === "cli");
@@ -46209,6 +46232,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
46209
46232
  ...wsPayload,
46210
46233
  timestamp: void 0
46211
46234
  }));
46235
+ if (!serverConnected || !serverConn) return;
46212
46236
  if (!opts?.forceServer && wsHash === this.lastServerStatusHash) {
46213
46237
  LOG2.debug("Server", `skip duplicate status_report${opts?.reason ? ` (${opts.reason})` : ""}`);
46214
46238
  return;