adhdev 0.9.16 → 0.9.18

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
@@ -12099,7 +12099,7 @@ var init_provider_cli_adapter = __esm({
12099
12099
  armApprovalExitTimeout() {
12100
12100
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
12101
12101
  this.approvalExitTimeout = setTimeout(() => {
12102
- if (this.currentStatus !== "waiting_approval") return;
12102
+ if (!this.hasActionableApproval()) return;
12103
12103
  const tail = this.recentOutputBuffer;
12104
12104
  const screenText = this.terminalScreen.getText() || "";
12105
12105
  const modal = this.runParseApproval(tail);
@@ -12126,7 +12126,7 @@ var init_provider_cli_adapter = __esm({
12126
12126
  }
12127
12127
  shouldRetryFinishResponse(commitResult) {
12128
12128
  if (!this.currentTurnScope) return false;
12129
- if (this.currentStatus === "waiting_approval" || this.activeModal) return false;
12129
+ if (this.hasActionableApproval()) return false;
12130
12130
  if (this.finishRetryCount >= _ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
12131
12131
  if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
12132
12132
  if (this.runDetectStatus(this.recentOutputBuffer) !== "idle") return false;
@@ -12142,7 +12142,7 @@ var init_provider_cli_adapter = __esm({
12142
12142
  return quietForMs < holdMs || screenStableMs < holdMs;
12143
12143
  }
12144
12144
  shouldDeferIdleTimeoutFinish() {
12145
- if (!this.isWaitingForResponse || this.currentStatus === "waiting_approval") {
12145
+ if (!this.isWaitingForResponse || this.hasActionableApproval()) {
12146
12146
  return false;
12147
12147
  }
12148
12148
  const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
@@ -12318,7 +12318,7 @@ var init_provider_cli_adapter = __esm({
12318
12318
  scope: this.currentTurnScope
12319
12319
  })
12320
12320
  });
12321
- if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && this.currentStatus !== "waiting_approval" && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
12321
+ if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && !this.hasActionableApproval() && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
12322
12322
  this.submitRetryUsed = true;
12323
12323
  this.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
12324
12324
  LOG.info("CLI", `[${this.cliType}] Retrying submit key from settled parser (no assistant yet)`);
@@ -12408,7 +12408,7 @@ var init_provider_cli_adapter = __esm({
12408
12408
  this.setStatus("generating", "recent_activity_hold");
12409
12409
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
12410
12410
  this.idleTimeout = setTimeout(() => {
12411
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
12411
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
12412
12412
  if (this.shouldDeferIdleTimeoutFinish()) return;
12413
12413
  this.finishResponse();
12414
12414
  }
@@ -12440,16 +12440,16 @@ var init_provider_cli_adapter = __esm({
12440
12440
  }
12441
12441
  this.activeModal = null;
12442
12442
  if (this.isWaitingForResponse) {
12443
- this.setStatus("generating", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
12443
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
12444
12444
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
12445
12445
  this.idleTimeout = setTimeout(() => {
12446
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
12446
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
12447
12447
  if (this.shouldDeferIdleTimeoutFinish()) return;
12448
12448
  this.finishResponse();
12449
12449
  }
12450
12450
  }, this.timeouts.generatingIdle);
12451
12451
  } else {
12452
- this.setStatus("idle", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
12452
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
12453
12453
  }
12454
12454
  this.onStatusChange?.();
12455
12455
  return;
@@ -12507,6 +12507,7 @@ var init_provider_cli_adapter = __esm({
12507
12507
  }
12508
12508
  this.activeModal = null;
12509
12509
  this.lastApprovalResolvedAt = Date.now();
12510
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
12510
12511
  }
12511
12512
  if (!this.isWaitingForResponse) {
12512
12513
  if (prevStatus !== "idle") {
@@ -12564,7 +12565,7 @@ var init_provider_cli_adapter = __esm({
12564
12565
  }
12565
12566
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
12566
12567
  this.idleTimeout = setTimeout(() => {
12567
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
12568
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
12568
12569
  if (this.shouldDeferIdleTimeoutFinish()) return;
12569
12570
  this.clearIdleFinishCandidate("idle_timeout_finish");
12570
12571
  this.finishResponse();
@@ -12602,7 +12603,7 @@ var init_provider_cli_adapter = __esm({
12602
12603
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
12603
12604
  this.finishRetryTimer = setTimeout(() => {
12604
12605
  this.finishRetryTimer = null;
12605
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
12606
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
12606
12607
  this.finishResponse();
12607
12608
  }
12608
12609
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -12748,10 +12749,13 @@ var init_provider_cli_adapter = __esm({
12748
12749
  return null;
12749
12750
  }
12750
12751
  }
12752
+ hasActionableApproval(startupModal = null) {
12753
+ return !!(startupModal || this.activeModal);
12754
+ }
12751
12755
  projectEffectiveStatus(startupModal = null) {
12752
12756
  if (this.parseErrorMessage) return "error";
12753
- if (startupModal || this.activeModal) return "waiting_approval";
12754
- if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
12757
+ if (this.hasActionableApproval(startupModal)) return "waiting_approval";
12758
+ if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
12755
12759
  return this.currentStatus;
12756
12760
  }
12757
12761
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -13049,7 +13053,7 @@ var init_provider_cli_adapter = __esm({
13049
13053
  async sendMessage(text) {
13050
13054
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
13051
13055
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
13052
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
13056
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
13053
13057
  if (this.startupParseGate) {
13054
13058
  const deadline = Date.now() + 1e4;
13055
13059
  while (this.startupParseGate && Date.now() < deadline) {
@@ -13173,7 +13177,7 @@ var init_provider_cli_adapter = __esm({
13173
13177
  const retrySubmitIfStuck = (attempt) => {
13174
13178
  this.submitRetryTimer = null;
13175
13179
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
13176
- if (this.currentStatus === "waiting_approval") return;
13180
+ if (this.hasActionableApproval()) return;
13177
13181
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
13178
13182
  const screenText2 = this.terminalScreen.getText();
13179
13183
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -13216,7 +13220,7 @@ var init_provider_cli_adapter = __esm({
13216
13220
  this.submitRetryTimer = setTimeout(() => {
13217
13221
  this.submitRetryTimer = null;
13218
13222
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
13219
- if (this.currentStatus === "waiting_approval") return;
13223
+ if (this.hasActionableApproval()) return;
13220
13224
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
13221
13225
  const screenText = this.terminalScreen.getText();
13222
13226
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -13501,6 +13505,9 @@ var init_provider_cli_adapter = __esm({
13501
13505
  name: this.cliName,
13502
13506
  providerResolution: this.providerResolutionMeta,
13503
13507
  status: effectiveStatus,
13508
+ projectedStatus: effectiveStatus,
13509
+ rawStatus: this.currentStatus,
13510
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
13504
13511
  ready: effectiveReady,
13505
13512
  startupParseGate: this.startupParseGate,
13506
13513
  spawnAt: this.spawnAt,
@@ -13553,7 +13560,10 @@ var init_provider_cli_adapter = __esm({
13553
13560
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
13554
13561
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
13555
13562
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
13556
- status: this.currentStatus,
13563
+ status: this.projectEffectiveStatus(),
13564
+ projectedStatus: this.projectEffectiveStatus(),
13565
+ rawStatus: this.currentStatus,
13566
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
13557
13567
  activeModal: this.activeModal,
13558
13568
  currentTurnScope: this.currentTurnScope,
13559
13569
  messages: summarizeCliTraceMessages(this.committedMessages, 5)
@@ -55516,7 +55526,7 @@ var init_adhdev_daemon = __esm({
55516
55526
  init_version();
55517
55527
  init_src();
55518
55528
  init_runtime_defaults();
55519
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.16" });
55529
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.18" });
55520
55530
  AdhdevDaemon = class _AdhdevDaemon {
55521
55531
  localHttpServer = null;
55522
55532
  localWss = null;