adhdev 0.9.0 → 0.9.2

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
@@ -6584,10 +6584,13 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
6584
6584
  ...FULL_STATUS_ACTIVE_CHAT_OPTIONS,
6585
6585
  ...options
6586
6586
  };
6587
- return {
6588
- ...activeChat,
6587
+ const {
6588
+ messages: _messages,
6589
+ ...rest
6590
+ } = activeChat;
6591
+ const normalized = {
6592
+ ...rest,
6589
6593
  status: normalizeManagedStatus(activeChat.status, { activeModal: activeChat.activeModal }),
6590
- messages: trimMessagesForStatus(activeChat.messages, resolvedOptions),
6591
6594
  activeModal: resolvedOptions.includeActiveModal && activeChat.activeModal ? {
6592
6595
  message: truncateString(activeChat.activeModal.message || "", STATUS_MODAL_MESSAGE_LIMIT),
6593
6596
  buttons: (activeChat.activeModal.buttons || []).map(
@@ -6596,6 +6599,10 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
6596
6599
  } : null,
6597
6600
  inputContent: resolvedOptions.includeInputContent && activeChat.inputContent ? truncateString(activeChat.inputContent, 2 * 1024) : void 0
6598
6601
  };
6602
+ if (resolvedOptions.includeMessages) {
6603
+ normalized.messages = trimMessagesForStatus(activeChat.messages, resolvedOptions);
6604
+ }
6605
+ return normalized;
6599
6606
  }
6600
6607
  var WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT;
6601
6608
  var init_normalize = __esm({
@@ -11970,6 +11977,10 @@ var init_provider_cli_adapter = __esm({
11970
11977
  this.activeModal = startupModal;
11971
11978
  this.setStatus("waiting_approval", `startup_ready:${trigger}`);
11972
11979
  } else {
11980
+ if (this.currentStatus === "waiting_approval" || this.activeModal) {
11981
+ this.lastApprovalResolvedAt = Date.now();
11982
+ }
11983
+ this.activeModal = null;
11973
11984
  this.setStatus("idle", `startup_ready:${trigger}`);
11974
11985
  }
11975
11986
  LOG.info(
@@ -12768,6 +12779,28 @@ var init_provider_cli_adapter = __esm({
12768
12779
  if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
12769
12780
  return this.currentStatus;
12770
12781
  }
12782
+ suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
12783
+ const actionableParsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
12784
+ if (!parsed || parsed?.status !== "waiting_approval" || !actionableParsedModal) {
12785
+ return parsed;
12786
+ }
12787
+ const inApprovalCooldown = this.lastApprovalResolvedAt > 0 && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
12788
+ if (!inApprovalCooldown) {
12789
+ return parsed;
12790
+ }
12791
+ const startupModal = this.getStartupConfirmationModal(screenText || "");
12792
+ const visibleModal = this.runParseApproval(recentBuffer) || startupModal;
12793
+ if (visibleModal) {
12794
+ return parsed;
12795
+ }
12796
+ const detectedStatus = this.runDetectStatus(recentBuffer);
12797
+ const fallbackStatus = detectedStatus && detectedStatus !== "waiting_approval" ? detectedStatus : this.isWaitingForResponse || this.currentTurnScope ? "generating" : this.currentStatus === "waiting_approval" ? "idle" : this.currentStatus;
12798
+ return {
12799
+ ...parsed,
12800
+ status: fallbackStatus,
12801
+ activeModal: null
12802
+ };
12803
+ }
12771
12804
  // ─── Public API (CliAdapter) ───────────────────
12772
12805
  getStatus() {
12773
12806
  const screenText = this.terminalScreen.getText() || "";
@@ -12986,15 +13019,16 @@ var init_provider_cli_adapter = __esm({
12986
13019
  if (parsed && refinedStatus && parsed.status !== refinedStatus) {
12987
13020
  parsed.status = refinedStatus;
12988
13021
  }
13022
+ const normalizedParsed = this.suppressStaleParsedApproval(parsed, input.recentBuffer, input.screenText);
12989
13023
  const promptForTrim = scope?.prompt || getLastUserPromptText(baseMessages);
12990
- if (parsed && Array.isArray(parsed.messages) && promptForTrim) {
12991
- const lastAssistant = [...parsed.messages].reverse().find((message) => message?.role === "assistant" && typeof message.content === "string");
13024
+ if (normalizedParsed && Array.isArray(normalizedParsed.messages) && promptForTrim) {
13025
+ const lastAssistant = [...normalizedParsed.messages].reverse().find((message) => message?.role === "assistant" && typeof message.content === "string");
12992
13026
  if (lastAssistant) {
12993
13027
  lastAssistant.content = trimPromptEchoPrefix(lastAssistant.content, promptForTrim);
12994
13028
  }
12995
13029
  }
12996
13030
  this.parseErrorMessage = null;
12997
- return parsed;
13031
+ return normalizedParsed;
12998
13032
  } catch (e) {
12999
13033
  const message = e?.message || String(e);
13000
13034
  this.parseErrorMessage = message;
@@ -55341,7 +55375,7 @@ var init_adhdev_daemon = __esm({
55341
55375
  init_version();
55342
55376
  init_src();
55343
55377
  init_runtime_defaults();
55344
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.0" });
55378
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.2" });
55345
55379
  AdhdevDaemon = class _AdhdevDaemon {
55346
55380
  localHttpServer = null;
55347
55381
  localWss = null;