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/cli/index.js CHANGED
@@ -13055,7 +13055,7 @@ var init_provider_cli_adapter = __esm({
13055
13055
  armApprovalExitTimeout() {
13056
13056
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
13057
13057
  this.approvalExitTimeout = setTimeout(() => {
13058
- if (this.currentStatus !== "waiting_approval") return;
13058
+ if (!this.hasActionableApproval()) return;
13059
13059
  const tail = this.recentOutputBuffer;
13060
13060
  const screenText = this.terminalScreen.getText() || "";
13061
13061
  const modal = this.runParseApproval(tail);
@@ -13082,7 +13082,7 @@ var init_provider_cli_adapter = __esm({
13082
13082
  }
13083
13083
  shouldRetryFinishResponse(commitResult) {
13084
13084
  if (!this.currentTurnScope) return false;
13085
- if (this.currentStatus === "waiting_approval" || this.activeModal) return false;
13085
+ if (this.hasActionableApproval()) return false;
13086
13086
  if (this.finishRetryCount >= _ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
13087
13087
  if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
13088
13088
  if (this.runDetectStatus(this.recentOutputBuffer) !== "idle") return false;
@@ -13098,7 +13098,7 @@ var init_provider_cli_adapter = __esm({
13098
13098
  return quietForMs < holdMs || screenStableMs < holdMs;
13099
13099
  }
13100
13100
  shouldDeferIdleTimeoutFinish() {
13101
- if (!this.isWaitingForResponse || this.currentStatus === "waiting_approval") {
13101
+ if (!this.isWaitingForResponse || this.hasActionableApproval()) {
13102
13102
  return false;
13103
13103
  }
13104
13104
  const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
@@ -13274,7 +13274,7 @@ var init_provider_cli_adapter = __esm({
13274
13274
  scope: this.currentTurnScope
13275
13275
  })
13276
13276
  });
13277
- if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && this.currentStatus !== "waiting_approval" && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
13277
+ if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && !this.hasActionableApproval() && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
13278
13278
  this.submitRetryUsed = true;
13279
13279
  this.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
13280
13280
  LOG.info("CLI", `[${this.cliType}] Retrying submit key from settled parser (no assistant yet)`);
@@ -13364,7 +13364,7 @@ var init_provider_cli_adapter = __esm({
13364
13364
  this.setStatus("generating", "recent_activity_hold");
13365
13365
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
13366
13366
  this.idleTimeout = setTimeout(() => {
13367
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
13367
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
13368
13368
  if (this.shouldDeferIdleTimeoutFinish()) return;
13369
13369
  this.finishResponse();
13370
13370
  }
@@ -13396,16 +13396,16 @@ var init_provider_cli_adapter = __esm({
13396
13396
  }
13397
13397
  this.activeModal = null;
13398
13398
  if (this.isWaitingForResponse) {
13399
- this.setStatus("generating", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
13399
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
13400
13400
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
13401
13401
  this.idleTimeout = setTimeout(() => {
13402
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
13402
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
13403
13403
  if (this.shouldDeferIdleTimeoutFinish()) return;
13404
13404
  this.finishResponse();
13405
13405
  }
13406
13406
  }, this.timeouts.generatingIdle);
13407
13407
  } else {
13408
- this.setStatus("idle", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
13408
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
13409
13409
  }
13410
13410
  this.onStatusChange?.();
13411
13411
  return;
@@ -13463,6 +13463,7 @@ var init_provider_cli_adapter = __esm({
13463
13463
  }
13464
13464
  this.activeModal = null;
13465
13465
  this.lastApprovalResolvedAt = Date.now();
13466
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
13466
13467
  }
13467
13468
  if (!this.isWaitingForResponse) {
13468
13469
  if (prevStatus !== "idle") {
@@ -13520,7 +13521,7 @@ var init_provider_cli_adapter = __esm({
13520
13521
  }
13521
13522
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
13522
13523
  this.idleTimeout = setTimeout(() => {
13523
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
13524
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
13524
13525
  if (this.shouldDeferIdleTimeoutFinish()) return;
13525
13526
  this.clearIdleFinishCandidate("idle_timeout_finish");
13526
13527
  this.finishResponse();
@@ -13558,7 +13559,7 @@ var init_provider_cli_adapter = __esm({
13558
13559
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
13559
13560
  this.finishRetryTimer = setTimeout(() => {
13560
13561
  this.finishRetryTimer = null;
13561
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
13562
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
13562
13563
  this.finishResponse();
13563
13564
  }
13564
13565
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -13704,10 +13705,13 @@ var init_provider_cli_adapter = __esm({
13704
13705
  return null;
13705
13706
  }
13706
13707
  }
13708
+ hasActionableApproval(startupModal = null) {
13709
+ return !!(startupModal || this.activeModal);
13710
+ }
13707
13711
  projectEffectiveStatus(startupModal = null) {
13708
13712
  if (this.parseErrorMessage) return "error";
13709
- if (startupModal || this.activeModal) return "waiting_approval";
13710
- if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
13713
+ if (this.hasActionableApproval(startupModal)) return "waiting_approval";
13714
+ if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
13711
13715
  return this.currentStatus;
13712
13716
  }
13713
13717
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -14005,7 +14009,7 @@ var init_provider_cli_adapter = __esm({
14005
14009
  async sendMessage(text) {
14006
14010
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
14007
14011
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
14008
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
14012
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
14009
14013
  if (this.startupParseGate) {
14010
14014
  const deadline = Date.now() + 1e4;
14011
14015
  while (this.startupParseGate && Date.now() < deadline) {
@@ -14129,7 +14133,7 @@ var init_provider_cli_adapter = __esm({
14129
14133
  const retrySubmitIfStuck = (attempt) => {
14130
14134
  this.submitRetryTimer = null;
14131
14135
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
14132
- if (this.currentStatus === "waiting_approval") return;
14136
+ if (this.hasActionableApproval()) return;
14133
14137
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
14134
14138
  const screenText2 = this.terminalScreen.getText();
14135
14139
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -14172,7 +14176,7 @@ var init_provider_cli_adapter = __esm({
14172
14176
  this.submitRetryTimer = setTimeout(() => {
14173
14177
  this.submitRetryTimer = null;
14174
14178
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
14175
- if (this.currentStatus === "waiting_approval") return;
14179
+ if (this.hasActionableApproval()) return;
14176
14180
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
14177
14181
  const screenText = this.terminalScreen.getText();
14178
14182
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -14457,6 +14461,9 @@ var init_provider_cli_adapter = __esm({
14457
14461
  name: this.cliName,
14458
14462
  providerResolution: this.providerResolutionMeta,
14459
14463
  status: effectiveStatus,
14464
+ projectedStatus: effectiveStatus,
14465
+ rawStatus: this.currentStatus,
14466
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
14460
14467
  ready: effectiveReady,
14461
14468
  startupParseGate: this.startupParseGate,
14462
14469
  spawnAt: this.spawnAt,
@@ -14509,7 +14516,10 @@ var init_provider_cli_adapter = __esm({
14509
14516
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
14510
14517
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
14511
14518
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
14512
- status: this.currentStatus,
14519
+ status: this.projectEffectiveStatus(),
14520
+ projectedStatus: this.projectEffectiveStatus(),
14521
+ rawStatus: this.currentStatus,
14522
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
14513
14523
  activeModal: this.activeModal,
14514
14524
  currentTurnScope: this.currentTurnScope,
14515
14525
  messages: summarizeCliTraceMessages(this.committedMessages, 5)
@@ -87236,7 +87246,7 @@ var init_adhdev_daemon = __esm({
87236
87246
  init_version();
87237
87247
  init_src();
87238
87248
  init_runtime_defaults();
87239
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.16" });
87249
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.18" });
87240
87250
  AdhdevDaemon = class _AdhdevDaemon {
87241
87251
  localHttpServer = null;
87242
87252
  localWss = null;