@adhdev/daemon-core 0.9.17 → 0.9.19
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/cli-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/index.js +26 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -19
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +27 -19
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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("
|
|
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.
|
|
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 ? "
|
|
2833
|
+
this.setStatus("idle", inCooldown ? "approval_cooldown_non_actionable" : "approval_prompt_gone_non_actionable");
|
|
2834
2834
|
}
|
|
2835
2835
|
this.onStatusChange?.();
|
|
2836
2836
|
return;
|
|
@@ -2888,9 +2888,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2888
2888
|
}
|
|
2889
2889
|
this.activeModal = null;
|
|
2890
2890
|
this.lastApprovalResolvedAt = Date.now();
|
|
2891
|
-
|
|
2892
|
-
this.setStatus("generating", "approval_prompt_gone_idle_confirm");
|
|
2893
|
-
}
|
|
2891
|
+
this.setStatus("idle", "approval_prompt_gone_script_idle");
|
|
2894
2892
|
}
|
|
2895
2893
|
if (!this.isWaitingForResponse) {
|
|
2896
2894
|
if (prevStatus !== "idle") {
|
|
@@ -2948,7 +2946,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2948
2946
|
}
|
|
2949
2947
|
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
2950
2948
|
this.idleTimeout = setTimeout(() => {
|
|
2951
|
-
if (this.isWaitingForResponse && this.
|
|
2949
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
2952
2950
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
2953
2951
|
this.clearIdleFinishCandidate("idle_timeout_finish");
|
|
2954
2952
|
this.finishResponse();
|
|
@@ -2986,7 +2984,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2986
2984
|
if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
|
|
2987
2985
|
this.finishRetryTimer = setTimeout(() => {
|
|
2988
2986
|
this.finishRetryTimer = null;
|
|
2989
|
-
if (this.isWaitingForResponse && this.
|
|
2987
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
2990
2988
|
this.finishResponse();
|
|
2991
2989
|
}
|
|
2992
2990
|
}, _ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
|
|
@@ -3132,10 +3130,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
3132
3130
|
return null;
|
|
3133
3131
|
}
|
|
3134
3132
|
}
|
|
3133
|
+
hasActionableApproval(startupModal = null) {
|
|
3134
|
+
return !!(startupModal || this.activeModal);
|
|
3135
|
+
}
|
|
3135
3136
|
projectEffectiveStatus(startupModal = null) {
|
|
3136
3137
|
if (this.parseErrorMessage) return "error";
|
|
3137
|
-
if (
|
|
3138
|
-
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus
|
|
3138
|
+
if (this.hasActionableApproval(startupModal)) return "waiting_approval";
|
|
3139
|
+
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== "stopped") return "generating";
|
|
3139
3140
|
return this.currentStatus;
|
|
3140
3141
|
}
|
|
3141
3142
|
suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
|
|
@@ -3433,7 +3434,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
3433
3434
|
async sendMessage(text) {
|
|
3434
3435
|
if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
|
|
3435
3436
|
const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
|
|
3436
|
-
const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && this.
|
|
3437
|
+
const allowInterventionPrompt = allowInputDuringGeneration && this.isWaitingForResponse && !this.hasActionableApproval();
|
|
3437
3438
|
if (this.startupParseGate) {
|
|
3438
3439
|
const deadline = Date.now() + 1e4;
|
|
3439
3440
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
@@ -3557,7 +3558,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
3557
3558
|
const retrySubmitIfStuck = (attempt) => {
|
|
3558
3559
|
this.submitRetryTimer = null;
|
|
3559
3560
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
3560
|
-
if (this.
|
|
3561
|
+
if (this.hasActionableApproval()) return;
|
|
3561
3562
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
3562
3563
|
const screenText2 = this.terminalScreen.getText();
|
|
3563
3564
|
if (!promptLikelyVisible(screenText2, normalizedPromptSnippet)) return;
|
|
@@ -3600,7 +3601,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
3600
3601
|
this.submitRetryTimer = setTimeout(() => {
|
|
3601
3602
|
this.submitRetryTimer = null;
|
|
3602
3603
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
3603
|
-
if (this.
|
|
3604
|
+
if (this.hasActionableApproval()) return;
|
|
3604
3605
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
3605
3606
|
const screenText = this.terminalScreen.getText();
|
|
3606
3607
|
if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
|
|
@@ -3885,6 +3886,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
3885
3886
|
name: this.cliName,
|
|
3886
3887
|
providerResolution: this.providerResolutionMeta,
|
|
3887
3888
|
status: effectiveStatus,
|
|
3889
|
+
projectedStatus: effectiveStatus,
|
|
3890
|
+
rawStatus: this.currentStatus,
|
|
3891
|
+
lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
|
|
3888
3892
|
ready: effectiveReady,
|
|
3889
3893
|
startupParseGate: this.startupParseGate,
|
|
3890
3894
|
spawnAt: this.spawnAt,
|
|
@@ -3937,7 +3941,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
3937
3941
|
screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4e3),
|
|
3938
3942
|
recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1e3),
|
|
3939
3943
|
responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
|
|
3940
|
-
status: this.
|
|
3944
|
+
status: this.projectEffectiveStatus(),
|
|
3945
|
+
projectedStatus: this.projectEffectiveStatus(),
|
|
3946
|
+
rawStatus: this.currentStatus,
|
|
3947
|
+
lifecycleStatus: this.isWaitingForResponse ? "awaiting_response" : "idle",
|
|
3941
3948
|
activeModal: this.activeModal,
|
|
3942
3949
|
currentTurnScope: this.currentTurnScope,
|
|
3943
3950
|
messages: summarizeCliTraceMessages(this.committedMessages, 5)
|