@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
|
@@ -95,10 +95,13 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
95
95
|
private static readonly MAX_TRACE_ENTRIES;
|
|
96
96
|
private readonly providerResolutionMeta;
|
|
97
97
|
private static readonly IDLE_FINISH_CONFIRM_MS;
|
|
98
|
+
private static readonly HERMES_IDLE_FINISH_CONFIRM_MS;
|
|
98
99
|
private static readonly STATUS_ACTIVITY_HOLD_MS;
|
|
99
100
|
private static readonly FINISH_RETRY_DELAY_MS;
|
|
100
101
|
private static readonly MAX_FINISH_RETRIES;
|
|
101
102
|
private syncMessageViews;
|
|
103
|
+
private getIdleFinishConfirmMs;
|
|
104
|
+
private getStatusActivityHoldMs;
|
|
102
105
|
private setStatus;
|
|
103
106
|
private clearIdleFinishCandidate;
|
|
104
107
|
private armIdleFinishCandidate;
|
package/dist/index.js
CHANGED
|
@@ -1420,6 +1420,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
1420
1420
|
static MAX_TRACE_ENTRIES = 250;
|
|
1421
1421
|
providerResolutionMeta;
|
|
1422
1422
|
static IDLE_FINISH_CONFIRM_MS = 2e3;
|
|
1423
|
+
static HERMES_IDLE_FINISH_CONFIRM_MS = 5e3;
|
|
1423
1424
|
static STATUS_ACTIVITY_HOLD_MS = 2e3;
|
|
1424
1425
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
1425
1426
|
static MAX_FINISH_RETRIES = 2;
|
|
@@ -1427,6 +1428,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
1427
1428
|
this.messages = [...this.committedMessages];
|
|
1428
1429
|
this.structuredMessages = [...this.committedMessages];
|
|
1429
1430
|
}
|
|
1431
|
+
getIdleFinishConfirmMs() {
|
|
1432
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
|
|
1433
|
+
}
|
|
1434
|
+
getStatusActivityHoldMs() {
|
|
1435
|
+
return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
|
|
1436
|
+
}
|
|
1430
1437
|
setStatus(status, trigger) {
|
|
1431
1438
|
const prev = this.currentStatus;
|
|
1432
1439
|
if (prev === status) return;
|
|
@@ -1449,6 +1456,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
1449
1456
|
}
|
|
1450
1457
|
armIdleFinishCandidate(assistantLength) {
|
|
1451
1458
|
const now = Date.now();
|
|
1459
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
1452
1460
|
this.idleFinishCandidate = {
|
|
1453
1461
|
armedAt: now,
|
|
1454
1462
|
lastOutputAt: this.lastOutputAt,
|
|
@@ -1457,7 +1465,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
1457
1465
|
assistantLength
|
|
1458
1466
|
};
|
|
1459
1467
|
this.recordTrace("idle_candidate_armed", {
|
|
1460
|
-
confirmMs:
|
|
1468
|
+
confirmMs: idleFinishConfirmMs,
|
|
1461
1469
|
candidate: this.idleFinishCandidate,
|
|
1462
1470
|
...buildCliTraceParseSnapshot({
|
|
1463
1471
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
@@ -1472,7 +1480,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
1472
1480
|
this.settleTimer = null;
|
|
1473
1481
|
this.settledBuffer = this.recentOutputBuffer;
|
|
1474
1482
|
this.evaluateSettled();
|
|
1475
|
-
},
|
|
1483
|
+
}, idleFinishConfirmMs);
|
|
1476
1484
|
}
|
|
1477
1485
|
recordTrace(type, payload = {}) {
|
|
1478
1486
|
const entry = {
|
|
@@ -1851,7 +1859,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
1851
1859
|
hasRecentInteractiveActivity(now) {
|
|
1852
1860
|
const quietForMs = this.lastNonEmptyOutputAt ? now - this.lastNonEmptyOutputAt : Number.MAX_SAFE_INTEGER;
|
|
1853
1861
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : Number.MAX_SAFE_INTEGER;
|
|
1854
|
-
|
|
1862
|
+
const holdMs = this.getStatusActivityHoldMs();
|
|
1863
|
+
return quietForMs < holdMs || screenStableMs < holdMs;
|
|
1855
1864
|
}
|
|
1856
1865
|
getStartupConfirmationModal(screenText) {
|
|
1857
1866
|
const text = sanitizeTerminalText(String(screenText || ""));
|
|
@@ -2003,6 +2012,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2003
2012
|
clearPendingScriptStatus();
|
|
2004
2013
|
}
|
|
2005
2014
|
const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
|
|
2015
|
+
const statusActivityHoldMs = this.getStatusActivityHoldMs();
|
|
2006
2016
|
const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity;
|
|
2007
2017
|
if (shouldHoldGenerating) {
|
|
2008
2018
|
this.clearIdleFinishCandidate("hold_generating_recent_activity");
|
|
@@ -2018,7 +2028,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2018
2028
|
recentInteractiveActivity,
|
|
2019
2029
|
lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
|
|
2020
2030
|
lastScreenChangeAt: this.lastScreenChangeAt,
|
|
2021
|
-
holdMs:
|
|
2031
|
+
holdMs: statusActivityHoldMs,
|
|
2022
2032
|
...buildCliTraceParseSnapshot({
|
|
2023
2033
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
2024
2034
|
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
@@ -2107,11 +2117,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
2107
2117
|
const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : 0;
|
|
2108
2118
|
const hasAssistantTurn = !!lastParsedAssistant;
|
|
2109
2119
|
const assistantLength = lastParsedAssistant?.content?.length || 0;
|
|
2110
|
-
const
|
|
2111
|
-
const
|
|
2120
|
+
const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
|
|
2121
|
+
const idleQuietThresholdMs = Math.max(idleFinishConfirmMs, this.timeouts.outputSettle);
|
|
2122
|
+
const idleStableThresholdMs = idleFinishConfirmMs;
|
|
2112
2123
|
const idleReady = visibleIdlePrompt && !modal && hasAssistantTurn && quietForMs >= idleQuietThresholdMs && screenStableMs >= idleStableThresholdMs;
|
|
2113
2124
|
const candidate = this.idleFinishCandidate;
|
|
2114
|
-
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >=
|
|
2125
|
+
const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >= idleFinishConfirmMs;
|
|
2115
2126
|
const canFinishImmediately = idleReady && candidateQuiet;
|
|
2116
2127
|
this.recordTrace("idle_decision", {
|
|
2117
2128
|
visibleIdlePrompt,
|
|
@@ -2123,7 +2134,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2123
2134
|
idleQuietThresholdMs,
|
|
2124
2135
|
idleStableThresholdMs,
|
|
2125
2136
|
idleReady,
|
|
2126
|
-
idleFinishConfirmMs
|
|
2137
|
+
idleFinishConfirmMs,
|
|
2127
2138
|
idleFinishCandidate: candidate,
|
|
2128
2139
|
candidateQuiet,
|
|
2129
2140
|
canFinishImmediately,
|