@realtimex/email-automator 2.11.2 โ†’ 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/api/src/routes/index.ts +2 -0
  2. package/api/src/routes/rulePacks.ts +204 -0
  3. package/api/src/services/RulePackService.ts +354 -0
  4. package/api/src/services/SDKService.ts +18 -7
  5. package/api/src/services/gmail.ts +68 -0
  6. package/api/src/services/intelligence.ts +160 -22
  7. package/api/src/services/microsoft.ts +99 -0
  8. package/api/src/services/processor.ts +146 -12
  9. package/api/src/services/rulePacks/developer.ts +179 -0
  10. package/api/src/services/rulePacks/executive.ts +143 -0
  11. package/api/src/services/rulePacks/index.ts +63 -0
  12. package/api/src/services/rulePacks/operations.ts +183 -0
  13. package/api/src/services/rulePacks/sales.ts +160 -0
  14. package/api/src/services/rulePacks/types.ts +116 -0
  15. package/api/src/services/rulePacks/universal.ts +83 -0
  16. package/api/src/services/supabase.ts +40 -0
  17. package/dist/api/src/routes/index.js +2 -0
  18. package/dist/api/src/routes/rulePacks.js +179 -0
  19. package/dist/api/src/services/RulePackService.js +296 -0
  20. package/dist/api/src/services/SDKService.js +18 -7
  21. package/dist/api/src/services/gmail.js +56 -0
  22. package/dist/api/src/services/intelligence.js +153 -21
  23. package/dist/api/src/services/microsoft.js +79 -0
  24. package/dist/api/src/services/processor.js +133 -12
  25. package/dist/api/src/services/rulePacks/developer.js +176 -0
  26. package/dist/api/src/services/rulePacks/executive.js +140 -0
  27. package/dist/api/src/services/rulePacks/index.js +58 -0
  28. package/dist/api/src/services/rulePacks/operations.js +180 -0
  29. package/dist/api/src/services/rulePacks/sales.js +157 -0
  30. package/dist/api/src/services/rulePacks/types.js +7 -0
  31. package/dist/api/src/services/rulePacks/universal.js +80 -0
  32. package/dist/assets/index-B5rXh3y8.css +1 -0
  33. package/dist/assets/index-B62ViZum.js +105 -0
  34. package/dist/index.html +2 -2
  35. package/package.json +1 -1
  36. package/supabase/migrations/20260131000000_add_rule_packs.sql +176 -0
  37. package/supabase/migrations/20260131000001_set_zero_config_defaults.sql +51 -0
  38. package/supabase/migrations/20260131095000_backfill_user_settings.sql +36 -0
  39. package/supabase/migrations/20260131100000_rule_templates_table.sql +154 -0
  40. package/supabase/migrations/20260131110000_auto_init_user_data.sql +90 -0
  41. package/supabase/migrations/20260131120000_backfill_universal_pack.sql +84 -0
  42. package/supabase/migrations/20260131130000_simplify_rules_with_categories.sql +87 -0
  43. package/supabase/migrations/20260131140000_fix_action_constraint.sql +11 -0
  44. package/supabase/migrations/20260131150000_fix_trigger_error_handling.sql +71 -0
  45. package/supabase/migrations/20260131160000_enable_intelligent_rename_by_default.sql +14 -0
  46. package/dist/assets/index-BuWrl4UD.js +0 -105
  47. package/dist/assets/index-CtDzSy0n.css +0 -1
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Developer Pack - Engineering & Technical Workflows
3
+ *
4
+ * Designed for software engineers, DevOps, and technical teams who need to:
5
+ * - Surface critical system alerts
6
+ * - Filter project management noise
7
+ * - Organize meeting recordings and docs
8
+ * - Focus on code reviews and incidents
9
+ */
10
+ export const DEVELOPER_PACK = {
11
+ id: 'developer',
12
+ name: 'Developer Pack',
13
+ description: 'Surface critical alerts and filter tool noise',
14
+ icon: '๐Ÿ’ป',
15
+ enabled_by_default: false,
16
+ target_roles: ['developer'],
17
+ rules: [
18
+ {
19
+ id: 'dev-system-alerts',
20
+ name: '๐Ÿšจ System Alerts Prioritizer',
21
+ intent: 'Prioritize critical system alerts and incidents',
22
+ description: 'Stars critical alerts from AWS, Datadog, Sentry, PagerDuty while archiving info-level notifications',
23
+ condition: {
24
+ or: [
25
+ {
26
+ sender_domain: 'aws.amazon.com',
27
+ contains_keywords: ['critical', 'down', 'outage', 'incident']
28
+ },
29
+ {
30
+ sender_domain: 'datadoghq.com',
31
+ contains_keywords: ['alert', 'critical', 'error rate']
32
+ },
33
+ {
34
+ sender_domain: 'sentry.io',
35
+ contains_keywords: ['new issue', 'regression', 'error']
36
+ },
37
+ {
38
+ sender_domain: 'pagerduty.com',
39
+ contains_keywords: ['triggered', 'incident']
40
+ }
41
+ ]
42
+ },
43
+ actions: ['star', 'important', 'pin'],
44
+ priority: 100,
45
+ is_enabled_by_default: true
46
+ },
47
+ {
48
+ id: 'dev-system-info',
49
+ name: 'โš ๏ธ System Info Organizer',
50
+ intent: 'Archive non-critical system notifications',
51
+ description: 'Archives info and warning level alerts from monitoring tools',
52
+ condition: {
53
+ or: [
54
+ {
55
+ sender_domain: 'aws.amazon.com',
56
+ not: {
57
+ contains_keywords: ['critical', 'down', 'outage']
58
+ }
59
+ },
60
+ {
61
+ sender_domain: 'datadoghq.com',
62
+ contains_keywords: ['info', 'warning', 'recovered']
63
+ },
64
+ {
65
+ sender_domain: 'circleci.com'
66
+ },
67
+ {
68
+ sender_domain: 'github.com',
69
+ contains_keywords: ['build', 'workflow']
70
+ }
71
+ ]
72
+ },
73
+ actions: ['label:Logs', 'archive', 'read'],
74
+ priority: 20,
75
+ is_enabled_by_default: true
76
+ },
77
+ {
78
+ id: 'dev-project-management',
79
+ name: '๐Ÿ”จ Project Management Organizer',
80
+ intent: 'Organize Jira, GitHub, and project management notifications',
81
+ description: 'Archives project management notifications unless you\'re directly assigned',
82
+ condition: {
83
+ or: [
84
+ {
85
+ sender_domain: 'atlassian.net',
86
+ not: {
87
+ contains_keywords: ['assigned to you', 'mentioned you']
88
+ }
89
+ },
90
+ {
91
+ sender_domain: 'github.com',
92
+ not: {
93
+ contains_keywords: ['assigned', 'review requested', '@']
94
+ }
95
+ },
96
+ {
97
+ sender_domain: 'asana.com',
98
+ not: {
99
+ contains_keywords: ['assigned to you']
100
+ }
101
+ },
102
+ {
103
+ sender_domain: 'trello.com'
104
+ },
105
+ {
106
+ sender_domain: 'monday.com'
107
+ }
108
+ ]
109
+ },
110
+ actions: ['label:Tools', 'archive'],
111
+ priority: 15,
112
+ is_enabled_by_default: true
113
+ },
114
+ {
115
+ id: 'dev-code-reviews',
116
+ name: '๐Ÿ‘€ Code Review Highlighter',
117
+ intent: 'Highlight pull request reviews and assignments',
118
+ description: 'Stars GitHub/GitLab notifications where your review is requested',
119
+ condition: {
120
+ or: [
121
+ {
122
+ sender_domain: 'github.com',
123
+ contains_keywords: ['review requested', 'requested your review']
124
+ },
125
+ {
126
+ sender_domain: 'gitlab.com',
127
+ contains_keywords: ['review', 'merge request']
128
+ }
129
+ ]
130
+ },
131
+ actions: ['star'],
132
+ priority: 80,
133
+ is_enabled_by_default: true
134
+ },
135
+ {
136
+ id: 'dev-meeting-recordings',
137
+ name: '๐Ÿ“น Meeting Recording Archiver',
138
+ intent: 'Archive meeting recordings and transcripts',
139
+ description: 'Automatically archives Zoom, Teams, and AI note-taker recordings',
140
+ condition: {
141
+ or: [
142
+ {
143
+ sender_domain: 'zoom.us',
144
+ contains_keywords: ['recording', 'cloud recording']
145
+ },
146
+ {
147
+ sender_domain: 'microsoft.com',
148
+ contains_keywords: ['recording', 'teams recording']
149
+ },
150
+ {
151
+ sender_domain: 'fireflies.ai'
152
+ },
153
+ {
154
+ sender_domain: 'otter.ai'
155
+ }
156
+ ]
157
+ },
158
+ actions: ['label:Recordings', 'archive'],
159
+ priority: 10,
160
+ is_enabled_by_default: true
161
+ },
162
+ {
163
+ id: 'dev-drive-shares',
164
+ name: '๐Ÿ“‚ Drive Share Organizer',
165
+ intent: 'Archive Google Drive/Docs share notifications',
166
+ description: 'Archives notifications about shared documents (usually redundant)',
167
+ condition: {
168
+ sender_domain: 'google.com',
169
+ contains_keywords: ['shared', 'document', 'commented on', 'mentioned you in']
170
+ },
171
+ actions: ['label:Drive', 'archive'],
172
+ priority: 5,
173
+ is_enabled_by_default: true
174
+ }
175
+ ]
176
+ };
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Executive Pack - Leadership & Strategic Communications
3
+ *
4
+ * Designed for executives, C-suite, and leadership who need to:
5
+ * - Focus on VIP communications
6
+ * - Prioritize strategic decisions
7
+ * - Filter operational noise
8
+ * - Manage travel and legal documents
9
+ */
10
+ export const EXECUTIVE_PACK = {
11
+ id: 'executive',
12
+ name: 'Executive Pack',
13
+ description: 'Focus on high-priority communications and strategic matters',
14
+ icon: '๐Ÿ‘”',
15
+ enabled_by_default: false,
16
+ target_roles: ['executive'],
17
+ rules: [
18
+ {
19
+ id: 'exec-vip-clients',
20
+ name: 'โญ VIP Client Prioritizer',
21
+ intent: 'Star and prioritize emails from key clients and partners',
22
+ description: 'Automatically highlights emails from VIP contacts and important clients',
23
+ condition: {
24
+ or: [
25
+ {
26
+ sender_is_vip: true // From VIP list (requires VIP management feature)
27
+ },
28
+ {
29
+ category: 'client',
30
+ ai_priority: 'High'
31
+ }
32
+ ]
33
+ },
34
+ actions: ['star', 'important'],
35
+ priority: 100,
36
+ is_enabled_by_default: true
37
+ },
38
+ {
39
+ id: 'exec-direct-questions',
40
+ name: 'โšก Direct Questions Highlighter',
41
+ intent: 'Highlight emails that require your direct input',
42
+ description: 'Identifies emails where you\'re the only recipient and a response is clearly needed',
43
+ condition: {
44
+ recipient_type: 'to',
45
+ recipient_count_gt: 0, // Only sent to you
46
+ contains_keywords: ['?', 'your input', 'your thoughts', 'need your', 'awaiting your'],
47
+ not: {
48
+ category: 'newsletter' // Exclude automated newsletters
49
+ }
50
+ },
51
+ actions: ['important'],
52
+ priority: 90,
53
+ is_enabled_by_default: true
54
+ },
55
+ {
56
+ id: 'exec-travel-itineraries',
57
+ name: 'โœˆ๏ธ Travel Organizer',
58
+ intent: 'Organize flight confirmations, hotel bookings, and itineraries',
59
+ description: 'Labels travel-related emails for easy access before trips',
60
+ condition: {
61
+ or: [
62
+ {
63
+ sender_domain: 'delta.com'
64
+ },
65
+ {
66
+ sender_domain: 'united.com'
67
+ },
68
+ {
69
+ sender_domain: 'aa.com'
70
+ },
71
+ {
72
+ sender_domain: 'hilton.com'
73
+ },
74
+ {
75
+ sender_domain: 'marriott.com'
76
+ },
77
+ {
78
+ contains_keywords: ['itinerary', 'flight confirmation', 'booking confirmation', 'reservation confirmed']
79
+ }
80
+ ]
81
+ },
82
+ actions: ['label:Travel', 'star'],
83
+ priority: 70,
84
+ is_enabled_by_default: true
85
+ },
86
+ {
87
+ id: 'exec-legal-contracts',
88
+ name: 'โš–๏ธ Legal & Contracts Highlighter',
89
+ intent: 'Highlight important legal documents and contracts',
90
+ description: 'Stars emails containing contracts, NDAs, and legal documents requiring signature',
91
+ condition: {
92
+ or: [
93
+ {
94
+ sender_domain: 'docusign.com'
95
+ },
96
+ {
97
+ sender_domain: 'hellosign.com'
98
+ },
99
+ {
100
+ sender_domain: 'pandadoc.com'
101
+ },
102
+ {
103
+ contains_keywords: ['nda', 'agreement', 'contract', 'sign', 'signature required']
104
+ }
105
+ ]
106
+ },
107
+ actions: ['label:Legal', 'star'],
108
+ priority: 95,
109
+ is_enabled_by_default: true
110
+ },
111
+ {
112
+ id: 'exec-social-notifications',
113
+ name: '๐Ÿ”” Social Media Archiver',
114
+ intent: 'Archive social media notifications',
115
+ description: 'Automatically archives LinkedIn, Twitter, and other social notifications',
116
+ condition: {
117
+ category: 'social',
118
+ confidence_gt: 0.8
119
+ },
120
+ actions: ['archive', 'read'],
121
+ priority: 5,
122
+ is_enabled_by_default: true
123
+ },
124
+ {
125
+ id: 'exec-calendar-responses',
126
+ name: '๐Ÿ“… Calendar Response Cleaner',
127
+ intent: 'Clean up calendar accept/decline notifications',
128
+ description: 'Deletes automatic calendar responses that don\'t contain custom messages',
129
+ condition: {
130
+ contains_keywords: ['accepted:', 'declined:', 'tentative:'],
131
+ not: {
132
+ recipient_type: 'to' // Don't delete if you're the only recipient
133
+ }
134
+ },
135
+ actions: ['delete'],
136
+ priority: 10,
137
+ is_enabled_by_default: false // Disabled by default - deletion is aggressive
138
+ }
139
+ ]
140
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Rule Packs - Zero-Configuration Email Automation
3
+ *
4
+ * This module provides pre-configured rule packs for different user roles.
5
+ * Rule packs enable zero-configuration UX by providing smart defaults that
6
+ * work out of the box.
7
+ */
8
+ export * from './types.js';
9
+ export { UNIVERSAL_PACK } from './universal.js';
10
+ export { EXECUTIVE_PACK } from './executive.js';
11
+ export { DEVELOPER_PACK } from './developer.js';
12
+ export { SALES_PACK } from './sales.js';
13
+ export { OPERATIONS_PACK } from './operations.js';
14
+ import { UNIVERSAL_PACK } from './universal.js';
15
+ import { EXECUTIVE_PACK } from './executive.js';
16
+ import { DEVELOPER_PACK } from './developer.js';
17
+ import { SALES_PACK } from './sales.js';
18
+ import { OPERATIONS_PACK } from './operations.js';
19
+ /**
20
+ * All available rule packs
21
+ */
22
+ export const ALL_PACKS = {
23
+ universal: UNIVERSAL_PACK,
24
+ executive: EXECUTIVE_PACK,
25
+ developer: DEVELOPER_PACK,
26
+ sales: SALES_PACK,
27
+ operations: OPERATIONS_PACK,
28
+ };
29
+ /**
30
+ * Get packs that should be installed for a specific user role
31
+ */
32
+ export function getPacksForRole(role) {
33
+ const packs = [
34
+ UNIVERSAL_PACK // Always include universal pack
35
+ ];
36
+ // Add role-specific pack
37
+ if (role === 'executive')
38
+ packs.push(EXECUTIVE_PACK);
39
+ if (role === 'developer')
40
+ packs.push(DEVELOPER_PACK);
41
+ if (role === 'sales')
42
+ packs.push(SALES_PACK);
43
+ if (role === 'operations')
44
+ packs.push(OPERATIONS_PACK);
45
+ return packs;
46
+ }
47
+ /**
48
+ * Get a specific pack by ID
49
+ */
50
+ export function getPackById(packId) {
51
+ return ALL_PACKS[packId];
52
+ }
53
+ /**
54
+ * Get all available packs
55
+ */
56
+ export function getAllPacks() {
57
+ return Object.values(ALL_PACKS);
58
+ }
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Operations Pack - Support & Customer Success
3
+ *
4
+ * Designed for operations, support, and customer success teams who need to:
5
+ * - Organize customer support tickets
6
+ * - Track internal announcements
7
+ * - Monitor system health
8
+ * - Manage receipts and expenses
9
+ */
10
+ export const OPERATIONS_PACK = {
11
+ id: 'operations',
12
+ name: 'Operations Pack',
13
+ description: 'Organize tickets, internal communications, and operations',
14
+ icon: '๐Ÿ› ๏ธ',
15
+ enabled_by_default: false,
16
+ target_roles: ['operations'],
17
+ rules: [
18
+ {
19
+ id: 'ops-support-tickets',
20
+ name: '๐ŸŽซ Support Ticket Organizer',
21
+ intent: 'Organize customer support tickets and cases',
22
+ description: 'Labels support tickets from Zendesk, Intercom, and other support tools',
23
+ condition: {
24
+ or: [
25
+ {
26
+ sender_domain: 'zendesk.com'
27
+ },
28
+ {
29
+ sender_domain: 'intercom.io'
30
+ },
31
+ {
32
+ sender_domain: 'freshdesk.com'
33
+ },
34
+ {
35
+ contains_keywords: ['ticket', 'case created', 'support request', 'customer inquiry']
36
+ },
37
+ {
38
+ category: 'support',
39
+ confidence_gt: 0.7
40
+ }
41
+ ]
42
+ },
43
+ actions: ['label:Support'],
44
+ priority: 80,
45
+ is_enabled_by_default: true
46
+ },
47
+ {
48
+ id: 'ops-urgent-tickets',
49
+ name: '๐Ÿšจ Urgent Ticket Highlighter',
50
+ intent: 'Highlight high-priority and urgent customer issues',
51
+ description: 'Stars urgent support tickets that need immediate attention',
52
+ condition: {
53
+ category: 'support',
54
+ or: [
55
+ {
56
+ contains_keywords: ['urgent', 'emergency', 'critical', 'down', 'not working']
57
+ },
58
+ {
59
+ ai_priority: 'High'
60
+ }
61
+ ]
62
+ },
63
+ actions: ['star', 'important'],
64
+ priority: 100,
65
+ is_enabled_by_default: true
66
+ },
67
+ {
68
+ id: 'ops-system-alerts',
69
+ name: 'โš ๏ธ System Alerts Organizer',
70
+ intent: 'Organize system monitoring and uptime alerts',
71
+ description: 'Labels system alerts while starring critical incidents',
72
+ condition: {
73
+ or: [
74
+ {
75
+ sender_domain: 'pingdom.com'
76
+ },
77
+ {
78
+ sender_domain: 'uptimerobot.com'
79
+ },
80
+ {
81
+ sender_domain: 'statuspage.io'
82
+ },
83
+ {
84
+ sender_domain: 'datadog.com'
85
+ }
86
+ ]
87
+ },
88
+ actions: ['label:Monitoring'],
89
+ priority: 70,
90
+ is_enabled_by_default: true
91
+ },
92
+ {
93
+ id: 'ops-critical-alerts',
94
+ name: '๐Ÿ”ฅ Critical Alert Highlighter',
95
+ intent: 'Highlight critical system incidents',
96
+ description: 'Stars critical alerts that indicate system downtime or major issues',
97
+ condition: {
98
+ or: [
99
+ {
100
+ sender_domain: 'pingdom.com',
101
+ contains_keywords: ['down', 'offline']
102
+ },
103
+ {
104
+ sender_domain: 'datadog.com',
105
+ contains_keywords: ['critical', 'incident']
106
+ }
107
+ ]
108
+ },
109
+ actions: ['star', 'important', 'pin'],
110
+ priority: 100,
111
+ is_enabled_by_default: true
112
+ },
113
+ {
114
+ id: 'ops-internal-announcements',
115
+ name: '๐Ÿข Internal Announcements',
116
+ intent: 'Keep internal company announcements in inbox',
117
+ description: 'Keeps HR, team, and company-wide announcements visible (doesn\'t archive)',
118
+ condition: {
119
+ or: [
120
+ {
121
+ category: 'internal',
122
+ confidence_gt: 0.7
123
+ },
124
+ {
125
+ sender_domain: 'company.com', // This should be customizable
126
+ contains_keywords: ['all-hands', 'team announcement', 'company update']
127
+ }
128
+ ]
129
+ },
130
+ actions: [], // No actions - keep in inbox
131
+ priority: 50,
132
+ is_enabled_by_default: true
133
+ },
134
+ {
135
+ id: 'ops-project-management',
136
+ name: '๐Ÿ”จ Project Management Organizer',
137
+ intent: 'Organize project management tool notifications',
138
+ description: 'Archives project management notifications unless you\'re directly mentioned',
139
+ condition: {
140
+ or: [
141
+ {
142
+ sender_domain: 'atlassian.net',
143
+ not: {
144
+ contains_keywords: ['assigned to you', 'mentioned you']
145
+ }
146
+ },
147
+ {
148
+ sender_domain: 'asana.com',
149
+ not: {
150
+ contains_keywords: ['assigned to you']
151
+ }
152
+ },
153
+ {
154
+ sender_domain: 'trello.com'
155
+ },
156
+ {
157
+ sender_domain: 'monday.com'
158
+ }
159
+ ]
160
+ },
161
+ actions: ['label:Tools', 'archive'],
162
+ priority: 15,
163
+ is_enabled_by_default: true
164
+ },
165
+ {
166
+ id: 'ops-receipts-invoices',
167
+ name: '๐Ÿงพ Receipt & Invoice Labeler',
168
+ intent: 'Label receipts and invoices for expense tracking',
169
+ description: 'Labels transactional emails for easy expense reporting',
170
+ condition: {
171
+ category: 'transactional',
172
+ contains_keywords: ['receipt', 'invoice', 'payment', 'order confirmation'],
173
+ confidence_gt: 0.75
174
+ },
175
+ actions: ['label:Finance/Receipts'],
176
+ priority: 60,
177
+ is_enabled_by_default: true
178
+ }
179
+ ]
180
+ };