@adhdev/daemon-core 0.9.17 → 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,9 +2885,7 @@ var init_provider_cli_adapter = __esm({
2885
2885
  }
2886
2886
  this.activeModal = null;
2887
2887
  this.lastApprovalResolvedAt = Date.now();
2888
- if (this.isWaitingForResponse) {
2889
- this.setStatus("generating", "approval_prompt_gone_idle_confirm");
2890
- }
2888
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
2891
2889
  }
2892
2890
  if (!this.isWaitingForResponse) {
2893
2891
  if (prevStatus !== "idle") {
@@ -2945,7 +2943,7 @@ var init_provider_cli_adapter = __esm({
2945
2943
  }
2946
2944
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2947
2945
  this.idleTimeout = setTimeout(() => {
2948
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2946
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2949
2947
  if (this.shouldDeferIdleTimeoutFinish()) return;
2950
2948
  this.clearIdleFinishCandidate("idle_timeout_finish");
2951
2949
  this.finishResponse();
@@ -2983,7 +2981,7 @@ var init_provider_cli_adapter = __esm({
2983
2981
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
2984
2982
  this.finishRetryTimer = setTimeout(() => {
2985
2983
  this.finishRetryTimer = null;
2986
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2984
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2987
2985
  this.finishResponse();
2988
2986
  }
2989
2987
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -3129,10 +3127,13 @@ var init_provider_cli_adapter = __esm({
3129
3127
  return null;
3130
3128
  }
3131
3129
  }
3130
+ hasActionableApproval(startupModal = null) {
3131
+ return !!(startupModal || this.activeModal);
3132
+ }
3132
3133
  projectEffectiveStatus(startupModal = null) {
3133
3134
  if (this.parseErrorMessage) return "error";
3134
- if (startupModal || this.activeModal) return "waiting_approval";
3135
- 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";
3136
3137
  return this.currentStatus;
3137
3138
  }
3138
3139
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -3430,7 +3431,7 @@ var init_provider_cli_adapter = __esm({
3430
3431
  async sendMessage(text) {
3431
3432
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
3432
3433
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
3433
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
3434
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
3434
3435
  if (this.startupParseGate) {
3435
3436
  const deadline = Date.now() + 1e4;
3436
3437
  while (this.startupParseGate && Date.now() < deadline) {
@@ -3554,7 +3555,7 @@ var init_provider_cli_adapter = __esm({
3554
3555
  const retrySubmitIfStuck = (attempt) => {
3555
3556
  this.submitRetryTimer = null;
3556
3557
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3557
- if (this.currentStatus === "waiting_approval") return;
3558
+ if (this.hasActionableApproval()) return;
3558
3559
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3559
3560
  const screenText2 = this.terminalScreen.getText();
3560
3561
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -3597,7 +3598,7 @@ var init_provider_cli_adapter = __esm({
3597
3598
  this.submitRetryTimer = setTimeout(() => {
3598
3599
  this.submitRetryTimer = null;
3599
3600
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3600
- if (this.currentStatus === "waiting_approval") return;
3601
+ if (this.hasActionableApproval()) return;
3601
3602
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3602
3603
  const screenText = this.terminalScreen.getText();
3603
3604
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -3882,6 +3883,9 @@ var init_provider_cli_adapter = __esm({
3882
3883
  name: this.cliName,
3883
3884
  providerResolution: this.providerResolutionMeta,
3884
3885
  status: effectiveStatus,
3886
+ projectedStatus: effectiveStatus,
3887
+ rawStatus: this.currentStatus,
3888
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3885
3889
  ready: effectiveReady,
3886
3890
  startupParseGate: this.startupParseGate,
3887
3891
  spawnAt: this.spawnAt,
@@ -3934,7 +3938,10 @@ var init_provider_cli_adapter = __esm({
3934
3938
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
3935
3939
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
3936
3940
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
3937
- status: this.currentStatus,
3941
+ status: this.projectEffectiveStatus(),
3942
+ projectedStatus: this.projectEffectiveStatus(),
3943
+ rawStatus: this.currentStatus,
3944
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3938
3945
  activeModal: this.activeModal,
3939
3946
  currentTurnScope: this.currentTurnScope,
3940
3947
  messages: summarizeCliTraceMessages(this.committedMessages, 5)