@adhdev/daemon-standalone 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
@@ -30748,7 +30748,7 @@ var require_dist2 = __commonJS({
30748
30748
  const screenText = this.terminalScreen.getText() || "";
30749
30749
  const effectiveScreenText = screenText || this.accumulatedBuffer;
30750
30750
  const noActiveTurn = !this.currentTurnScope;
30751
- 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));
30751
+ const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(effectiveScreenText);
30752
30752
  const parsedShowsLiveAssistantProgress = parsedStatus === "generating" && !!lastParsedAssistant && parsedMessages.length > this.committedMessages.length;
30753
30753
  if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome && !parsedShowsLiveAssistantProgress) {
30754
30754
  return;
@@ -38144,13 +38144,40 @@ ${effect.notification.body || ""}`.trim();
38144
38144
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
38145
38145
  return role === "assistant" || role === "system";
38146
38146
  }
38147
+ function normalizeReadChatReplayText(message) {
38148
+ return flattenContent(message?.content || "").replace(/\s+/g, " ").trim();
38149
+ }
38150
+ function isStableReadChatAssistantAnswer(message) {
38151
+ if (!message) return false;
38152
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
38153
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
38154
+ if (role !== "assistant") return false;
38155
+ if (kind && kind !== "standard") return false;
38156
+ const content = normalizeReadChatReplayText(message);
38157
+ if (content.length < 160) return false;
38158
+ if (/^(bash|shell|terminal) command\b/i.test(content)) return false;
38159
+ return true;
38160
+ }
38161
+ function isReplayedAssistantAnswerAfterStableAnswer(message, stableAnswer) {
38162
+ if (!message || !stableAnswer) return false;
38163
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
38164
+ const kind = typeof message.kind === "string" ? message.kind.trim().toLowerCase() : "standard";
38165
+ if (role !== "assistant") return false;
38166
+ if (kind && kind !== "standard") return false;
38167
+ const content = normalizeReadChatReplayText(message);
38168
+ const stableContent = normalizeReadChatReplayText(stableAnswer);
38169
+ if (content.length < 80 || stableContent.length < 80) return false;
38170
+ return content === stableContent || content.startsWith(stableContent) || stableContent.startsWith(content);
38171
+ }
38147
38172
  function collapseReplayDuplicatesFromReadChat(messages) {
38148
38173
  const collapsed = [];
38149
38174
  const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
38175
+ let stableAssistantAnswerInCurrentTurn = null;
38150
38176
  for (const message of messages) {
38151
38177
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
38152
38178
  if (role === "user") {
38153
38179
  replaySignaturesInCurrentTurn.clear();
38180
+ stableAssistantAnswerInCurrentTurn = null;
38154
38181
  }
38155
38182
  const signature = buildReadChatReplayCollapseSignature(message);
38156
38183
  const previous = collapsed[collapsed.length - 1];
@@ -38158,11 +38185,15 @@ ${effect.notification.body || ""}`.trim();
38158
38185
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
38159
38186
  if (previousSignature === signature) continue;
38160
38187
  if (replaySignaturesInCurrentTurn.has(signature)) continue;
38188
+ if (isReplayedAssistantAnswerAfterStableAnswer(message, stableAssistantAnswerInCurrentTurn)) continue;
38161
38189
  }
38162
38190
  collapsed.push(message);
38163
38191
  if (shouldCollapseReadChatReplayDuplicate(message) && signature) {
38164
38192
  replaySignaturesInCurrentTurn.add(signature);
38165
38193
  }
38194
+ if (isStableReadChatAssistantAnswer(message)) {
38195
+ stableAssistantAnswerInCurrentTurn = message;
38196
+ }
38166
38197
  }
38167
38198
  return collapsed;
38168
38199
  }
@@ -40900,6 +40931,12 @@ ${effect.notification.body || ""}`.trim();
40900
40931
  if (historyMessageCount !== null) {
40901
40932
  parsedMessages = historyMessageCount > 0 ? parsedMessages.slice(-historyMessageCount) : [];
40902
40933
  }
40934
+ const committedMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
40935
+ const isActiveNonIdle = adapterStatus.status !== "idle";
40936
+ const shouldApplyCommittedFloor = parsedMessages.length < committedMessages.length && (adapterStatus.status === "waiting_approval" || isActiveNonIdle && historyMessageCount === null);
40937
+ if (shouldApplyCommittedFloor) {
40938
+ parsedMessages = normalizeChatMessages(committedMessages);
40939
+ }
40903
40940
  const mergedMessages = this.mergeConversationMessages(parsedMessages);
40904
40941
  const canonicalBackedHistory = this.syncCanonicalSavedHistoryIfNeeded();
40905
40942
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";