adhdev 0.8.88 → 0.8.89

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
@@ -11797,8 +11797,7 @@ var init_provider_cli_adapter = __esm({
11797
11797
  const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
11798
11798
  if (buttons.length !== 1) return false;
11799
11799
  const buttonLabel = String(buttons[0] || "").trim();
11800
- const modalText = `${modal.message || ""} ${buttonLabel}`.trim();
11801
- return looksLikeConfirmOnlyLabel(buttonLabel) || /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)|Enter to confirm/i.test(modalText);
11800
+ return looksLikeConfirmOnlyLabel(buttonLabel);
11802
11801
  }
11803
11802
  async waitForInteractivePrompt(maxWaitMs = 5e3) {
11804
11803
  const startedAt = Date.now();
@@ -12414,11 +12413,14 @@ var init_provider_cli_adapter = __esm({
12414
12413
  }
12415
12414
  // ─── Public API (CliAdapter) ───────────────────
12416
12415
  getStatus() {
12416
+ const screenText = this.terminalScreen.getText() || "";
12417
+ const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
12418
+ const effectiveStatus = this.parseErrorMessage ? "error" : startupModal ? "waiting_approval" : this.currentStatus;
12417
12419
  return {
12418
- status: this.parseErrorMessage ? "error" : this.currentStatus,
12420
+ status: effectiveStatus,
12419
12421
  messages: [...this.committedMessages],
12420
12422
  workingDir: this.workingDir,
12421
- activeModal: this.activeModal,
12423
+ activeModal: startupModal || this.activeModal,
12422
12424
  errorMessage: this.parseErrorMessage || void 0,
12423
12425
  errorReason: this.parseErrorMessage ? "parse_error" : void 0
12424
12426
  };
@@ -12472,7 +12474,8 @@ var init_provider_cli_adapter = __esm({
12472
12474
  receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
12473
12475
  }));
12474
12476
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
12475
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && this.currentStatus === "idle" && parsedHydratedMessages.length > committedHydratedMessages.length && !!parsedLastAssistant;
12477
+ const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
12478
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
12476
12479
  if (shouldAdoptParsedIdleReplay) {
12477
12480
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
12478
12481
  committedMessages: this.committedMessages,
@@ -12480,6 +12483,18 @@ var init_provider_cli_adapter = __esm({
12480
12483
  lastOutputAt: this.lastOutputAt
12481
12484
  });
12482
12485
  this.syncMessageViews();
12486
+ if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
12487
+ this.responseBuffer = "";
12488
+ this.isWaitingForResponse = false;
12489
+ this.responseSettleIgnoreUntil = 0;
12490
+ this.submitRetryUsed = false;
12491
+ this.submitRetryPromptSnippet = "";
12492
+ this.finishRetryCount = 0;
12493
+ this.currentTurnScope = null;
12494
+ this.activeModal = null;
12495
+ this.setStatus("idle", "parsed_idle_replay_commit");
12496
+ this.onStatusChange?.();
12497
+ }
12483
12498
  }
12484
12499
  const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
12485
12500
  ...message,
@@ -13090,8 +13105,9 @@ ${data.message || ""}`.trim();
13090
13105
  this.ptyProcess?.write(data);
13091
13106
  }
13092
13107
  resolveModal(buttonIndex) {
13093
- if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !this.activeModal) return;
13094
- const modal = this.activeModal;
13108
+ const screenText = this.terminalScreen.getText() || "";
13109
+ const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
13110
+ if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
13095
13111
  this.clearIdleFinishCandidate("resolve_modal");
13096
13112
  this.recordTrace("resolve_modal", {
13097
13113
  buttonIndex,
@@ -13106,7 +13122,10 @@ ${data.message || ""}`.trim();
13106
13122
  }
13107
13123
  this.setStatus("generating", "approval_resolved");
13108
13124
  this.onStatusChange?.();
13109
- if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
13125
+ const startupTrustModal = /Quick safety check|project trust|trust (?:this project|the contents of this directory|the files in this folder)/i.test(String(modal?.message || ""));
13126
+ if (startupTrustModal && buttonIndex in this.approvalKeys) {
13127
+ this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
13128
+ } else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
13110
13129
  this.ptyProcess.write("\r");
13111
13130
  } else if (buttonIndex in this.approvalKeys) {
13112
13131
  this.ptyProcess.write(this.approvalKeys[buttonIndex]);
@@ -13127,20 +13146,24 @@ ${data.message || ""}`.trim();
13127
13146
  }
13128
13147
  }
13129
13148
  getDebugState() {
13149
+ const screenText = sanitizeTerminalText(this.terminalScreen.getText());
13150
+ const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
13151
+ const effectiveStatus = startupModal ? "waiting_approval" : this.currentStatus;
13152
+ const effectiveReady = this.ready || !!startupModal;
13130
13153
  return {
13131
13154
  type: this.cliType,
13132
13155
  name: this.cliName,
13133
13156
  providerResolution: this.providerResolutionMeta,
13134
- status: this.currentStatus,
13135
- ready: this.ready,
13157
+ status: effectiveStatus,
13158
+ ready: effectiveReady,
13136
13159
  startupParseGate: this.startupParseGate,
13137
13160
  spawnAt: this.spawnAt,
13138
13161
  workingDir: this.workingDir,
13139
- messages: this.messages.slice(-20),
13140
- committedMessages: this.committedMessages.slice(-20),
13141
- structuredMessages: this.structuredMessages.slice(-20),
13162
+ messages: this.messages,
13163
+ committedMessages: this.committedMessages,
13164
+ structuredMessages: this.structuredMessages,
13142
13165
  messageCount: this.committedMessages.length,
13143
- screenText: sanitizeTerminalText(this.terminalScreen.getText()).slice(-4e3),
13166
+ screenText: screenText.slice(-4e3),
13144
13167
  currentTurnScope: this.currentTurnScope,
13145
13168
  startupBuffer: this.startupBuffer.slice(-4e3),
13146
13169
  recentOutputBuffer: this.recentOutputBuffer.slice(-500),
@@ -13155,7 +13178,7 @@ ${data.message || ""}`.trim();
13155
13178
  lastScreenChangeAt: this.lastScreenChangeAt,
13156
13179
  lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
13157
13180
  isWaitingForResponse: this.isWaitingForResponse,
13158
- activeModal: this.activeModal,
13181
+ activeModal: startupModal || this.activeModal,
13159
13182
  lastApprovalResolvedAt: this.lastApprovalResolvedAt,
13160
13183
  sendDelayMs: this.sendDelayMs,
13161
13184
  sendKey: this.sendKey,
@@ -54773,7 +54796,7 @@ var init_adhdev_daemon = __esm({
54773
54796
  init_version();
54774
54797
  init_src();
54775
54798
  init_runtime_defaults();
54776
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.88" });
54799
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.89" });
54777
54800
  AdhdevDaemon = class _AdhdevDaemon {
54778
54801
  localHttpServer = null;
54779
54802
  localWss = null;