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