@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/index.mjs CHANGED
@@ -1417,6 +1417,7 @@ var init_provider_cli_adapter = __esm({
1417
1417
  static MAX_TRACE_ENTRIES = 250;
1418
1418
  providerResolutionMeta;
1419
1419
  static IDLE_FINISH_CONFIRM_MS = 2e3;
1420
+ static HERMES_IDLE_FINISH_CONFIRM_MS = 5e3;
1420
1421
  static STATUS_ACTIVITY_HOLD_MS = 2e3;
1421
1422
  static FINISH_RETRY_DELAY_MS = 300;
1422
1423
  static MAX_FINISH_RETRIES = 2;
@@ -1424,6 +1425,12 @@ var init_provider_cli_adapter = __esm({
1424
1425
  this.messages = [...this.committedMessages];
1425
1426
  this.structuredMessages = [...this.committedMessages];
1426
1427
  }
1428
+ getIdleFinishConfirmMs() {
1429
+ return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
1430
+ }
1431
+ getStatusActivityHoldMs() {
1432
+ return this.cliType === "hermes-cli" ? _ProviderCliAdapter.HERMES_IDLE_FINISH_CONFIRM_MS : _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
1433
+ }
1427
1434
  setStatus(status, trigger) {
1428
1435
  const prev = this.currentStatus;
1429
1436
  if (prev === status) return;
@@ -1446,6 +1453,7 @@ var init_provider_cli_adapter = __esm({
1446
1453
  }
1447
1454
  armIdleFinishCandidate(assistantLength) {
1448
1455
  const now = Date.now();
1456
+ const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
1449
1457
  this.idleFinishCandidate = {
1450
1458
  armedAt: now,
1451
1459
  lastOutputAt: this.lastOutputAt,
@@ -1454,7 +1462,7 @@ var init_provider_cli_adapter = __esm({
1454
1462
  assistantLength
1455
1463
  };
1456
1464
  this.recordTrace("idle_candidate_armed", {
1457
- confirmMs: _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS,
1465
+ confirmMs: idleFinishConfirmMs,
1458
1466
  candidate: this.idleFinishCandidate,
1459
1467
  ...buildCliTraceParseSnapshot({
1460
1468
  accumulatedBuffer: this.accumulatedBuffer,
@@ -1469,7 +1477,7 @@ var init_provider_cli_adapter = __esm({
1469
1477
  this.settleTimer = null;
1470
1478
  this.settledBuffer = this.recentOutputBuffer;
1471
1479
  this.evaluateSettled();
1472
- }, _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS);
1480
+ }, idleFinishConfirmMs);
1473
1481
  }
1474
1482
  recordTrace(type, payload = {}) {
1475
1483
  const entry = {
@@ -1848,7 +1856,8 @@ var init_provider_cli_adapter = __esm({
1848
1856
  hasRecentInteractiveActivity(now) {
1849
1857
  const quietForMs = this.lastNonEmptyOutputAt ? now - this.lastNonEmptyOutputAt : Number.MAX_SAFE_INTEGER;
1850
1858
  const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : Number.MAX_SAFE_INTEGER;
1851
- return quietForMs < _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS || screenStableMs < _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS;
1859
+ const holdMs = this.getStatusActivityHoldMs();
1860
+ return quietForMs < holdMs || screenStableMs < holdMs;
1852
1861
  }
1853
1862
  getStartupConfirmationModal(screenText) {
1854
1863
  const text = sanitizeTerminalText(String(screenText || ""));
@@ -2000,6 +2009,7 @@ var init_provider_cli_adapter = __esm({
2000
2009
  clearPendingScriptStatus();
2001
2010
  }
2002
2011
  const recentInteractiveActivity = this.hasRecentInteractiveActivity(now);
2012
+ const statusActivityHoldMs = this.getStatusActivityHoldMs();
2003
2013
  const shouldHoldGenerating = scriptStatus === "idle" && this.isWaitingForResponse && !modal && recentInteractiveActivity;
2004
2014
  if (shouldHoldGenerating) {
2005
2015
  this.clearIdleFinishCandidate("hold_generating_recent_activity");
@@ -2015,7 +2025,7 @@ var init_provider_cli_adapter = __esm({
2015
2025
  recentInteractiveActivity,
2016
2026
  lastNonEmptyOutputAt: this.lastNonEmptyOutputAt,
2017
2027
  lastScreenChangeAt: this.lastScreenChangeAt,
2018
- holdMs: _ProviderCliAdapter.STATUS_ACTIVITY_HOLD_MS,
2028
+ holdMs: statusActivityHoldMs,
2019
2029
  ...buildCliTraceParseSnapshot({
2020
2030
  accumulatedBuffer: this.accumulatedBuffer,
2021
2031
  accumulatedRawBuffer: this.accumulatedRawBuffer,
@@ -2104,11 +2114,12 @@ var init_provider_cli_adapter = __esm({
2104
2114
  const screenStableMs = this.lastScreenChangeAt ? now - this.lastScreenChangeAt : 0;
2105
2115
  const hasAssistantTurn = !!lastParsedAssistant;
2106
2116
  const assistantLength = lastParsedAssistant?.content?.length || 0;
2107
- const idleQuietThresholdMs = Math.max(2e3, this.timeouts.outputSettle);
2108
- const idleStableThresholdMs = 2e3;
2117
+ const idleFinishConfirmMs = this.getIdleFinishConfirmMs();
2118
+ const idleQuietThresholdMs = Math.max(idleFinishConfirmMs, this.timeouts.outputSettle);
2119
+ const idleStableThresholdMs = idleFinishConfirmMs;
2109
2120
  const idleReady = visibleIdlePrompt && !modal && hasAssistantTurn && quietForMs >= idleQuietThresholdMs && screenStableMs >= idleStableThresholdMs;
2110
2121
  const candidate = this.idleFinishCandidate;
2111
- const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >= _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS;
2122
+ const candidateQuiet = !!candidate && candidate.responseEpoch === this.responseEpoch && candidate.lastOutputAt === this.lastOutputAt && candidate.lastScreenChangeAt === this.lastScreenChangeAt && assistantLength >= candidate.assistantLength && now - candidate.armedAt >= idleFinishConfirmMs;
2112
2123
  const canFinishImmediately = idleReady && candidateQuiet;
2113
2124
  this.recordTrace("idle_decision", {
2114
2125
  visibleIdlePrompt,
@@ -2120,7 +2131,7 @@ var init_provider_cli_adapter = __esm({
2120
2131
  idleQuietThresholdMs,
2121
2132
  idleStableThresholdMs,
2122
2133
  idleReady,
2123
- idleFinishConfirmMs: _ProviderCliAdapter.IDLE_FINISH_CONFIRM_MS,
2134
+ idleFinishConfirmMs,
2124
2135
  idleFinishCandidate: candidate,
2125
2136
  candidateQuiet,
2126
2137
  canFinishImmediately,