@adhdev/daemon-standalone 0.9.55 → 0.9.57

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
@@ -30175,6 +30175,12 @@ var require_dist2 = __commonJS({
30175
30175
  accumulatedRawBuffer = "";
30176
30176
  /** Current visible terminal screen snapshot */
30177
30177
  terminalScreen = new TerminalScreen(24, 80);
30178
+ static MAX_RESPONSE_BUFFER = 8e3;
30179
+ static MAX_RECENT_OUTPUT_BUFFER = 1e3;
30180
+ responseBufferDroppedChars = 0;
30181
+ recentOutputDroppedChars = 0;
30182
+ accumulatedBufferDroppedChars = 0;
30183
+ accumulatedRawBufferDroppedChars = 0;
30178
30184
  /** Max accumulated buffer size. Sized to comfortably hold a single long
30179
30185
  * Hermes turn (tool calls + reasoning + final bubble) without the
30180
30186
  * rolling window pushing the turn's ╭─ opening line out of view. */
@@ -30192,6 +30198,23 @@ var require_dist2 = __commonJS({
30192
30198
  providerResolutionMeta;
30193
30199
  static FINISH_RETRY_DELAY_MS = 300;
30194
30200
  static MAX_FINISH_RETRIES = 2;
30201
+ getBufferState() {
30202
+ const build = (droppedChars, maxChars) => droppedChars > 0 ? { truncated: true, droppedChars, maxChars } : void 0;
30203
+ const responseBuffer = build(this.responseBufferDroppedChars, _ProviderCliAdapter.MAX_RESPONSE_BUFFER);
30204
+ const recentOutputBuffer = build(this.recentOutputDroppedChars, _ProviderCliAdapter.MAX_RECENT_OUTPUT_BUFFER);
30205
+ const accumulatedBuffer = build(this.accumulatedBufferDroppedChars, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30206
+ const accumulatedRawBuffer = build(this.accumulatedRawBufferDroppedChars, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30207
+ if (!responseBuffer && !recentOutputBuffer && !accumulatedBuffer && !accumulatedRawBuffer) return void 0;
30208
+ return {
30209
+ ...responseBuffer ? { responseBuffer } : {},
30210
+ ...recentOutputBuffer ? { recentOutputBuffer } : {},
30211
+ ...accumulatedBuffer ? { accumulatedBuffer } : {},
30212
+ ...accumulatedRawBuffer ? { accumulatedRawBuffer } : {}
30213
+ };
30214
+ }
30215
+ recordBoundedAppendDrop(previousLength, appendedLength, nextLength) {
30216
+ return Math.max(0, previousLength + appendedLength - nextLength);
30217
+ }
30195
30218
  buildCommittedMessagesActivitySignature() {
30196
30219
  const last = this.committedMessages[this.committedMessages.length - 1];
30197
30220
  return [
@@ -30557,7 +30580,9 @@ var require_dist2 = __commonJS({
30557
30580
  this.scheduleStartupSettleCheck();
30558
30581
  }
30559
30582
  if (this.isWaitingForResponse && cleanData) {
30560
- this.responseBuffer = appendBoundedText(this.responseBuffer, cleanData, 8e3);
30583
+ const previousResponseLen = this.responseBuffer.length;
30584
+ this.responseBuffer = appendBoundedText(this.responseBuffer, cleanData, _ProviderCliAdapter.MAX_RESPONSE_BUFFER);
30585
+ this.responseBufferDroppedChars += this.recordBoundedAppendDrop(previousResponseLen, cleanData.length, this.responseBuffer.length);
30561
30586
  }
30562
30587
  if (cleanData.trim()) {
30563
30588
  if (this.serverConn) {
@@ -30566,14 +30591,19 @@ var require_dist2 = __commonJS({
30566
30591
  this.logBuffer.push({ message: cleanData.trim(), level: "info" });
30567
30592
  }
30568
30593
  }
30594
+ const prevRecentLen = this.recentOutputBuffer.length;
30569
30595
  const prevAccumulatedLen = this.accumulatedBuffer.length;
30570
30596
  const prevAccumulatedRawLen = this.accumulatedRawBuffer.length;
30571
- this.recentOutputBuffer = appendBoundedText(this.recentOutputBuffer, cleanData, 1e3);
30597
+ this.recentOutputBuffer = appendBoundedText(this.recentOutputBuffer, cleanData, _ProviderCliAdapter.MAX_RECENT_OUTPUT_BUFFER);
30572
30598
  this.accumulatedBuffer = appendBoundedText(this.accumulatedBuffer, cleanData, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30573
30599
  this.accumulatedRawBuffer = appendBoundedText(this.accumulatedRawBuffer, rawData, _ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
30600
+ const droppedRecent = this.recordBoundedAppendDrop(prevRecentLen, cleanData.length, this.recentOutputBuffer.length);
30601
+ const droppedClean = this.recordBoundedAppendDrop(prevAccumulatedLen, cleanData.length, this.accumulatedBuffer.length);
30602
+ const droppedRaw = this.recordBoundedAppendDrop(prevAccumulatedRawLen, rawData.length, this.accumulatedRawBuffer.length);
30603
+ this.recentOutputDroppedChars += droppedRecent;
30604
+ this.accumulatedBufferDroppedChars += droppedClean;
30605
+ this.accumulatedRawBufferDroppedChars += droppedRaw;
30574
30606
  if (this.currentTurnScope) {
30575
- const droppedClean = prevAccumulatedLen + cleanData.length - this.accumulatedBuffer.length;
30576
- const droppedRaw = prevAccumulatedRawLen + rawData.length - this.accumulatedRawBuffer.length;
30577
30607
  if (droppedClean > 0) {
30578
30608
  this.currentTurnScope.bufferStart = Math.max(0, this.currentTurnScope.bufferStart - droppedClean);
30579
30609
  }
@@ -31403,13 +31433,15 @@ var require_dist2 = __commonJS({
31403
31433
  effectiveModal = parsedModal;
31404
31434
  }
31405
31435
  }
31436
+ const bufferState = this.getBufferState();
31406
31437
  return {
31407
31438
  status: effectiveStatus,
31408
31439
  messages: [...this.committedMessages],
31409
31440
  workingDir: this.workingDir,
31410
31441
  activeModal: effectiveModal,
31411
31442
  errorMessage: this.parseErrorMessage || void 0,
31412
- errorReason: this.parseErrorMessage ? "parse_error" : void 0
31443
+ errorReason: this.parseErrorMessage ? "parse_error" : void 0,
31444
+ ...bufferState ? { bufferState } : {}
31413
31445
  };
31414
31446
  }
31415
31447
  seedCommittedMessages(messages) {
@@ -31591,10 +31623,12 @@ var require_dist2 = __commonJS({
31591
31623
  messages: hydratedMessages,
31592
31624
  activeModal: parsed.activeModal ?? this.activeModal,
31593
31625
  providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
31626
+ ...this.getBufferState() ? { bufferState: this.getBufferState() } : {},
31594
31627
  ...this.providerOwnsTranscript() ? { transcriptAuthority: "provider", coverage: this.shouldUseFullProviderTranscriptContext() ? "full" : "tail" } : {}
31595
31628
  };
31596
31629
  } else {
31597
31630
  const messages = [...this.committedMessages];
31631
+ const bufferState = this.getBufferState();
31598
31632
  result = {
31599
31633
  id: "cli_session",
31600
31634
  status: this.currentStatus,
@@ -31605,7 +31639,8 @@ var require_dist2 = __commonJS({
31605
31639
  index: typeof message.index === "number" ? message.index : index,
31606
31640
  receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
31607
31641
  })),
31608
- activeModal: this.activeModal
31642
+ activeModal: this.activeModal,
31643
+ ...bufferState ? { bufferState } : {}
31609
31644
  };
31610
31645
  }
31611
31646
  const hasVisibleAssistantMessage = Array.isArray(result?.messages) && result.messages.some((message) => message?.role === "assistant" && typeof message?.content === "string" && message.content.trim());
@@ -45429,7 +45464,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
45429
45464
  resolvedDir,
45430
45465
  resolvedCliArgs,
45431
45466
  resolvedProvider,
45432
- {},
45467
+ this.providerLoader.getSettings(normalizedType),
45433
45468
  false,
45434
45469
  {
45435
45470
  providerSessionId: sessionBinding.providerSessionId,