adhdev 0.9.21 → 0.9.23

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.js CHANGED
@@ -7356,13 +7356,40 @@ function shouldCollapseReadChatReplayDuplicate(message) {
7356
7356
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7357
7357
  return role === "assistant" || role === "system";
7358
7358
  }
7359
+ function normalizeReadChatReplayText(message) {
7360
+ return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
7361
+ }
7362
+ function isStableReadChatAssistantAnswer(message) {
7363
+ if (!message) return false;
7364
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7365
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
7366
+ if (role !== "assistant") return false;
7367
+ if (kind && kind !== "standard") return false;
7368
+ const content = normalizeReadChatReplayText(message);
7369
+ if (content.length < 160) return false;
7370
+ if (/^(bash|shell|terminal) command\b/i.test(content)) return false;
7371
+ return true;
7372
+ }
7373
+ function isReplayedAssistantAnswerAfterStableAnswer(message, stableAnswer) {
7374
+ if (!message || !stableAnswer) return false;
7375
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7376
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
7377
+ if (role !== "assistant") return false;
7378
+ if (kind && kind !== "standard") return false;
7379
+ const content = normalizeReadChatReplayText(message);
7380
+ const stableContent = normalizeReadChatReplayText(stableAnswer);
7381
+ if (content.length < 80 || stableContent.length < 80) return false;
7382
+ return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
7383
+ }
7359
7384
  function collapseReplayDuplicatesFromReadChat(messages) {
7360
7385
  const collapsed = [];
7361
7386
  const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
7387
+ let stableAssistantAnswerInCurrentTurn = null;
7362
7388
  for (const message of messages) {
7363
7389
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7364
7390
  if (role === "user") {
7365
7391
  replaySignaturesInCurrentTurn.clear();
7392
+ stableAssistantAnswerInCurrentTurn = null;
7366
7393
  }
7367
7394
  const signature = buildReadChatReplayCollapseSignature(message);
7368
7395
  const previous = collapsed[collapsed.length - 1];
@@ -7370,11 +7397,15 @@ function collapseReplayDuplicatesFromReadChat(messages) {
7370
7397
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
7371
7398
  if (previousSignature === signature) continue;
7372
7399
  if (replaySignaturesInCurrentTurn.has(signature)) continue;
7400
+ if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
7373
7401
  }
7374
7402
  collapsed.push(message);
7375
7403
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
7376
7404
  replaySignaturesInCurrentTurn.add(signature);
7377
7405
  }
7406
+ if (isStableReadChatAssistantAnswer(message)) {
7407
+ stableAssistantAnswerInCurrentTurn = message;
7408
+ }
7378
7409
  }
7379
7410
  return collapsed;
7380
7411
  }
@@ -12500,7 +12531,7 @@ var init_provider_cli_adapter = __esm({
12500
12531
  const screenText = this.terminalScreen.getText() || "";
12501
12532
  const effectiveScreenText = screenText || this.accumulatedBuffer;
12502
12533
  const noActiveTurn = !this.currentTurnScope;
12503
- const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText) || /accept edits on/i.test(effectiveScreenText) && (/Update available!/i.test(screenText) || /\/effort/i.test(screenText) || /^.*➜\s+\S+/m.test(effectiveScreenText));
12534
+ const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText);
12504
12535
  const parsedShowsLiveAssistantProgress = parsedStatus === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
12505
12536
  if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
12506
12537
  return;
@@ -13966,6 +13997,12 @@ var init_cli_provider_instance = __esm({
13966
13997
  if (historyMessageCount !== null) {
13967
13998
  parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
13968
13999
  }
14000
+ const committedMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
14001
+ const isActiveNonIdle = adapterStatus.status !== "idle";
14002
+ const shouldApplyCommittedFloor = parsedMessages.length < committedMessages.length && (adapterStatus.status === "waiting_approval" || isActiveNonIdle && historyMessageCount === null);
14003
+ if (shouldApplyCommittedFloor) {
14004
+ parsedMessages = normalizeChatMessages(committedMessages);
14005
+ }
13969
14006
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
13970
14007
  const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
13971
14008
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
@@ -55680,7 +55717,7 @@ var init_adhdev_daemon = __esm({
55680
55717
  init_version();
55681
55718
  init_src();
55682
55719
  init_runtime_defaults();
55683
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.21" });
55720
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.23" });
55684
55721
  AdhdevDaemon = class _AdhdevDaemon {
55685
55722
  localHttpServer = null;
55686
55723
  localWss = null;