@adhdev/daemon-core 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.mjs CHANGED
@@ -2477,7 +2477,7 @@ var init_provider_cli_adapter = __esm({
2477
2477
  armApprovalExitTimeout() {
2478
2478
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
2479
2479
  this.approvalExitTimeout = setTimeout(() => {
2480
- if (this.currentStatus !== "waiting_approval") return;
2480
+ if (!this.hasActionableApproval()) return;
2481
2481
  const tail = this.recentOutputBuffer;
2482
2482
  const screenText = this.terminalScreen.getText() || "";
2483
2483
  const modal = this.runParseApproval(tail);
@@ -2504,7 +2504,7 @@ var init_provider_cli_adapter = __esm({
2504
2504
  }
2505
2505
  shouldRetryFinishResponse(commitResult) {
2506
2506
  if (!this.currentTurnScope) return false;
2507
- if (this.currentStatus === "waiting_approval" || this.activeModal) return false;
2507
+ if (this.hasActionableApproval()) return false;
2508
2508
  if (this.finishRetryCount >= _ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
2509
2509
  if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
2510
2510
  if (this.runDetectStatus(this.recentOutputBuffer) !== "idle") return false;
@@ -2520,7 +2520,7 @@ var init_provider_cli_adapter = __esm({
2520
2520
  return quietForMs < holdMs || screenStableMs < holdMs;
2521
2521
  }
2522
2522
  shouldDeferIdleTimeoutFinish() {
2523
- if (!this.isWaitingForResponse || this.currentStatus === "waiting_approval") {
2523
+ if (!this.isWaitingForResponse || this.hasActionableApproval()) {
2524
2524
  return false;
2525
2525
  }
2526
2526
  const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
@@ -2696,7 +2696,7 @@ var init_provider_cli_adapter = __esm({
2696
2696
  scope: this.currentTurnScope
2697
2697
  })
2698
2698
  });
2699
- if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && this.currentStatus !== "waiting_approval" && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
2699
+ if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && !this.hasActionableApproval() && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
2700
2700
  this.submitRetryUsed = true;
2701
2701
  this.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
2702
2702
  LOG.info("CLI", `[${this.cliType}] Retrying submit key from settled parser (no assistant yet)`);
@@ -2786,7 +2786,7 @@ var init_provider_cli_adapter = __esm({
2786
2786
  this.setStatus("generating", "recent_activity_hold");
2787
2787
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2788
2788
  this.idleTimeout = setTimeout(() => {
2789
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2789
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2790
2790
  if (this.shouldDeferIdleTimeoutFinish()) return;
2791
2791
  this.finishResponse();
2792
2792
  }
@@ -2818,16 +2818,16 @@ var init_provider_cli_adapter = __esm({
2818
2818
  }
2819
2819
  this.activeModal = null;
2820
2820
  if (this.isWaitingForResponse) {
2821
- this.setStatus("generating", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
2821
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
2822
2822
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2823
2823
  this.idleTimeout = setTimeout(() => {
2824
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2824
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2825
2825
  if (this.shouldDeferIdleTimeoutFinish()) return;
2826
2826
  this.finishResponse();
2827
2827
  }
2828
2828
  }, this.timeouts.generatingIdle);
2829
2829
  } else {
2830
- this.setStatus("idle", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
2830
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
2831
2831
  }
2832
2832
  this.onStatusChange?.();
2833
2833
  return;
@@ -2885,6 +2885,7 @@ var init_provider_cli_adapter = __esm({
2885
2885
  }
2886
2886
  this.activeModal = null;
2887
2887
  this.lastApprovalResolvedAt = Date.now();
2888
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
2888
2889
  }
2889
2890
  if (!this.isWaitingForResponse) {
2890
2891
  if (prevStatus !== "idle") {
@@ -2942,7 +2943,7 @@ var init_provider_cli_adapter = __esm({
2942
2943
  }
2943
2944
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2944
2945
  this.idleTimeout = setTimeout(() => {
2945
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2946
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2946
2947
  if (this.shouldDeferIdleTimeoutFinish()) return;
2947
2948
  this.clearIdleFinishCandidate("idle_timeout_finish");
2948
2949
  this.finishResponse();
@@ -2980,7 +2981,7 @@ var init_provider_cli_adapter = __esm({
2980
2981
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
2981
2982
  this.finishRetryTimer = setTimeout(() => {
2982
2983
  this.finishRetryTimer = null;
2983
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2984
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2984
2985
  this.finishResponse();
2985
2986
  }
2986
2987
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -3126,10 +3127,13 @@ var init_provider_cli_adapter = __esm({
3126
3127
  return null;
3127
3128
  }
3128
3129
  }
3130
+ hasActionableApproval(startupModal = null) {
3131
+ return !!(startupModal || this.activeModal);
3132
+ }
3129
3133
  projectEffectiveStatus(startupModal = null) {
3130
3134
  if (this.parseErrorMessage) return "error";
3131
- if (startupModal || this.activeModal) return "waiting_approval";
3132
- if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
3135
+ if (this.hasActionableApproval(startupModal)) return "waiting_approval";
3136
+ if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
3133
3137
  return this.currentStatus;
3134
3138
  }
3135
3139
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -3427,7 +3431,7 @@ var init_provider_cli_adapter = __esm({
3427
3431
  async sendMessage(text) {
3428
3432
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
3429
3433
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
3430
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
3434
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
3431
3435
  if (this.startupParseGate) {
3432
3436
  const deadline = Date.now() + 1e4;
3433
3437
  while (this.startupParseGate && Date.now() < deadline) {
@@ -3551,7 +3555,7 @@ var init_provider_cli_adapter = __esm({
3551
3555
  const retrySubmitIfStuck = (attempt) => {
3552
3556
  this.submitRetryTimer = null;
3553
3557
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3554
- if (this.currentStatus === "waiting_approval") return;
3558
+ if (this.hasActionableApproval()) return;
3555
3559
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3556
3560
  const screenText2 = this.terminalScreen.getText();
3557
3561
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -3594,7 +3598,7 @@ var init_provider_cli_adapter = __esm({
3594
3598
  this.submitRetryTimer = setTimeout(() => {
3595
3599
  this.submitRetryTimer = null;
3596
3600
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3597
- if (this.currentStatus === "waiting_approval") return;
3601
+ if (this.hasActionableApproval()) return;
3598
3602
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3599
3603
  const screenText = this.terminalScreen.getText();
3600
3604
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -3879,6 +3883,9 @@ var init_provider_cli_adapter = __esm({
3879
3883
  name: this.cliName,
3880
3884
  providerResolution: this.providerResolutionMeta,
3881
3885
  status: effectiveStatus,
3886
+ projectedStatus: effectiveStatus,
3887
+ rawStatus: this.currentStatus,
3888
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3882
3889
  ready: effectiveReady,
3883
3890
  startupParseGate: this.startupParseGate,
3884
3891
  spawnAt: this.spawnAt,
@@ -3931,7 +3938,10 @@ var init_provider_cli_adapter = __esm({
3931
3938
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
3932
3939
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
3933
3940
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
3934
- status: this.currentStatus,
3941
+ status: this.projectEffectiveStatus(),
3942
+ projectedStatus: this.projectEffectiveStatus(),
3943
+ rawStatus: this.currentStatus,
3944
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3935
3945
  activeModal: this.activeModal,
3936
3946
  currentTurnScope: this.currentTurnScope,
3937
3947
  messages: summarizeCliTraceMessages(this.committedMessages, 5)