Skip to content

Comments

AI Updates#818

Merged
MrgSub merged 3 commits intostagingfrom
dakdevs/staging/ai-fix
May 1, 2025
Merged

AI Updates#818
MrgSub merged 3 commits intostagingfrom
dakdevs/staging/ai-fix

Conversation

@dakdevs
Copy link
Contributor

@dakdevs dakdevs commented May 1, 2025

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

Summary by CodeRabbit

  • New Features

    • Introduced Microsoft mail provider support, enabling integration with Microsoft accounts.
    • Added advanced email composition with AI assistance, draft management, and recipient handling.
    • Implemented a voice chat component for conversational AI email assistance.
    • Added label management enhancements, including label creation from sidebar and improved filtering.
    • Integrated AI-powered email search and chat features.
    • Added keyboard shortcut management and user-specific shortcut update functionality.
  • Enhancements

    • Improved mail list, thread, and mail display UI with richer metadata, attachment handling, and interactivity.
    • Refined navigation, homepage, and settings layout with responsive design and dynamic theming.
    • Enhanced sidebar, dialog, and badge components with new styling and overlay options.
    • Updated editor components to support read-only mode and toolbar toggling.
    • Added new animated and static icon components for improved visual feedback.
  • Bug Fixes

    • Fixed issues with label handling, bulk actions, and starred state management.
    • Improved error handling and feedback for various actions (e.g., email sending, note deletion).
  • Refactor

    • Simplified and modularized email composing, reply, and draft components.
    • Streamlined AI assistant and chat logic for maintainability and usability.
    • Reorganized and optimized type definitions for better clarity and extensibility.
  • Chores

    • Updated environment variable examples and configuration files.
    • Adjusted workflow and CI/CD settings for improved concurrency and caching.
    • Updated .gitignore and .npmrc for better development experience.
  • Removals

    • Removed deprecated AI assistant, draft, and shortcut management components and API routes.
    • Deleted unused or legacy files to reduce codebase clutter.

dakdevs added 3 commits May 1, 2025 12:06
Enhanced the AI email composer to include thread message metadata (e.g., CC and subject), sanitize HTML content, and better integrate writing style fallbacks if unavailable. Updated dependencies, including `string-strip-html`, to support these changes.
@vercel
Copy link

vercel bot commented May 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
0 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 1, 2025 7:13pm

@dakdevs dakdevs changed the base branch from main to staging May 1, 2025 19:13
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces significant refactoring and feature enhancements across the mail application. Major changes include the addition of a Microsoft mail driver, a comprehensive AI-assisted email composition system, and a new, modular email composer component with draft management and AI integration. The home page and navigation are reworked for a fully client-side experience, and the UI for mail, threads, and labels is modernized with improved interactivity, theming, and bulk actions. Several obsolete files and components are removed, and new utility functions, hooks, and context providers are introduced to support the updated architecture. Workflow and configuration files are also updated for improved environment management and CI/CD reliability.

Changes

Files / Groups Change Summary
.env.example, .github/workflows/ci.yml, .github/workflows/main.yml, .gitignore, .npmrc Added new env vars, improved workflow concurrency, updated runner/image, enhanced npm config.
apps/mail/actions/ai-composer.ts, apps/mail/actions/ai-composer-prompt.ts Added new AI email composition function and comprehensive system prompt.
apps/mail/actions/ai-reply.ts, apps/mail/actions/ai-search.ts, apps/mail/actions/ai.ts, apps/mail/actions/extractText.ts Deleted legacy AI email and search action files.
apps/mail/actions/brain.ts Added DisableBrain function for unsubscribing.
apps/mail/actions/getSummary.ts Refactored summary fetching to use utility functions and HTTP requests; added GetState.
apps/mail/actions/mail.ts Added/updated bulk mail actions, removed id validation, refined starred logic.
apps/mail/actions/send.ts Updated typing, improved error messages, added post-send writing style update.
apps/mail/actions/shortcuts.ts Added updateShortcuts server action for keyboard shortcut management.
apps/mail/actions/utils.ts Added base64url decoding and HTML part finding utilities.
apps/mail/app/(auth)/login/login-client.tsx Improved fallback for search params, UI tweaks, added "Return home" link.
apps/mail/app/(full-width)/about/page.tsx Added new About page with company info, founders, and contact.
apps/mail/app/(full-width)/privacy/page.tsx Updated contact email for privacy/data deletion.
apps/mail/app/(routes)/layout.tsx Changed container classes for layout adjustments.
apps/mail/app/(routes)/mail/create/page.tsx Refactored to redirect with compose params, updated metadata logic.
apps/mail/app/(routes)/mail/layout.tsx Themed background, removed padding, dropped hotkeys import.
apps/mail/app/(routes)/settings/appearance/page.tsx Replaced theme toggle with dropdown, async saving, improved feedback.
apps/mail/app/(routes)/settings/danger-zone/page.tsx Refactored delete account dialog to use toast.promise, updated translation keys.
apps/mail/app/(routes)/settings/labels/colors.ts Reduced color palette to 7 basic colors.
apps/mail/app/(routes)/settings/labels/page.tsx Refactored label CRUD to use toasts, redesigned color picker and label grid.
apps/mail/app/(routes)/settings/shortcuts/page.tsx Switched to hook-based shortcut cache, disabled editing, grouped display.
apps/mail/app/api/ai-search/route.ts Added new AI-powered email search API route.
apps/mail/app/api/auth/settings/route.ts Added early return for unauthenticated users, serving default settings.
apps/mail/app/api/chat/prompt.ts, apps/mail/app/api/chat/route.ts Added intelligent email management assistant prompt and chat API route with tool integration.
apps/mail/app/api/driver/drafts/[id]/route.ts Added GET API for fetching a draft by ID with rate limiting.
apps/mail/app/api/driver/google.ts Improved Gmail driver: HTML sanitization, label normalization, draft parsing, added getIdType.
apps/mail/app/api/driver/index.ts Added Microsoft driver support to driver factory.
apps/mail/app/api/driver/microsoft.ts New Microsoft Graph API mail driver implementing MailManager.
apps/mail/app/api/driver/route.ts Special handling for drafts folder in mail listing.
apps/mail/app/api/driver/types.ts Extended types: added labels to thread, ParsedDraft, updated signatures.
apps/mail/app/api/golden-ticket/route.ts Disabled early access enforcement.
apps/mail/app/api/og/home/route.tsx Removed early access user count from image output.
apps/mail/app/api/utils.ts Added delay and withExponentialBackoff utility functions.
apps/mail/app/api/v1/hotkeys/route.ts, apps/mail/app/api/v1/thread-labels/route.ts Deleted hotkey and thread-labels API routes.
apps/mail/app/api/v1/labels/route.ts Refined error codes, imported Label type, enforced driver presence.
apps/mail/app/api/v1/shortcuts/route.ts Added GET API for fetching user shortcuts with rate limiting.
apps/mail/app/globals.css Tweaked dark background variable, adjusted gradients, set tiptap paragraph margin.
apps/mail/app/layout.tsx Added web streams polyfill, replaced Toast with CustomToaster, removed CookieProvider.
apps/mail/app/page.tsx Disabled session-based redirect, always renders homepage.
apps/mail/app/toast-test/page.tsx Added test page for toast notifications.
apps/mail/components/connection/add.tsx Updated dialog styling and overlay.
apps/mail/components/context/command-palette-context.tsx Swapped compose icon, refined icon styling.
apps/mail/components/context/thread-context.tsx Added label toggling, improved action handlers, enhanced reply state.
apps/mail/components/create/ai-chat.tsx Refactored to use useChat hook, simplified UI, removed voice/file features.
apps/mail/components/create/ai-textarea.tsx Changed from textarea to input, updated props and styles.
apps/mail/components/create/create-email.tsx Refactored to delegate to new EmailComposer, removed internal state/UI.
apps/mail/components/create/editor.tsx Added read-only mode and hideToolbar option, removed toolbar, improved event handling.
apps/mail/components/create/email-composer.tsx New, full-featured email composer with AI, attachments, validation, and draft management.
apps/mail/components/create/voice.tsx New voice chat component using ElevenLabs, with thread context and permission handling.
apps/mail/components/draft/drafts-list.tsx, apps/mail/components/draft/drafts.tsx Deleted drafts list and layout components.
apps/mail/components/golden.tsx Enhanced invite modal: prevents double submit, adds keyboard shortcut, UI updates.
apps/mail/components/home/HomeContent.tsx Rewritten as client component, new homepage with tabs, navigation, and effects.
apps/mail/components/home/footer.tsx Added clickable contact email to footer.
apps/mail/components/home/home.tsx New Home component with header, hero, tabs, and glowing effect.
apps/mail/components/icons/animated/alert.tsx New animated badge alert icon with imperative animation control.
apps/mail/components/icons/animated/archive.tsx, apps/mail/components/icons/animated/trash.tsx Removed positioning classes from SVGs.
apps/mail/components/icons/icons.tsx Added many new SVG icon components.
apps/mail/components/mail/demo.json Changed "tags" from string arrays to objects with id/name.
apps/mail/components/mail/empty-state.tsx Added overlay and border to dialog content.
apps/mail/components/mail/mail-display.tsx Refactored and enhanced: new label/attachment display, AI summary, popovers, utility functions.
apps/mail/components/mail/mail-iframe.tsx Improved trusted sender/image handling, async HTML generation, removed DynamicIframe.
apps/mail/components/mail/mail-list.tsx Refactored: added draft rendering, starred state, improved selection, label display, empty state.
apps/mail/components/mail/mail-quick-actions.tsx Now clears activeReplyId query state when closing thread.
apps/mail/components/mail/mail.tsx Removed demo layout, refactored mail UI, bulk actions, category selection, AI labeling state.
apps/mail/components/mail/nav-main.tsx New NavMain component skeleton.
apps/mail/components/mail/note-panel.tsx Refined styling, simplified note deletion (removed dialog), improved toast feedback.
apps/mail/components/mail/render-labels.tsx Refactored to interactive label filter UI with tooltips and toggle logic.
apps/mail/components/mail/reply-composer.tsx Refactored to delegate to EmailComposer, removed local state/UI.
apps/mail/components/mail/search-bar.tsx Integrated pathname reset, restyled input, removed advanced filter UI.
apps/mail/components/mail/thread-display.tsx Refactored: internalized state, added navigation, starring, new header, AI sidebar toggle.
apps/mail/components/mail/use-mail.ts Exported Config type, minor import and formatting tweaks.
apps/mail/components/motion-primitives/text-effect.tsx New animated text effect component with presets and granular control.
apps/mail/components/providers/editor-provider.tsx New context/provider/hook for TipTap editor instance.
apps/mail/components/providers/hotkey-provider-wrapper.tsx Enabled mail list hotkeys.
apps/mail/components/settings/settings-card.tsx Added 'use client' directive, updated background classes.
apps/mail/components/ui/ai-sidebar.tsx Refactored: state persistence, resizable panels, dialog for system prompts, improved layout.
apps/mail/components/ui/app-sidebar.tsx Replaced link-based compose with dialog, updated layout, added invite modal.
apps/mail/components/ui/badge.tsx Simplified badge variants, removed most background/hover colors.
apps/mail/components/ui/checkbox.tsx New Checkbox component using Radix primitives and Lucide icon.
apps/mail/components/ui/command.tsx Updated dialog content styling, reduced search icon size.
apps/mail/components/ui/dialog.tsx Overlay now conditionally styled, added z-index, refactored content classes.
apps/mail/components/ui/nav-main.tsx Added label creation dialog/form, improved label filtering UI, adjusted navigation logic.
apps/mail/components/ui/nav-user.tsx Refactored user nav: removed sidebar menu, added dropdowns, debug menu, brain activity toggle.
apps/mail/components/ui/navigation-menu.tsx New customizable navigation menu using Radix primitives and custom styles.
apps/mail/components/ui/scroll-area.tsx Added hideScrollbar prop to ScrollArea/ScrollBar, updated types.
apps/mail/components/ui/settings-content.tsx Refined layout, padding, background, and sticky header styling.

Sequence Diagram(s)

AI Email Composition Flow

sequenceDiagram
    participant User
    participant EmailComposer
    participant aiCompose (server)
    participant AI Model (Gemini)
    participant Session/Auth
    participant DB/StyleProfile

    User->>EmailComposer: Click "Generate with AI"
    EmailComposer->>aiCompose: Call with prompt, subject, recipients, thread
    aiCompose->>Session/Auth: Validate user session
    aiCompose->>DB/StyleProfile: Fetch writing style matrix
    aiCompose->>AI Model (Gemini): Send system/user prompt, thread context, style
    AI Model (Gemini)-->>aiCompose: Return generated email body
    aiCompose-->>EmailComposer: Return AI-composed email
    EmailComposer-->>User: Show AI-generated email preview
Loading

Microsoft Mail Driver Integration

sequenceDiagram
    participant App
    participant createDriver
    participant microsoftDriver
    participant Microsoft Graph API

    App->>createDriver: Request driver for 'microsoft'
    createDriver->>microsoftDriver: Initialize with config
    microsoftDriver->>Microsoft Graph API: Authenticate and perform mail actions
    Microsoft Graph API-->>microsoftDriver: Return mail data
    microsoftDriver-->>App: Provide mail operations (fetch, send, draft, etc.)
Loading

Possibly related PRs

  • Mail-0/Zero#597: Modifies the same ThreadDisplay component, adding thread action buttons and state functions, directly overlapping with this PR’s thread UI and state refactor.
  • Mail-0/Zero#813: Shares identical changes to env, workflow, and AI composer files, indicating a strong code-level connection.
  • Mail-0/Zero#768: Both PRs modify mail actions and sending logic, including new bulk operations and draft support, showing direct functional overlap.

Suggested reviewers

  • needleXO
  • MrgSub

Poem

In fields of code, a rabbit hops,
Through drafts and threads, it never stops.
With AI brains and drivers new,
Compose and chat—so much to do!
Labels bloom in colors bright,
While emails soar from day to night.
Refactored paths, a garden grown—
Zero’s mail is finely sown!

((\
( -.-)
o_(")(")

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MrgSub MrgSub merged commit b1a1920 into staging May 1, 2025
2 of 4 checks passed
@MrgSub MrgSub deleted the dakdevs/staging/ai-fix branch May 1, 2025 19:15
@coderabbitai coderabbitai bot mentioned this pull request Jun 19, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants