@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.
- package/dist/cli-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -16
- 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 -16
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,6 +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
|
+
this.setStatus('idle', 'approval_prompt_gone_script_idle');
|
|
1156
1157
|
}
|
|
1157
1158
|
if (!this.isWaitingForResponse) {
|
|
1158
1159
|
if (prevStatus !== 'idle') {
|
|
@@ -1222,7 +1223,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1222
1223
|
|
|
1223
1224
|
if (this.idleTimeout) clearTimeout(this.idleTimeout);
|
|
1224
1225
|
this.idleTimeout = setTimeout(() => {
|
|
1225
|
-
if (this.isWaitingForResponse && this.
|
|
1226
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1226
1227
|
if (this.shouldDeferIdleTimeoutFinish()) return;
|
|
1227
1228
|
this.clearIdleFinishCandidate('idle_timeout_finish');
|
|
1228
1229
|
this.finishResponse();
|
|
@@ -1261,7 +1262,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1261
1262
|
if (this.finishRetryTimer) clearTimeout(this.finishRetryTimer);
|
|
1262
1263
|
this.finishRetryTimer = setTimeout(() => {
|
|
1263
1264
|
this.finishRetryTimer = null;
|
|
1264
|
-
if (this.isWaitingForResponse && this.
|
|
1265
|
+
if (this.isWaitingForResponse && !this.hasActionableApproval()) {
|
|
1265
1266
|
this.finishResponse();
|
|
1266
1267
|
}
|
|
1267
1268
|
}, ProviderCliAdapter.FINISH_RETRY_DELAY_MS);
|
|
@@ -1424,10 +1425,14 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1424
1425
|
}
|
|
1425
1426
|
}
|
|
1426
1427
|
|
|
1428
|
+
private hasActionableApproval(startupModal: { message: string; buttons: string[] } | null = null): boolean {
|
|
1429
|
+
return !!(startupModal || this.activeModal);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1427
1432
|
private projectEffectiveStatus(startupModal: { message: string; buttons: string[] } | null = null): CliSessionStatus['status'] {
|
|
1428
1433
|
if (this.parseErrorMessage) return 'error';
|
|
1429
|
-
if (
|
|
1430
|
-
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';
|
|
1431
1436
|
return this.currentStatus;
|
|
1432
1437
|
}
|
|
1433
1438
|
|
|
@@ -1812,7 +1817,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1812
1817
|
const allowInputDuringGeneration = this.provider.allowInputDuringGeneration === true;
|
|
1813
1818
|
const allowInterventionPrompt = allowInputDuringGeneration
|
|
1814
1819
|
&& this.isWaitingForResponse
|
|
1815
|
-
&& this.
|
|
1820
|
+
&& !this.hasActionableApproval();
|
|
1816
1821
|
if (this.startupParseGate) {
|
|
1817
1822
|
const deadline = Date.now() + 10000;
|
|
1818
1823
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
@@ -1943,7 +1948,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1943
1948
|
const retrySubmitIfStuck = (attempt: number) => {
|
|
1944
1949
|
this.submitRetryTimer = null;
|
|
1945
1950
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
1946
|
-
if (this.
|
|
1951
|
+
if (this.hasActionableApproval()) return;
|
|
1947
1952
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
1948
1953
|
const screenText = this.terminalScreen.getText();
|
|
1949
1954
|
if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
|
|
@@ -1987,7 +1992,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1987
1992
|
this.submitRetryTimer = setTimeout(() => {
|
|
1988
1993
|
this.submitRetryTimer = null;
|
|
1989
1994
|
if (!this.ptyProcess || !this.isWaitingForResponse || this.submitRetryUsed) return;
|
|
1990
|
-
if (this.
|
|
1995
|
+
if (this.hasActionableApproval()) return;
|
|
1991
1996
|
if (this.hasMeaningfulResponseBuffer(normalizedPromptSnippet)) return;
|
|
1992
1997
|
const screenText = this.terminalScreen.getText();
|
|
1993
1998
|
if (!promptLikelyVisible(screenText, normalizedPromptSnippet)) return;
|
|
@@ -2281,6 +2286,9 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
2281
2286
|
name: this.cliName,
|
|
2282
2287
|
providerResolution: this.providerResolutionMeta,
|
|
2283
2288
|
status: effectiveStatus,
|
|
2289
|
+
projectedStatus: effectiveStatus,
|
|
2290
|
+
rawStatus: this.currentStatus,
|
|
2291
|
+
lifecycleStatus: this.isWaitingForResponse ? 'awaiting_response' : 'idle',
|
|
2284
2292
|
ready: effectiveReady,
|
|
2285
2293
|
startupParseGate: this.startupParseGate,
|
|
2286
2294
|
spawnAt: this.spawnAt,
|
|
@@ -2334,7 +2342,10 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
2334
2342
|
screenText: summarizeCliTraceText(this.terminalScreen.getText(), 4000),
|
|
2335
2343
|
recentOutputBuffer: summarizeCliTraceText(this.recentOutputBuffer, 1000),
|
|
2336
2344
|
responseBuffer: summarizeCliTraceText(this.responseBuffer, 1200),
|
|
2337
|
-
status: this.
|
|
2345
|
+
status: this.projectEffectiveStatus(),
|
|
2346
|
+
projectedStatus: this.projectEffectiveStatus(),
|
|
2347
|
+
rawStatus: this.currentStatus,
|
|
2348
|
+
lifecycleStatus: this.isWaitingForResponse ? 'awaiting_response' : 'idle',
|
|
2338
2349
|
activeModal: this.activeModal,
|
|
2339
2350
|
currentTurnScope: this.currentTurnScope,
|
|
2340
2351
|
messages: summarizeCliTraceMessages(this.committedMessages, 5),
|