forked from elie222/inbox-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add Outlook Calendar integration for meeting availability #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,388
−441
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…dling
Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars
and standardize error handling between Google and Microsoft providers.
- Add showPreview prop to ConfirmationStep component type - Update clean-preview.ts to use correct Account token structure - Fix token access: use account.access_token instead of tokens.access_token - Convert Date to timestamp (getTime()) for client functions - Use queryBatchMessages for Gmail to get full message details - Fix message property access: use message.headers instead of message.parsedMessage.headers - Remove unsupported 'after' parameter from Outlook getMessages call All TypeScript errors resolved, build now passes successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
fe34f2b to
5bb5391
Compare
salja03-t21
added a commit
that referenced
this pull request
Nov 6, 2025
* Use outlook endpoint
* PR feedback
* PR feedback
* add microsoft calendar set up notes
* fix(calendar): fix OAuth callback redirects and standardize error handling
Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars
and standardize error handling between Google and Microsoft providers.
* unify google and microsoft calendar connection
* get availabilty for ai drafting from microsoft calendars
* fix: Resolve TypeScript errors after Outlook Calendar merge
- Add showPreview prop to ConfirmationStep component type
- Update clean-preview.ts to use correct Account token structure
- Fix token access: use account.access_token instead of tokens.access_token
- Convert Date to timestamp (getTime()) for client functions
- Use queryBatchMessages for Gmail to get full message details
- Fix message property access: use message.headers instead of message.parsedMessage.headers
- Remove unsupported 'after' parameter from Outlook getMessages call
All TypeScript errors resolved, build now passes successfully.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Eduardo Lelis <[email protected]>
Co-authored-by: Eliezer Steinbock <[email protected]>
Co-authored-by: Claude <[email protected]>
salja03-t21
added a commit
that referenced
this pull request
Nov 6, 2025
* Use outlook endpoint
* PR feedback
* PR feedback
* add microsoft calendar set up notes
* fix(calendar): fix OAuth callback redirects and standardize error handling
Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars
and standardize error handling between Google and Microsoft providers.
* unify google and microsoft calendar connection
* get availabilty for ai drafting from microsoft calendars
* fix: Resolve TypeScript errors after Outlook Calendar merge
- Add showPreview prop to ConfirmationStep component type
- Update clean-preview.ts to use correct Account token structure
- Fix token access: use account.access_token instead of tokens.access_token
- Convert Date to timestamp (getTime()) for client functions
- Use queryBatchMessages for Gmail to get full message details
- Fix message property access: use message.headers instead of message.parsedMessage.headers
- Remove unsupported 'after' parameter from Outlook getMessages call
All TypeScript errors resolved, build now passes successfully.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Eduardo Lelis <[email protected]>
Co-authored-by: Eliezer Steinbock <[email protected]>
Co-authored-by: Claude <[email protected]>
salja03-t21
added a commit
that referenced
this pull request
Nov 6, 2025
* Use outlook endpoint
* PR feedback
* PR feedback
* add microsoft calendar set up notes
* fix(calendar): fix OAuth callback redirects and standardize error handling
Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars
and standardize error handling between Google and Microsoft providers.
* unify google and microsoft calendar connection
* get availabilty for ai drafting from microsoft calendars
* fix: Resolve TypeScript errors after Outlook Calendar merge
- Add showPreview prop to ConfirmationStep component type
- Update clean-preview.ts to use correct Account token structure
- Fix token access: use account.access_token instead of tokens.access_token
- Convert Date to timestamp (getTime()) for client functions
- Use queryBatchMessages for Gmail to get full message details
- Fix message property access: use message.headers instead of message.parsedMessage.headers
- Remove unsupported 'after' parameter from Outlook getMessages call
All TypeScript errors resolved, build now passes successfully.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Eduardo Lelis <[email protected]>
Co-authored-by: Eliezer Steinbock <[email protected]>
Co-authored-by: Claude <[email protected]>
salja03-t21
added a commit
that referenced
this pull request
Nov 6, 2025
* feat: Add Outlook support to deep-clean feature Implement complete Outlook integration for the deep-clean feature: Backend Changes: - Created /api/clean/outlook/route.ts with Graph API integration - Implemented archive operation (moves to Archive folder) - Implemented mark as read operation - Added provider detection and routing in /api/clean/route.ts - Provider-agnostic static rules (starred/flagged, sent, etc.) - QStash integration with signature verification UI Improvements: - Removed premium banner from intro step - Updated 'Starred emails' to 'Starred/Flagged emails' - Provider-aware confirmation text (Gmail vs Outlook) - Dynamic messaging for archive and mark-as-read operations Development Changes: - Commented out premium checks for testing - QStash credentials configured - All required environment variables set Files Created: - apps/web/app/api/clean/outlook/route.ts Files Modified: - apps/web/app/api/clean/route.ts - apps/web/app/(app)/[emailAccountId]/clean/IntroStep.tsx - apps/web/app/(app)/[emailAccountId]/clean/CleanInstructionsStep.tsx - apps/web/app/(app)/[emailAccountId]/clean/ConfirmationStep.tsx - apps/web/.env Note: Premium checks are disabled for development/testing only. Re-enable before production deployment. * feat(clean): Add backward navigation to deep-clean wizard - Added onPrevious() function to useStep hook - Added Back buttons to all wizard steps: * ActionSelectionStep * CleanInstructionsStep * TimeRangeStep * ConfirmationStep - Users can now navigate back through the wizard steps - Improves UX by allowing users to correct mistakes without restarting * fix: Disable PremiumAlertWithData component for testing Temporarily disable premium banner by making PremiumAlertWithData return null. Original code preserved in comment block for re-enabling before production. This resolves the persistent premium banner issue in the deep-clean wizard. * fix: Disable premium check in cleanInbox action for testing Temporarily comment out premium validation (lines 41-43) to allow testing the deep-clean wizard without premium subscription. Original code preserved in comments for re-enabling before production. * Fix: Correct provider property path to use emailAccount.account.provider - Both lines 87 and 153 now correctly access provider from account object - Pattern matches usage throughout codebase (safe-action.ts, etc) - Type definition includes provider in account select * fix: Make clean preview work with Outlook and improve UX - Refactored undoCleanInboxAction and changeKeepToDoneAction to use provider-agnostic EmailProvider pattern instead of Gmail-only functions - Fixed Undo button to work with both Gmail and Outlook accounts - Hidden 'Process Only These 50 Emails' button on preview page as requested - Integrated useEmailStream hook to properly display emails in real-time via SSE - Fixed React hydration errors in Radix UI components (DropdownMenu, Tooltip) by adding suppressHydrationWarning - Fixed TypeScript error in LoadingContent by changing error prop from string | null to string | undefined * feat: Add Outlook Calendar integration for meeting availability (#4) * Use outlook endpoint * PR feedback * PR feedback * add microsoft calendar set up notes * fix(calendar): fix OAuth callback redirects and standardize error handling Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars and standardize error handling between Google and Microsoft providers. * unify google and microsoft calendar connection * get availabilty for ai drafting from microsoft calendars * fix: Resolve TypeScript errors after Outlook Calendar merge - Add showPreview prop to ConfirmationStep component type - Update clean-preview.ts to use correct Account token structure - Fix token access: use account.access_token instead of tokens.access_token - Convert Date to timestamp (getTime()) for client functions - Use queryBatchMessages for Gmail to get full message details - Fix message property access: use message.headers instead of message.parsedMessage.headers - Remove unsupported 'after' parameter from Outlook getMessages call All TypeScript errors resolved, build now passes successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Eduardo Lelis <[email protected]> Co-authored-by: Eliezer Steinbock <[email protected]> Co-authored-by: Claude <[email protected]> * feat: Add email-triggered meeting scheduler with automatic webhook setup (#3) * Use outlook endpoint * PR feedback * PR feedback * add microsoft calendar set up notes * fix(calendar): fix OAuth callback redirects and standardize error handling Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars and standardize error handling between Google and Microsoft providers. * unify google and microsoft calendar connection * get availabilty for ai drafting from microsoft calendars * fix: Address CoderabbitAI review findings - Add loading state to ConfirmationStep to prevent duplicate submissions - Clamp onPrevious in useStep to prevent underflow below step 0 - Extract duplicate payload construction in PreviewStep into buildCleanPayload helper - Fix LoadingContent error prop type in PreviewStep * chore: Update cursor rules and refine Outlook clean functionality - Updated all cursor rules documentation for consistency - Enhanced Outlook email streaming and preview functionality - Added clean-preview utility for better code organization - Improved error handling in Microsoft email utilities - Refined clean preview batch UI components 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Resolve TypeScript errors after Outlook Calendar merge - Add showPreview prop to ConfirmationStep component type - Update clean-preview.ts to use correct Account token structure - Fix token access: use account.access_token instead of tokens.access_token - Convert Date to timestamp (getTime()) for client functions - Use queryBatchMessages for Gmail to get full message details - Fix message property access: use message.headers instead of message.parsedMessage.headers - Remove unsupported 'after' parameter from Outlook getMessages call All TypeScript errors resolved, build now passes successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * docs: Create implementation plan for email-triggered meeting scheduler - Support email triggers: 'Schedule:' in subject or '/schedule meeting' in body - AI-powered meeting detail extraction - Calendar availability checking - Teams/Zoom/Google Meet link generation - Native calendar event creation (not .ics files) - Automatic invite sending via Google Calendar/Outlook Calendar APIs - Comprehensive 6-phase implementation plan * feat: Add email trigger detection for meeting scheduler - Created detectMeetingTrigger utility to detect meeting scheduling triggers - Supports "Schedule:" in subject line (case-insensitive) - Supports "/schedule meeting" command in email body (case-insensitive) - Works for both sent emails and emails to yourself - Integrated detection into webhook processing (Gmail and Outlook) - Added comprehensive test coverage with 19 passing tests - Lazy-loads logger to avoid env validation issues in tests Trigger patterns: 1. Subject: "Schedule:" (e.g., "Schedule: Team meeting next week") 2. Body: "/schedule meeting" (e.g., "Hi team, /schedule meeting to discuss Q4") Both patterns work for: - Sent emails (outbound messages) - Emails to yourself (inbound from your own address) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add AI meeting parser for extracting meeting details Phase 2 of meeting scheduler implementation - Created aiParseMeetingRequest to extract structured meeting data - Parses attendees from To/CC fields and email body - Extracts date/time preferences in natural language - Detects meeting duration (default 60 min) - Generates professional meeting title from content - Extracts agenda/purpose from email body - Detects preferred provider (Teams/Zoom/Google Meet) - Identifies in-person meeting locations - Captures special requests and notes - Detects urgency flags (ASAP, urgent, today) - Integrated parser into webhook processing - Added comprehensive test suite (11 test cases) Features: - Zod schema validation for structured output - Uses createGenerateObject for AI integration - Follows codebase LLM patterns - Scoped logging for debugging - Handles self-reminder emails (emails to yourself) Test coverage: ✓ Simple meeting requests ✓ Teams/Zoom/Google Meet detection ✓ Urgency detection ✓ In-person location extraction ✓ Multiple attendees from CC ✓ Detailed agenda extraction ✓ Requests with no specific times ✓ Special preparation notes ✓ Self-reminder emails 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting availability checker Phase 3 of meeting scheduler implementation - Created findMeetingAvailability to find available time slots - Leverages existing unified calendar integration (Google + Microsoft) - Parses natural language time preferences (e.g., "next Tuesday at 2pm") - Checks requested times against busy periods from all calendars - Suggests alternative times if requested slots are busy - Integrated into webhook processing pipeline Features: - Natural language parsing for common date/time expressions - Supports: "tomorrow at 2pm", "next Tuesday", "Jan 15 at 10am" - Day-of-week detection (Monday-Sunday) - Intelligent time slot conflict detection - Working hours suggestions (9 AM - 5 PM) - Timezone-aware date handling using TZDate - User timezone detection from calendar connections - Fallback suggestions when no specific times requested Algorithm: 1. Parse user's timezone from connected calendars 2. Parse natural language date/time preferences 3. Fetch busy periods across all Google + Microsoft calendars 4. Check if requested times are available (no conflicts) 5. If conflicts found, suggest alternative times 6. Return structured availability data with timezone Time slot conflict detection: - Checks for overlaps: slot starts before busy ends AND slot ends after busy starts - Returns only available slots (no conflicts) Suggestions algorithm: - Checks next 7 days by default - Prioritizes times near user's preferred hour - Working hours: 9 AM - 5 PM - Returns up to 5 suggestions - Filters duplicate slots 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Implement meeting link generation (Phase 4) Add meeting link generators for Microsoft Teams and Google Meet with provider validation. **New Files:** - `create-meeting-link.ts`: Main orchestration for creating meeting links with provider validation - `providers/types.ts`: Provider validation logic ensuring Teams=Microsoft only, Google Meet=Google only - `providers/teams.ts`: Microsoft Teams meeting creation via Graph API /me/onlineMeetings - `providers/google-meet.ts`: Google Meet conferenceData generation for calendar events **Updates:** - `parse-meeting-request.ts`: Fixed EmailForLLM type usage (removed .headers accessor) - `process-history-item.ts`: Integrated meeting link creation into webhook flow **Key Features:** - Provider compatibility validation (Teams for Microsoft, Google Meet for Google) - Automatic fallback to native provider when incompatible provider requested - Zoom support deferred (returns fallback to native provider) - Teams uses Microsoft Graph API with OAuth refresh - Google Meet uses conferenceData structure (link auto-created by Google Calendar) Next: Phase 5 (calendar event creation) and Phase 6 (user settings) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Implement calendar event creation (Phase 5) Add unified calendar event creation for both Google Calendar and Microsoft Calendar with full meeting link integration. **New File:** - `create-calendar-event.ts`: Unified calendar event creation with provider-specific implementations **Key Features:** - **Google Calendar**: Uses googleapis calendar_v3 API - Creates events with conferenceData for Google Meet - Sets sendUpdates='all' to notify attendees - Includes description with agenda, notes, and meeting link - **Microsoft Calendar**: Uses Microsoft Graph API - Creates events with Teams meeting integration - Sets isOnlineMeeting and onlineMeetingProvider - Includes body content with agenda, notes, and meeting link - **Unified Interface**: Single function handles both providers - Automatically detects provider from email account - Gets primary/enabled calendar - Validates authentication tokens - Returns standardized event details (eventId, eventUrl, provider) - **Full Integration**: Connected to meeting details - Adds all attendees from parsed meeting request - Sets location if specified - Includes agenda and notes in event description - Applies correct timezone from availability checker - Sends calendar invitations automatically **Updates:** - `process-history-item.ts`: Integrated calendar event creation after meeting link generation **Flow:** 1. Parse meeting request → 2. Find availability → 3. Generate meeting link → 4. **Create calendar event** → 5. Send confirmation email (TODO) Next: Phase 6 (user settings) and testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive provider validation tests Add unit tests for meeting provider validation logic: - Test getAvailableProviders() for both Google and Microsoft accounts - Test validateProviderForAccount() for all provider/account combinations - Verify Teams=Microsoft only, Google Meet=Google only - Test fallback logic for incompatible providers - Test 'none' and 'zoom' edge cases All 11 tests passing ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings to database schema Add user-configurable settings for meeting scheduler: - meetingSchedulerEnabled: Enable/disable automatic meeting scheduling (default: true) - meetingSchedulerDefaultDuration: Default meeting duration in minutes (default: 60) - meetingSchedulerPreferredProvider: Preferred meeting provider (auto/teams/google-meet/zoom/none) - meetingSchedulerWorkingHoursStart: Working hours start 0-23 (default: 9) - meetingSchedulerWorkingHoursEnd: Working hours end 0-23 (default: 17) - meetingSchedulerAutoCreate: Auto-create events or prompt for confirmation (default: true) Migration applied successfully ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings and server actions - Add database schema fields for meeting scheduler configuration: - meetingSchedulerEnabled: toggle meeting scheduler on/off - meetingSchedulerDefaultDuration: default meeting duration (15-240 minutes) - meetingSchedulerPreferredProvider: preferred meeting provider (auto, teams, google-meet, zoom, none) - meetingSchedulerWorkingHoursStart/End: working hours for scheduling (0-23) - meetingSchedulerAutoCreate: auto-create meetings without confirmation - Create validation schema with Zod for settings updates - Implement server action for updating meeting scheduler settings with working hours validation - Integrate settings check into webhook processing to respect user preferences - Update webhook type definitions to include meetingSchedulerEnabled - Add meetingSchedulerEnabled to webhook account selection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive unit tests for meeting scheduler settings validation - Add 24 test cases covering all validation scenarios - Test valid inputs for all settings fields - Test boundary conditions (min/max values) - Test edge cases (0, 23 hours; 15, 240 minutes) - Test invalid inputs (out of range, wrong types) - Test optional field handling - All tests passing (24/24) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings UI and API - Create GET API route for fetching meeting scheduler settings - Build comprehensive settings UI component with: - Enable/disable toggle for meeting scheduler - Default meeting duration input (15-240 minutes) - Preferred meeting provider dropdown (auto, teams, google-meet, zoom, none) - Working hours configuration (start/end hours 0-23) - Auto-create toggle for automatic meeting creation - Dynamic provider options based on account type (Google/Microsoft) - Form validation with React Hook Form and Zod - Integrated with existing settings page under Email Account tab - Real-time form state management with SWR data fetching - Proper error handling with toast notifications 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add automatic webhook setup and Connect Calendar UI for Meeting Scheduler Implements automatic webhook configuration with manual fallback UI to enable real-time email processing for the Meeting Scheduler feature. Premium checks temporarily disabled for testing. Key changes: - Auto-setup Outlook webhooks when enabling Meeting Scheduler - Add "Connect Calendar" button with status display in Settings - Disable premium checks in webhook cron job for testing - Fix HTML validation errors in ProgressPanel component - Fix form layout issues in Meeting Scheduler settings - Enable Share Premium section for testing - Update API to return webhook expiration status 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Eduardo Lelis <[email protected]> Co-authored-by: Eliezer Steinbock <[email protected]> Co-authored-by: Claude <[email protected]> * feat: Add comprehensive test coverage for meeting scheduling and access control (#1) * Use outlook endpoint * PR feedback * PR feedback * add microsoft calendar set up notes * fix(calendar): fix OAuth callback redirects and standardize error handling Fix calendar OAuth callbacks to redirect to /{emailAccountId}/calendars and standardize error handling between Google and Microsoft providers. * unify google and microsoft calendar connection * get availabilty for ai drafting from microsoft calendars * fix: Address CoderabbitAI review findings - Add loading state to ConfirmationStep to prevent duplicate submissions - Clamp onPrevious in useStep to prevent underflow below step 0 - Extract duplicate payload construction in PreviewStep into buildCleanPayload helper - Fix LoadingContent error prop type in PreviewStep * chore: Update cursor rules and refine Outlook clean functionality - Updated all cursor rules documentation for consistency - Enhanced Outlook email streaming and preview functionality - Added clean-preview utility for better code organization - Improved error handling in Microsoft email utilities - Refined clean preview batch UI components 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix: Resolve TypeScript errors after Outlook Calendar merge - Add showPreview prop to ConfirmationStep component type - Update clean-preview.ts to use correct Account token structure - Fix token access: use account.access_token instead of tokens.access_token - Convert Date to timestamp (getTime()) for client functions - Use queryBatchMessages for Gmail to get full message details - Fix message property access: use message.headers instead of message.parsedMessage.headers - Remove unsupported 'after' parameter from Outlook getMessages call All TypeScript errors resolved, build now passes successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * docs: Create implementation plan for email-triggered meeting scheduler - Support email triggers: 'Schedule:' in subject or '/schedule meeting' in body - AI-powered meeting detail extraction - Calendar availability checking - Teams/Zoom/Google Meet link generation - Native calendar event creation (not .ics files) - Automatic invite sending via Google Calendar/Outlook Calendar APIs - Comprehensive 6-phase implementation plan * feat: Add email trigger detection for meeting scheduler - Created detectMeetingTrigger utility to detect meeting scheduling triggers - Supports "Schedule:" in subject line (case-insensitive) - Supports "/schedule meeting" command in email body (case-insensitive) - Works for both sent emails and emails to yourself - Integrated detection into webhook processing (Gmail and Outlook) - Added comprehensive test coverage with 19 passing tests - Lazy-loads logger to avoid env validation issues in tests Trigger patterns: 1. Subject: "Schedule:" (e.g., "Schedule: Team meeting next week") 2. Body: "/schedule meeting" (e.g., "Hi team, /schedule meeting to discuss Q4") Both patterns work for: - Sent emails (outbound messages) - Emails to yourself (inbound from your own address) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add AI meeting parser for extracting meeting details Phase 2 of meeting scheduler implementation - Created aiParseMeetingRequest to extract structured meeting data - Parses attendees from To/CC fields and email body - Extracts date/time preferences in natural language - Detects meeting duration (default 60 min) - Generates professional meeting title from content - Extracts agenda/purpose from email body - Detects preferred provider (Teams/Zoom/Google Meet) - Identifies in-person meeting locations - Captures special requests and notes - Detects urgency flags (ASAP, urgent, today) - Integrated parser into webhook processing - Added comprehensive test suite (11 test cases) Features: - Zod schema validation for structured output - Uses createGenerateObject for AI integration - Follows codebase LLM patterns - Scoped logging for debugging - Handles self-reminder emails (emails to yourself) Test coverage: ✓ Simple meeting requests ✓ Teams/Zoom/Google Meet detection ✓ Urgency detection ✓ In-person location extraction ✓ Multiple attendees from CC ✓ Detailed agenda extraction ✓ Requests with no specific times ✓ Special preparation notes ✓ Self-reminder emails 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting availability checker Phase 3 of meeting scheduler implementation - Created findMeetingAvailability to find available time slots - Leverages existing unified calendar integration (Google + Microsoft) - Parses natural language time preferences (e.g., "next Tuesday at 2pm") - Checks requested times against busy periods from all calendars - Suggests alternative times if requested slots are busy - Integrated into webhook processing pipeline Features: - Natural language parsing for common date/time expressions - Supports: "tomorrow at 2pm", "next Tuesday", "Jan 15 at 10am" - Day-of-week detection (Monday-Sunday) - Intelligent time slot conflict detection - Working hours suggestions (9 AM - 5 PM) - Timezone-aware date handling using TZDate - User timezone detection from calendar connections - Fallback suggestions when no specific times requested Algorithm: 1. Parse user's timezone from connected calendars 2. Parse natural language date/time preferences 3. Fetch busy periods across all Google + Microsoft calendars 4. Check if requested times are available (no conflicts) 5. If conflicts found, suggest alternative times 6. Return structured availability data with timezone Time slot conflict detection: - Checks for overlaps: slot starts before busy ends AND slot ends after busy starts - Returns only available slots (no conflicts) Suggestions algorithm: - Checks next 7 days by default - Prioritizes times near user's preferred hour - Working hours: 9 AM - 5 PM - Returns up to 5 suggestions - Filters duplicate slots 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Implement meeting link generation (Phase 4) Add meeting link generators for Microsoft Teams and Google Meet with provider validation. **New Files:** - `create-meeting-link.ts`: Main orchestration for creating meeting links with provider validation - `providers/types.ts`: Provider validation logic ensuring Teams=Microsoft only, Google Meet=Google only - `providers/teams.ts`: Microsoft Teams meeting creation via Graph API /me/onlineMeetings - `providers/google-meet.ts`: Google Meet conferenceData generation for calendar events **Updates:** - `parse-meeting-request.ts`: Fixed EmailForLLM type usage (removed .headers accessor) - `process-history-item.ts`: Integrated meeting link creation into webhook flow **Key Features:** - Provider compatibility validation (Teams for Microsoft, Google Meet for Google) - Automatic fallback to native provider when incompatible provider requested - Zoom support deferred (returns fallback to native provider) - Teams uses Microsoft Graph API with OAuth refresh - Google Meet uses conferenceData structure (link auto-created by Google Calendar) Next: Phase 5 (calendar event creation) and Phase 6 (user settings) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Implement calendar event creation (Phase 5) Add unified calendar event creation for both Google Calendar and Microsoft Calendar with full meeting link integration. **New File:** - `create-calendar-event.ts`: Unified calendar event creation with provider-specific implementations **Key Features:** - **Google Calendar**: Uses googleapis calendar_v3 API - Creates events with conferenceData for Google Meet - Sets sendUpdates='all' to notify attendees - Includes description with agenda, notes, and meeting link - **Microsoft Calendar**: Uses Microsoft Graph API - Creates events with Teams meeting integration - Sets isOnlineMeeting and onlineMeetingProvider - Includes body content with agenda, notes, and meeting link - **Unified Interface**: Single function handles both providers - Automatically detects provider from email account - Gets primary/enabled calendar - Validates authentication tokens - Returns standardized event details (eventId, eventUrl, provider) - **Full Integration**: Connected to meeting details - Adds all attendees from parsed meeting request - Sets location if specified - Includes agenda and notes in event description - Applies correct timezone from availability checker - Sends calendar invitations automatically **Updates:** - `process-history-item.ts`: Integrated calendar event creation after meeting link generation **Flow:** 1. Parse meeting request → 2. Find availability → 3. Generate meeting link → 4. **Create calendar event** → 5. Send confirmation email (TODO) Next: Phase 6 (user settings) and testing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive provider validation tests Add unit tests for meeting provider validation logic: - Test getAvailableProviders() for both Google and Microsoft accounts - Test validateProviderForAccount() for all provider/account combinations - Verify Teams=Microsoft only, Google Meet=Google only - Test fallback logic for incompatible providers - Test 'none' and 'zoom' edge cases All 11 tests passing ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings to database schema Add user-configurable settings for meeting scheduler: - meetingSchedulerEnabled: Enable/disable automatic meeting scheduling (default: true) - meetingSchedulerDefaultDuration: Default meeting duration in minutes (default: 60) - meetingSchedulerPreferredProvider: Preferred meeting provider (auto/teams/google-meet/zoom/none) - meetingSchedulerWorkingHoursStart: Working hours start 0-23 (default: 9) - meetingSchedulerWorkingHoursEnd: Working hours end 0-23 (default: 17) - meetingSchedulerAutoCreate: Auto-create events or prompt for confirmation (default: true) Migration applied successfully ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings and server actions - Add database schema fields for meeting scheduler configuration: - meetingSchedulerEnabled: toggle meeting scheduler on/off - meetingSchedulerDefaultDuration: default meeting duration (15-240 minutes) - meetingSchedulerPreferredProvider: preferred meeting provider (auto, teams, google-meet, zoom, none) - meetingSchedulerWorkingHoursStart/End: working hours for scheduling (0-23) - meetingSchedulerAutoCreate: auto-create meetings without confirmation - Create validation schema with Zod for settings updates - Implement server action for updating meeting scheduler settings with working hours validation - Integrate settings check into webhook processing to respect user preferences - Update webhook type definitions to include meetingSchedulerEnabled - Add meetingSchedulerEnabled to webhook account selection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive unit tests for meeting scheduler settings validation - Add 24 test cases covering all validation scenarios - Test valid inputs for all settings fields - Test boundary conditions (min/max values) - Test edge cases (0, 23 hours; 15, 240 minutes) - Test invalid inputs (out of range, wrong types) - Test optional field handling - All tests passing (24/24) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add meeting scheduler settings UI and API - Create GET API route for fetching meeting scheduler settings - Build comprehensive settings UI component with: - Enable/disable toggle for meeting scheduler - Default meeting duration input (15-240 minutes) - Preferred meeting provider dropdown (auto, teams, google-meet, zoom, none) - Working hours configuration (start/end hours 0-23) - Auto-create toggle for automatic meeting creation - Dynamic provider options based on account type (Google/Microsoft) - Form validation with React Hook Form and Zod - Integrated with existing settings page under Email Account tab - Real-time form state management with SWR data fetching - Proper error handling with toast notifications 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add automatic webhook setup and Connect Calendar UI for Meeting Scheduler Implements automatic webhook configuration with manual fallback UI to enable real-time email processing for the Meeting Scheduler feature. Premium checks temporarily disabled for testing. Key changes: - Auto-setup Outlook webhooks when enabling Meeting Scheduler - Add "Connect Calendar" button with status display in Settings - Disable premium checks in webhook cron job for testing - Fix HTML validation errors in ProgressPanel component - Fix form layout issues in Meeting Scheduler settings - Enable Share Premium section for testing - Update API to return webhook expiration status 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add authentication provider control and domain-based access control Implements comprehensive access control features for the login system: 1. Authentication Provider Control: - Added ENABLE_GOOGLE_AUTH, ENABLE_MICROSOFT_AUTH, ENABLE_SSO_AUTH env variables - Login page now conditionally displays auth buttons based on config - Defaults to true for all providers if not specified - Shows error message if all auth methods are disabled 2. Domain-Based Access Control: - Added ALLOWED_EMAIL_DOMAINS env variable for email domain restrictions - Server-side validation during sign-in event - Case-insensitive domain matching - Works with all authentication providers - User-friendly "Access Restricted" error message 3. Documentation: - Comprehensive ACCESS_CONTROL_README.md with examples - Configuration examples for both features - Combined usage scenarios - Testing instructions Files modified: - apps/web/env.ts - Added environment variables - apps/web/.env.example - Configuration examples - apps/web/utils/auth.ts - Domain validation logic - apps/web/app/(landing)/login/page.tsx - Props and error handling - apps/web/app/(landing)/login/LoginForm.tsx - Conditional rendering - turbo.json - Build configuration - apps/web/ACCESS_CONTROL_README.md - Documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * docs: Add comprehensive .env comments and make login the default landing page 1. Enhanced .env.example with detailed comments: - Added full documentation section for access control features - Explained domain-based access control with examples and use cases - Documented authentication provider control with detailed descriptions - Added configuration examples for common scenarios - Included behavior notes and requirements for each setting 2. Updated default landing page to show login: - Changed app/(landing)/page.tsx to redirect to /login - Authenticated users are redirected to welcome page - Unauthenticated users see login page with 3 auth buttons - Provides cleaner first-time user experience This makes the login page with Google, Microsoft, and SSO buttons the default entry point for the application. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat: Add comprehensive test coverage for meeting scheduling and access control ## Test Coverage (54 tests - 100% passing) ### Meeting Scheduling Tests - **find-availability.test.ts** (20 tests): Natural language time parsing, conflict detection, timezone handling - **create-meeting-link.test.ts** (18 tests): Google Meet & Teams link creation, provider compatibility - **create-calendar-event.test.ts** (16 tests): Calendar event creation for Google & Outlook with attendees ### Access Control Tests - **access-control.test.ts**: Domain validation for email-based access control (ALLOWED_EMAIL_DOMAINS) ## Implementation Fixes ### Timezone Handling (`utils/meetings/find-availability.ts`) - Fixed timezone handling in `parseNaturalLanguageTime` function - Changed from creating Date then converting to TZDate (which caused timezone shifts) - Now creates TZDate directly with year/month/day/hour components - Fixed "next Tuesday" parsing bug (was returning Monday) ### Key Technical Details - All tests use proper async/await patterns with `await import()` for ES modules - Fixed mock setup to use module-level imports for consistent behavior - Used Date.UTC() in tests to ensure timezone consistency with implementation - Tests cover edge cases, error handling, and provider compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Eduardo Lelis <[email protected]> Co-authored-by: Eliezer Steinbock <[email protected]> Co-authored-by: Claude <[email protected]> * fix: Address CodeRabbit AI review findings and update cursor rules (#2) * fix: Address CoderabbitAI review findings - Add loading state to ConfirmationStep to prevent duplicate submissions - Clamp onPrevious in useStep to prevent underflow below step 0 - Extract duplicate payload construction in PreviewStep into buildCleanPayload helper - Fix LoadingContent error prop type in PreviewStep * chore: Update cursor rules and refine Outlook clean functionality - Updated all cursor rules documentation for consistency - Enhanced Outlook email streaming and preview functionality - Added clean-preview utility for better code organization - Improved error handling in Microsoft email utilities - Refined clean preview batch UI components 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> * feat: Add comprehensive prompt injection defense Implement multi-layer security system to protect AI operations from prompt injection attacks and data exfiltration attempts. - Pattern detection for 15+ injection attack types - XML tag escaping to prevent content breakout - Markdown code block neutralization - Comprehensive logging of suspicious patterns - Redis-based sliding window rate limiting - Default limits: choose-rule (100/hr), generate-draft (50/hr), categorize (200/hr) - Graceful degradation if Redis unavailable - Warning at 80% capacity threshold - Centralized security event logging - Sentry integration for alerting - Sanitization event tracking - AI operation audit trail - Explicit anti-injection instructions in system prompts - Clear scope limitation for AI tasks - Data protection rules (no PII in responses) - Untrusted content wrapping with warnings - Verified AI ONLY creates drafts (never sends directly) - User review required before any email/calendar action - Primary security boundary: user approval - No need for strict output validation (user reviews all content) ✅ 23 tests passing covering: - 10 different injection attack patterns - XML tag escaping in body and subject - Markdown code block replacement - Multi-vector attacks - Edge cases (empty, long, unicode content) - Real-world jailbreak attempts - Added comprehensive AI Security section to .cursor/rules/security.mdc - Documented all security patterns and anti-patterns - Included complete integration examples - Added AI security checklist - Defense in depth: Multiple security layers - Fail gracefully: Rate limiting and monitoring don't block on failures - User as final gate: Draft-only behavior is primary control - No false positives blocking legitimate use: User review handles edge cases 🔒 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * docs: add WARP.md guidance for Warp.dev - Comprehensive development commands (setup, dev, build, Prisma, testing) - Architecture overview (AI assistant, email processing, data flow) - Clear distinction between local Redis (caching) and Upstash (queues) - Deployment details for local and production (iz.salsven.com) instances - References to ARCHITECTURE.md and apps/web/CLAUDE.md * docs: add git repository safety rule to WARP.md - Add critical reminder to verify git remote before committing - Ensure commits only go to origin (salja03-t21/inbox-zero), never upstream * docs: add data safety rule to WARP.md - Require explicit permission before destroying any volume data - Never run docker volume rm, docker compose down -v, or prisma migrate reset without asking * Document known issues in WARP.md * Production deployment setup with Docker and Traefik - Add .dockerignore to prevent .env files in Docker images - Add docker-compose.prod.yml with Traefik labels and serverless-redis-http - Update WARP.md with deployment documentation - Fix calendar OAuth redirect URLs to use NEXT_PUBLIC_BASE_URL - Add .env.production to .gitignore * Fix auth issues: dynamic login page and Microsoft re-consent - Force login page to render dynamically so ENABLE_*_AUTH env vars work - Add offline_access scope to Microsoft OAuth - Change prompt from 'consent' to 'select_account' to avoid re-consent - This fixes both the auth buttons showing when disabled and the Microsoft re-consent issue * Fix auth provider button visibility with dynamic rendering - Change ENABLE_*_AUTH env vars to use string with transform instead of z.coerce.boolean() - Login page already has 'dynamic = force-dynamic' to ensure runtime env reading - Auth buttons now correctly show/hide based on ENABLE_GOOGLE_AUTH, ENABLE_MICROSOFT_AUTH, and ENABLE_SSO_AUTH env vars * docs: Add branching model and maintenance workflow to WARP.md * feat: Update deployment script to use production branch from git * fix: Handle existing git repository in deployment script * chore: Add deploy.log to gitignore * fix(deploy): Handle untracked files on server during checkout * fix(deploy): Force checkout and reset to handle config files * fix(deploy): Build docker image instead of pulling from registry * fix: Update clean-preview to use Account tokens instead of deprecated tokens relation * fix: Convert expires_at Date to Unix timestamp * fix: Use queryBatchMessages to get full message data * fix: Remove unsupported after parameter for Outlook getMessages * fix: Add labelName parameter to labelMessage call * feat: Add toggle to process all emails or only unread in bulk process * fix: Add explicit user directives to prevent permissions issues * fix: Remove user directives that conflict with NFS * docs: Update deployment process to use docker-compose.prod.yml as source of truth - Updated deploy-production.sh to backup and copy docker-compose.prod.yml to docker-compose.yml on server - Added comprehensive deployment documentation to WARP.md including automated and manual deployment instructions - Documented that docker-compose.prod.yml is the source of truth for production configuration - All production config changes should be made to docker-compose.prod.yml in the repo --------- Co-authored-by: Eduardo Lelis <[email protected]> Co-authored-by: Eliezer Steinbock <[email protected]> Co-authored-by: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR integrates Outlook Calendar support for checking meeting availability when drafting emails and scheduling meetings.
Features
Changes
Key Commits
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]