MCPcopy Create free account
hub / github.com/Noumena-Network/code / hasVisibleAssistantContent

Function hasVisibleAssistantContent

src/utils/sessionStorage.ts:2592–2605  ·  view source on GitHub ↗

* Checks if an assistant message has visible text content (not just tool_use blocks). * Tool uses are displayed as grouped/collapsed UI elements, not as standalone messages.

(message: TranscriptMessage)

Source from the content-addressed store, hash-verified

2590 * Tool uses are displayed as grouped/collapsed UI elements, not as standalone messages.
2591 */
2592function hasVisibleAssistantContent(message: TranscriptMessage): boolean {
2593 if (message.type !== 'assistant') return false
2594
2595 const content = message.message?.content
2596 if (!content || !Array.isArray(content)) return false
2597
2598 // Check for text block (not just tool_use/thinking blocks)
2599 return content.some(
2600 block =>
2601 block.type === 'text' &&
2602 typeof block.text === 'string' &&
2603 block.text.trim().length > 0,
2604 )
2605}
2606
2607/**
2608 * Counts visible messages that would appear as conversation turns in the UI.

Callers 1

countVisibleMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected