@realtimex/email-automator 2.21.5 → 2.21.7
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.
- package/api/src/routes/index.ts +0 -2
- package/api/src/services/DefaultRuleService.ts +98 -0
- package/api/src/services/defaultRules/development.ts +135 -0
- package/api/src/services/defaultRules/emailOrg.ts +154 -0
- package/api/src/services/defaultRules/index.ts +28 -0
- package/api/src/services/defaultRules/operations.ts +134 -0
- package/api/src/services/defaultRules/priority.ts +114 -0
- package/api/src/services/defaultRules/salesBusiness.ts +67 -0
- package/api/src/services/{rulePacks → defaultRules}/types.ts +19 -31
- package/api/src/services/processor.ts +5 -5
- package/api/src/services/supabase.ts +6 -19
- package/dist/api/src/routes/index.js +0 -2
- package/dist/api/src/services/DefaultRuleService.js +87 -0
- package/dist/api/src/services/defaultRules/development.js +132 -0
- package/dist/api/src/services/defaultRules/emailOrg.js +151 -0
- package/dist/api/src/services/defaultRules/index.js +22 -0
- package/dist/api/src/services/defaultRules/operations.js +131 -0
- package/dist/api/src/services/defaultRules/priority.js +111 -0
- package/dist/api/src/services/defaultRules/salesBusiness.js +64 -0
- package/dist/api/src/services/defaultRules/types.js +7 -0
- package/dist/api/src/services/processor.js +5 -5
- package/dist/assets/{es-BQiNEjuo.js → es-Ba5LYhav.js} +1 -1
- package/dist/assets/{fr-Di3HVss0.js → fr-bhwA8wS2.js} +1 -1
- package/dist/assets/index-DQR_Ll3H.css +1 -0
- package/dist/assets/index-drQZGbCT.js +193 -0
- package/dist/assets/{ja-OkCqAyrq.js → ja-BN-umAAP.js} +1 -1
- package/dist/assets/{ko-ZvnlIxWp.js → ko-DGfIFnSn.js} +1 -1
- package/dist/assets/{vi-BATQPoNy.js → vi-BjY3K1cD.js} +2 -2
- package/dist/index.html +2 -2
- package/docs/README.md +14 -14
- package/docs/images/cover-landscape.webp +0 -0
- package/docs/marketplace/listing.md +34 -0
- package/docs/user-guide/ACCOUNT.md +40 -27
- package/docs/user-guide/AUTOMATION.md +75 -29
- package/docs/user-guide/CONFIGURATION.md +35 -49
- package/docs/user-guide/DASHBOARD.md +46 -52
- package/docs/user-guide/GETTING-STARTED.md +36 -55
- package/docs/user-guide/TROUBLESHOOTING.md +43 -42
- package/package.json +1 -1
- package/supabase/migrations/20260203145936_remove_pack_concept.sql +29 -0
- package/api/src/routes/rulePacks.ts +0 -204
- package/api/src/services/RulePackService.ts +0 -354
- package/api/src/services/rulePacks/developer.ts +0 -179
- package/api/src/services/rulePacks/executive.ts +0 -143
- package/api/src/services/rulePacks/index.ts +0 -63
- package/api/src/services/rulePacks/operations.ts +0 -183
- package/api/src/services/rulePacks/sales.ts +0 -160
- package/api/src/services/rulePacks/universal.ts +0 -83
- package/dist/api/src/routes/rulePacks.js +0 -179
- package/dist/api/src/services/RulePackService.js +0 -296
- package/dist/api/src/services/rulePacks/developer.js +0 -176
- package/dist/api/src/services/rulePacks/executive.js +0 -140
- package/dist/api/src/services/rulePacks/index.js +0 -58
- package/dist/api/src/services/rulePacks/operations.js +0 -180
- package/dist/api/src/services/rulePacks/sales.js +0 -157
- package/dist/api/src/services/rulePacks/types.js +0 -7
- package/dist/api/src/services/rulePacks/universal.js +0 -80
- package/dist/assets/index-CotbFXGe.js +0 -193
- package/dist/assets/index-DTtR5hN2.css +0 -1
package/api/src/routes/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ import migrateRoutes from './migrate.js';
|
|
|
10
10
|
import sdkRoutes from './sdk.js';
|
|
11
11
|
import ttsRoutes from './tts.js';
|
|
12
12
|
import agentRoutes from './agent.js';
|
|
13
|
-
import rulePacksRoutes from './rulePacks.js';
|
|
14
13
|
import draftsRoutes from './drafts.js';
|
|
15
14
|
|
|
16
15
|
|
|
@@ -28,7 +27,6 @@ router.use('/migrate', migrateRoutes);
|
|
|
28
27
|
router.use('/sdk', sdkRoutes);
|
|
29
28
|
router.use('/tts', ttsRoutes);
|
|
30
29
|
router.use('/agent', agentRoutes);
|
|
31
|
-
router.use('/rule-packs', rulePacksRoutes);
|
|
32
30
|
router.use('/drafts', draftsRoutes);
|
|
33
31
|
|
|
34
32
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Rule Service
|
|
3
|
+
*
|
|
4
|
+
* Handles seeding of default system rules for users.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { SupabaseClient } from '@supabase/supabase-js';
|
|
8
|
+
import { createLogger } from '../utils/logger.js';
|
|
9
|
+
import { ALL_DEFAULT_RULES } from './defaultRules/index.js';
|
|
10
|
+
|
|
11
|
+
const logger = createLogger('DefaultRuleService');
|
|
12
|
+
|
|
13
|
+
export class DefaultRuleService {
|
|
14
|
+
constructor(private supabase: SupabaseClient) {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Ensure all default rules are seeded for the user
|
|
18
|
+
* Called during sync or onboarding
|
|
19
|
+
*/
|
|
20
|
+
async ensureDefaultRules(userId: string): Promise<{ success: boolean; installed: boolean }> {
|
|
21
|
+
try {
|
|
22
|
+
// Check if user has already been seeded (check if any system-managed rules exist)
|
|
23
|
+
const { data: existingRules } = await this.supabase
|
|
24
|
+
.from('rules')
|
|
25
|
+
.select('id')
|
|
26
|
+
.eq('user_id', userId)
|
|
27
|
+
.eq('is_system_managed', true)
|
|
28
|
+
.limit(1);
|
|
29
|
+
|
|
30
|
+
if (existingRules && existingRules.length > 0) {
|
|
31
|
+
return { success: true, installed: false };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
logger.info(`Seeding default rules for user ${userId}`);
|
|
35
|
+
|
|
36
|
+
let totalRulesCreated = 0;
|
|
37
|
+
|
|
38
|
+
for (const rule of ALL_DEFAULT_RULES) {
|
|
39
|
+
// Check if rule already exists (by rule_template_id)
|
|
40
|
+
const { data: existingRule } = await this.supabase
|
|
41
|
+
.from('rules')
|
|
42
|
+
.select('id')
|
|
43
|
+
.eq('user_id', userId)
|
|
44
|
+
.eq('rule_template_id', rule.id)
|
|
45
|
+
.single();
|
|
46
|
+
|
|
47
|
+
if (existingRule) continue;
|
|
48
|
+
|
|
49
|
+
const { error } = await this.supabase
|
|
50
|
+
.from('rules')
|
|
51
|
+
.insert({
|
|
52
|
+
user_id: userId,
|
|
53
|
+
name: rule.name,
|
|
54
|
+
description: rule.description,
|
|
55
|
+
intent: rule.intent,
|
|
56
|
+
priority: rule.priority,
|
|
57
|
+
condition: rule.condition as any,
|
|
58
|
+
actions: rule.actions as any,
|
|
59
|
+
instructions: rule.instructions,
|
|
60
|
+
is_enabled: rule.is_enabled_by_default, // Default enable state from rule
|
|
61
|
+
category: rule.category,
|
|
62
|
+
rule_template_id: rule.id,
|
|
63
|
+
is_system_managed: true
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (error) {
|
|
67
|
+
logger.error(`Failed to create rule '${rule.id}'`, error);
|
|
68
|
+
// Continue with other rules instead of failing entirely
|
|
69
|
+
} else {
|
|
70
|
+
totalRulesCreated++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
logger.info(`Successfully seeded ${totalRulesCreated} default rules for user ${userId}`);
|
|
75
|
+
return { success: true, installed: true };
|
|
76
|
+
|
|
77
|
+
} catch (error: any) {
|
|
78
|
+
logger.error('Failed to seed default rules', error);
|
|
79
|
+
return { success: false, installed: false };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get singleton instance (convenience)
|
|
86
|
+
*/
|
|
87
|
+
let defaultInstance: DefaultRuleService | null = null;
|
|
88
|
+
|
|
89
|
+
export function getDefaultRuleService(supabase: SupabaseClient): DefaultRuleService {
|
|
90
|
+
if (!defaultInstance) {
|
|
91
|
+
defaultInstance = new DefaultRuleService(supabase);
|
|
92
|
+
}
|
|
93
|
+
return defaultInstance;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Export legacy name for backward compatibility during transition
|
|
97
|
+
export const RulePackService = DefaultRuleService;
|
|
98
|
+
export const getRulePackService = getDefaultRuleService;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development Rules
|
|
3
|
+
*
|
|
4
|
+
* Rules for software engineers and technical teams:
|
|
5
|
+
* - System alert prioritization
|
|
6
|
+
* - CI/CD and monitoring notifications
|
|
7
|
+
* - Code review highlights
|
|
8
|
+
* - Project management tool organization
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { DefaultRule } from './types.js';
|
|
12
|
+
|
|
13
|
+
export const DEVELOPMENT_RULES: DefaultRule[] = [
|
|
14
|
+
{
|
|
15
|
+
id: 'system-alerts-prioritizer',
|
|
16
|
+
category: 'development',
|
|
17
|
+
name: '🚨 System Alerts Prioritizer',
|
|
18
|
+
intent: 'Prioritize critical system alerts and incidents',
|
|
19
|
+
description: 'Stars critical alerts from AWS, Datadog, Sentry, PagerDuty while archiving info-level notifications',
|
|
20
|
+
condition: {
|
|
21
|
+
or: [
|
|
22
|
+
{
|
|
23
|
+
sender_domain: 'aws.amazon.com',
|
|
24
|
+
contains_keywords: ['critical', 'down', 'outage', 'incident']
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
sender_domain: 'datadoghq.com',
|
|
28
|
+
contains_keywords: ['alert', 'critical', 'error rate']
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
sender_domain: 'sentry.io',
|
|
32
|
+
contains_keywords: ['new issue', 'regression', 'error']
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
sender_domain: 'pagerduty.com',
|
|
36
|
+
contains_keywords: ['triggered', 'incident']
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
actions: ['star', 'important', 'pin'],
|
|
41
|
+
priority: 100,
|
|
42
|
+
is_enabled_by_default: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'system-info-organizer',
|
|
46
|
+
category: 'development',
|
|
47
|
+
name: '⚠️ System Info Organizer',
|
|
48
|
+
intent: 'Archive non-critical system notifications',
|
|
49
|
+
description: 'Archives info and warning level alerts from monitoring tools',
|
|
50
|
+
condition: {
|
|
51
|
+
or: [
|
|
52
|
+
{
|
|
53
|
+
sender_domain: 'aws.amazon.com',
|
|
54
|
+
not: {
|
|
55
|
+
contains_keywords: ['critical', 'down', 'outage']
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
sender_domain: 'datadoghq.com',
|
|
60
|
+
contains_keywords: ['info', 'warning', 'recovered']
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
sender_domain: 'circleci.com'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
sender_domain: 'github.com',
|
|
67
|
+
contains_keywords: ['build', 'workflow']
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
actions: ['label:Logs', 'archive'],
|
|
72
|
+
priority: 20,
|
|
73
|
+
is_enabled_by_default: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'project-management-organizer',
|
|
77
|
+
category: 'development',
|
|
78
|
+
name: '🔨 Project Management Organizer',
|
|
79
|
+
intent: 'Organize Jira, GitHub, and project management notifications',
|
|
80
|
+
description: 'Archives project management notifications unless you\'re directly assigned',
|
|
81
|
+
condition: {
|
|
82
|
+
or: [
|
|
83
|
+
{
|
|
84
|
+
sender_domain: 'atlassian.net',
|
|
85
|
+
not: {
|
|
86
|
+
contains_keywords: ['assigned to you', 'mentioned you']
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
sender_domain: 'github.com',
|
|
91
|
+
not: {
|
|
92
|
+
contains_keywords: ['assigned', 'review requested', '@']
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
sender_domain: 'asana.com',
|
|
97
|
+
not: {
|
|
98
|
+
contains_keywords: ['assigned to you']
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
sender_domain: 'trello.com'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
sender_domain: 'monday.com'
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
actions: ['label:Tools', 'archive'],
|
|
110
|
+
priority: 15,
|
|
111
|
+
is_enabled_by_default: true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'code-reviews-highlighter',
|
|
115
|
+
category: 'development',
|
|
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
|
+
];
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email Organization Rules
|
|
3
|
+
*
|
|
4
|
+
* Rules for keeping inbox clean through automated organization:
|
|
5
|
+
* - Newsletter management
|
|
6
|
+
* - Cold outreach filtering
|
|
7
|
+
* - CC/FYI organization
|
|
8
|
+
* - Receipt labeling
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { DefaultRule } from './types.js';
|
|
12
|
+
|
|
13
|
+
export const EMAIL_ORG_RULES: DefaultRule[] = [
|
|
14
|
+
{
|
|
15
|
+
id: 'newsletters-auto-archive',
|
|
16
|
+
category: 'email_organization',
|
|
17
|
+
name: '📚 Newsletter Sweeper',
|
|
18
|
+
intent: 'Keep newsletters organized and out of main inbox',
|
|
19
|
+
description: 'Automatically archives newsletters and mass-marketing emails so you can read them later without inbox clutter',
|
|
20
|
+
condition: {
|
|
21
|
+
category: 'newsletter',
|
|
22
|
+
confidence_gt: 0.7
|
|
23
|
+
},
|
|
24
|
+
actions: ['archive'],
|
|
25
|
+
priority: 10,
|
|
26
|
+
is_enabled_by_default: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'cold-outreach-filter',
|
|
30
|
+
category: 'email_organization',
|
|
31
|
+
name: '❄️ Cold Outreach Filter',
|
|
32
|
+
intent: 'Filter unsolicited sales and marketing emails',
|
|
33
|
+
description: 'Identifies and archives cold emails from unknown senders with sales language',
|
|
34
|
+
condition: {
|
|
35
|
+
or: [
|
|
36
|
+
{
|
|
37
|
+
// High-confidence promotional emails that are first contact
|
|
38
|
+
category: 'promotional',
|
|
39
|
+
confidence_gt: 0.85,
|
|
40
|
+
is_first_contact: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
// Spam category (very high confidence)
|
|
44
|
+
category: 'spam',
|
|
45
|
+
confidence_gt: 0.9
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
actions: ['archive'],
|
|
50
|
+
priority: 20,
|
|
51
|
+
is_enabled_by_default: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'cc-fyi-organizer',
|
|
55
|
+
category: 'email_organization',
|
|
56
|
+
name: '👀 CC/FYI Organizer',
|
|
57
|
+
intent: 'Keep inbox focused on direct communications',
|
|
58
|
+
description: 'Archives emails where you\'re CC\'d in group threads, keeping your inbox for direct messages',
|
|
59
|
+
condition: {
|
|
60
|
+
recipient_type: 'cc',
|
|
61
|
+
recipient_count_gt: 3 // Group emails (more than 3 recipients)
|
|
62
|
+
},
|
|
63
|
+
actions: ['archive'],
|
|
64
|
+
priority: 5,
|
|
65
|
+
is_enabled_by_default: true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'receipts-organizer',
|
|
69
|
+
category: 'email_organization',
|
|
70
|
+
name: '🧾 Receipt Organizer',
|
|
71
|
+
intent: 'Auto-label receipts for easy tax and expense retrieval',
|
|
72
|
+
description: 'Labels transactional emails (receipts, invoices, confirmations) for easy searching',
|
|
73
|
+
condition: {
|
|
74
|
+
category: 'transactional',
|
|
75
|
+
contains_keywords: ['receipt', 'invoice', 'payment', 'order confirmation', 'purchase'],
|
|
76
|
+
confidence_gt: 0.75
|
|
77
|
+
},
|
|
78
|
+
actions: ['label:Finance/Receipts'],
|
|
79
|
+
priority: 15,
|
|
80
|
+
is_enabled_by_default: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'social-notifications-archiver',
|
|
84
|
+
category: 'email_organization',
|
|
85
|
+
name: '🔔 Social Media Archiver',
|
|
86
|
+
intent: 'Archive social media notifications',
|
|
87
|
+
description: 'Automatically archives LinkedIn, Twitter, and other social notifications',
|
|
88
|
+
condition: {
|
|
89
|
+
category: 'social',
|
|
90
|
+
confidence_gt: 0.8
|
|
91
|
+
},
|
|
92
|
+
actions: ['archive'],
|
|
93
|
+
priority: 5,
|
|
94
|
+
is_enabled_by_default: true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'calendar-responses-cleaner',
|
|
98
|
+
category: 'email_organization',
|
|
99
|
+
name: '📅 Calendar Response Cleaner',
|
|
100
|
+
intent: 'Clean up calendar accept/decline notifications',
|
|
101
|
+
description: 'Deletes automatic calendar responses that don\'t contain custom messages',
|
|
102
|
+
condition: {
|
|
103
|
+
contains_keywords: ['accepted:', 'declined:', 'tentative:'],
|
|
104
|
+
not: {
|
|
105
|
+
recipient_type: 'to' // Don't delete if you're the only recipient
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
actions: ['delete'],
|
|
109
|
+
priority: 10,
|
|
110
|
+
is_enabled_by_default: false // Disabled by default - deletion is aggressive
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'drive-shares-organizer',
|
|
114
|
+
category: 'email_organization',
|
|
115
|
+
name: '📂 Drive Share Organizer',
|
|
116
|
+
intent: 'Archive Google Drive/Docs share notifications',
|
|
117
|
+
description: 'Archives notifications about shared documents (usually redundant)',
|
|
118
|
+
condition: {
|
|
119
|
+
sender_domain: 'google.com',
|
|
120
|
+
contains_keywords: ['shared', 'document', 'commented on', 'mentioned you in']
|
|
121
|
+
},
|
|
122
|
+
actions: ['label:Drive', 'archive'],
|
|
123
|
+
priority: 5,
|
|
124
|
+
is_enabled_by_default: true
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'meeting-recordings-archiver',
|
|
128
|
+
category: 'email_organization',
|
|
129
|
+
name: '📹 Meeting Recording Archiver',
|
|
130
|
+
intent: 'Archive meeting recordings and transcripts',
|
|
131
|
+
description: 'Automatically archives Zoom, Teams, and AI note-taker recordings',
|
|
132
|
+
condition: {
|
|
133
|
+
or: [
|
|
134
|
+
{
|
|
135
|
+
sender_domain: 'zoom.us',
|
|
136
|
+
contains_keywords: ['recording', 'cloud recording']
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
sender_domain: 'microsoft.com',
|
|
140
|
+
contains_keywords: ['recording', 'teams recording']
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
sender_domain: 'fireflies.ai'
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
sender_domain: 'otter.ai'
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
actions: ['label:Recordings', 'archive'],
|
|
151
|
+
priority: 10,
|
|
152
|
+
is_enabled_by_default: true
|
|
153
|
+
}
|
|
154
|
+
];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Rules Index
|
|
3
|
+
*
|
|
4
|
+
* Exports all default rules organized by category.
|
|
5
|
+
* Rules are now flat arrays grouped by category instead of packs.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { DefaultRule } from './types.js';
|
|
9
|
+
import { EMAIL_ORG_RULES } from './emailOrg.js';
|
|
10
|
+
import { PRIORITY_RULES } from './priority.js';
|
|
11
|
+
import { DEVELOPMENT_RULES } from './development.js';
|
|
12
|
+
import { SALES_BUSINESS_RULES } from './salesBusiness.js';
|
|
13
|
+
import { OPERATIONS_RULES } from './operations.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* All default rules available in the system.
|
|
17
|
+
* This is a flat array that can be filtered/searched as needed.
|
|
18
|
+
*/
|
|
19
|
+
export const ALL_DEFAULT_RULES: DefaultRule[] = [
|
|
20
|
+
...EMAIL_ORG_RULES,
|
|
21
|
+
...PRIORITY_RULES,
|
|
22
|
+
...DEVELOPMENT_RULES,
|
|
23
|
+
...SALES_BUSINESS_RULES,
|
|
24
|
+
...OPERATIONS_RULES,
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
// Re-export types for convenience
|
|
28
|
+
export type { DefaultRule, RuleCategory, EmailCategory, EmailAction, EnhancedRuleCondition } from './types.js';
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations Rules
|
|
3
|
+
*
|
|
4
|
+
* Rules for support, operations, and customer success teams:
|
|
5
|
+
* - Support ticket organization
|
|
6
|
+
* - System monitoring alerts
|
|
7
|
+
* - Internal announcements
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { DefaultRule } from './types.js';
|
|
11
|
+
|
|
12
|
+
export const OPERATIONS_RULES: DefaultRule[] = [
|
|
13
|
+
{
|
|
14
|
+
id: 'support-tickets-organizer',
|
|
15
|
+
category: 'operations',
|
|
16
|
+
name: '🎫 Support Ticket Organizer',
|
|
17
|
+
intent: 'Organize customer support tickets and cases',
|
|
18
|
+
description: 'Labels support tickets from Zendesk, Intercom, and other support tools',
|
|
19
|
+
condition: {
|
|
20
|
+
or: [
|
|
21
|
+
{
|
|
22
|
+
sender_domain: 'zendesk.com'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
sender_domain: 'intercom.io'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
sender_domain: 'freshdesk.com'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
contains_keywords: ['ticket', 'case created', 'support request', 'customer inquiry']
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
category: 'support',
|
|
35
|
+
confidence_gt: 0.7
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
actions: ['label:Support'],
|
|
40
|
+
priority: 80,
|
|
41
|
+
is_enabled_by_default: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'urgent-tickets-highlighter',
|
|
45
|
+
category: 'operations',
|
|
46
|
+
name: '🚨 Urgent Ticket Highlighter',
|
|
47
|
+
intent: 'Highlight high-priority and urgent customer issues',
|
|
48
|
+
description: 'Stars urgent support tickets that need immediate attention',
|
|
49
|
+
condition: {
|
|
50
|
+
category: 'support',
|
|
51
|
+
or: [
|
|
52
|
+
{
|
|
53
|
+
contains_keywords: ['urgent', 'emergency', 'critical', 'down', 'not working']
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
ai_priority: 'High'
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
actions: ['star', 'important'],
|
|
61
|
+
priority: 100,
|
|
62
|
+
is_enabled_by_default: true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'system-monitoring-organizer',
|
|
66
|
+
category: 'operations',
|
|
67
|
+
name: '⚠️ System Alerts Organizer',
|
|
68
|
+
intent: 'Organize system monitoring and uptime alerts',
|
|
69
|
+
description: 'Labels system alerts while starring critical incidents',
|
|
70
|
+
condition: {
|
|
71
|
+
or: [
|
|
72
|
+
{
|
|
73
|
+
sender_domain: 'pingdom.com'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
sender_domain: 'uptimerobot.com'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
sender_domain: 'statuspage.io'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
sender_domain: 'datadog.com'
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
actions: ['label:Monitoring'],
|
|
87
|
+
priority: 70,
|
|
88
|
+
is_enabled_by_default: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'critical-system-alerts-highlighter',
|
|
92
|
+
category: 'operations',
|
|
93
|
+
name: '🔥 Critical Alert Highlighter',
|
|
94
|
+
intent: 'Highlight critical system incidents',
|
|
95
|
+
description: 'Stars critical alerts that indicate system downtime or major issues',
|
|
96
|
+
condition: {
|
|
97
|
+
or: [
|
|
98
|
+
{
|
|
99
|
+
sender_domain: 'pingdom.com',
|
|
100
|
+
contains_keywords: ['down', 'offline']
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
sender_domain: 'datadog.com',
|
|
104
|
+
contains_keywords: ['critical', 'incident']
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
actions: ['star', 'important', 'pin'],
|
|
109
|
+
priority: 100,
|
|
110
|
+
is_enabled_by_default: true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'internal-announcements',
|
|
114
|
+
category: 'operations',
|
|
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
|
+
];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Priority Alert Rules
|
|
3
|
+
*
|
|
4
|
+
* Rules for highlighting important and urgent communications:
|
|
5
|
+
* - VIP client/customer prioritization
|
|
6
|
+
* - Direct questions requiring responses
|
|
7
|
+
* - Legal documents and contracts
|
|
8
|
+
* - Travel itineraries
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { DefaultRule } from './types.js';
|
|
12
|
+
|
|
13
|
+
export const PRIORITY_RULES: DefaultRule[] = [
|
|
14
|
+
{
|
|
15
|
+
id: 'vip-clients-prioritizer',
|
|
16
|
+
category: 'priority_alerts',
|
|
17
|
+
name: '⭐ VIP Client Prioritizer',
|
|
18
|
+
intent: 'Star and prioritize emails from key clients and partners',
|
|
19
|
+
description: 'Automatically highlights emails from VIP contacts and important clients',
|
|
20
|
+
condition: {
|
|
21
|
+
or: [
|
|
22
|
+
{
|
|
23
|
+
sender_is_vip: true // From VIP list (requires VIP management feature)
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
category: 'client',
|
|
27
|
+
ai_priority: 'High'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
actions: ['star', 'important'],
|
|
32
|
+
priority: 100,
|
|
33
|
+
is_enabled_by_default: true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'direct-questions-highlighter',
|
|
37
|
+
category: 'priority_alerts',
|
|
38
|
+
name: '⚡ Direct Questions Highlighter',
|
|
39
|
+
intent: 'Highlight emails that require your direct input',
|
|
40
|
+
description: 'Identifies emails where you\'re the only recipient and a response is clearly needed',
|
|
41
|
+
condition: {
|
|
42
|
+
recipient_type: 'to',
|
|
43
|
+
recipient_count_gt: 0, // Only sent to you
|
|
44
|
+
contains_keywords: ['?', 'your input', 'your thoughts', 'need your', 'awaiting your', 'question', 'wondering', 'can you', 'could you'],
|
|
45
|
+
not: {
|
|
46
|
+
category: 'newsletter' // Exclude automated newsletters
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
actions: ['important'],
|
|
50
|
+
priority: 90,
|
|
51
|
+
is_enabled_by_default: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'travel-itineraries-organizer',
|
|
55
|
+
category: 'priority_alerts',
|
|
56
|
+
name: '✈️ Travel Organizer',
|
|
57
|
+
intent: 'Organize flight confirmations, hotel bookings, and itineraries',
|
|
58
|
+
description: 'Labels travel-related emails for easy access before trips',
|
|
59
|
+
condition: {
|
|
60
|
+
or: [
|
|
61
|
+
{
|
|
62
|
+
sender_domain: 'delta.com'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
sender_domain: 'united.com'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
sender_domain: 'aa.com'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
sender_domain: 'hilton.com'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
sender_domain: 'marriott.com'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
sender_domain: 'airbnb.com'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
contains_keywords: ['itinerary', 'flight confirmation', 'booking confirmation', 'reservation confirmed']
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
actions: ['label:Travel', 'star'],
|
|
85
|
+
priority: 70,
|
|
86
|
+
is_enabled_by_default: true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'legal-contracts-highlighter',
|
|
90
|
+
category: 'priority_alerts',
|
|
91
|
+
name: '⚖️ Legal & Contracts Highlighter',
|
|
92
|
+
intent: 'Highlight important legal documents and contracts',
|
|
93
|
+
description: 'Stars emails containing contracts, NDAs, and legal documents requiring signature',
|
|
94
|
+
condition: {
|
|
95
|
+
or: [
|
|
96
|
+
{
|
|
97
|
+
sender_domain: 'docusign.com'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
sender_domain: 'hellosign.com'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
sender_domain: 'pandadoc.com'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
contains_keywords: ['nda', 'agreement', 'contract', 'sign', 'signature required', 'proposal', 'quote']
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
actions: ['label:Legal', 'star'],
|
|
111
|
+
priority: 95,
|
|
112
|
+
is_enabled_by_default: true
|
|
113
|
+
}
|
|
114
|
+
];
|