| 687 | } |
| 688 | |
| 689 | export function isNotEmptyMessage(message: Message): boolean { |
| 690 | if ( |
| 691 | message.type === 'progress' || |
| 692 | message.type === 'attachment' || |
| 693 | message.type === 'system' |
| 694 | ) { |
| 695 | return true |
| 696 | } |
| 697 | |
| 698 | if (typeof message.message.content === 'string') { |
| 699 | return message.message.content.trim().length > 0 |
| 700 | } |
| 701 | |
| 702 | if (message.message.content.length === 0) { |
| 703 | return false |
| 704 | } |
| 705 | |
| 706 | // Skip multi-block messages for now |
| 707 | if (message.message.content.length > 1) { |
| 708 | return true |
| 709 | } |
| 710 | |
| 711 | if (message.message.content[0]!.type !== 'text') { |
| 712 | return true |
| 713 | } |
| 714 | |
| 715 | return ( |
| 716 | message.message.content[0]!.text.trim().length > 0 && |
| 717 | message.message.content[0]!.text !== NO_CONTENT_MESSAGE && |
| 718 | message.message.content[0]!.text !== INTERRUPT_MESSAGE_FOR_TOOL_USE |
| 719 | ) |
| 720 | } |
| 721 | |
| 722 | // Deterministic UUID derivation. Produces a stable UUID-shaped string from a |
| 723 | // parent UUID + content block index so that the same input always produces the |