* Checks if a user message has visible content (text or image, not just tool_result). * Tool results are displayed as part of collapsed groups, not as standalone messages. * Also excludes meta messages which are not shown to the user.
(message: TranscriptMessage)
| 2397 | * Also excludes meta messages which are not shown to the user. |
| 2398 | */ |
| 2399 | function hasVisibleUserContent(message: TranscriptMessage): boolean { |
| 2400 | if (message.type !== 'user') return false |
| 2401 | |
| 2402 | // Meta messages are not shown to the user |
| 2403 | if (message.isMeta) return false |
| 2404 | |
| 2405 | const content = message.message?.content |
| 2406 | if (!content) return false |
| 2407 | |
| 2408 | // String content is always visible |
| 2409 | if (typeof content === 'string') { |
| 2410 | return content.trim().length > 0 |
| 2411 | } |
| 2412 | |
| 2413 | // Array content: check for text or image blocks (not tool_result) |
| 2414 | if (Array.isArray(content)) { |
| 2415 | return content.some( |
| 2416 | block => |
| 2417 | block.type === 'text' || |
| 2418 | block.type === 'image' || |
| 2419 | block.type === 'document', |
| 2420 | ) |
| 2421 | } |
| 2422 | |
| 2423 | return false |
| 2424 | } |
| 2425 | |
| 2426 | /** |
| 2427 | * Checks if an assistant message has visible text content (not just tool_use blocks). |
no outgoing calls
no test coverage detected