@adhdev/daemon-core 0.9.76-rc.53 → 0.9.76-rc.54

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.mjs CHANGED
@@ -7956,6 +7956,40 @@ function normalizeChatMessage(message) {
7956
7956
  function normalizeChatMessages(messages) {
7957
7957
  return (Array.isArray(messages) ? messages : []).map((message) => normalizeChatMessage(message));
7958
7958
  }
7959
+ function readMessageMeta(message) {
7960
+ const meta = message?.meta;
7961
+ return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
7962
+ }
7963
+ function readStringField(value) {
7964
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
7965
+ }
7966
+ function isExplicitlyHiddenFromTranscript(message, meta) {
7967
+ const record = message;
7968
+ const visibility = readStringField(record.visibility || meta?.visibility || meta?.transcriptVisibility);
7969
+ const audience = readStringField(record.audience || meta?.audience);
7970
+ const source = readStringField(record.source || meta?.source);
7971
+ return visibility === "hidden" || visibility === "debug" || visibility === "internal" || audience === "debug" || audience === "trace" || audience === "internal" || source === "runtime_status" || source === "provider_chrome" || source === "control" || record.internal === true || record.isInternal === true || record.debug === true || meta?.internal === true || meta?.isInternal === true || meta?.debug === true || meta?.statusOnly === true || meta?.controlOnly === true;
7972
+ }
7973
+ function isExplicitlyVisibleInTranscript(message, meta) {
7974
+ const record = message;
7975
+ const visibility = readStringField(record.visibility || meta?.visibility || meta?.transcriptVisibility);
7976
+ const audience = readStringField(record.audience || meta?.audience);
7977
+ return visibility === "visible" || visibility === "user" || audience === "chat" || record.userFacing === true || meta?.userFacing === true;
7978
+ }
7979
+ function isUserFacingChatMessage(message) {
7980
+ if (!message) return false;
7981
+ const meta = readMessageMeta(message);
7982
+ if (isExplicitlyHiddenFromTranscript(message, meta)) return false;
7983
+ if (isExplicitlyVisibleInTranscript(message, meta)) return true;
7984
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7985
+ const kind = resolveChatMessageKind(message);
7986
+ if (role === "user" || role === "human") return kind === "standard" || kind === "";
7987
+ if (role === "assistant") return kind === "standard" || kind === "";
7988
+ return false;
7989
+ }
7990
+ function filterUserFacingChatMessages(messages) {
7991
+ return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
7992
+ }
7959
7993
 
7960
7994
  // src/providers/control-effects.ts
7961
7995
  function extractProviderControlValues(controls, data) {
@@ -11929,13 +11963,22 @@ function buildReadChatCommandResult(payload, args) {
11929
11963
  return { success: false, error: error?.message || String(error) };
11930
11964
  }
11931
11965
  const messages = normalizeReadChatMessages(validatedPayload);
11932
- const sync = buildFullTail(messages, normalizeReadChatTailLimit(args));
11966
+ const visibleMessages = filterUserFacingChatMessages(messages);
11967
+ const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
11968
+ const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
11969
+ const returnedDebugReadChat = debugReadChat ? {
11970
+ ...debugReadChat,
11971
+ fullMsgCount: typeof debugReadChat.fullMsgCount === "number" ? debugReadChat.fullMsgCount : messages.length,
11972
+ visibleMsgCount: visibleMessages.length,
11973
+ hiddenMsgCount,
11974
+ returnedMsgCount: sync.messages.length
11975
+ } : void 0;
11933
11976
  return {
11934
11977
  success: true,
11935
11978
  ...validatedPayload,
11936
11979
  messages: sync.messages,
11937
11980
  totalMessages: sync.totalMessages,
11938
- ...debugReadChat ? { debugReadChat } : {}
11981
+ ...returnedDebugReadChat ? { debugReadChat: returnedDebugReadChat } : {}
11939
11982
  };
11940
11983
  }
11941
11984
  var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
@@ -30618,6 +30661,7 @@ export {
30618
30661
  detectIDEs,
30619
30662
  ensureSessionHostReady,
30620
30663
  execNpmCommandSync,
30664
+ filterUserFacingChatMessages,
30621
30665
  findCdpManager,
30622
30666
  flattenMessageParts,
30623
30667
  forwardAgentStreamsToIdeInstance,
@@ -30659,6 +30703,7 @@ export {
30659
30703
  isSessionHostLiveRuntime,
30660
30704
  isSessionHostRecoverySnapshot,
30661
30705
  isSetupComplete,
30706
+ isUserFacingChatMessage,
30662
30707
  killIdeProcess,
30663
30708
  launchIDE,
30664
30709
  launchWithCdp,