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/cli/index.js CHANGED
@@ -7876,13 +7876,40 @@ function shouldCollapseReadChatReplayDuplicate(message) {
7876
7876
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7877
7877
  return role === "assistant" || role === "system";
7878
7878
  }
7879
+ function normalizeReadChatReplayText(message) {
7880
+ return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
7881
+ }
7882
+ function isStableReadChatAssistantAnswer(message) {
7883
+ if (!message) return false;
7884
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7885
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
7886
+ if (role !== "assistant") return false;
7887
+ if (kind && kind !== "standard") return false;
7888
+ const content = normalizeReadChatReplayText(message);
7889
+ if (content.length < 160) return false;
7890
+ if (/^(bash|shell|terminal) command\b/i.test(content)) return false;
7891
+ return true;
7892
+ }
7893
+ function isReplayedAssistantAnswerAfterStableAnswer(message, stableAnswer) {
7894
+ if (!message || !stableAnswer) return false;
7895
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7896
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
7897
+ if (role !== "assistant") return false;
7898
+ if (kind && kind !== "standard") return false;
7899
+ const content = normalizeReadChatReplayText(message);
7900
+ const stableContent = normalizeReadChatReplayText(stableAnswer);
7901
+ if (content.length < 80 || stableContent.length < 80) return false;
7902
+ return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
7903
+ }
7879
7904
  function collapseReplayDuplicatesFromReadChat(messages) {
7880
7905
  const collapsed = [];
7881
7906
  const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
7907
+ let stableAssistantAnswerInCurrentTurn = null;
7882
7908
  for (const message of messages) {
7883
7909
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7884
7910
  if (role === "user") {
7885
7911
  replaySignaturesInCurrentTurn.clear();
7912
+ stableAssistantAnswerInCurrentTurn = null;
7886
7913
  }
7887
7914
  const signature = buildReadChatReplayCollapseSignature(message);
7888
7915
  const previous = collapsed[collapsed.length - 1];
@@ -7890,11 +7917,15 @@ function collapseReplayDuplicatesFromReadChat(messages) {
7890
7917
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
7891
7918
  if (previousSignature === signature) continue;
7892
7919
  if (replaySignaturesInCurrentTurn.has(signature)) continue;
7920
+ if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
7893
7921
  }
7894
7922
  collapsed.push(message);
7895
7923
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
7896
7924
  replaySignaturesInCurrentTurn.add(signature);
7897
7925
  }
7926
+ if (isStableReadChatAssistantAnswer(message)) {
7927
+ stableAssistantAnswerInCurrentTurn = message;
7928
+ }
7898
7929
  }
7899
7930
  return collapsed;
7900
7931
  }
@@ -13456,7 +13487,7 @@ var init_provider_cli_adapter = __esm({
13456
13487
  const screenText = this.terminalScreen.getText() || "";
13457
13488
  const effectiveScreenText = screenText || this.accumulatedBuffer;
13458
13489
  const noActiveTurn = !this.currentTurnScope;
13459
- 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));
13490
+ const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText);
13460
13491
  const parsedShowsLiveAssistantProgress = parsedStatus === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
13461
13492
  if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
13462
13493
  return;
@@ -14922,6 +14953,12 @@ var init_cli_provider_instance = __esm({
14922
14953
  if (historyMessageCount !== null) {
14923
14954
  parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
14924
14955
  }
14956
+ const committedMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
14957
+ const isActiveNonIdle = adapterStatus.status !== "idle";
14958
+ const shouldApplyCommittedFloor = parsedMessages.length < committedMessages.length && (adapterStatus.status === "waiting_approval" || isActiveNonIdle && historyMessageCount === null);
14959
+ if (shouldApplyCommittedFloor) {
14960
+ parsedMessages = normalizeChatMessages(committedMessages);
14961
+ }
14925
14962
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
14926
14963
  const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
14927
14964
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
@@ -87400,7 +87437,7 @@ var init_adhdev_daemon = __esm({
87400
87437
  init_version();
87401
87438
  init_src();
87402
87439
  init_runtime_defaults();
87403
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.21" });
87440
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.23" });
87404
87441
  AdhdevDaemon = class _AdhdevDaemon {
87405
87442
  localHttpServer = null;
87406
87443
  localWss = null;