<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Added autofocus to the email composer after selecting a template, so users can start editing right away. This improves workflow by placing the cursor at the end of the content automatically.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- New Features
- Added a delete confirmation toast with an action before removing a template.
- Added an empty-state message when no templates are available.
- Applying a template now fills subject, body, and recipients, then returns focus to the editor.
- The template menu closes immediately after selection.
- Smoother searching/filtering when browsing templates.
- Bug Fixes
- Templates list refreshes after creating a new template to reliably show the latest items.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Description
Fixed a UI issue in the mail list component by changing the overflow behavior of draft messages from `overflow-clip` to `overflow-visible`. Also removed an unnecessary decorative bar element that was positioned absolutely on the left side of draft messages.
## Type of Change
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)
- [x] 🎨 UI/UX improvement
## Areas Affected
- [x] User Interface/Experience
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Style**
- Updated the appearance of draft messages in the Mail list: removed the left-side accent line for a cleaner look.
- Adjusted item layout to allow content to display fully without being clipped, improving readability and visual consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Add ability to delete drafts
This PR adds the ability to delete drafts directly from the mail list interface. It implements:
1. A delete button that appears when hovering over draft items
2. Backend support for draft deletion in both Google and Microsoft mail providers
3. Optimistic UI updates to immediately remove deleted drafts from the view
The implementation follows the existing optimistic action pattern used for other mail operations, ensuring a consistent user experience.
## Type of Change
- ✨ New feature (non-breaking change which adds functionality)
## Areas Affected
- [x] Email Integration (Gmail, Outlook, etc.)
- [x] User Interface/Experience
- [x] API Endpoints
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- New Features
- Delete drafts directly from the mail list via a new trash icon on each draft.
- Immediate, optimistic removal of deleted drafts from the list for faster feedback.
- Contextual tooltips on draft actions for clearer guidance.
- Bug Fixes
- Corrected a visual offset issue in the action bar for consistent positioning.
- Improved range selection behavior for multi-select actions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Disabled the meet feature across the app and removed unused code related to meet functionality.
- **Refactors**
- Commented out meet-related UI and logic in the sidebar.
- Added an environment flag to control meet availability.
- Updated backend routes to check the flag and return 501 if meet is disabled.
- Deleted unused meet code and cleaned up server files.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Added environment variable to enable or disable the meeting creation feature.
* Introduced thread-level resynchronization and improved thread fetching performance.
* **Bug Fixes**
* Meeting creation is now disabled in the sidebar and backend when the feature flag is off, preventing unintended access.
* **Refactor**
* Improved concurrency for shard data operations and optimized thread retrieval logic.
* Removed legacy workflow functions for a cleaner codebase.
* **Chores**
* Removed scheduled cron triggers from the local server environment configuration.
* **Other**
* Enhanced synchronization after sending emails and creating drafts to ensure up-to-date thread information.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Restores the email draft in the composer when a user clicks "undo" after sending, so they can edit and resend easily.
- **New Features**
- Saves email content to local storage on undo and reopens the composer with all fields and attachments restored.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Added automatic saving of email content when using the undo send feature, allowing users to restore unsent emails in the compose window.
* Compose and reply windows now restore email fields (recipients, subject, message, attachments, etc.) if an undo send is triggered.
* **Enhancements**
* Improved handling of email drafts and restoration, providing a smoother experience when recovering unsent emails.
* Undo send now persists full email data including attachments, with seamless restoration and clearing of undo data on send or close.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Restrict Video Meeting Creation to Pro Users
## Description
This PR restricts the video meeting creation functionality to Pro users only. It also adds rate limiting to the meeting creation endpoint to prevent abuse. The UI has been updated to hide the video meeting button for non-Pro users.
## Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
- [x] 🔒 Security enhancement
- [x] ⚡ Performance improvement
## Areas Affected
- [x] User Interface/Experience
- [x] Authentication/Authorization
- [x] API Endpoints
## Testing Done
- [x] Manual testing performed
## Security Considerations
- [x] Authentication checks are in place
- [x] Rate limiting is implemented
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
## Additional Notes
The PR includes:
1. Refactoring the Pro user detection logic into a reusable utility function
2. Adding rate limiting to the meeting creation endpoint (10 requests per minute)
3. Conditionally rendering the video meeting button in the sidebar based on Pro status
4. Proper error handling for unauthorized meeting creation attempts
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Improved thread counting performance by batching label queries and added Apache license headers to workflow files.
- **Refactors**
- Replaced individual thread count queries with a single batched query for all labels.
- Added license headers to workflow-related source files.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Improved thread counting performance by enabling batch counting of threads across multiple folders or labels.
* **Refactor**
* Streamlined folder synchronization logic and removed unused or commented-out code for better maintainability.
* **Documentation**
* Added Apache 2.0 license headers to several files to clarify usage and licensing terms.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Added Playwright end-to-end tests for bulk actions and search in the AI chat sidebar to ensure key workflows work as expected.
- **New Features**
- Added tests that simulate sending bulk action and search commands in the chat sidebar.
- Updated chat message markup to support easier test targeting.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved identification of message roles in the AI chat component for enhanced accessibility and testing.
* **Tests**
* Added a new end-to-end test suite to verify AI Chat Sidebar functionality, including user interactions and AI responses.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Implement Database Sharding for Email Storage
This PR implements database sharding to improve scalability and performance for email storage. The system now distributes email data across multiple shards instead of storing all data in a single database instance.
## Type of Change
- ✨ New feature (non-breaking change which adds functionality)
- ⚡ Performance improvement
## Areas Affected
- [x] Email Integration (Gmail, IMAP, etc.)
- [x] Data Storage/Management
- [x] API Endpoints
## Description
This PR introduces a sharding mechanism for email storage to handle large volumes of data more efficiently:
1. Created a new `ShardRegistry` Durable Object to track and manage shards for each connection
2. Implemented logic to distribute threads across multiple shards based on size limits (9GB per shard)
3. Modified thread operations to work across shards, including:
- Thread retrieval with shard fallback
- Aggregation of results from multiple shards
- Sequential processing for paginated results
4. Moved notification handling from a separate component to the AI sidebar
5. Added shard count display in the user interface
6. Refactored server utilities to support the new sharding architecture
7. Updated API endpoints to work with the sharded database structure
The implementation ensures that as email volume grows, the system can scale horizontally by adding new shards rather than being limited by a single database's capacity.
## Testing Done
- [x] Manual testing performed
- [x] Cross-browser testing (if UI changes)
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] All tests pass locally
## Additional Notes
This change significantly improves the system's ability to handle large email volumes by distributing data across multiple database shards. The UI now displays the number of shards in use, providing transparency about the underlying storage architecture.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Introduced sharding support for improved scalability and performance.
* Added display of shard count in the user interface.
* Enhanced sidebar to handle real-time updates for mail, labels, and state.
* **Bug Fixes**
* Improved cache invalidation and data refresh for more accurate mail and label updates.
* **Refactor**
* Centralized thread and label operations for better maintainability.
* Simplified and streamlined backend logic for thread and label management.
* **Chores**
* Updated configuration to support new sharding infrastructure.
* Removed unused notification provider component and related logic.
* **Documentation**
* UI now reflects the number of database shards in relevant menus.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added a ThreadSyncWorker Durable Object to handle thread synchronization, improving reliability and separation of concerns in thread syncing.
- **New Features**
- Introduced ThreadSyncWorker for dedicated thread sync operations.
- Updated server logic to use ThreadSyncWorker for fetching and storing thread data.
- Registered ThreadSyncWorker in environment and configuration files.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Introduced a new background worker to improve email thread synchronization reliability and performance.
* Enhanced logging for thread synchronization, including duration and progress details.
* **Bug Fixes**
* Increased retry attempts for Gmail rate-limiting errors to improve sync robustness.
* **Chores**
* Updated environment and configuration settings to support the new background worker.
* Removed keyboard shortcut functionality for category labels in the mail interface.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
The new implementation:
- Uses a single `useHotkeys` call with an array of key combinations
- Determines the appropriate category based on the pressed key
- Handles toggling labels in a more centralized way
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Refactor**
* Simplified hotkey handling for category selection by consolidating multiple hotkey registrations into a single, unified hotkey listener.
* The '0' key now selects the 10th category instead of clearing all labels.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Add Numeric Hotkeys for Category Selection in Mail List
## Description
This PR adds keyboard shortcuts for quickly toggling mail categories in the inbox view:
- Numbers 1-9 toggle the corresponding categories (based on their index)
- Number 0 clears all selected labels
The implementation uses React Hotkeys Hook to register these shortcuts within the mail-list scope, making View switching much faster for keyboard-oriented users.
## Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
- [x] 🎨 UI/UX improvement
## Areas Affected
- [x] User Interface/Experience
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Added keyboard shortcuts (number keys 1–9) to quickly toggle category label filters in the mail category dropdown.
* Added a keyboard shortcut (0 key) to clear all active category label filters.
* **Refactor**
* Disabled previous keyboard shortcuts for switching mail list categories to avoid conflicts and streamline shortcut behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated example queries in the chat interface and clarified tool descriptions to make them easier to understand and use.
- **Improvements**
- Replaced and refined example queries for better relevance.
- Expanded tool descriptions to give clearer guidance on their purpose and usage.
- Added a rule to prevent returning IDs directly in responses.
<!-- End of auto-generated description by cubic. -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated email queue IDs in wrangler.jsonc to match new configuration and removed an unused import from the mail component.
<!-- End of auto-generated description by cubic. -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Removed the sync status indicator from the mail layout and fixed trailing commas in wrangler.jsonc files to ensure valid JSONC formatting.
- **Bug Fixes**
- Cleaned up JSONC files by removing trailing commas that could cause parsing errors.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Bug Fixes**
* Removed the syncing status indicator from the mail interface.
* **Chores**
* Updated configuration files with improved formatting and added new rules for handling certain file types in different environments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Migrate ZeroDriver to use SQLite database with Drizzle ORM
## Description
This PR refactors the ZeroDriver to use a SQLite database with Drizzle ORM for managing threads and labels, replacing the previous storage approach. The implementation includes:
- Added a new database schema with tables for threads, labels, and thread-label relationships
- Created comprehensive database operations for thread and label management
- Updated all agent methods to use the new database layer
- Modified TRPC routes and tools to work with the updated database structure
- Added thread count information to the DoState to display folder counts in the UI
This change improves query capabilities, enables more complex filtering operations, and provides a more reliable storage solution for email data.
## Type of Change
- ✨ New feature (non-breaking change which adds functionality)
- ⚡ Performance improvement
## Areas Affected
- [x] Email Integration (Gmail, IMAP, etc.)
- [x] User Interface/Experience
- [x] Data Storage/Management
- [x] API Endpoints
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] I have updated the documentation
## Additional Notes
The PR includes database migration files to ensure smooth transitions for existing users. The new database structure allows for more efficient querying of threads by labels and supports complex filtering operations that were previously difficult to implement.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Introduced a new SQLite-backed database layer for managing email threads and labels, enabling advanced filtering, pagination, and label management.
* Added a "Force re-sync" option and a syncing status indicator with detailed info to the user menu.
* Enhanced syncing status UI for improved clarity and visual feedback.
* **Improvements**
* Optimized email syncing and label modification logic for greater reliability and performance.
* Standardized agent usage across mail, label, and draft operations for consistency.
* Refined UI elements for syncing feedback and debug actions.
* **Bug Fixes**
* Improved handling of thread and label counts and syncing state in the user interface.
* **Chores**
* Migrated internal data access to use Drizzle ORM and modular database functions.
* Added configuration and migration files to support the new database backend.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Removed email hover tracking and all related event listeners from the mail list and hotkey logic.
- **Refactors**
- Commented out email hover event dispatch and handlers in mail-list and mail components.
- Removed emailHover event listener logic from mail-list-hotkeys.
<!-- End of auto-generated description by cubic. -->
# Email Syncing Status Indicators
## Description
Added real-time email syncing status indicators to the mail UI that show when emails are being synchronized, which folders are currently syncing, and the current storage size. This provides users with better visibility into background processes.
## Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
- [x] ⚡ Performance improvement
## Areas Affected
- [x] Email Integration (Gmail, IMAP, etc.)
- [x] User Interface/Experience
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
## Additional Notes
This PR implements a state management system for email synchronization status using Jotai atoms. The server now broadcasts syncing status through Party, and the UI displays this information in a non-intrusive way at the top of the mail interface.
Key changes:
- Created a new `useDoState` hook to manage syncing state
- Added status indicators in the mail layout component
- Modified the server to track and broadcast syncing status
- Improved folder synchronization logic to be more efficient
- Removed unnecessary delays in the synchronization process
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Added a real-time syncing status indicator in the mail interface, displaying current sync progress, folders being synced, and storage usage.
* Introduced live syncing state updates communicated between server and client for improved sync transparency.
* **Improvements**
* Enhanced background synchronization logic to provide clearer feedback on syncing activity.
* Real-time updates now reflect the latest syncing state without delays.
* Removed artificial delays in syncing processes for faster synchronization.
* Triggered folder syncing asynchronously when fetching threads from the database.
* **Bug Fixes**
* Removed unused and obsolete code related to database table management and sync rate-limiting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Redesigned Mail Categories with Label-Based Filtering
## Description
Reimplemented the mail categories feature to use label-based filtering instead of search queries. This change makes it easier for users to customize and manage their inbox views by selecting specific labels rather than writing complex search queries.
The PR enables the categories settings page in the navigation and completely redesigns the UI to focus on label selection. Users can now add, delete, reorder, and set default categories with a more intuitive interface.
## Type of Change
- ✨ New feature (non-breaking change which adds functionality)
- 🎨 UI/UX improvement
## Areas Affected
- [x] User Interface/Experience
- [x] Data Storage/Management
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] My code follows the project's style guidelines
## Additional Notes
The PR also includes improvements to the thread querying logic in the backend to better support label-based filtering. The categories feature is now called "Views" in the UI to better reflect its purpose.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Categories settings page is now accessible from navigation.
* Categories (now called "Views") can be managed with multi-select label filters, drag-and-drop reordering, add/delete actions, and unsaved changes tracking.
* Save and reset options are available for category changes.
* **Improvements**
* Category selection supports multi-label filtering with a dropdown menu.
* UI styling updated for better dark mode support and usability.
* Localization updated to rename "Categories" to "Views".
* Navigation and mail list no longer use category query parameters, simplifying URL handling.
* **Bug Fixes**
* Removed unused and AI-related code for category search queries.
* **Chores**
* Added a pre-commit script to enforce linting before commits.
* Refactored internal logic for category and thread management for better maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Removed unused variables from ai-chat.tsx and commented out the unused getFolderLabelId function in mail.ts to clean up the codebase.
<!-- End of auto-generated description by cubic. -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added thread, folder, and filter context to chat prompts and enforced strict security rules to prevent unsafe responses.
- **Security**
- Wrapped all chat prompts with locked instructions to block code, markup, and unsafe content.
- **Context Awareness**
- Passed current thread, folder, and filter info to chat prompts for more relevant responses.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Chat prompts now include enhanced security instructions and contextual information such as thread, folder, and filter details for improved safety and relevance.
* All chat messages, including system messages, are now displayed in the chat interface.
* **Improvements**
* Contextual information is now passed throughout the chat pipeline, enabling more accurate and context-aware responses.
* Updated default chat prompts for improved consistency.
* Message submission now clears the editor content and ensures the chat view scrolls to the latest message.
* **Bug Fixes**
* Ensured editor content is cleared and chat scrolls to the bottom after sending a message.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Removed thread ID tracking from the agent and deleted unused filter suggestion files to simplify code and reduce complexity.
- **Refactors**
- Removed all code related to thread ID updates and tracking in both client and server.
- Deleted filter suggestion utilities and types from mail and server libs.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Enhanced inbox search tool to allow specifying the folder and number of results when searching email threads.
* **Bug Fixes**
* Improved handling of email thread listing to ensure correct retrieval based on search queries and folder selection.
* **Refactor**
* Removed deprecated email filter suggestion logic and related utilities from both client and server.
* Cleaned up unused message types and socket communication related to thread ID updates.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Thread context is now sent to the chat as a system message instead of being included in the prompt. This makes thread handling more flexible and decouples context from prompt generation.
- **Refactors**
- Removed thread ID from the prompt and updated backend logic to use system messages for thread context.
- Adjusted chat component to append thread context as a system message before user input.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Introduced a tool to generate and display summaries for specific email threads, including key details like subject, sender, and received date.
* **Improvements**
* Enhanced AI chat functionality by updating message handling and filtering system messages from the chat display.
* Updated AI chat prompts and tools for improved interaction and flexibility.
* Simplified and streamlined internal chat handling for better reliability and maintainability.
* **Bug Fixes**
* Corrected minor display and formatting issues in chat components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# feat: sync threadId to ZeroAgent via WebSocket for multi-tab support
## Summary
This PR implements real-time threadId synchronization between the frontend and ZeroAgent backend to provide better context to the AI assistant. When users navigate between email threads in the frontend (via `useQueryState('threadId')`), the system now automatically sends WebSocket updates to the ZeroAgent so the AI knows which thread the user is currently viewing.
**Key changes:**
- Added `ThreadIdUpdate` WebSocket message type for bidirectional communication
- Created `ThreadIdSyncProvider` component that monitors threadId changes and sends updates
- Modified `ZeroAgent` to store threadId per connection for multi-tab support
- Updated AI system prompt generation to include current threadId context
- Maintains connection isolation so multiple tabs can have different active threads
## Review & Testing Checklist for Human
- [ ] **Verify frontend loads properly and threadId sync works** - There was a CSS import error during development that prevented browser testing. Confirm the app loads and threadId changes trigger WebSocket messages in DevTools.
- [ ] **Test multi-tab support** - Open multiple browser tabs, navigate to different threads in each tab, and verify the AI chat in each tab has context for the correct thread.
- [ ] **Confirm AI system prompt includes threadId** - Start a chat conversation and verify the AI assistant has proper context about the current thread the user is viewing.
- [ ] **Check for regressions** - Verify existing email navigation, AI chat functionality, and WebSocket notifications still work as expected.
- [ ] **Test edge cases** - Try rapid thread navigation, WebSocket reconnections, and tab closing/opening to ensure the system handles these scenarios gracefully.
---
### Diagram
```mermaid
%%{ init : { "theme" : "default" }}%%
graph TD
Frontend["apps/mail/components/party.tsx<br/>NotificationProvider"]:::major-edit
ThreadSync["ThreadIdSyncProvider<br/>(new component)"]:::major-edit
QueryState["useQueryState('threadId')<br/>(existing hook)"]:::context
Backend["apps/server/src/routes/agent/index.ts<br/>ZeroAgent class"]:::major-edit
Types["apps/server/src/routes/agent/types.ts<br/>Message Types"]:::minor-edit
Prompt["apps/server/src/lib/prompts.ts<br/>AiChatPrompt"]:::context
QueryState --> ThreadSync
ThreadSync --> Frontend
Frontend -->|"WebSocket ThreadIdUpdate"| Backend
Backend --> Prompt
Types -.->|"defines message structure"| Frontend
Types -.->|"defines message structure"| Backend
subgraph Legend
L1[Major Edit]:::major-edit
L2[Minor Edit]:::minor-edit
L3[Context/No Edit]:::context
end
classDef major-edit fill:#90EE90
classDef minor-edit fill:#87CEEB
classDef context fill:#FFFFFF
```
### Notes
- **Session Info**: Requested by @MrgSub, implemented in Devin session: https://app.devin.ai/sessions/f2c92b4c778d4314a4c9947ca2022667
- **Environment Issue**: Frontend had CSS import errors during development preventing full browser testing. The implementation follows existing WebSocket patterns but needs verification in a working environment.
- **Architecture**: Uses existing connection management system where each browser tab gets a unique connectionId, enabling independent threadId tracking per tab.
- **Backward Compatibility**: Changes are additive and shouldn't break existing functionality, but the system prompt generation flow has been modified to use stored threadId instead of request-time threadId.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Enabled real-time syncing of the current threadId to ZeroAgent over WebSocket, allowing each browser tab to maintain its own thread context for multi-tab support.
- **New Features**
- Added a ThreadIdSyncProvider component to detect thread changes and send updates to ZeroAgent.
- ZeroAgent now tracks threadId per connection, so each tab can have independent context.
- System prompt generation now uses the correct threadId for each connection.
<!-- End of auto-generated description by cubic. -->
based on the featurebase issue:
https://linear.app/0email/issue/ZERO-366/beautiful-animation-between-switching-emails
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added a smooth transition animation when switching between emails, with a new user setting to enable or disable this effect.
- **New Features**
- Added an "Animations" toggle in settings.
- Email view now animates when moving to the next or previous email if enabled.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Added an option in user settings to enable or disable smooth animations when switching between email threads.
* Introduced animated transitions for email thread display, providing a sliding and fading effect when navigating between threads if animations are enabled.
* **Bug Fixes**
* None.
* **Chores**
* Updated settings schema and defaults to support the new animation preference.
* Added localization entries for the new animations setting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Fix AI Summary Display and Gmail Subscription Key Format
## Description
This PR includes three key changes:
1. Removed the conditional rendering of the `AiSummary` component based on `brainState.enabled`, allowing the component to handle its own visibility logic.
2. Fixed the Gmail subscription key format in the server by using a composite key format `${id}__${providerId}` instead of just `id` when accessing the `gmail_sub_age` KV store.
3. Temporarily commented out thread synchronization logic in the agent routes due to issues with Durable Object storage resetting.
## Type of Change
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)
## Areas Affected
- [x] Email Integration (Gmail, IMAP, etc.)
- [x] User Interface/Experience
- [x] Data Storage/Management
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
## Additional Notes
The commented-out thread synchronization code includes a TODO note explaining that the Durable Object storage is sometimes resetting. This is a temporary measure until we can properly address the underlying issue.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added automatic user topics generation from email subjects and improved label management to keep labels in sync with user interests.
- **New Features**
- Generates 1–6 user topics based on email subjects and creates labels for them if needed.
- Stores and caches generated topics for faster access.
- Exposes user topics via agent API and broadcasts updates to the frontend.
- **Refactors**
- Centralized Google service account parsing.
- Improved thread and label change handling in pipelines for better reliability.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Introduced user topic generation from email subjects to highlight user interests.
* Enabled retrieval, display, and automatic creation of labels for user topics with cache management.
* Added real-time notifications for user topic updates.
* Added manual mail folder reload capability.
* **Enhancements**
* Improved label synchronization with detailed tracking of label changes per thread.
* Updated email thread labeling instructions for clarity and flexibility.
* Unified service account handling across workflows.
* **Bug Fixes**
* Fixed cache invalidation for user topics to ensure up-to-date information.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added a sequential thinking processor for dynamic problem-solving and switched the default model to OpenAI for agent responses.
- **New Features**
- Introduced a SequentialThinkingProcessor to support step-by-step and branching thought processes.
- Added ThinkingMCP agent for advanced reasoning workflows.
- **Dependencies**
- Updated environment to use OpenAI models by default.
<!-- End of auto-generated description by cubic. -->
# Implement Thread Deletion Functionality
## Description
This PR implements thread deletion functionality, allowing users to permanently delete threads from the bin. The implementation includes:
1. Replacing the optimistic delete with a real deletion using TRPC mutation
2. Enabling the previously disabled delete button in the thread context menu
3. Adding server-side support for thread deletion from the database
4. Adding folder name normalization to handle 'bin' vs 'trash' naming differences
## Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)
## Areas Affected
- [x] Email Integration (Gmail, IMAP, etc.)
- [x] User Interface/Experience
- [x] Data Storage/Management
## Testing Done
- [x] Manual testing performed
## Checklist
- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
## Additional Notes
The implementation now properly deletes threads from the database when the user selects the delete option from the context menu. The UI provides toast notifications to indicate the deletion status.
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
# READ CAREFULLY THEN REMOVE
Remove bullet points that are not relevant.
PLEASE REFRAIN FROM USING AI TO WRITE YOUR CODE AND PR DESCRIPTION. IF YOU DO USE AI TO WRITE YOUR CODE PLEASE PROVIDE A DESCRIPTION AND REVIEW IT CAREFULLY. MAKE SURE YOU UNDERSTAND THE CODE YOU ARE SUBMITTING USING AI.
- Pull requests that do not follow these guidelines will be closed without review or comment.
- If you use AI to write your PR description your pr will be close without review or comment.
- If you are unsure about anything, feel free to ask for clarification.
## Description
Please provide a clear description of your changes.
---
## Type of Change
Please delete options that are not relevant.
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature with breaking changes)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔒 Security enhancement
- [ ] ⚡ Performance improvement
## Areas Affected
Please check all that apply:
- [ ] Email Integration (Gmail, IMAP, etc.)
- [ ] User Interface/Experience
- [ ] Authentication/Authorization
- [ ] Data Storage/Management
- [ ] API Endpoints
- [ ] Documentation
- [ ] Testing Infrastructure
- [ ] Development Workflow
- [ ] Deployment/Infrastructure
## Testing Done
Describe the tests you've done:
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
- [ ] Cross-browser testing (if UI changes)
- [ ] Mobile responsiveness verified (if UI changes)
## Security Considerations
For changes involving data or authentication:
- [ ] No sensitive data is exposed
- [ ] Authentication checks are in place
- [ ] Input validation is implemented
- [ ] Rate limiting is considered (if applicable)
## Checklist
- [ ] I have read the [CONTRIBUTING](https://github.com/Mail-0/Zero/blob/staging/.github/CONTRIBUTING.md) document
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in complex areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix/feature works
- [ ] All tests pass locally
- [ ] Any dependent changes are merged and published
## Additional Notes
Add any other context about the pull request here.
## Screenshots/Recordings
Add screenshots or recordings here if applicable.
---
_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Enabled automatic draft generation in the thread workflow by uncommenting and activating related logic.
- **New Features**
- Threads now automatically generate a draft reply when a response is needed, based on email intent analysis.
<!-- End of auto-generated description by cubic. -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Automatic draft generation for certain email threads has been re-enabled, allowing drafts to be created based on message intent.
* **Bug Fixes**
* Restored previously disabled functionality for generating and logging automatic drafts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->