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

Function extractFirstMessageText

source code/utils/fingerprint.ts:18–40  ·  view source on GitHub ↗
(
  messages: (UserMessage | AssistantMessage)[],
)

Source from the content-addressed store, hash-verified

16 * @returns First text content, or empty string if not found
17 */
18export function extractFirstMessageText(
19 messages: (UserMessage | AssistantMessage)[],
20): string {
21 const firstUserMessage = messages.find(msg => msg.type === 'user')
22 if (!firstUserMessage) {
23 return ''
24 }
25
26 const content = firstUserMessage.message.content
27
28 if (typeof content === 'string') {
29 return content
30 }
31
32 if (Array.isArray(content)) {
33 const textBlock = content.find(block => block.type === 'text')
34 if (textBlock && textBlock.type === 'text') {
35 return textBlock.text
36 }
37 }
38
39 return ''
40}
41
42/**
43 * Computes 3-character fingerprint for Claude Code attribution.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected