MCPcopy Index your code
hub / github.com/Noumena-Network/code / cleanMessagesForLogging

Function cleanMessagesForLogging

src/utils/sessionStorage.ts:4711–4729  ·  view source on GitHub ↗
(
  messages: Message[],
  allMessages: readonly Message[] = messages,
)

Source from the content-addressed store, hash-verified

4709}
4710
4711export function cleanMessagesForLogging(
4712 messages: Message[],
4713 allMessages: readonly Message[] = messages,
4714): Transcript {
4715 // Only use the array-growth cache for the ant path (common case) where
4716 // allMessages === messages. External-user transforms depend on the full
4717 // allMessages array for collectReplIds which needs fresh computation anyway.
4718 if (isAntOrNoumena() && allMessages === messages) {
4719 return getCleanMessagesForLoggingCached(messages, allMessages)
4720 }
4721
4722 const filtered = messages.filter(isLoggableMessage) as Transcript
4723 return !isAntOrNoumena()
4724 ? transformMessagesForExternalTranscript(
4725 filtered,
4726 collectReplIds(allMessages),
4727 )
4728 : filtered
4729}
4730
4731/**
4732 * Gets a log by its index

Callers 5

recordTranscriptFullFunction · 0.85
recordTranscriptFunction · 0.85
useLogMessagesFunction · 0.85

Calls 4

isAntOrNoumenaFunction · 0.85
collectReplIdsFunction · 0.85

Tested by

no test coverage detected