adhdev 0.9.76-rc.53 → 0.9.76-rc.55

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
@@ -5732,6 +5732,34 @@ function normalizeChatMessage(message) {
5732
5732
  function normalizeChatMessages(messages) {
5733
5733
  return (Array.isArray(messages) ? messages : []).map((message) => normalizeChatMessage(message));
5734
5734
  }
5735
+ function readMessageMeta(message) {
5736
+ const meta3 = message?.meta;
5737
+ return meta3 && typeof meta3 === "object" && !Array.isArray(meta3) ? meta3 : null;
5738
+ }
5739
+ function isExplicitlyHiddenFromTranscript(meta3) {
5740
+ if (!meta3) return false;
5741
+ const visibility = typeof meta3.transcriptVisibility === "string" ? meta3.transcriptVisibility.trim().toLowerCase() : "";
5742
+ return visibility === "hidden" || visibility === "debug" || meta3.internal === true || meta3.debug === true || meta3.statusOnly === true || meta3.controlOnly === true;
5743
+ }
5744
+ function isExplicitlyVisibleInTranscript(meta3) {
5745
+ if (!meta3) return false;
5746
+ const visibility = typeof meta3.transcriptVisibility === "string" ? meta3.transcriptVisibility.trim().toLowerCase() : "";
5747
+ return visibility === "visible" || meta3.userFacing === true;
5748
+ }
5749
+ function isUserFacingChatMessage(message) {
5750
+ if (!message) return false;
5751
+ const meta3 = readMessageMeta(message);
5752
+ if (isExplicitlyHiddenFromTranscript(meta3)) return false;
5753
+ if (isExplicitlyVisibleInTranscript(meta3)) return true;
5754
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
5755
+ const kind = resolveChatMessageKind(message);
5756
+ if (role === "user" || role === "human") return kind === "standard" || kind === "";
5757
+ if (role === "assistant") return kind === "standard" || kind === "";
5758
+ return false;
5759
+ }
5760
+ function filterUserFacingChatMessages(messages) {
5761
+ return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
5762
+ }
5735
5763
  var BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES;
5736
5764
  var init_chat_message_normalization = __esm({
5737
5765
  "../../oss/packages/daemon-core/src/providers/chat-message-normalization.ts"() {
@@ -9814,7 +9842,7 @@ function normalizeReadChatTailLimit(args) {
9814
9842
  }
9815
9843
  function normalizeReadChatMessages(payload) {
9816
9844
  const messages = Array.isArray(payload.messages) ? payload.messages : [];
9817
- return messages;
9845
+ return normalizeChatMessages(messages);
9818
9846
  }
9819
9847
  function deriveHistoryDedupKey(message) {
9820
9848
  const unitKey = typeof message._unitKey === "string" ? message._unitKey.trim() : "";
@@ -9908,13 +9936,22 @@ function buildReadChatCommandResult(payload, args) {
9908
9936
  return { success: false, error: error48?.message || String(error48) };
9909
9937
  }
9910
9938
  const messages = normalizeReadChatMessages(validatedPayload);
9911
- const sync = buildFullTail(messages, normalizeReadChatTailLimit(args));
9939
+ const visibleMessages = filterUserFacingChatMessages(messages);
9940
+ const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
9941
+ const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
9942
+ const nextDebugReadChat = {
9943
+ ...debugReadChat || {},
9944
+ fullMsgCount: messages.length,
9945
+ visibleMsgCount: visibleMessages.length,
9946
+ hiddenMsgCount,
9947
+ returnedMsgCount: sync.messages.length
9948
+ };
9912
9949
  return {
9913
9950
  success: true,
9914
9951
  ...validatedPayload,
9915
9952
  messages: sync.messages,
9916
9953
  totalMessages: sync.totalMessages,
9917
- ...debugReadChat ? { debugReadChat } : {}
9954
+ debugReadChat: nextDebugReadChat
9918
9955
  };
9919
9956
  }
9920
9957
  function truncateDebugString(value, maxLength) {
@@ -11260,6 +11297,7 @@ var init_chat_commands = __esm({
11260
11297
  init_logger();
11261
11298
  init_debug_trace();
11262
11299
  init_chat_signatures();
11300
+ init_chat_message_normalization();
11263
11301
  RECENT_SEND_WINDOW_MS = 1200;
11264
11302
  READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
11265
11303
  HERMES_CLI_STARTING_SEND_SETTLE_MS = 2e3;
@@ -17625,16 +17663,47 @@ ${effect.notification.body || ""}`.trim();
17625
17663
  const runtimeEntries = this.runtimeMessages.map((entry, index) => ({
17626
17664
  message: entry.message,
17627
17665
  index: parsedMessages.length + index,
17628
- source: "runtime"
17666
+ source: "runtime",
17667
+ runtimeKey: entry.key
17629
17668
  }));
17630
17669
  const getTime = (message) => {
17631
17670
  const value = typeof message.receivedAt === "number" ? message.receivedAt : typeof message.timestamp === "number" ? message.timestamp : 0;
17632
17671
  return Number.isFinite(value) && value > 0 ? value : 0;
17633
17672
  };
17673
+ const getRole = (message) => typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
17674
+ const isAutoApprovalRuntimeOverlay = (entry) => {
17675
+ if (entry.source !== "runtime") return false;
17676
+ const key = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
17677
+ if (key.startsWith("auto_approval:")) return true;
17678
+ const content = typeof entry.message.content === "string" ? entry.message.content.trim().toLowerCase() : flattenContent(entry.message.content).trim().toLowerCase();
17679
+ return content.startsWith("auto-approved:");
17680
+ };
17681
+ const shouldKeepParsedBeforeUntimedRuntime = (message) => {
17682
+ const role = getRole(message);
17683
+ return role === "user" || role === "human";
17684
+ };
17685
+ const shouldKeepParsedAfterUntimedRuntime = (message) => {
17686
+ const role = getRole(message);
17687
+ if (role !== "assistant") return false;
17688
+ const kind = resolveChatMessageKind(message);
17689
+ return kind === "standard" || kind === "terminal";
17690
+ };
17634
17691
  return normalizeChatMessages([...parsedEntries, ...runtimeEntries].sort((a, b) => {
17635
17692
  const aTime = getTime(a.message);
17636
17693
  const bTime = getTime(b.message);
17637
17694
  if (aTime && bTime && aTime !== bTime) return aTime - bTime;
17695
+ if (a.source !== b.source && aTime !== bTime) {
17696
+ const parsedEntry = a.source === "parsed" ? a : b.source === "parsed" ? b : null;
17697
+ const runtimeEntry = a.source === "runtime" ? a : b.source === "runtime" ? b : null;
17698
+ if (parsedEntry && runtimeEntry && isAutoApprovalRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
17699
+ if (shouldKeepParsedBeforeUntimedRuntime(parsedEntry.message)) {
17700
+ return a.source === "parsed" ? -1 : 1;
17701
+ }
17702
+ if (shouldKeepParsedAfterUntimedRuntime(parsedEntry.message)) {
17703
+ return a.source === "parsed" ? 1 : -1;
17704
+ }
17705
+ }
17706
+ }
17638
17707
  return a.index - b.index;
17639
17708
  }).map((entry) => entry.message));
17640
17709
  }
@@ -53632,6 +53701,7 @@ __export(src_exports, {
53632
53701
  detectIDEs: () => detectIDEs,
53633
53702
  ensureSessionHostReady: () => ensureSessionHostReady,
53634
53703
  execNpmCommandSync: () => execNpmCommandSync,
53704
+ filterUserFacingChatMessages: () => filterUserFacingChatMessages,
53635
53705
  findCdpManager: () => findCdpManager,
53636
53706
  flattenMessageParts: () => flattenMessageParts,
53637
53707
  forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance,
@@ -53673,6 +53743,7 @@ __export(src_exports, {
53673
53743
  isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
53674
53744
  isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
53675
53745
  isSetupComplete: () => isSetupComplete,
53746
+ isUserFacingChatMessage: () => isUserFacingChatMessage,
53676
53747
  killIdeProcess: () => killIdeProcess,
53677
53748
  launchIDE: () => launchIDE,
53678
53749
  launchWithCdp: () => launchWithCdp,
@@ -93973,7 +94044,7 @@ var init_adhdev_daemon = __esm({
93973
94044
  init_version();
93974
94045
  init_src();
93975
94046
  init_runtime_defaults();
93976
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.53" });
94047
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.55" });
93977
94048
  AdhdevDaemon = class _AdhdevDaemon {
93978
94049
  localHttpServer = null;
93979
94050
  localWss = null;