Truncate oversized messages before compaction summarization to avoid
context limit failures. When individual messages exceed the chunk token
budget, they are flattened to text and truncated to fit within limits.
This prevents the 'prompt is too long' error during compaction that was
causing sessions to reset with empty summaries.
- Add truncateMessagesForSummary function to pre-process messages
- Apply truncation in summarizeChunks before chunking
- Preserve tool call names and image placeholders in truncated content
- Add tests for truncation behavior