MCPcopy
hub / github.com/claude-code-best/claude-code / isNotEmptyMessage

Function isNotEmptyMessage

src/utils/messages.ts:692–726  ·  view source on GitHub ↗
(message: Message)

Source from the content-addressed store, hash-verified

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

Callers 2

messages.test.tsFile · 0.90
normalizeMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected