(message: SerializedMessage)
| 1505 | return [log, buildSearchableText(log)]; |
| 1506 | } |
| 1507 | function extractSearchableText(message: SerializedMessage): string { |
| 1508 | // Only extract from user and assistant messages that have content |
| 1509 | if (message.type !== 'user' && message.type !== 'assistant') { |
| 1510 | return ''; |
| 1511 | } |
| 1512 | const content = 'message' in message ? message.message?.content : undefined; |
| 1513 | if (!content) return ''; |
| 1514 | |
| 1515 | // Handle string content (simple messages) |
| 1516 | if (typeof content === 'string') { |
| 1517 | return content; |
| 1518 | } |
| 1519 | |
| 1520 | // Handle array of content blocks |
| 1521 | if (Array.isArray(content)) { |
| 1522 | return content.map(block => { |
| 1523 | if (typeof block === 'string') return block; |
| 1524 | if ('text' in block && typeof block.text === 'string') return block.text; |
| 1525 | return ''; |
| 1526 | // we don't return thinking blocks and tool names here; |
| 1527 | // they're not useful for search, as they can add noise to the fuzzy matching |
| 1528 | }).filter(Boolean).join(' '); |
| 1529 | } |
| 1530 | return ''; |
| 1531 | } |
| 1532 | |
| 1533 | /** |
| 1534 | * Builds searchable text for a log including messages, titles, summaries, and metadata. |
nothing calls this directly
no outgoing calls
no test coverage detected