@adhdev/daemon-standalone 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.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,6 +30755,7 @@ var require_dist2 = __commonJS({
30755
30755
  }
30756
30756
  this.activeModal = null;
30757
30757
  this.lastApprovalResolvedAt = Date.now();
30758
+ this.setStatus("idle", "approval_prompt_gone_script_idle");
30758
30759
  }
30759
30760
  if (!this.isWaitingForResponse) {
30760
30761
  if (prevStatus !== "idle") {
@@ -30812,7 +30813,7 @@ var require_dist2 = __commonJS({
30812
30813
  }
30813
30814
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
30814
30815
  this.idleTimeout = setTimeout(() => {
30815
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30816
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30816
30817
  if (this.shouldDeferIdleTimeoutFinish()) return;
30817
30818
  this.clearIdleFinishCandidate("idle_timeout_finish");
30818
30819
  this.finishResponse();
@@ -30850,7 +30851,7 @@ var require_dist2 = __commonJS({
30850
30851
  if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
30851
30852
  this.finishRetryTimer = setTimeout(() => {
30852
30853
  this.finishRetryTimer = null;
30853
- if (this.isWaitingForResponse && this.currentStatus !== "waiting_approval") {
30854
+ if (this.isWaitingForResponse && !this.hasActionableApproval()) {
30854
30855
  this.finishResponse();
30855
30856
  }
30856
30857
  }, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
@@ -30996,10 +30997,13 @@ var require_dist2 = __commonJS({
30996
30997
  return null;
30997
30998
  }
30998
30999
  }
31000
+ hasActionableApproval(startupModal = null) {
31001
+ return !!(startupModal || this.activeModal);
31002
+ }
30999
31003
  projectEffectiveStatus(startupModal = null) {
31000
31004
  if (this.parseErrorMessage) return "error";
31001
- if (startupModal || this.activeModal) return "waiting_approval";
31002
- 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";
31003
31007
  return this.currentStatus;
31004
31008
  }
31005
31009
  suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
@@ -31297,7 +31301,7 @@ var require_dist2 = __commonJS({
31297
31301
  async sendMessage(text) {
31298
31302
  if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
31299
31303
  const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
31300
- const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.currentStatus !== "waiting_approval";
31304
+ const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
31301
31305
  if (this.startupParseGate) {
31302
31306
  const deadline = Date.now() + 1e4;
31303
31307
  while (this.startupParseGate && Date.now() < deadline) {
@@ -31421,7 +31425,7 @@ var require_dist2 = __commonJS({
31421
31425
  const retrySubmitIfStuck = (attempt) => {
31422
31426
  this.submitRetryTimer = null;
31423
31427
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
31424
- if (this.currentStatus === "waiting_approval") return;
31428
+ if (this.hasActionableApproval()) return;
31425
31429
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
31426
31430
  const screenText2 = this.terminalScreen.getText();
31427
31431
  if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
@@ -31464,7 +31468,7 @@ var require_dist2 = __commonJS({
31464
31468
  this.submitRetryTimer = setTimeout(() => {
31465
31469
  this.submitRetryTimer = null;
31466
31470
  if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
31467
- if (this.currentStatus === "waiting_approval") return;
31471
+ if (this.hasActionableApproval()) return;
31468
31472
  if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
31469
31473
  const screenText = this.terminalScreen.getText();
31470
31474
  if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
@@ -31749,6 +31753,9 @@ var require_dist2 = __commonJS({
31749
31753
  name: this.cliName,
31750
31754
  providerResolution: this.providerResolutionMeta,
31751
31755
  status: effectiveStatus,
31756
+ projectedStatus: effectiveStatus,
31757
+ rawStatus: this.currentStatus,
31758
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
31752
31759
  ready: effectiveReady,
31753
31760
  startupParseGate: this.startupParseGate,
31754
31761
  spawnAt: this.spawnAt,
@@ -31801,7 +31808,10 @@ var require_dist2 = __commonJS({
31801
31808
  screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
31802
31809
  recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
31803
31810
  responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
31804
- status: this.currentStatus,
31811
+ status: this.projectEffectiveStatus(),
31812
+ projectedStatus: this.projectEffectiveStatus(),
31813
+ rawStatus: this.currentStatus,
31814
+ lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
31805
31815
  activeModal: this.activeModal,
31806
31816
  currentTurnScope: this.currentTurnScope,
31807
31817
  messages: summarizeCliTraceMessages(this.committedMessages, 5)