pub fn prepare_conversation(messages: &[Message], max_chars: usize) -> StringExpand description
Formats session messages into a conversation transcript for the LLM.
Each message is rendered with a role tag and, for user messages, a UTC
timestamp. Tool calls and thinking blocks are excluded via
MessageContent::text().
If the formatted output exceeds max_chars, the middle portion of the
conversation is replaced with an omission marker. The first 20% and
last 30% of messages are kept to preserve context from both the beginning
and end of the session.
Returns an empty string when the message slice is empty.