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/cli/index.js CHANGED
@@ -12738,8 +12738,7 @@ var init_provider_cli_adapter = __esm({
12738
12738
  const buttons = Array.isArray(modal.buttons) ? modal.buttons : [];
12739
12739
  if (buttons.length !== 1) return false;
12740
12740
  const buttonLabel = String(buttons[0] || "").trim();
12741
- const modalText = `${modal.message || ""} ${buttonLabel}`.trim();
12742
- 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);
12741
+ return looksLikeConfirmOnlyLabel(buttonLabel);
12743
12742
  }
12744
12743
  async waitForInteractivePrompt(maxWaitMs = 5e3) {
12745
12744
  const startedAt = Date.now();
@@ -13355,11 +13354,14 @@ var init_provider_cli_adapter = __esm({
13355
13354
  }
13356
13355
  // ─── Public API (CliAdapter) ───────────────────
13357
13356
  getStatus() {
13357
+ const screenText = this.terminalScreen.getText() || "";
13358
+ const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
13359
+ const effectiveStatus = this.parseErrorMessage ? "error" : startupModal ? "waiting_approval" : this.currentStatus;
13358
13360
  return {
13359
- status: this.parseErrorMessage ? "error" : this.currentStatus,
13361
+ status: effectiveStatus,
13360
13362
  messages: [...this.committedMessages],
13361
13363
  workingDir: this.workingDir,
13362
- activeModal: this.activeModal,
13364
+ activeModal: startupModal || this.activeModal,
13363
13365
  errorMessage: this.parseErrorMessage || void 0,
13364
13366
  errorReason: this.parseErrorMessage ? "parse_error" : void 0
13365
13367
  };
@@ -13413,7 +13415,8 @@ var init_provider_cli_adapter = __esm({
13413
13415
  receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
13414
13416
  }));
13415
13417
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
13416
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && this.currentStatus === "idle" && parsedHydratedMessages.length > committedHydratedMessages.length && !!parsedLastAssistant;
13418
+ const visibleIdlePrompt = this.looksLikeVisibleIdlePrompt(screenText);
13419
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedHydratedMessages.length > committedHydratedMessages.length && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && visibleIdlePrompt);
13417
13420
  if (shouldAdoptParsedIdleReplay) {
13418
13421
  this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
13419
13422
  committedMessages: this.committedMessages,
@@ -13421,6 +13424,18 @@ var init_provider_cli_adapter = __esm({
13421
13424
  lastOutputAt: this.lastOutputAt
13422
13425
  });
13423
13426
  this.syncMessageViews();
13427
+ if (this.currentStatus !== "idle" || this.isWaitingForResponse) {
13428
+ this.responseBuffer = "";
13429
+ this.isWaitingForResponse = false;
13430
+ this.responseSettleIgnoreUntil = 0;
13431
+ this.submitRetryUsed = false;
13432
+ this.submitRetryPromptSnippet = "";
13433
+ this.finishRetryCount = 0;
13434
+ this.currentTurnScope = null;
13435
+ this.activeModal = null;
13436
+ this.setStatus("idle", "parsed_idle_replay_commit");
13437
+ this.onStatusChange?.();
13438
+ }
13424
13439
  }
13425
13440
  const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
13426
13441
  ...message,
@@ -14031,8 +14046,9 @@ ${data.message || ""}`.trim();
14031
14046
  this.ptyProcess?.write(data);
14032
14047
  }
14033
14048
  resolveModal(buttonIndex) {
14034
- if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !this.activeModal) return;
14035
- const modal = this.activeModal;
14049
+ const screenText = this.terminalScreen.getText() || "";
14050
+ const modal = this.activeModal || this.getStartupConfirmationModal(screenText);
14051
+ if (!this.ptyProcess || this.currentStatus !== "waiting_approval" && !modal) return;
14036
14052
  this.clearIdleFinishCandidate("resolve_modal");
14037
14053
  this.recordTrace("resolve_modal", {
14038
14054
  buttonIndex,
@@ -14047,7 +14063,10 @@ ${data.message || ""}`.trim();
14047
14063
  }
14048
14064
  this.setStatus("generating", "approval_resolved");
14049
14065
  this.onStatusChange?.();
14050
- if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
14066
+ 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 || ""));
14067
+ if (startupTrustModal && buttonIndex in this.approvalKeys) {
14068
+ this.ptyProcess.write(`${this.approvalKeys[buttonIndex]}\r`);
14069
+ } else if (this.shouldResolveModalWithEnter(modal, buttonIndex)) {
14051
14070
  this.ptyProcess.write("\r");
14052
14071
  } else if (buttonIndex in this.approvalKeys) {
14053
14072
  this.ptyProcess.write(this.approvalKeys[buttonIndex]);
@@ -14068,20 +14087,24 @@ ${data.message || ""}`.trim();
14068
14087
  }
14069
14088
  }
14070
14089
  getDebugState() {
14090
+ const screenText = sanitizeTerminalText(this.terminalScreen.getText());
14091
+ const startupModal = this.startupParseGate ? this.getStartupConfirmationModal(screenText) : null;
14092
+ const effectiveStatus = startupModal ? "waiting_approval" : this.currentStatus;
14093
+ const effectiveReady = this.ready || !!startupModal;
14071
14094
  return {
14072
14095
  type: this.cliType,
14073
14096
  name: this.cliName,
14074
14097
  providerResolution: this.providerResolutionMeta,
14075
- status: this.currentStatus,
14076
- ready: this.ready,
14098
+ status: effectiveStatus,
14099
+ ready: effectiveReady,
14077
14100
  startupParseGate: this.startupParseGate,
14078
14101
  spawnAt: this.spawnAt,
14079
14102
  workingDir: this.workingDir,
14080
- messages: this.messages.slice(-20),
14081
- committedMessages: this.committedMessages.slice(-20),
14082
- structuredMessages: this.structuredMessages.slice(-20),
14103
+ messages: this.messages,
14104
+ committedMessages: this.committedMessages,
14105
+ structuredMessages: this.structuredMessages,
14083
14106
  messageCount: this.committedMessages.length,
14084
- screenText: sanitizeTerminalText(this.terminalScreen.getText()).slice(-4e3),
14107
+ screenText: screenText.slice(-4e3),
14085
14108
  currentTurnScope: this.currentTurnScope,
14086
14109
  startupBuffer: this.startupBuffer.slice(-4e3),
14087
14110
  recentOutputBuffer: this.recentOutputBuffer.slice(-500),
@@ -14096,7 +14119,7 @@ ${data.message || ""}`.trim();
14096
14119
  lastScreenChangeAt: this.lastScreenChangeAt,
14097
14120
  lastScreenSnapshot: this.lastScreenSnapshot.slice(-500),
14098
14121
  isWaitingForResponse: this.isWaitingForResponse,
14099
- activeModal: this.activeModal,
14122
+ activeModal: startupModal || this.activeModal,
14100
14123
  lastApprovalResolvedAt: this.lastApprovalResolvedAt,
14101
14124
  sendDelayMs: this.sendDelayMs,
14102
14125
  sendKey: this.sendKey,
@@ -86478,7 +86501,7 @@ var init_adhdev_daemon = __esm({
86478
86501
  init_version();
86479
86502
  init_src();
86480
86503
  init_runtime_defaults();
86481
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.88" });
86504
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.89" });
86482
86505
  AdhdevDaemon = class _AdhdevDaemon {
86483
86506
  localHttpServer = null;
86484
86507
  localWss = null;