adhdev 0.9.43 → 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
@@ -11817,7 +11817,8 @@ var provider_cli_adapter_exports = {};
11817
11817
  __export(provider_cli_adapter_exports, {
11818
11818
  ProviderCliAdapter: () => ProviderCliAdapter,
11819
11819
  appendBoundedText: () => appendBoundedText,
11820
- normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
11820
+ normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
11821
+ sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
11821
11822
  });
11822
11823
  function normalizeComparableTranscriptText(value) {
11823
11824
  return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
@@ -11857,7 +11858,63 @@ function appendBoundedText(current, chunk, maxChars) {
11857
11858
  if (current.length <= keepFromCurrent) return current + chunk;
11858
11859
  return current.slice(-keepFromCurrent) + chunk;
11859
11860
  }
11860
- var os12, ProviderCliAdapter;
11861
+ function isLikelyCommittedActivityPrefixContinuation(line) {
11862
+ const trimmed = String(line || "").trim();
11863
+ if (!trimmed) return false;
11864
+ if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
11865
+ if (/\s/.test(trimmed)) return false;
11866
+ if (/[가-힣]/.test(trimmed)) return false;
11867
+ if (trimmed.length > 96) return false;
11868
+ return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
11869
+ }
11870
+ function parseCommittedActivityPrefixBlock(lines, index) {
11871
+ const first = String(lines[index] || "").trim();
11872
+ if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
11873
+ const parts = [first];
11874
+ let nextIndex = index + 1;
11875
+ while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
11876
+ parts.push(String(lines[nextIndex] || "").trim());
11877
+ nextIndex += 1;
11878
+ }
11879
+ return { label: parts.join(""), nextIndex };
11880
+ }
11881
+ function sanitizeCliStandardMessageContent(content) {
11882
+ const source = String(content || "").trim();
11883
+ if (!source) return "";
11884
+ const lines = source.split(/\r?\n/);
11885
+ if (lines.length < 4) return source;
11886
+ const counts = /* @__PURE__ */ new Map();
11887
+ for (let index = 0; index < lines.length; index += 1) {
11888
+ const block = parseCommittedActivityPrefixBlock(lines, index);
11889
+ if (!block) continue;
11890
+ counts.set(block.label, (counts.get(block.label) || 0) + 1);
11891
+ index = block.nextIndex - 1;
11892
+ }
11893
+ const repeatedLabels = new Set(
11894
+ Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
11895
+ );
11896
+ if (repeatedLabels.size === 0) return source;
11897
+ const stripped = [];
11898
+ let removed = 0;
11899
+ for (let index = 0; index < lines.length; index += 1) {
11900
+ const block = parseCommittedActivityPrefixBlock(lines, index);
11901
+ if (block && repeatedLabels.has(block.label)) {
11902
+ removed += 1;
11903
+ index = block.nextIndex - 1;
11904
+ continue;
11905
+ }
11906
+ stripped.push(lines[index]);
11907
+ }
11908
+ const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
11909
+ return removed >= 3 && next.length >= 80 ? next : source;
11910
+ }
11911
+ function sanitizeCommittedMessageForDisplay(message) {
11912
+ if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
11913
+ const content = sanitizeCliStandardMessageContent(message.content);
11914
+ if (content === message.content) return message;
11915
+ return { ...message, content };
11916
+ }
11917
+ var os12, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
11861
11918
  var init_provider_cli_adapter = __esm({
11862
11919
  "../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
11863
11920
  "use strict";
@@ -11873,6 +11930,7 @@ var init_provider_cli_adapter = __esm({
11873
11930
  init_provider_cli_config();
11874
11931
  init_provider_cli_runtime();
11875
11932
  init_provider_cli_shared();
11933
+ COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
11876
11934
  ProviderCliAdapter = class _ProviderCliAdapter {
11877
11935
  constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
11878
11936
  this.extraArgs = extraArgs;
@@ -12084,7 +12142,10 @@ var init_provider_cli_adapter = __esm({
12084
12142
  const tailFirst = parseBaseMessages[0];
12085
12143
  if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
12086
12144
  const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
12087
- return [...fullBaseMessages.slice(0, prefixLength), ...parsedMessages];
12145
+ const prefix = fullBaseMessages.slice(0, prefixLength);
12146
+ const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
12147
+ const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
12148
+ return [...nextPrefix, ...parsedMessages];
12088
12149
  }
12089
12150
  return [...fullBaseMessages, ...parsedMessages];
12090
12151
  }
@@ -13283,10 +13344,12 @@ var init_provider_cli_adapter = __esm({
13283
13344
  }
13284
13345
  buildCommittedChatMessages() {
13285
13346
  return this.committedMessages.map((message, index) => {
13286
- const contentValue = message.content;
13347
+ const rawContentValue = message.content;
13348
+ const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
13349
+ const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
13287
13350
  return buildChatMessage({
13288
13351
  role: message.role,
13289
- content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
13352
+ content,
13290
13353
  timestamp: message.timestamp,
13291
13354
  kind: message.kind,
13292
13355
  meta: message.meta,
@@ -56719,7 +56782,7 @@ var init_adhdev_daemon = __esm({
56719
56782
  init_version();
56720
56783
  init_src();
56721
56784
  init_runtime_defaults();
56722
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.43" });
56785
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.44" });
56723
56786
  AdhdevDaemon = class _AdhdevDaemon {
56724
56787
  localHttpServer = null;
56725
56788
  localWss = null;