@adhdev/daemon-standalone 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.js CHANGED
@@ -30347,7 +30347,7 @@ var require_dist2 = __commonJS({
30347
30347
  armApprovalExitTimeout() {
30348
30348
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
30349
30349
  this.approvalExitTimeout = setTimeout(() => {
30350
- if (this.currentStatus !== "waiting_approval") return;
30350
+ if (!this.hasActionableApproval()) return;
30351
30351
  const tail = this.recentOutputBuffer;
30352
30352
  const screenText = this.terminalScreen.getText() || "";
30353
30353
  const modal = this.runParseApproval(tail);
@@ -30374,7 +30374,7 @@ var require_dist2 = __commonJS({
30374
30374
  }
30375
30375
  shouldRetryFinishResponse(commitResult) {
30376
30376
  if (!this.currentTurnScope) return false;
30377
- if (this.currentStatus === "waiting_approval" || this.activeModal) return false;
30377
+ if (this.hasActionableApproval()) return false;
30378
30378
  if (this.finishRetryCount >= _ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
30379
30379
  if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
30380
30380
  if (this.runDetectStatus(this.recentOutputBuffer) !== "idle") return false;
@@ -30390,7 +30390,7 @@ var require_dist2 = __commonJS({
30390
30390
  return quietForMs < holdMs || screenStableMs < holdMs;
30391
30391
  }
30392
30392
  shouldDeferIdleTimeoutFinish() {
30393
- if (!this.isWaitingForResponse || this.currentStatus === "waiting_approval") {
30393
+ if (!this.isWaitingForResponse || this.hasActionableApproval()) {
30394
30394
  return false;
30395
30395
  }
30396
30396
  const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
@@ -30566,7 +30566,7 @@ var require_dist2 = __commonJS({
30566
30566
  scope: this.currentTurnScope
30567
30567
  })
30568
30568
  });
30569
- if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && this.currentStatus !== "waiting_approval" && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
30569
+ if (this.currentTurnScope && !lastParsedAssistant && !this.submitRetryUsed && this.ptyProcess && !this.hasActionableApproval() && promptLikelyVisible(screenText, normalizedPromptSnippet) && !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) {
30570
30570
  this.submitRetryUsed = true;
30571
30571
  this.responseSettleIgnoreUntil = Date.now() + this.timeouts.outputSettle + 400;
30572
30572
  LOG2.info("CLI", `[${this.cliType}] Retrying submit key from settled parser (no assistant yet)`);
@@ -30656,7 +30656,7 @@ var require_dist2 = __commonJS({
30656
30656
  this.setStatus("generating", "recent_activity_hold");
30657
30657
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
30658
30658
  this.idleTimeout = setTimeout(() => {
30659
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30659
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30660
30660
  if (this.shouldDeferIdleTimeoutFinish()) return;
30661
30661
  this.finishResponse();
30662
30662
  }
@@ -30688,16 +30688,16 @@ var require_dist2 = __commonJS({
30688
30688
  }
30689
30689
  this.activeModal = null;
30690
30690
  if (this.isWaitingForResponse) {
30691
- this.setStatus("generating", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
30691
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
30692
30692
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
30693
30693
  this.idleTimeout = setTimeout(() => {
30694
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30694
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30695
30695
  if (this.shouldDeferIdleTimeoutFinish()) return;
30696
30696
  this.finishResponse();
30697
30697
  }
30698
30698
  }, this.timeouts.generatingIdle);
30699
30699
  } else {
30700
- this.setStatus("idle", inCooldown ? "approval_cooldown_ignore" : "approval_prompt_gone");
30700
+ this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
30701
30701
  }
30702
30702
  this.onStatusChange?.();
30703
30703
  return;
@@ -30755,9 +30755,7 @@ var require_dist2 = __commonJS({
30755
30755
  }
30756
30756
  this.activeModal = null;
30757
30757
  this.lastApprovalResolvedAt = Date.now();
30758
- if (this.isWaitingForResponse) {
30759
- this.setStatus("generating", "approval_prompt_gone_idle_confirm");
30760
- }
30758
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
30761
30759
  }
30762
30760
  if (!this.isWaitingForResponse) {
30763
30761
  if (prevStatus !== "idle") {
@@ -30815,7 +30813,7 @@ var require_dist2 = __commonJS({
30815
30813
  }
30816
30814
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
30817
30815
  this.idleTimeout = setTimeout(() => {
30818
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30816
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30819
30817
  if (this.shouldDeferIdleTimeoutFinish()) return;
30820
30818
  this.clearIdleFinishCandidate("idle_timeout_finish");
30821
30819
  this.finishResponse();
@@ -30853,7 +30851,7 @@ var require_dist2 = __commonJS({
30853
30851
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
30854
30852
  this.finishRetryTimer = setTimeout(() => {
30855
30853
  this.finishRetryTimer = null;
30856
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30854
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30857
30855
  this.finishResponse();
30858
30856
  }
30859
30857
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -30999,10 +30997,13 @@ var require_dist2 = __commonJS({
30999
30997
  return null;
31000
30998
  }
31001
30999
  }
31000
+ hasActionableApproval(startupModal = null) {
31001
+ return !!(startupModal || this.activeModal);
31002
+ }
31002
31003
  projectEffectiveStatus(startupModal = null) {
31003
31004
  if (this.parseErrorMessage) return "error";
31004
- if (startupModal || this.activeModal) return "waiting_approval";
31005
- if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
31005
+ if (this.hasActionableApproval(startupModal)) return "waiting_approval";
31006
+ if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
31006
31007
  return this.currentStatus;
31007
31008
  }
31008
31009
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -31300,7 +31301,7 @@ var require_dist2 = __commonJS({
31300
31301
  async sendMessage(text) {
31301
31302
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
31302
31303
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
31303
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
31304
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
31304
31305
  if (this.startupParseGate) {
31305
31306
  const deadline = Date.now() + 1e4;
31306
31307
  while (this.startupParseGate && Date.now() < deadline) {
@@ -31424,7 +31425,7 @@ var require_dist2 = __commonJS({
31424
31425
  const retrySubmitIfStuck = (attempt) => {
31425
31426
  this.submitRetryTimer = null;
31426
31427
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
31427
- if (this.currentStatus === "waiting_approval") return;
31428
+ if (this.hasActionableApproval()) return;
31428
31429
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
31429
31430
  const screenText2 = this.terminalScreen.getText();
31430
31431
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -31467,7 +31468,7 @@ var require_dist2 = __commonJS({
31467
31468
  this.submitRetryTimer = setTimeout(() => {
31468
31469
  this.submitRetryTimer = null;
31469
31470
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
31470
- if (this.currentStatus === "waiting_approval") return;
31471
+ if (this.hasActionableApproval()) return;
31471
31472
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
31472
31473
  const screenText = this.terminalScreen.getText();
31473
31474
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -31752,6 +31753,9 @@ var require_dist2 = __commonJS({
31752
31753
  name: this.cliName,
31753
31754
  providerResolution: this.providerResolutionMeta,
31754
31755
  status: effectiveStatus,
31756
+ projectedStatus: effectiveStatus,
31757
+ rawStatus: this.currentStatus,
31758
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
31755
31759
  ready: effectiveReady,
31756
31760
  startupParseGate: this.startupParseGate,
31757
31761
  spawnAt: this.spawnAt,
@@ -31804,7 +31808,10 @@ var require_dist2 = __commonJS({
31804
31808
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
31805
31809
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
31806
31810
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
31807
- status: this.currentStatus,
31811
+ status: this.projectEffectiveStatus(),
31812
+ projectedStatus: this.projectEffectiveStatus(),
31813
+ rawStatus: this.currentStatus,
31814
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
31808
31815
  activeModal: this.activeModal,
31809
31816
  currentTurnScope: this.currentTurnScope,
31810
31817
  messages: summarizeCliTraceMessages(this.committedMessages, 5)