@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.d.ts CHANGED
@@ -90,7 +90,7 @@ export type { ProviderModule, CdpTargetFilter, ProviderResumeCapability, InputEn
90
90
  export type { ProviderSourceConfigSnapshot, ProviderSourceConfigUpdate } from './config/provider-source-config.js';
91
91
  export { parseProviderSourceConfigUpdate } from './config/provider-source-config.js';
92
92
  export { normalizeInputEnvelope, normalizeMessageParts, flattenMessageParts } from './providers/io-contracts.js';
93
- export { BUILTIN_CHAT_MESSAGE_KINDS, isBuiltinChatMessageKind, normalizeChatMessageKind, resolveChatMessageKind, buildChatMessage, buildSystemChatMessage, buildRuntimeSystemChatMessage, buildAssistantChatMessage, buildThoughtChatMessage, buildToolChatMessage, buildTerminalChatMessage, buildUserChatMessage, normalizeChatMessage, normalizeChatMessages, } from './providers/chat-message-normalization.js';
93
+ export { BUILTIN_CHAT_MESSAGE_KINDS, isBuiltinChatMessageKind, normalizeChatMessageKind, resolveChatMessageKind, buildChatMessage, buildSystemChatMessage, buildRuntimeSystemChatMessage, buildAssistantChatMessage, buildThoughtChatMessage, buildToolChatMessage, buildTerminalChatMessage, buildUserChatMessage, normalizeChatMessage, normalizeChatMessages, isUserFacingChatMessage, filterUserFacingChatMessages, } from './providers/chat-message-normalization.js';
94
94
  export type { BuiltinChatMessageKind, ChatMessageKind } from './providers/chat-message-normalization.js';
95
95
  export { VersionArchive, detectAllVersions } from './providers/version-archive.js';
96
96
  export type { ProviderVersionInfo, VersionHistory } from './providers/version-archive.js';
package/dist/index.js CHANGED
@@ -3900,6 +3900,7 @@ __export(index_exports, {
3900
3900
  detectIDEs: () => detectIDEs,
3901
3901
  ensureSessionHostReady: () => ensureSessionHostReady,
3902
3902
  execNpmCommandSync: () => execNpmCommandSync,
3903
+ filterUserFacingChatMessages: () => filterUserFacingChatMessages,
3903
3904
  findCdpManager: () => findCdpManager,
3904
3905
  flattenMessageParts: () => flattenMessageParts,
3905
3906
  forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance,
@@ -3941,6 +3942,7 @@ __export(index_exports, {
3941
3942
  isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
3942
3943
  isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
3943
3944
  isSetupComplete: () => isSetupComplete,
3945
+ isUserFacingChatMessage: () => isUserFacingChatMessage,
3944
3946
  killIdeProcess: () => killIdeProcess,
3945
3947
  launchIDE: () => launchIDE,
3946
3948
  launchWithCdp: () => launchWithCdp,
@@ -8152,6 +8154,40 @@ function normalizeChatMessage(message) {
8152
8154
  function normalizeChatMessages(messages) {
8153
8155
  return (Array.isArray(messages) ? messages : []).map((message) => normalizeChatMessage(message));
8154
8156
  }
8157
+ function readMessageMeta(message) {
8158
+ const meta = message?.meta;
8159
+ return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
8160
+ }
8161
+ function readStringField(value) {
8162
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
8163
+ }
8164
+ function isExplicitlyHiddenFromTranscript(message, meta) {
8165
+ const record = message;
8166
+ const visibility = readStringField(record.visibility || meta?.visibility || meta?.transcriptVisibility);
8167
+ const audience = readStringField(record.audience || meta?.audience);
8168
+ const source = readStringField(record.source || meta?.source);
8169
+ 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;
8170
+ }
8171
+ function isExplicitlyVisibleInTranscript(message, meta) {
8172
+ const record = message;
8173
+ const visibility = readStringField(record.visibility || meta?.visibility || meta?.transcriptVisibility);
8174
+ const audience = readStringField(record.audience || meta?.audience);
8175
+ return visibility === "visible" || visibility === "user" || audience === "chat" || record.userFacing === true || meta?.userFacing === true;
8176
+ }
8177
+ function isUserFacingChatMessage(message) {
8178
+ if (!message) return false;
8179
+ const meta = readMessageMeta(message);
8180
+ if (isExplicitlyHiddenFromTranscript(message, meta)) return false;
8181
+ if (isExplicitlyVisibleInTranscript(message, meta)) return true;
8182
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
8183
+ const kind = resolveChatMessageKind(message);
8184
+ if (role === "user" || role === "human") return kind === "standard" || kind === "";
8185
+ if (role === "assistant") return kind === "standard" || kind === "";
8186
+ return false;
8187
+ }
8188
+ function filterUserFacingChatMessages(messages) {
8189
+ return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
8190
+ }
8155
8191
 
8156
8192
  // src/providers/control-effects.ts
8157
8193
  function extractProviderControlValues(controls, data) {
@@ -12125,13 +12161,22 @@ function buildReadChatCommandResult(payload, args) {
12125
12161
  return { success: false, error: error?.message || String(error) };
12126
12162
  }
12127
12163
  const messages = normalizeReadChatMessages(validatedPayload);
12128
- const sync = buildFullTail(messages, normalizeReadChatTailLimit(args));
12164
+ const visibleMessages = filterUserFacingChatMessages(messages);
12165
+ const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
12166
+ const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
12167
+ const returnedDebugReadChat = debugReadChat ? {
12168
+ ...debugReadChat,
12169
+ fullMsgCount: typeof debugReadChat.fullMsgCount === "number" ? debugReadChat.fullMsgCount : messages.length,
12170
+ visibleMsgCount: visibleMessages.length,
12171
+ hiddenMsgCount,
12172
+ returnedMsgCount: sync.messages.length
12173
+ } : void 0;
12129
12174
  return {
12130
12175
  success: true,
12131
12176
  ...validatedPayload,
12132
12177
  messages: sync.messages,
12133
12178
  totalMessages: sync.totalMessages,
12134
- ...debugReadChat ? { debugReadChat } : {}
12179
+ ...returnedDebugReadChat ? { debugReadChat: returnedDebugReadChat } : {}
12135
12180
  };
12136
12181
  }
12137
12182
  var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
@@ -30805,6 +30850,7 @@ async function shutdownDaemonComponents(components) {
30805
30850
  detectIDEs,
30806
30851
  ensureSessionHostReady,
30807
30852
  execNpmCommandSync,
30853
+ filterUserFacingChatMessages,
30808
30854
  findCdpManager,
30809
30855
  flattenMessageParts,
30810
30856
  forwardAgentStreamsToIdeInstance,
@@ -30846,6 +30892,7 @@ async function shutdownDaemonComponents(components) {
30846
30892
  isSessionHostLiveRuntime,
30847
30893
  isSessionHostRecoverySnapshot,
30848
30894
  isSetupComplete,
30895
+ isUserFacingChatMessage,
30849
30896
  killIdeProcess,
30850
30897
  launchIDE,
30851
30898
  launchWithCdp,