@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/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
package/package.json
CHANGED
|
@@ -708,7 +708,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
708
708
|
private armApprovalExitTimeout(): void {
|
|
709
709
|
if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
|
|
710
710
|
this.approvalExitTimeout = setTimeout(() => {
|
|
711
|
-
if (this.
|
|
711
|
+
if (!this.hasActionableApproval()) return;
|
|
712
712
|
const tail = this.recentOutputBuffer;
|
|
713
713
|
const screenText = this.terminalScreen.getText() || '';
|
|
714
714
|
const modal = this.runParseApproval(tail);
|
|
@@ -736,7 +736,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
736
736
|
|
|
737
737
|
private shouldRetryFinishResponse(commitResult: { hasAssistant: boolean; assistantContent: string }): boolean {
|
|
738
738
|
if (!this.currentTurnScope) return false;
|
|
739
|
-
if (this.
|
|
739
|
+
if (this.hasActionableApproval()) return false;
|
|
740
740
|
if (this.finishRetryCount >= ProviderCliAdapter.MAX_FINISH_RETRIES) return false;
|
|
741
741
|
if (commitResult.hasAssistant && commitResult.assistantContent.trim()) return false;
|
|
742
742
|
|
|
@@ -757,7 +757,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
private shouldDeferIdleTimeoutFinish(): boolean {
|
|
760
|
-
if (!this.isWaitingForResponse || this.
|
|
760
|
+
if (!this.isWaitingForResponse || this.hasActionableApproval()) {
|
|
761
761
|
return false;
|
|
762
762
|
}
|
|
763
763
|
const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
|
|
@@ -942,7 +942,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
942
942
|
&& !lastParsedAssistant
|
|
943
943
|
&& !this.submitRetryUsed
|
|
944
944
|
&& this.ptyProcess
|
|
945
|
-
&& this.
|
|
945
|
+
&& !this.hasActionableApproval()
|
|
946
946
|
&& promptLikelyVisible(screenText, normalizedPromptSnippet)
|
|
947
947
|
&& !this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)
|
|
948
948
|
) {
|
|
@@ -1054,7 +1054,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1054
1054
|
this.setStatus('generating', 'recent_activity_hold');
|
|
1055
1055
|
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
1056
1056
|
this.idleTimeout = setTimeout(() => {
|
|
1057
|
-
if (this.isWaitingForResponse && this.
|
|
1057
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1058
1058
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
1059
1059
|
this.finishResponse();
|
|
1060
1060
|
}
|
|
@@ -1084,16 +1084,16 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1084
1084
|
if (this.approvalExitTimeout) { clearTimeout(this.approvalExitTimeout); this.approvalExitTimeout = null; }
|
|
1085
1085
|
this.activeModal = null;
|
|
1086
1086
|
if (this.isWaitingForResponse) {
|
|
1087
|
-
this.setStatus('
|
|
1087
|
+
this.setStatus('idle', inCooldown ? 'approval_cooldown_non_actionable' : 'approval_prompt_gone_non_actionable');
|
|
1088
1088
|
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
1089
1089
|
this.idleTimeout = setTimeout(() => {
|
|
1090
|
-
if (this.isWaitingForResponse && this.
|
|
1090
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1091
1091
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
1092
1092
|
this.finishResponse();
|
|
1093
1093
|
}
|
|
1094
1094
|
}, this.timeouts.generatingIdle);
|
|
1095
1095
|
} else {
|
|
1096
|
-
this.setStatus('idle', inCooldown ? '
|
|
1096
|
+
this.setStatus('idle', inCooldown ? 'approval_cooldown_non_actionable' : 'approval_prompt_gone_non_actionable');
|
|
1097
1097
|
}
|
|
1098
1098
|
this.onStatusChange?.();
|
|
1099
1099
|
return;
|
|
@@ -1153,9 +1153,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1153
1153
|
if (this.approvalExitTimeout) { clearTimeout(this.approvalExitTimeout); this.approvalExitTimeout = null; }
|
|
1154
1154
|
this.activeModal = null;
|
|
1155
1155
|
this.lastApprovalResolvedAt = Date.now();
|
|
1156
|
-
|
|
1157
|
-
this.setStatus('generating', 'approval_prompt_gone_idle_confirm');
|
|
1158
|
-
}
|
|
1156
|
+
this.setStatus('idle', 'approval_prompt_gone_script_idle');
|
|
1159
1157
|
}
|
|
1160
1158
|
if (!this.isWaitingForResponse) {
|
|
1161
1159
|
if (prevStatus !== 'idle') {
|
|
@@ -1225,7 +1223,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1225
1223
|
|
|
1226
1224
|
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
1227
1225
|
this.idleTimeout = setTimeout(() => {
|
|
1228
|
-
if (this.isWaitingForResponse && this.
|
|
1226
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1229
1227
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
1230
1228
|
this.clearIdleFinishCandidate('idle_timeout_finish');
|
|
1231
1229
|
this.finishResponse();
|
|
@@ -1264,7 +1262,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1264
1262
|
if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
|
|
1265
1263
|
this.finishRetryTimer = setTimeout(() => {
|
|
1266
1264
|
this.finishRetryTimer = null;
|
|
1267
|
-
if (this.isWaitingForResponse && this.
|
|
1265
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1268
1266
|
this.finishResponse();
|
|
1269
1267
|
}
|
|
1270
1268
|
}, ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
|
|
@@ -1427,10 +1425,14 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1427
1425
|
}
|
|
1428
1426
|
}
|
|
1429
1427
|
|
|
1428
|
+
private hasActionableApproval(startupModal: { message: string; buttons: string[] } | null = null): boolean {
|
|
1429
|
+
return !!(startupModal || this.activeModal);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1430
1432
|
private projectEffectiveStatus(startupModal: { message: string; buttons: string[] } | null = null): CliSessionStatus['status'] {
|
|
1431
1433
|
if (this.parseErrorMessage) return 'error';
|
|
1432
|
-
if (
|
|
1433
|
-
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus
|
|
1434
|
+
if (this.hasActionableApproval(startupModal)) return 'waiting_approval';
|
|
1435
|
+
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus !== 'stopped') return 'generating';
|
|
1434
1436
|
return this.currentStatus;
|
|
1435
1437
|
}
|
|
1436
1438
|
|
|
@@ -1815,7 +1817,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1815
1817
|
const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
|
|
1816
1818
|
const allowInterventionPrompt = allowInputDuringGeneration
|
|
1817
1819
|
&& this.isWaitingForResponse
|
|
1818
|
-
&& this.
|
|
1820
|
+
&& !this.hasActionableApproval();
|
|
1819
1821
|
if (this.startupParseGate) {
|
|
1820
1822
|
const deadline = Date.now() + 10000;
|
|
1821
1823
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
@@ -1946,7 +1948,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1946
1948
|
const retrySubmitIfStuck = (attempt: number) => {
|
|
1947
1949
|
this.submitRetryTimer = null;
|
|
1948
1950
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
1949
|
-
if (this.
|
|
1951
|
+
if (this.hasActionableApproval()) return;
|
|
1950
1952
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
1951
1953
|
const screenText = this.terminalScreen.getText();
|
|
1952
1954
|
if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
|
|
@@ -1990,7 +1992,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1990
1992
|
this.submitRetryTimer = setTimeout(() => {
|
|
1991
1993
|
this.submitRetryTimer = null;
|
|
1992
1994
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
1993
|
-
if (this.
|
|
1995
|
+
if (this.hasActionableApproval()) return;
|
|
1994
1996
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
1995
1997
|
const screenText = this.terminalScreen.getText();
|
|
1996
1998
|
if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
|
|
@@ -2284,6 +2286,9 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
2284
2286
|
name: this.cliName,
|
|
2285
2287
|
providerResolution: this.providerResolutionMeta,
|
|
2286
2288
|
status: effectiveStatus,
|
|
2289
|
+
projectedStatus: effectiveStatus,
|
|
2290
|
+
rawStatus: this.currentStatus,
|
|
2291
|
+
lifecycleStatus: this.isWaitingForResponse ? 'awaiting_response' : 'idle',
|
|
2287
2292
|
ready: effectiveReady,
|
|
2288
2293
|
startupParseGate: this.startupParseGate,
|
|
2289
2294
|
spawnAt: this.spawnAt,
|
|
@@ -2337,7 +2342,10 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
2337
2342
|
screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4000),
|
|
2338
2343
|
recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1000),
|
|
2339
2344
|
responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
|
|
2340
|
-
status: this.
|
|
2345
|
+
status: this.projectEffectiveStatus(),
|
|
2346
|
+
projectedStatus: this.projectEffectiveStatus(),
|
|
2347
|
+
rawStatus: this.currentStatus,
|
|
2348
|
+
lifecycleStatus: this.isWaitingForResponse ? 'awaiting_response' : 'idle',
|
|
2341
2349
|
activeModal: this.activeModal,
|
|
2342
2350
|
currentTurnScope: this.currentTurnScope,
|
|
2343
2351
|
messages: summarizeCliTraceMessages(this.committedMessages, 5),
|