MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / extractTranscript

Function extractTranscript

source code/utils/agenticSessionSearch.ts:88–110  ·  view source on GitHub ↗

* Extracts a truncated transcript from session messages.

(messages: SerializedMessage[])

Source from the content-addressed store, hash-verified

86 * Extracts a truncated transcript from session messages.
87 */
88function extractTranscript(messages: SerializedMessage[]): string {
89 if (messages.length === 0) return ''
90
91 // Take messages from start and end to get context
92 const messagesToScan =
93 messages.length <= MAX_MESSAGES_TO_SCAN
94 ? messages
95 : [
96 ...messages.slice(0, MAX_MESSAGES_TO_SCAN / 2),
97 ...messages.slice(-MAX_MESSAGES_TO_SCAN / 2),
98 ]
99
100 const text = messagesToScan
101 .map(extractMessageText)
102 .filter(Boolean)
103 .join(' ')
104 .replace(/\s+/g, ' ')
105 .trim()
106
107 return text.length > MAX_TRANSCRIPT_CHARS
108 ? text.slice(0, MAX_TRANSCRIPT_CHARS) + '…'
109 : text
110}
111
112/**
113 * Checks if a log contains the query term in any searchable field.

Callers 2

logContainsQueryFunction · 0.85
agenticSessionSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected