MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / extractTitleText

Function extractTitleText

src/bridge/bridgeMessaging.ts:116–136  ·  view source on GitHub ↗
(m: Message)

Source from the content-addressed store, hash-verified

114 * implausible (an interrupt implies a prior prompt already flowed through).
115 */
116export function extractTitleText(m: Message): string | undefined {
117 if (m.type !== 'user' || m.isMeta || m.toolUseResult || m.isCompactSummary)
118 return undefined
119 if (m.origin && (m.origin as { kind?: string }).kind !== 'human')
120 return undefined
121 const content = m.message!.content
122 let raw: string | undefined
123 if (typeof content === 'string') {
124 raw = content
125 } else {
126 for (const block of content ?? []) {
127 if (block.type === 'text') {
128 raw = block.text
129 break
130 }
131 }
132 }
133 if (!raw) return undefined
134 const clean = stripDisplayTagsAllowEmpty(raw)
135 return clean || undefined
136}
137
138const SYSTEM_REMINDER_TAG = 'system-reminder'
139const XML_BLOCK_PATTERN = /\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy

Callers 2

writeMessagesFunction · 0.85
writeMessagesFunction · 0.85

Calls 1

Tested by

no test coverage detected