@adhdev/daemon-standalone 0.9.42 → 0.9.44

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
@@ -29926,7 +29926,8 @@ var require_dist2 = __commonJS({
29926
29926
  __export2(provider_cli_adapter_exports, {
29927
29927
  ProviderCliAdapter: () => ProviderCliAdapter,
29928
29928
  appendBoundedText: () => appendBoundedText,
29929
- normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
29929
+ normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
29930
+ sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
29930
29931
  });
29931
29932
  function normalizeComparableTranscriptText(value) {
29932
29933
  return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
@@ -29966,7 +29967,64 @@ var require_dist2 = __commonJS({
29966
29967
  if (current.length <= keepFromCurrent) return current + chunk;
29967
29968
  return current.slice(-keepFromCurrent) + chunk;
29968
29969
  }
29970
+ function isLikelyCommittedActivityPrefixContinuation(line) {
29971
+ const trimmed = String(line || "").trim();
29972
+ if (!trimmed) return false;
29973
+ if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
29974
+ if (/\s/.test(trimmed)) return false;
29975
+ if (/[가-힣]/.test(trimmed)) return false;
29976
+ if (trimmed.length > 96) return false;
29977
+ return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
29978
+ }
29979
+ function parseCommittedActivityPrefixBlock(lines, index) {
29980
+ const first = String(lines[index] || "").trim();
29981
+ if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
29982
+ const parts = [first];
29983
+ let nextIndex = index + 1;
29984
+ while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
29985
+ parts.push(String(lines[nextIndex] || "").trim());
29986
+ nextIndex += 1;
29987
+ }
29988
+ return { label: parts.join(""), nextIndex };
29989
+ }
29990
+ function sanitizeCliStandardMessageContent(content) {
29991
+ const source = String(content || "").trim();
29992
+ if (!source) return "";
29993
+ const lines = source.split(/\r?\n/);
29994
+ if (lines.length < 4) return source;
29995
+ const counts = /* @__PURE__ */ new Map();
29996
+ for (let index = 0; index < lines.length; index += 1) {
29997
+ const block = parseCommittedActivityPrefixBlock(lines, index);
29998
+ if (!block) continue;
29999
+ counts.set(block.label, (counts.get(block.label) || 0) + 1);
30000
+ index = block.nextIndex - 1;
30001
+ }
30002
+ const repeatedLabels = new Set(
30003
+ Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
30004
+ );
30005
+ if (repeatedLabels.size === 0) return source;
30006
+ const stripped = [];
30007
+ let removed = 0;
30008
+ for (let index = 0; index < lines.length; index += 1) {
30009
+ const block = parseCommittedActivityPrefixBlock(lines, index);
30010
+ if (block && repeatedLabels.has(block.label)) {
30011
+ removed += 1;
30012
+ index = block.nextIndex - 1;
30013
+ continue;
30014
+ }
30015
+ stripped.push(lines[index]);
30016
+ }
30017
+ const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
30018
+ return removed >= 3 && next.length >= 80 ? next : source;
30019
+ }
30020
+ function sanitizeCommittedMessageForDisplay(message) {
30021
+ if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
30022
+ const content = sanitizeCliStandardMessageContent(message.content);
30023
+ if (content === message.content) return message;
30024
+ return { ...message, content };
30025
+ }
29969
30026
  var os10;
30027
+ var COMMITTED_ACTIVITY_PREFIX_BLOCK_RE;
29970
30028
  var ProviderCliAdapter;
29971
30029
  var init_provider_cli_adapter = __esm2({
29972
30030
  "src/cli-adapters/provider-cli-adapter.ts"() {
@@ -29983,6 +30041,7 @@ var require_dist2 = __commonJS({
29983
30041
  init_provider_cli_config();
29984
30042
  init_provider_cli_runtime();
29985
30043
  init_provider_cli_shared();
30044
+ COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
29986
30045
  ProviderCliAdapter = class _ProviderCliAdapter {
29987
30046
  constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
29988
30047
  this.extraArgs = extraArgs;
@@ -30194,7 +30253,10 @@ var require_dist2 = __commonJS({
30194
30253
  const tailFirst = parseBaseMessages[0];
30195
30254
  if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
30196
30255
  const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
30197
- return [...fullBaseMessages.slice(0, prefixLength), ...parsedMessages];
30256
+ const prefix = fullBaseMessages.slice(0, prefixLength);
30257
+ const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
30258
+ const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
30259
+ return [...nextPrefix, ...parsedMessages];
30198
30260
  }
30199
30261
  return [...fullBaseMessages, ...parsedMessages];
30200
30262
  }
@@ -31393,10 +31455,12 @@ var require_dist2 = __commonJS({
31393
31455
  }
31394
31456
  buildCommittedChatMessages() {
31395
31457
  return this.committedMessages.map((message, index) => {
31396
- const contentValue = message.content;
31458
+ const rawContentValue = message.content;
31459
+ const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
31460
+ const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
31397
31461
  return buildChatMessage({
31398
31462
  role: message.role,
31399
- content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
31463
+ content,
31400
31464
  timestamp: message.timestamp,
31401
31465
  kind: message.kind,
31402
31466
  meta: message.meta,