adhdev 0.8.82 → 0.8.83

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/index.js CHANGED
@@ -1756,9 +1756,15 @@ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessio
1756
1756
  continue;
1757
1757
  }
1758
1758
  const status = String(session?.status || "").toLowerCase();
1759
+ const unread = session?.unread === true;
1760
+ const inboxBucket = String(session?.inboxBucket || "").toLowerCase();
1761
+ const runtimeSurfaceKind = String(session?.runtimeSurfaceKind || "").toLowerCase();
1762
+ const runtimeLifecycle = String(session?.runtimeLifecycle || "").toLowerCase();
1763
+ const isLiveRuntime = runtimeSurfaceKind === "live_runtime" || LIVE_RUNTIME_LIFECYCLES.has(runtimeLifecycle);
1759
1764
  const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
1760
1765
  const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
1761
- if (activeStatuses.has(status) || recentlyUpdated) {
1766
+ const shouldKeepRecentTailHot = recentlyUpdated && (unread || inboxBucket === "task_complete" || inboxBucket === "needs_attention" || isLiveRuntime || activeStatuses.has(status));
1767
+ if (activeStatuses.has(status) || shouldKeepRecentTailHot) {
1762
1768
  active.add(sessionId);
1763
1769
  }
1764
1770
  }
@@ -10811,10 +10817,12 @@ function logTerminalBackendSelection(preference, ghosttyAvailable, backendKind)
10811
10817
  if (loggedTerminalBackends.has(key)) return;
10812
10818
  loggedTerminalBackends.add(key);
10813
10819
  if (backendKind === "xterm" && preference !== "xterm" && !ghosttyAvailable) {
10814
- LOG.warn(
10815
- "Terminal",
10816
- `[terminal-screen] ghostty-vt unavailable; using xterm fallback (preference=${preference})`
10817
- );
10820
+ const message = `[terminal-screen] ghostty-vt unavailable; using xterm fallback (preference=${preference})`;
10821
+ if (preference === "auto") {
10822
+ LOG.info("Terminal", message);
10823
+ } else {
10824
+ LOG.warn("Terminal", message);
10825
+ }
10818
10826
  return;
10819
10827
  }
10820
10828
  LOG.info(
@@ -12088,6 +12096,7 @@ var init_provider_cli_adapter = __esm({
12088
12096
  "use strict";
12089
12097
  os13 = __toESM(require("os"));
12090
12098
  init_logger();
12099
+ init_debug_config();
12091
12100
  init_terminal_screen();
12092
12101
  init_pty_transport();
12093
12102
  init_provider_cli_shared();
@@ -12121,7 +12130,15 @@ var init_provider_cli_adapter = __esm({
12121
12130
  `[${this.cliType}] Provider resolution: providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`
12122
12131
  );
12123
12132
  } else {
12124
- LOG.warn("CLI", `[${this.cliType}] \u26A0 No CLI scripts loaded! Provider needs scripts/{version}/scripts.js`);
12133
+ const resolutionSummary = `providerDir=${this.providerResolutionMeta.providerDir || "-"} scriptDir=${this.providerResolutionMeta.scriptDir || "-"} scriptsPath=${this.providerResolutionMeta.scriptsPath || "-"} source=${this.providerResolutionMeta.scriptsSource || "-"} version=${this.providerResolutionMeta.resolvedVersion || "-"}`;
12134
+ const hasResolvedProviderScripts = Boolean(
12135
+ this.providerResolutionMeta.providerDir || this.providerResolutionMeta.scriptDir || this.providerResolutionMeta.scriptsPath || this.providerResolutionMeta.scriptsSource || this.providerResolutionMeta.resolvedVersion
12136
+ );
12137
+ if (hasResolvedProviderScripts) {
12138
+ LOG.warn("CLI", `[${this.cliType}] \u26A0 No CLI scripts loaded! Provider needs scripts/{version}/scripts.js (${resolutionSummary})`);
12139
+ } else {
12140
+ LOG.info("CLI", `[${this.cliType}] CLI scripts not yet resolved (${resolutionSummary})`);
12141
+ }
12125
12142
  }
12126
12143
  }
12127
12144
  cliType;
@@ -12200,7 +12217,8 @@ var init_provider_cli_adapter = __esm({
12200
12217
  currentTurnScope = null;
12201
12218
  traceEntries = [];
12202
12219
  traceSeq = 0;
12203
- traceSessionId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
12220
+ traceSessionId = "";
12221
+ parsedStatusCache = null;
12204
12222
  static MAX_TRACE_ENTRIES = 250;
12205
12223
  providerResolutionMeta;
12206
12224
  static FINISH_RETRY_DELAY_MS = 300;
@@ -12441,7 +12459,8 @@ var init_provider_cli_adapter = __esm({
12441
12459
  this.terminalScreen.write(rawData);
12442
12460
  const cleanData = sanitizeTerminalText(rawData);
12443
12461
  const now = Date.now();
12444
- const normalizedScreenSnapshot = normalizeScreenSnapshot(this.terminalScreen.getText());
12462
+ const screenText = this.terminalScreen.getText();
12463
+ const normalizedScreenSnapshot = normalizeScreenSnapshot(screenText);
12445
12464
  this.lastOutputAt = now;
12446
12465
  if (cleanData.trim()) this.lastNonEmptyOutputAt = now;
12447
12466
  if (normalizedScreenSnapshot !== this.lastScreenSnapshot) {
@@ -12454,13 +12473,14 @@ var init_provider_cli_adapter = __esm({
12454
12473
  if (this.idleFinishCandidate && (rawData.length > 0 || cleanData.length > 0)) {
12455
12474
  this.clearIdleFinishCandidate("new_output");
12456
12475
  }
12457
- this.recordTrace("output", {
12458
- rawLength: rawData.length,
12459
- cleanLength: cleanData.length,
12460
- rawPreview: summarizeCliTraceText(rawData, 300),
12461
- cleanPreview: summarizeCliTraceText(cleanData, 300),
12462
- screenText: summarizeCliTraceText(this.terminalScreen.getText(), 1200)
12463
- });
12476
+ if (getDebugRuntimeConfig().collectDebugTrace) {
12477
+ this.recordTrace("output", {
12478
+ rawLength: rawData.length,
12479
+ cleanLength: cleanData.length,
12480
+ rawPreview: summarizeCliTraceText(rawData, 300),
12481
+ cleanPreview: summarizeCliTraceText(cleanData, 300)
12482
+ });
12483
+ }
12464
12484
  if (this.startupParseGate) {
12465
12485
  this.scheduleStartupSettleCheck();
12466
12486
  }
@@ -13162,12 +13182,19 @@ var init_provider_cli_adapter = __esm({
13162
13182
  * Called by command handler / dashboard for rich content rendering.
13163
13183
  */
13164
13184
  getScriptParsedStatus() {
13185
+ const screenText = this.terminalScreen.getText();
13186
+ const cached2 = this.parsedStatusCache;
13187
+ if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBuffer === this.accumulatedRawBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName && cached2.lastOutputAt === this.lastOutputAt) {
13188
+ return cached2.result;
13189
+ }
13165
13190
  const parsed = this.parseCurrentTranscript(
13166
13191
  this.committedMessages,
13167
13192
  this.responseBuffer,
13168
- this.currentTurnScope
13193
+ this.currentTurnScope,
13194
+ screenText
13169
13195
  );
13170
13196
  const shouldPreferCommittedMessages = !this.currentTurnScope && this.currentStatus === "idle" && !this.activeModal;
13197
+ let result;
13171
13198
  if (parsed && Array.isArray(parsed.messages)) {
13172
13199
  const hydratedMessages = shouldPreferCommittedMessages ? this.committedMessages.map((message, index) => buildChatMessage({
13173
13200
  ...message,
@@ -13179,7 +13206,7 @@ var init_provider_cli_adapter = __esm({
13179
13206
  scope: this.currentTurnScope,
13180
13207
  lastOutputAt: this.lastOutputAt
13181
13208
  });
13182
- return {
13209
+ result = {
13183
13210
  id: parsed.id || "cli_session",
13184
13211
  status: parsed.status || this.currentStatus,
13185
13212
  title: parsed.title || this.cliName,
@@ -13187,20 +13214,36 @@ var init_provider_cli_adapter = __esm({
13187
13214
  activeModal: parsed.activeModal ?? this.activeModal,
13188
13215
  providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0
13189
13216
  };
13217
+ } else {
13218
+ const messages = [...this.committedMessages];
13219
+ result = {
13220
+ id: "cli_session",
13221
+ status: this.currentStatus,
13222
+ title: this.cliName,
13223
+ messages: messages.map((message, index) => buildChatMessage({
13224
+ ...message,
13225
+ id: message.id || `msg_${index}`,
13226
+ index: typeof message.index === "number" ? message.index : index,
13227
+ receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
13228
+ })),
13229
+ activeModal: this.activeModal
13230
+ };
13190
13231
  }
13191
- const messages = [...this.committedMessages];
13192
- return {
13193
- id: "cli_session",
13194
- status: this.currentStatus,
13195
- title: this.cliName,
13196
- messages: messages.map((message, index) => buildChatMessage({
13197
- ...message,
13198
- id: message.id || `msg_${index}`,
13199
- index: typeof message.index === "number" ? message.index : index,
13200
- receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
13201
- })),
13202
- activeModal: this.activeModal
13232
+ this.parsedStatusCache = {
13233
+ committedMessagesRef: this.committedMessages,
13234
+ responseBuffer: this.responseBuffer,
13235
+ currentTurnScope: this.currentTurnScope,
13236
+ recentOutputBuffer: this.recentOutputBuffer,
13237
+ accumulatedBuffer: this.accumulatedBuffer,
13238
+ accumulatedRawBuffer: this.accumulatedRawBuffer,
13239
+ screenText,
13240
+ currentStatus: this.currentStatus,
13241
+ activeModal: this.activeModal,
13242
+ cliName: this.cliName,
13243
+ lastOutputAt: this.lastOutputAt,
13244
+ result
13203
13245
  };
13246
+ return result;
13204
13247
  }
13205
13248
  async invokeScript(scriptName, args) {
13206
13249
  const fn = this.cliScripts?.[scriptName];
@@ -13223,17 +13266,18 @@ var init_provider_cli_adapter = __esm({
13223
13266
  args: args && typeof args === "object" ? { ...args } : {}
13224
13267
  }));
13225
13268
  }
13226
- parseCurrentTranscript(baseMessages, partialResponse, scope) {
13269
+ parseCurrentTranscript(baseMessages, partialResponse, scope, screenTextOverride) {
13227
13270
  if (!this.cliScripts?.parseOutput) {
13228
13271
  this.parseErrorMessage = null;
13229
13272
  return null;
13230
13273
  }
13231
13274
  try {
13275
+ const screenText = typeof screenTextOverride === "string" ? screenTextOverride : this.terminalScreen.getText();
13232
13276
  const input = buildCliParseInput({
13233
13277
  accumulatedBuffer: this.accumulatedBuffer,
13234
13278
  accumulatedRawBuffer: this.accumulatedRawBuffer,
13235
13279
  recentOutputBuffer: this.recentOutputBuffer,
13236
- terminalScreenText: this.terminalScreen.getText(),
13280
+ terminalScreenText: screenText,
13237
13281
  baseMessages,
13238
13282
  partialResponse,
13239
13283
  isWaitingForResponse: this.isWaitingForResponse,
@@ -14003,6 +14047,7 @@ var init_cli_provider_instance = __esm({
14003
14047
  }
14004
14048
  async onTick() {
14005
14049
  if (this.providerSessionId) return;
14050
+ if (this.type === "hermes-cli" && this.launchMode === "new") return;
14006
14051
  let probedSessionId = null;
14007
14052
  const probeConfig = this.provider.sessionProbe;
14008
14053
  if (probeConfig) {
@@ -36781,6 +36826,8 @@ function buildStatusSnapshot(options) {
36781
36826
  session.lastSeenAt = lastSeenAt;
36782
36827
  session.unread = overlayUnread;
36783
36828
  session.inboxBucket = overlayInboxBucket;
36829
+ session.completionMarker = completionMarker;
36830
+ session.seenCompletionMarker = seenCompletionMarker;
36784
36831
  if (READ_DEBUG_ENABLED && (session.unread || session.inboxBucket !== "idle" || session.providerType.includes("codex"))) {
36785
36832
  const recentReadSnapshot = {
36786
36833
  sessionId: session.id,
@@ -77504,6 +77551,8 @@ var init_server_connection = __esm({
77504
77551
  if (misses >= 3 && this.ws) {
77505
77552
  LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 closing stale WS`);
77506
77553
  this.ws.terminate();
77554
+ } else if (misses === 1) {
77555
+ LOG.info("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
77507
77556
  } else {
77508
77557
  LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
77509
77558
  }
@@ -86059,7 +86108,7 @@ var init_adhdev_daemon = __esm({
86059
86108
  init_source();
86060
86109
  init_version();
86061
86110
  init_src();
86062
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.82" });
86111
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.83" });
86063
86112
  AdhdevDaemon = class _AdhdevDaemon {
86064
86113
  localHttpServer = null;
86065
86114
  localWss = null;