3708 Commits

Author SHA1 Message Date
Adam
843dc54969 ugh 2026-05-26 13:27:26 -07:00
Adam
b9ce93c712 idk atp 2026-05-26 13:24:11 -07:00
Adam
caaa53d0ac fix build 2026-05-26 13:21:36 -07:00
Adam
7e0088dea2 fixes build & XSS 2026-05-26 13:17:39 -07:00
Adam
cdde4d81d7 feat(landing): introduce Orchid on the 0.email home page (#2076) 2026-05-26 13:10:03 -07:00
Aj Wazzan
2ada920e4a hotfix 2025-08-09 11:54:29 -07:00
Adam
c3582d3120 Remove hardcoded Cloudflare credentials from configuration files (#1898)
# 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 hardcoded Cloudflare account ID and API token from configuration files to improve security.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Chores**
  * Updated environment variable values for Cloudflare account ID and API token to empty strings in configuration files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-03 14:23:30 -07:00
Ayush Sharma
c6fd1d8814 fix: Trigger refetch() after label creation toast completes (#1889) 2025-08-03 14:02:41 -07:00
Brandon McConnell
c4b75173e4 Fix sizes and styles of AI sidebar icons (#1894) 2025-08-03 14:02:25 -07:00
Brandon McConnell
838057d564 Fix toast styling (#1893) 2025-08-03 14:02:08 -07:00
Adam
99bc631a4f Remove unused variables and comment out getFolderLabelId function (#1897)
# 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. -->
2025-08-03 13:51:39 -07:00
Adam
649eb45d60 Add thread context to AI chat and enhance security with locked prompts (#1896)
# 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 -->
2025-08-03 13:48:14 -07:00
Adam
5723c627ee Remove thread ID tracking and filter suggestion files (#1895)
# 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 -->
2025-08-03 13:41:08 -07:00
Adam
e1e76242f7 Comment out unused constants and set default server URL (#1890)
# 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
Commented out unused constants in prompts and voice provider files, and set a default server URL in the ElevenLabs tools script.

<!-- End of auto-generated description by cubic. -->
2025-08-02 16:34:29 -07:00
Adam
108dc8db5f Make AutoRAG optional and improve thread summary fallback (#1888)
# 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
Made AutoRAG optional so it only runs when configured, and improved thread summary fallback to always return basic info if a summary is missing.

- **Bug Fixes**
  - Thread summary now returns subject, sender, and date even if no summary is found.
  - AutoRAG is only used when enabled, with a proper fallback to raw search results.

<!-- 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 inbox search tool supporting natural language queries with configurable result limits.
  * Enabled conditional use of advanced search features based on environment settings.

* **Improvements**
  * Clarified tool parameter descriptions.
  * Enhanced tool registration to accept dynamic header values.

* **Refactor**
  * Improved internal handling of request headers and tool configuration.

* **Chores**
  * Removed default fallback server URL in tool registration scripts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-01 15:21:47 -07:00
Adam
a34028c1bc Streamline email assistant prompt and add server-side tool execution (#1887)
# 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
Simplified the email assistant system prompt for clarity and added server-side tool execution for voice and web integrations.

- **Refactors**
  - Rewrote the assistant prompt to be shorter, more direct, and easier for models to follow.
  - Removed unused and verbose prompt sections.

- **New Features**
  - Added a server-side tool execution endpoint and utility for handling tool calls from the client.
  - Introduced a script to register all tools with ElevenLabs for voice agent integration.

<!-- End of auto-generated description by cubic. -->
2025-08-01 14:14:50 -07:00
Adam
fd6a222c78 Allow SSE connections with system__caller_id (#1886)
# 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
Allowed SSE connections when the X-Caller header is set to system__caller_id, enabling system-level clients to connect without standard authentication.

<!-- End of auto-generated description by cubic. -->
2025-08-01 13:47:24 -07:00
Adam
0343c292ba Allow SSE connections without X-Caller header (#1885)
# 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
SSE connections to the /vsse endpoint can now be established without requiring the X-Caller header. If X-Caller is missing, the connection is still allowed as long as the Authorization header is valid.

<!-- End of auto-generated description by cubic. -->
2025-08-01 13:40:21 -07:00
Adam
032006c0f0 Add voice SSE endpoint and thread summary tool to MCP agent (#1884)
# 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 new voice SSE endpoint for authenticated callers and a thread summary tool to the MCP agent for summarizing email threads.

- **New Features**
  - Added /vsse SSE endpoint with authentication for voice integrations.
  - Added getThreadSummary tool to MCP agent to return concise summaries of email threads.

<!-- 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 new endpoint at `/vsse` with enhanced multi-step authorization and user verification.
  * Introduced a tool to generate AI-powered summaries of email threads, providing concise overviews along with key thread details.

* **Improvements**
  * Updated thread listings to display sender information in the format: name <email>.
  * Improved thread retrieval logic for more accurate results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-01 13:07:31 -07:00
Adam
9a22f39721 Pass thread context to AI chat via system messages instead of prompt (#1883)
# 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 -->
2025-08-01 12:34:10 -07:00
Brandon McConnell
1ea4bfe69c Upgrade to Tailwind CSS v4 (#1881)
Co-authored-by: Adam <13007539+MrgSub@users.noreply.github.com>
Co-authored-by: Aj Wazzan <x_1337@outlook.com>
2025-08-01 09:58:19 -07:00
Yadong (Adam) Zhang
824b2325fc fix: update locale keys for Chinese language support (#1878) 2025-08-01 09:53:12 -07:00
Adam
bcf2d17b44 Integrate Dormroom for durable object management and queryable storage (#1873)
## Description

This PR integrates Dormroom for managing durable objects and enabling queryable storage for email agents. It improves how we handle agent instances and database operations, making our system more robust and maintainable.

## 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

## Testing Done

- [x] Manual testing performed

## Checklist

- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings

## Key Changes

1. Added Dormroom dependency for better durable object management
2. Implemented `@Migratable` and `@Queryable` decorators for ZeroDriver class
3. Created new `getZeroClient` function to replace direct agent instantiation
4. Fixed redirect header handling to prevent header persistence after redirects
5. Improved folder sync logic to skip unnecessary operations for aggregate instances
6. Standardized environment variable access through instance properties
7. Added structured database migrations for thread storage
8. Enhanced type safety with proper environment type definitions

These changes improve our agent architecture and make database operations more reliable while maintaining backward compatibility.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Introduced new methods for database size reporting and conditional folder synchronization.
  * Added structured environment typing for improved configuration management.

* **Refactor**
  * Standardized environment variable access throughout the server and agent components.
  * Migrated database schema management to a migration system.
  * Updated client acquisition logic to utilize execution context.

* **Bug Fixes**
  * Improved redirect handling in the mail provider to clean up response headers after navigation.
  * Adjusted redirect logic to only trigger under specific authorization conditions.

* **Chores**
  * Added the "dormroom" dependency to the server application.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-01 09:43:42 -07:00
devin-ai-integration[bot]
b709dfcba4 Centralize env imports from cloudflare:workers (#1792)
# Centralize env imports from cloudflare:workers

## Summary

This PR centralizes all `env` imports from `cloudflare:workers` in the `apps/server` directory by creating a single centralized file (`src/env.ts`) that exports both the runtime `env` and its type. All 19 files that previously imported `env` directly from `cloudflare:workers` have been updated to use the centralized import.

**Key Changes:**
- Created `apps/server/src/env.ts` to export `env` and `Env` type centrally
- Updated 19 files across the server codebase to import from centralized location
- Preserved type safety by exporting `Env` type for use in type definitions
- Maintained all existing functionality while improving maintainability

This change makes env-related maintenance easier and ensures consistency across the codebase. All `env` bindings are now imported from a single source of truth.

## Review & Testing Checklist for Human

- [ ] **Verify import paths are correct** - Spot check 3-4 files with different relative paths (e.g., `src/main.ts` uses `./env`, `src/lib/utils.ts` uses `../env`, `src/trpc/routes/ai/compose.ts` uses `../../../env`) to ensure no typos in path calculations
- [ ] **Test core env-dependent functionality** - Beyond server startup, verify that authentication, AI services, and email processing work correctly since these heavily depend on env bindings
- [ ] **Confirm build works properly** - Run the full build process to catch any import resolution issues that might not surface during dev server startup
- [ ] **Verify type safety** - Check that TypeScript compilation passes and that the `Env` type export works correctly in `ctx.ts` and other type definitions

**Recommended Test Plan:**
1. Start the dev server and confirm it runs without errors
2. Test a few core user flows that depend on env variables (login, AI features, email sync)
3. Run any available test suites to catch regressions
4. Build the project for production to verify no import issues

---

### Diagram

```mermaid
%%{ init : { "theme" : "default" }}%%
graph TD
    env["apps/server/src/env.ts<br/>(NEW CENTRALIZED FILE)"]:::major-edit
    
    main["apps/server/src/main.ts"]:::major-edit
    ctx["apps/server/src/ctx.ts"]:::major-edit
    services["apps/server/src/lib/services.ts"]:::minor-edit
    utils["apps/server/src/lib/utils.ts"]:::minor-edit
    auth["apps/server/src/lib/auth.ts"]:::minor-edit
    google["apps/server/src/lib/driver/google.ts"]:::minor-edit
    compose["apps/server/src/trpc/routes/ai/compose.ts"]:::minor-edit
    
    cloudflare["'cloudflare:workers'<br/>(External Module)"]:::context
    
    env --> main
    env --> ctx
    env --> services
    env --> utils
    env --> auth
    env --> google
    env --> compose
    
    cloudflare --> env
    cloudflare --> main
    
    main -.->|"Also imports WorkerEntrypoint,<br/>DurableObject, RpcTarget"| cloudflare
    
    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

- The centralized `env.ts` file exports both the runtime `env` and its TypeScript type for maximum flexibility
- Some files like `main.ts` and `routes/chat.ts` still import other items from `cloudflare:workers` (WorkerEntrypoint, DurableObject, RpcTarget) - only the `env` import was moved
- Server startup testing was successful, confirming basic functionality works
- This change improves maintainability by providing a single point of control for env imports

**Session Info:** Requested by Adam (@MrgSub)  
**Link to Devin run:** https://app.devin.ai/sessions/d31157d47fdb432c961bf8fae7248dd1
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Centralized all env imports from cloudflare:workers into a single src/env.ts file in apps/server, updating 19 files to use this shared import for better maintainability and type safety.

- **Refactors**
  - Created src/env.ts to export env and its type.
  - Updated all server files to import env from the new centralized file.

<!-- End of auto-generated description by cubic. -->
2025-08-01 09:26:07 -07:00
amrit
e1cdeb82c2 feat: add tests using playwright (#1877)
1. Get both the better auth session tokens from appliations/cookies in .env

<img width="852" height="316" alt="image" src="https://github.com/user-attachments/assets/0177c496-103c-4111-8a80-089d1f4a6f94" />

2. Enter the email you wish to send to in .env

3. `cd packages/testing`

3. run `npm test:e2e:headed`

thats it tbh

https://github.com/user-attachments/assets/b703e78c-2373-40a2-b431-f9ba53d5d871



    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Added Playwright end-to-end tests for the mail inbox flow, including authentication setup and email send/reply actions.

- **New Features**
  - Added Playwright config, test scripts, and environment variables for E2E testing.
  - Implemented tests to sign in, send an email, and reply within the same session.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
  * Introduced a comprehensive testing package with support for unit, UI, and end-to-end tests.
  * Added Playwright-based authentication setup and mail inbox end-to-end test scripts.
  * Provided a dedicated test configuration and TypeScript setup for robust test execution.

* **Chores**
  * Updated environment variable examples to support Playwright testing.
  * Enhanced main project scripts to facilitate various testing modes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-01 08:29:43 -07:00
github-actions[bot]
908fdbb7d9 feat: update translations via @LingoDotDev (#1858)
Hey team,

[**Lingo.dev**](https://lingo.dev) here with fresh translations!

### In this update

- Added missing translations
- Performed brand voice, context and glossary checks
- Enhanced translations using Lingo.dev Localization Engine

### Next Steps

- [ ] Review the changes
- [ ] Merge when ready
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Updated translations for all supported languages in the mail app, adding new keys for "animations" and improving existing text for clarity and consistency.

<!-- End of auto-generated description by cubic. -->
2025-08-01 08:27:16 -07:00
Ahmet Kilinc
7572947531 HMR fix (#1882)
fixes HMR issue.

### !!! test on staging first.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Refactor**
  * Simplified the root layout by removing dynamic loading and usage of the connection ID. The connection ID is now always set to null.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-01 16:17:49 +01:00
Adam
78987ea588 Add email composition and sending tools to MCP agent (#1874)
# 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 new tools to the MCP agent for composing and sending emails directly through the agent interface.

- **New Features**
  - Added a tool to generate email drafts based on prompts and thread context.
  - Added a tool to send emails, including support for drafts, CC, and BCC.

<!-- End of auto-generated description by cubic. -->
2025-07-30 17:47:27 -07:00
Adam
803a6caedb Implement workflow chain execution to share results between workflows (#1872)
# 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 workflow chain execution so results can be shared between workflows, enabling workflows to pass data to each other during execution.

- **New Features**
  - Introduced `executeWorkflowChain` to run multiple workflows in sequence and share results.
  - Updated workflow runner to use the new chain execution method.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Improved accuracy in counting successfully synced threads during workflow execution.
  * Workflows now proceed regardless of certain environment variable settings.

* **New Features**
  * Added support for executing multiple workflows in sequence with consolidated result and error reporting.

* **Refactor**
  * Simplified and streamlined workflow execution logic for better maintainability.

* **Style**
  * Enhanced code formatting for improved readability.

* **Documentation**
  * Updated method signatures to clarify optional parameters.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-30 15:29:31 -07:00
amrit
9707613cf4 feat: add email template management functionality (#1573) 2025-07-31 01:10:16 +05:30
devin-ai-integration[bot]
f664c537b2 feat: sync threadId to ZeroAgent via WebSocket for multi-tab support (#1870)
# 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. -->
2025-07-30 10:18:18 -07:00
Adam
15bbf89c3b Add Effect-free workflow implementation for direct Cloudflare Workers execution (#1869)
## Description

Added support for draft detection in email threads to improve the auto-draft generation workflow. This PR adds an `isLatestDraft` flag to thread responses, allowing the system to check if a draft already exists in a thread without making additional API calls. The workflow engine has been optimized to skip draft generation for threads that already have drafts, automated emails, or messages older than 7 days.

Additionally, implemented non-Effect.ts versions of the workflow functions to provide an alternative implementation path that doesn't rely on the Effect library, which will help with testing and debugging.

## Type of Change

- [x]  New feature (non-breaking change which adds functionality)
- [x]  Performance improvement

## Areas Affected

- [x] Email Integration (Gmail, IMAP, etc.)
- [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] I have commented my code, particularly in complex areas

## Additional Notes

The draft detection improvements reduce unnecessary API calls to check for existing drafts, which should improve performance and reduce the likelihood of hitting API rate limits. The workflow engine now also properly skips automated emails and old threads, focusing resources on generating drafts only for relevant conversations.

---

_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
2025-07-29 16:38:17 -07:00
Adam
762895a76f Pass results to workflow step condition function (#1867)
# 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 the workflow engine to pass the results object to each step's condition function, allowing conditions to use previous step results.

<!-- End of auto-generated description by cubic. -->
2025-07-29 14:13:25 -07:00
Adam
67a4cbfd1b Add local environment support to bulkDeleteKeys function (#1866)
# 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 support for running bulkDeleteKeys in local environments by deleting keys from the local store.

<!-- End of auto-generated description by cubic. -->
2025-07-29 14:04:50 -07:00
Adam
091bb5df39 Replace Sentry with Cloudflare WorkerEntrypoint class (#1865)
# 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
Replaced Sentry integration with a Cloudflare WorkerEntrypoint class to handle fetch, queue, and scheduled events directly.

- **Refactors**
  - Removed withSentry wrapper and migrated all event handling logic into a WorkerEntrypoint class.

<!-- End of auto-generated description by cubic. -->
2025-07-29 14:02:19 -07:00
Adam
8807459996 Integrate Sentry error monitoring for Cloudflare worker environment (#1863)
# 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 Sentry error monitoring to the Cloudflare worker environment to capture and report runtime errors.

- **Dependencies**
  - Installed the @sentry/cloudflare package and updated configuration for Sentry integration.

<!-- End of auto-generated description by cubic. -->
2025-07-29 13:28:18 -07:00
Adam
def4234d55 Add bulk delete utility for Cloudflare KV keys in workflow processing (#1861)
# 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 utility for bulk deleting Cloudflare KV keys and updated workflow processing to use it for more efficient cleanup.

- **Dependencies**
  - Added the Cloudflare SDK as a new dependency.

<!-- End of auto-generated description by cubic. -->
2025-07-29 11:50:08 -07:00
Adam
e6165e8304 Update thread labels workflow to use Llama 4 Scout model (#1860)
# 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 the thread labels workflow to use the Llama 4 Scout model for improved label generation accuracy.

<!-- End of auto-generated description by cubic. -->
2025-07-29 11:09:23 -07:00
Adam
4639fd9b8d Switch to Llama 4 Scout model and add delay in workflow execution (#1859)
# 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
Switched the summarization model to Llama 4 Scout and added a 1-second delay before workflow execution to improve reliability.

- **Dependencies**
 - Updated model from Llama 3 to Llama 4 Scout for thread summarization.

- **Performance**
 - Added a 1-second delay before marking workflows as executed.

<!-- End of auto-generated description by cubic. -->
2025-07-29 11:08:20 -07:00
amrit
6a976215da feat: add a transition when user switches emails (#1854)
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 -->
2025-07-29 10:46:16 -07:00
Ahmet Kilinc
e9d32f45ed fix: add draft generation check (#1855)
# Prevent duplicate draft generation by checking existing drafts

## Description

This PR enhances the `shouldGenerateDraft` function to prevent generating duplicate drafts for the same email thread. The function now:

1. Checks if a draft already exists for the thread by calling the Gmail API
2. Skips draft generation if a draft is already present for that thread
3. Logs the decision for better debugging

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Improved draft generation logic to prevent creating duplicate drafts for the same thread.
  * Enhanced workflow reliability by ensuring eligibility checks are properly awaited.

* **Chores**
  * Added detailed logging for draft generation, including thread message counts and sender information.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 10:43:27 -07:00
Adam
4c86d591ff Fix WorkflowRunner to use this.env instead of global env (#1857)
# Fix WorkflowRunner to use instance environment variables

## Description

This PR fixes an issue in the `WorkflowRunner` class where global `env` was being used instead of the instance's `this.env`. All references to the global `env` variable have been replaced with `this.env` to ensure proper access to environment variables within the Durable Object context.

## Type of Change

- [x] 🐛 Bug fix (non-breaking change which fixes an issue)

## Areas Affected

- [x] Email Integration (Gmail, IMAP, etc.)

## 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] All tests pass locally

## Additional Notes

This change ensures that the WorkflowRunner correctly accesses environment variables through the instance's context rather than relying on the global environment, which could lead to undefined behavior in a Cloudflare Workers environment.

---

_By submitting this pull request, I confirm that my contribution is made under the terms of the project's license._
2025-07-29 10:34:46 -07:00
Adam
d043eaa84a Refactor workflow processing to use durable objects for better concurrency (#1853)
# Refactored workflow processing with Durable Objects

## Description

Refactored the workflow processing system to use Durable Objects for better concurrency and reliability. Created a new `WorkflowRunner` Durable Object that encapsulates the workflow execution logic, replacing the previous function-based approach. This change improves thread processing by providing better isolation and state management.

The implementation includes:
- A new `WorkflowRunner` Durable Object that handles main, zero, and thread workflows
- Updated thread queue processing to use the Durable Object
- Enhanced workflow engine with execution tracking to prevent duplicate processing
- Added cleanup steps to properly manage workflow execution state

## 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] Deployment/Infrastructure

## 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

This change should significantly improve the reliability of thread processing by preventing race conditions and providing better isolation between workflow executions. The Durable Object approach also allows for better scaling as each workflow execution gets its own isolated environment.

---

_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 workflow execution engine with the `WorkflowRunner` class for improved workflow management and error handling.
  * Added workflow execution tracking to prevent duplicate processing of threads, with automatic cleanup for re-execution.
  * Added new workflow functions to check and clean up workflow execution state.

* **Improvements**
  * Enhanced workflow step execution logic with conditional and batched processing for better reliability and efficiency.
  * Updated configuration to support the new workflow runner across all environments.

* **Chores**
  * Refactored and reorganized workflow-related code for better maintainability and structure.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 10:30:43 -07:00
Adam
e455bf000a Refactor thread workflow to use modular workflow engine (#1852)
# Refactored Thread Processing with Workflow Engine Architecture

## Description

Implemented a modular workflow engine architecture for thread processing, replacing the monolithic approach with a flexible, configurable system. This refactoring moves hardcoded business logic into reusable workflow steps that can be composed and executed dynamically, improving maintainability and extensibility.

## Type of Change

-  New feature (non-breaking change which adds functionality)
- 🎨 UI/UX improvement
-  Performance improvement

## Areas Affected

- [x] Email Integration (Gmail, IMAP, etc.)
- [x] Data Storage/Management
- [x] Development Workflow

## Testing Done

- [x] Manual testing performed

## Checklist

- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in complex areas
- [x] I have updated the documentation
- [x] My changes generate no new warnings

## Additional Notes

The new workflow engine provides several key benefits:
- Type-safe workflow configuration with TypeScript
- Modular functions that can be tested independently
- Configurable error handling per workflow step
- Reusable components shared between workflows
- Cleaner separation of concerns in the main pipeline

The implementation includes comprehensive documentation in the README.md file explaining the architecture and how to extend it with new workflows.
2025-07-28 14:12:54 -07:00
Adam
180133fe27 Enable workflows in server configuration (#1849)
# 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 workflows in the server configuration by setting DISABLE_WORKFLOWS to false.

<!-- End of auto-generated description by cubic. -->
2025-07-27 22:09:06 -07:00
Adam
b753afa5b6 Remove brain state dependency and fix Gmail subscription key format (#1848)
# 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._
2025-07-27 21:57:52 -07:00
Adam
2e46251116 Add expired subscription handling for non-Google providers (#1847)
# 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 support for detecting expired subscriptions for all non-Google providers.

- **New Features**
  - Expired subscriptions are now tracked for providers other than Google.

<!-- End of auto-generated description by cubic. -->
2025-07-27 21:03:45 -07:00
Adam
a11d219783 Update subscription expiration check to use database instead of KV store (#1846)
# Switch from KV to Hyperdrive for subscription management

## Description

This PR updates the scheduled task that checks for expired subscriptions to use Hyperdrive database instead of KV storage. The changes include:

1. Replacing `env.subscribed_accounts.list()` with a direct database query to find connections with access and refresh tokens
2. Simplifying the connection ID handling by using the database ID directly instead of parsing from key names
3. Adding proper database connection cleanup with `conn.end()` in multiple places to prevent connection leaks
4. Removing redundant logging in the thread workflow when closing database connections

## Type of Change

- [x]  Performance improvement
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)

## Areas Affected

- [x] Data Storage/Management
- [x] Email Integration (Gmail, IMAP, etc.)

## 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 added tests that prove my fix/feature works

## Additional Notes

This change helps prevent potential connection leaks and improves the reliability of subscription management by using the database as the source of truth rather than KV storage.
2025-07-27 18:33:57 -07:00
Adam
7cd7d856dc Optimize thread synchronization with rate limiting and concurrency control (#1845)
# 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 synchronization by adding rate limiting and stricter concurrency control to prevent API overload and duplicate syncs.

- **Performance**
  - Added delays between thread and page syncs to respect rate limits.
  - Limited concurrent thread syncs to one at a time.

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Refactor**
  * Improved the thread synchronization process for enhanced reliability and efficiency.
  * Introduced stricter sequential processing and increased rate limiting to prevent overload.
  * Simplified error handling and logging for clearer feedback during synchronization.

No user-facing features or visible changes have been introduced.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-27 17:01:15 -07:00
Adam
7cd0e407e0 Add auth validation and logging for API endpoints (#1844)
# 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 authentication checks and logging to API endpoints to block unauthorized requests and help debug failed logins.

- **Bug Fixes**
  - Log when missing or invalid auth headers are detected.
  - Return 401 responses for unauthorized access.

<!-- End of auto-generated description by cubic. -->
2025-07-27 14:14:28 -07:00