@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.
@@ -147,6 +147,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
147
147
  private commitCurrentTranscript;
148
148
  private runDetectStatus;
149
149
  private runParseApproval;
150
+ private hasActionableApproval;
150
151
  private projectEffectiveStatus;
151
152
  private suppressStaleParsedApproval;
152
153
  getStatus(): CliSessionStatus;
package/dist/index.js CHANGED
@@ -2480,7 +2480,7 @@ var init_provider_cli_adapter = __esm({
2480
2480
  armApprovalExitTimeout() {
2481
2481
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
2482
2482
  this.approvalExitTimeout = setTimeout(() => {
2483
- if (this.currentStatus !== "waiting_approval") return;
2483
+ if (!this.hasActionableApproval()) return;
2484
2484
  const tail = this.recentOutputBuffer;
2485
2485
  const screenText = this.terminalScreen.getText() || "";
2486
2486
  const modal = this.runParseApproval(tail);
@@ -2507,7 +2507,7 @@ var init_provider_cli_adapter = __esm({
2507
2507
  }
2508
2508
  shouldRetryFinishResponse(commitResult) {
2509
2509
  if (!this.currentTurnScope) return false;
2510
- if (this.currentStatus === "waiting_approval" || this.activeModal) return false;
2510
+ if (this.hasActionableApproval()) return false;
2511
2511
  if (this.finishRetryCount >= _ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
2512
2512
  if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
2513
2513
  if (this.runDetectStatus(this.recentOutputBuffer) !== "idle") return false;
@@ -2523,7 +2523,7 @@ var init_provider_cli_adapter = __esm({
2523
2523
  return quietForMs < holdMs || screenStableMs < holdMs;
2524
2524
  }
2525
2525
  shouldDeferIdleTimeoutFinish() {
2526
- if (!this.isWaitingForResponse || this.currentStatus === "waiting_approval") {
2526
+ if (!this.isWaitingForResponse || this.hasActionableApproval()) {
2527
2527
  return false;
2528
2528
  }
2529
2529
  const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
@@ -2699,7 +2699,7 @@ var init_provider_cli_adapter = __esm({
2699
2699
  scope: this.currentTurnScope
2700
2700
  })
2701
2701
  });
2702
- if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && this.currentStatus !== "waiting_approval" && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
2702
+ if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && !this.hasActionableApproval() && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
2703
2703
  this.submitRetryUsed = true;
2704
2704
  this.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
2705
2705
  LOG.info("CLI", `[${this.cliType}] Retrying submit key from settled parser (no assistant yet)`);
@@ -2789,7 +2789,7 @@ var init_provider_cli_adapter = __esm({
2789
2789
  this.setStatus("generating", "recent_activity_hold");
2790
2790
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2791
2791
  this.idleTimeout = setTimeout(() => {
2792
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2792
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2793
2793
  if (this.shouldDeferIdleTimeoutFinish()) return;
2794
2794
  this.finishResponse();
2795
2795
  }
@@ -2821,16 +2821,16 @@ var init_provider_cli_adapter = __esm({
2821
2821
  }
2822
2822
  this.activeModal = null;
2823
2823
  if (this.isWaitingForResponse) {
2824
- this.setStatus("generating", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
2824
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
2825
2825
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2826
2826
  this.idleTimeout = setTimeout(() => {
2827
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2827
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2828
2828
  if (this.shouldDeferIdleTimeoutFinish()) return;
2829
2829
  this.finishResponse();
2830
2830
  }
2831
2831
  }, this.timeouts.generatingIdle);
2832
2832
  } else {
2833
- this.setStatus("idle", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
2833
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
2834
2834
  }
2835
2835
  this.onStatusChange?.();
2836
2836
  return;
@@ -2888,6 +2888,7 @@ var init_provider_cli_adapter = __esm({
2888
2888
  }
2889
2889
  this.activeModal = null;
2890
2890
  this.lastApprovalResolvedAt = Date.now();
2891
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
2891
2892
  }
2892
2893
  if (!this.isWaitingForResponse) {
2893
2894
  if (prevStatus !== "idle") {
@@ -2945,7 +2946,7 @@ var init_provider_cli_adapter = __esm({
2945
2946
  }
2946
2947
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
2947
2948
  this.idleTimeout = setTimeout(() => {
2948
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2949
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2949
2950
  if (this.shouldDeferIdleTimeoutFinish()) return;
2950
2951
  this.clearIdleFinishCandidate("idle_timeout_finish");
2951
2952
  this.finishResponse();
@@ -2983,7 +2984,7 @@ var init_provider_cli_adapter = __esm({
2983
2984
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
2984
2985
  this.finishRetryTimer = setTimeout(() => {
2985
2986
  this.finishRetryTimer = null;
2986
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
2987
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
2987
2988
  this.finishResponse();
2988
2989
  }
2989
2990
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -3129,10 +3130,13 @@ var init_provider_cli_adapter = __esm({
3129
3130
  return null;
3130
3131
  }
3131
3132
  }
3133
+ hasActionableApproval(startupModal = null) {
3134
+ return !!(startupModal || this.activeModal);
3135
+ }
3132
3136
  projectEffectiveStatus(startupModal = null) {
3133
3137
  if (this.parseErrorMessage) return "error";
3134
- if (startupModal || this.activeModal) return "waiting_approval";
3135
- if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
3138
+ if (this.hasActionableApproval(startupModal)) return "waiting_approval";
3139
+ if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
3136
3140
  return this.currentStatus;
3137
3141
  }
3138
3142
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -3430,7 +3434,7 @@ var init_provider_cli_adapter = __esm({
3430
3434
  async sendMessage(text) {
3431
3435
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
3432
3436
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
3433
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
3437
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
3434
3438
  if (this.startupParseGate) {
3435
3439
  const deadline = Date.now() + 1e4;
3436
3440
  while (this.startupParseGate && Date.now() < deadline) {
@@ -3554,7 +3558,7 @@ var init_provider_cli_adapter = __esm({
3554
3558
  const retrySubmitIfStuck = (attempt) => {
3555
3559
  this.submitRetryTimer = null;
3556
3560
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3557
- if (this.currentStatus === "waiting_approval") return;
3561
+ if (this.hasActionableApproval()) return;
3558
3562
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3559
3563
  const screenText2 = this.terminalScreen.getText();
3560
3564
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -3597,7 +3601,7 @@ var init_provider_cli_adapter = __esm({
3597
3601
  this.submitRetryTimer = setTimeout(() => {
3598
3602
  this.submitRetryTimer = null;
3599
3603
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
3600
- if (this.currentStatus === "waiting_approval") return;
3604
+ if (this.hasActionableApproval()) return;
3601
3605
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
3602
3606
  const screenText = this.terminalScreen.getText();
3603
3607
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -3882,6 +3886,9 @@ var init_provider_cli_adapter = __esm({
3882
3886
  name: this.cliName,
3883
3887
  providerResolution: this.providerResolutionMeta,
3884
3888
  status: effectiveStatus,
3889
+ projectedStatus: effectiveStatus,
3890
+ rawStatus: this.currentStatus,
3891
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3885
3892
  ready: effectiveReady,
3886
3893
  startupParseGate: this.startupParseGate,
3887
3894
  spawnAt: this.spawnAt,
@@ -3934,7 +3941,10 @@ var init_provider_cli_adapter = __esm({
3934
3941
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
3935
3942
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
3936
3943
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
3937
- status: this.currentStatus,
3944
+ status: this.projectEffectiveStatus(),
3945
+ projectedStatus: this.projectEffectiveStatus(),
3946
+ rawStatus: this.currentStatus,
3947
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
3938
3948
  activeModal: this.activeModal,
3939
3949
  currentTurnScope: this.currentTurnScope,
3940
3950
  messages: summarizeCliTraceMessages(this.committedMessages, 5)