* feat: optimize context compression and session sync
Context Compressor:
- Add ContentBlock type support for user messages with images/files
- Enhance buildConversationHistory to handle ContentBlock[] format
- Update serializeForSummary to convert ContentBlock[] to text
- Support mixed content (text, images, files) in history compression
Session Sync:
- Replace loop of addMessage with batch addMessages (transaction-protected)
- Use addMessages for atomic bulk insert with BEGIN/COMMIT
- Ensure data consistency before calcAndUpdateUsage reads DB
Chat Run Socket:
- Remove convertHistoryFormat before compression (compressor handles raw format)
- Compressor now processes original messages for better tool message handling
- Improve compression quality by preserving original message structure
Benefits:
- Better compression quality with proper tool message recognition
- Improved performance with batch DB inserts
- Strong data consistency with transaction protection
- Support for rich content (images/files) in conversation history
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: bump version to 0.5.7
- Prepare for release with context compression and session sync optimizations
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: add 0.5.7 changelog entries
- Optimize context compression to support rich content (images, files)
- Improve session sync with batch inserts and transaction protection
- Fix usage.updated event reception for accurate token tracking
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>