adhdev 0.9.0 → 0.9.1

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
@@ -7104,10 +7104,13 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
7104
7104
  ...FULL_STATUS_ACTIVE_CHAT_OPTIONS,
7105
7105
  ...options
7106
7106
  };
7107
- return {
7108
- ...activeChat,
7107
+ const {
7108
+ messages: _messages,
7109
+ ...rest
7110
+ } = activeChat;
7111
+ const normalized = {
7112
+ ...rest,
7109
7113
  status: normalizeManagedStatus(activeChat.status, { activeModal: activeChat.activeModal }),
7110
- messages: trimMessagesForStatus(activeChat.messages, resolvedOptions),
7111
7114
  activeModal: resolvedOptions.includeActiveModal && activeChat.activeModal ? {
7112
7115
  message: truncateString(activeChat.activeModal.message || "", STATUS_MODAL_MESSAGE_LIMIT),
7113
7116
  buttons: (activeChat.activeModal.buttons || []).map(
@@ -7116,6 +7119,10 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
7116
7119
  } : null,
7117
7120
  inputContent: resolvedOptions.includeInputContent && activeChat.inputContent ? truncateString(activeChat.inputContent, 2 * 1024) : void 0
7118
7121
  };
7122
+ if (resolvedOptions.includeMessages) {
7123
+ normalized.messages = trimMessagesForStatus(activeChat.messages, resolvedOptions);
7124
+ }
7125
+ return normalized;
7119
7126
  }
7120
7127
  var WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT;
7121
7128
  var init_normalize = __esm({
@@ -12926,6 +12933,10 @@ var init_provider_cli_adapter = __esm({
12926
12933
  this.activeModal = startupModal;
12927
12934
  this.setStatus("waiting_approval", `startup_ready:${trigger}`);
12928
12935
  } else {
12936
+ if (this.currentStatus === "waiting_approval" || this.activeModal) {
12937
+ this.lastApprovalResolvedAt = Date.now();
12938
+ }
12939
+ this.activeModal = null;
12929
12940
  this.setStatus("idle", `startup_ready:${trigger}`);
12930
12941
  }
12931
12942
  LOG.info(
@@ -13724,6 +13735,28 @@ var init_provider_cli_adapter = __esm({
13724
13735
  if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
13725
13736
  return this.currentStatus;
13726
13737
  }
13738
+ suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
13739
+ const actionableParsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
13740
+ if (!parsed || parsed?.status !== "waiting_approval" || !actionableParsedModal) {
13741
+ return parsed;
13742
+ }
13743
+ const inApprovalCooldown = this.lastApprovalResolvedAt > 0 && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
13744
+ if (!inApprovalCooldown) {
13745
+ return parsed;
13746
+ }
13747
+ const startupModal = this.getStartupConfirmationModal(screenText || "");
13748
+ const visibleModal = this.runParseApproval(recentBuffer) || startupModal;
13749
+ if (visibleModal) {
13750
+ return parsed;
13751
+ }
13752
+ const detectedStatus = this.runDetectStatus(recentBuffer);
13753
+ const fallbackStatus = detectedStatus && detectedStatus !== "waiting_approval" ? detectedStatus : this.isWaitingForResponse || this.currentTurnScope ? "generating" : this.currentStatus === "waiting_approval" ? "idle" : this.currentStatus;
13754
+ return {
13755
+ ...parsed,
13756
+ status: fallbackStatus,
13757
+ activeModal: null
13758
+ };
13759
+ }
13727
13760
  // ─── Public API (CliAdapter) ───────────────────
13728
13761
  getStatus() {
13729
13762
  const screenText = this.terminalScreen.getText() || "";
@@ -13942,15 +13975,16 @@ var init_provider_cli_adapter = __esm({
13942
13975
  if (parsed && refinedStatus && parsed.status !== refinedStatus) {
13943
13976
  parsed.status = refinedStatus;
13944
13977
  }
13978
+ const normalizedParsed = this.suppressStaleParsedApproval(parsed, input.recentBuffer, input.screenText);
13945
13979
  const promptForTrim = scope?.prompt || getLastUserPromptText(baseMessages);
13946
- if (parsed && Array.isArray(parsed.messages) && promptForTrim) {
13947
- const lastAssistant = [...parsed.messages].reverse().find((message) => message?.role === "assistant" && typeof message.content === "string");
13980
+ if (normalizedParsed && Array.isArray(normalizedParsed.messages) && promptForTrim) {
13981
+ const lastAssistant = [...normalizedParsed.messages].reverse().find((message) => message?.role === "assistant" && typeof message.content === "string");
13948
13982
  if (lastAssistant) {
13949
13983
  lastAssistant.content = trimPromptEchoPrefix(lastAssistant.content, promptForTrim);
13950
13984
  }
13951
13985
  }
13952
13986
  this.parseErrorMessage = null;
13953
- return parsed;
13987
+ return normalizedParsed;
13954
13988
  } catch (e) {
13955
13989
  const message = e?.message || String(e);
13956
13990
  this.parseErrorMessage = message;
@@ -87061,7 +87095,7 @@ var init_adhdev_daemon = __esm({
87061
87095
  init_version();
87062
87096
  init_src();
87063
87097
  init_runtime_defaults();
87064
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.0" });
87098
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.1" });
87065
87099
  AdhdevDaemon = class _AdhdevDaemon {
87066
87100
  localHttpServer = null;
87067
87101
  localWss = null;