@adhdev/daemon-core 0.9.76-rc.55 → 0.9.76-rc.56

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
@@ -7960,21 +7960,27 @@ function readMessageMeta(message) {
7960
7960
  const meta = message?.meta;
7961
7961
  return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
7962
7962
  }
7963
- function isExplicitlyHiddenFromTranscript(meta) {
7964
- if (!meta) return false;
7965
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
7966
- return visibility === "hidden" || visibility === "debug" || meta.internal === true || meta.debug === true || meta.statusOnly === true || meta.controlOnly === true;
7967
- }
7968
- function isExplicitlyVisibleInTranscript(meta) {
7969
- if (!meta) return false;
7970
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
7971
- return visibility === "visible" || meta.userFacing === true;
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;
7972
7978
  }
7973
7979
  function isUserFacingChatMessage(message) {
7974
7980
  if (!message) return false;
7975
7981
  const meta = readMessageMeta(message);
7976
- if (isExplicitlyHiddenFromTranscript(meta)) return false;
7977
- if (isExplicitlyVisibleInTranscript(meta)) return true;
7982
+ if (isExplicitlyHiddenFromTranscript(message, meta)) return false;
7983
+ if (isExplicitlyVisibleInTranscript(message, meta)) return true;
7978
7984
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7979
7985
  const kind = resolveChatMessageKind(message);
7980
7986
  if (role === "user" || role === "human") return kind === "standard" || kind === "";
@@ -11960,19 +11966,19 @@ function buildReadChatCommandResult(payload, args) {
11960
11966
  const visibleMessages = filterUserFacingChatMessages(messages);
11961
11967
  const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
11962
11968
  const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
11963
- const nextDebugReadChat = {
11964
- ...debugReadChat || {},
11965
- fullMsgCount: messages.length,
11969
+ const returnedDebugReadChat = debugReadChat ? {
11970
+ ...debugReadChat,
11971
+ fullMsgCount: typeof debugReadChat.fullMsgCount === "number" ? debugReadChat.fullMsgCount : messages.length,
11966
11972
  visibleMsgCount: visibleMessages.length,
11967
11973
  hiddenMsgCount,
11968
11974
  returnedMsgCount: sync.messages.length
11969
- };
11975
+ } : void 0;
11970
11976
  return {
11971
11977
  success: true,
11972
11978
  ...validatedPayload,
11973
11979
  messages: sync.messages,
11974
11980
  totalMessages: sync.totalMessages,
11975
- debugReadChat: nextDebugReadChat
11981
+ ...returnedDebugReadChat ? { debugReadChat: returnedDebugReadChat } : {}
11976
11982
  };
11977
11983
  }
11978
11984
  var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
@@ -15603,12 +15609,11 @@ ${effect.notification.body || ""}`.trim();
15603
15609
  return Number.isFinite(value) && value > 0 ? value : 0;
15604
15610
  };
15605
15611
  const getRole = (message) => typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
15606
- const isAutoApprovalRuntimeOverlay = (entry) => {
15612
+ const isRuntimeOverlay = (entry) => {
15607
15613
  if (entry.source !== "runtime") return false;
15608
15614
  const key = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
15609
15615
  if (key.startsWith("auto_approval:")) return true;
15610
- const content = typeof entry.message.content === "string" ? entry.message.content.trim().toLowerCase() : flattenContent(entry.message.content).trim().toLowerCase();
15611
- return content.startsWith("auto-approved:");
15616
+ return !isUserFacingChatMessage(entry.message);
15612
15617
  };
15613
15618
  const shouldKeepParsedBeforeUntimedRuntime = (message) => {
15614
15619
  const role = getRole(message);
@@ -15627,7 +15632,7 @@ ${effect.notification.body || ""}`.trim();
15627
15632
  if (a.source !== b.source && aTime !== bTime) {
15628
15633
  const parsedEntry = a.source === "parsed" ? a : b.source === "parsed" ? b : null;
15629
15634
  const runtimeEntry = a.source === "runtime" ? a : b.source === "runtime" ? b : null;
15630
- if (parsedEntry && runtimeEntry && isAutoApprovalRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15635
+ if (parsedEntry && runtimeEntry && isRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15631
15636
  if (shouldKeepParsedBeforeUntimedRuntime(parsedEntry.message)) {
15632
15637
  return a.source === "parsed" ? -1 : 1;
15633
15638
  }