pub fn count_user_image_markers(messages: &[ChatMessage]) -> usizeExpand description
Count image markers that originate from genuine user messages (i.e.
inbound attachments), excluding tool-result carriers (role == "tool" and
[Tool results] user messages).
Callers use this to distinguish “the user sent an image we cannot see”
(which should surface a user-facing capability error so the attachment is
not silently ignored) from “an image marker arrived only via a tool result”
(e.g. image_info/screenshot/image_gen), which can degrade to text-only
on a non-vision provider without misleading the user.