-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.js
More file actions
102 lines (86 loc) · 3.15 KB
/
config.js
File metadata and controls
102 lines (86 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
* Configuration for Outlook Assistant Server
*
* Token-efficient configuration with field presets and response limits.
*/
const path = require('path');
const os = require('os');
// Import new utility modules
const {
FIELD_PRESETS,
FOLDER_FIELDS,
getEmailFields,
getFolderFields,
} = require('./utils/field-presets');
const { VERBOSITY, DEFAULT_LIMITS } = require('./utils/response-formatter');
// Ensure we have a home directory path — never fall back to /tmp (world-readable)
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir();
if (!homeDir) {
throw new Error(
'Cannot determine home directory. Set HOME or USERPROFILE environment variable.'
);
}
module.exports = {
// Server information
SERVER_NAME: 'outlook-assistant',
SERVER_VERSION: require('./package.json').version,
// Test mode setting
USE_TEST_MODE: process.env.USE_TEST_MODE === 'true',
// Authentication configuration
AUTH_CONFIG: {
clientId: process.env.OUTLOOK_CLIENT_ID || '',
clientSecret: process.env.OUTLOOK_CLIENT_SECRET || '',
redirectUri: 'http://localhost:3333/auth/callback',
scopes: [
'offline_access',
'User.Read',
'Mail.Read',
'Mail.ReadWrite',
'Mail.Send',
'Calendars.Read',
'Calendars.ReadWrite',
'Contacts.Read',
'Contacts.ReadWrite',
'People.Read',
'MailboxSettings.ReadWrite',
// Org-dependent scopes (work/school accounts only):
// 'Mail.Read.Shared', // access-shared-mailbox tool
// 'Place.Read.All', // find-meeting-rooms tool
],
tokenStorePath: path.join(homeDir, '.outlook-assistant-tokens.json'),
authServerUrl: 'http://localhost:3333',
deviceCodeEndpoint:
'https://login.microsoftonline.com/common/oauth2/v2.0/devicecode',
tokenEndpoint: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
defaultAuthMethod: process.env.OUTLOOK_AUTH_METHOD || 'device-code',
},
// Microsoft Graph API
GRAPH_API_ENDPOINT: 'https://graph.microsoft.com/v1.0/',
// Calendar constants
CALENDAR_SELECT_FIELDS:
'id,subject,bodyPreview,start,end,location,organizer,attendees,isAllDay,isCancelled',
// Email field presets (use getEmailFields() for dynamic selection)
FIELD_PRESETS,
getEmailFields,
// Legacy email fields (kept for backward compatibility)
EMAIL_SELECT_FIELDS: getEmailFields('list'),
EMAIL_DETAIL_FIELDS: getEmailFields('read'),
EMAIL_FORENSIC_FIELDS: getEmailFields('forensic'),
EMAIL_EXPORT_FIELDS: getEmailFields('export'),
// Folder field presets
FOLDER_FIELDS,
getFolderFields,
// Verbosity levels for response formatting
VERBOSITY,
// Default limits for token efficiency
DEFAULT_LIMITS,
// Pagination (updated to use DEFAULT_LIMITS)
DEFAULT_PAGE_SIZE: DEFAULT_LIMITS.listEmails,
MAX_RESULT_COUNT: 100, // Increased for batch operations
// Search defaults (reduced for token efficiency)
DEFAULT_SEARCH_RESULTS: DEFAULT_LIMITS.searchEmails,
// Immutable IDs (opt-in: IDs persist through folder moves)
USE_IMMUTABLE_IDS: process.env.OUTLOOK_IMMUTABLE_IDS === 'true',
// Timezone
DEFAULT_TIMEZONE: 'Australia/Melbourne', // Updated for Nathan's timezone
};