@adhdev/daemon-core 0.8.59 → 0.8.60
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 +3 -0
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -8
- 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 +26 -9
package/package.json
CHANGED
|
@@ -183,6 +183,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
183
183
|
private static readonly MAX_TRACE_ENTRIES = 250;
|
|
184
184
|
private readonly providerResolutionMeta: ProviderResolutionMeta;
|
|
185
185
|
private static readonly IDLE_FINISH_CONFIRM_MS = 2000;
|
|
186
|
+
private static readonly HERMES_IDLE_FINISH_CONFIRM_MS = 5000;
|
|
186
187
|
private static readonly STATUS_ACTIVITY_HOLD_MS = 2000;
|
|
187
188
|
private static readonly FINISH_RETRY_DELAY_MS = 300;
|
|
188
189
|
private static readonly MAX_FINISH_RETRIES = 2;
|
|
@@ -192,6 +193,18 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
192
193
|
this.structuredMessages = [...this.committedMessages];
|
|
193
194
|
}
|
|
194
195
|
|
|
196
|
+
private getIdleFinishConfirmMs(): number {
|
|
197
|
+
return this.cliType === 'hermes-cli'
|
|
198
|
+
? ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS
|
|
199
|
+
: ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private getStatusActivityHoldMs(): number {
|
|
203
|
+
return this.cliType === 'hermes-cli'
|
|
204
|
+
? ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS
|
|
205
|
+
: ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
|
|
206
|
+
}
|
|
207
|
+
|
|
195
208
|
private setStatus(status: CliSessionStatus['status'], trigger?: string): void {
|
|
196
209
|
const prev = this.currentStatus;
|
|
197
210
|
if (prev === status) return;
|
|
@@ -216,6 +229,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
216
229
|
|
|
217
230
|
private armIdleFinishCandidate(assistantLength: number): void {
|
|
218
231
|
const now = Date.now();
|
|
232
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
219
233
|
this.idleFinishCandidate = {
|
|
220
234
|
armedAt: now,
|
|
221
235
|
lastOutputAt: this.lastOutputAt,
|
|
@@ -224,7 +238,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
224
238
|
assistantLength,
|
|
225
239
|
};
|
|
226
240
|
this.recordTrace('idle_candidate_armed', {
|
|
227
|
-
confirmMs:
|
|
241
|
+
confirmMs: idleFinishConfirmMs,
|
|
228
242
|
candidate: this.idleFinishCandidate,
|
|
229
243
|
...buildCliTraceParseSnapshot({
|
|
230
244
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
@@ -239,7 +253,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
239
253
|
this.settleTimer = null;
|
|
240
254
|
this.settledBuffer = this.recentOutputBuffer;
|
|
241
255
|
this.evaluateSettled();
|
|
242
|
-
},
|
|
256
|
+
}, idleFinishConfirmMs);
|
|
243
257
|
}
|
|
244
258
|
|
|
245
259
|
|
|
@@ -719,8 +733,9 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
719
733
|
private hasRecentInteractiveActivity(now: number): boolean {
|
|
720
734
|
const quietForMs = this.lastNonEmptyOutputAt ? (now - this.lastNonEmptyOutputAt) : Number.MAX_SAFE_INTEGER;
|
|
721
735
|
const screenStableMs = this.lastScreenChangeAt ? (now - this.lastScreenChangeAt) : Number.MAX_SAFE_INTEGER;
|
|
722
|
-
|
|
723
|
-
|
|
736
|
+
const holdMs = this.getStatusActivityHoldMs();
|
|
737
|
+
return quietForMs < holdMs
|
|
738
|
+
|| screenStableMs < holdMs;
|
|
724
739
|
}
|
|
725
740
|
|
|
726
741
|
private getStartupConfirmationModal(screenText: string): { message: string; buttons: string[] } | null {
|
|
@@ -901,6 +916,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
901
916
|
}
|
|
902
917
|
|
|
903
918
|
const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
|
|
919
|
+
const statusActivityHoldMs = this.getStatusActivityHoldMs();
|
|
904
920
|
const shouldHoldGenerating =
|
|
905
921
|
scriptStatus === 'idle'
|
|
906
922
|
&& this.isWaitingForResponse
|
|
@@ -921,7 +937,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
921
937
|
recentInteractiveActivity,
|
|
922
938
|
lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
|
|
923
939
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
924
|
-
holdMs:
|
|
940
|
+
holdMs: statusActivityHoldMs,
|
|
925
941
|
...buildCliTraceParseSnapshot({
|
|
926
942
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
927
943
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
@@ -1013,8 +1029,9 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1013
1029
|
const screenStableMs = this.lastScreenChangeAt ? (now - this.lastScreenChangeAt) : 0;
|
|
1014
1030
|
const hasAssistantTurn = !!lastParsedAssistant;
|
|
1015
1031
|
const assistantLength = lastParsedAssistant?.content?.length || 0;
|
|
1016
|
-
const
|
|
1017
|
-
const
|
|
1032
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
1033
|
+
const idleQuietThresholdMs = Math.max(idleFinishConfirmMs, this.timeouts.outputSettle);
|
|
1034
|
+
const idleStableThresholdMs = idleFinishConfirmMs;
|
|
1018
1035
|
const idleReady = visibleIdlePrompt
|
|
1019
1036
|
&& !modal
|
|
1020
1037
|
&& hasAssistantTurn
|
|
@@ -1026,7 +1043,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1026
1043
|
&& candidate.lastOutputAt === this.lastOutputAt
|
|
1027
1044
|
&& candidate.lastScreenChangeAt === this.lastScreenChangeAt
|
|
1028
1045
|
&& assistantLength >= candidate.assistantLength
|
|
1029
|
-
&& (now - candidate.armedAt) >=
|
|
1046
|
+
&& (now - candidate.armedAt) >= idleFinishConfirmMs;
|
|
1030
1047
|
const canFinishImmediately = idleReady && candidateQuiet;
|
|
1031
1048
|
|
|
1032
1049
|
this.recordTrace('idle_decision', {
|
|
@@ -1039,7 +1056,7 @@ export class ProviderCliAdapter implements CliAdapter {
|
|
|
1039
1056
|
idleQuietThresholdMs,
|
|
1040
1057
|
idleStableThresholdMs,
|
|
1041
1058
|
idleReady,
|
|
1042
|
-
idleFinishConfirmMs
|
|
1059
|
+
idleFinishConfirmMs,
|
|
1043
1060
|
idleFinishCandidate: candidate,
|
|
1044
1061
|
candidateQuiet,
|
|
1045
1062
|
canFinishImmediately,
|