@jbctechsolutions/mcp-outlook-mac 1.0.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.
- package/LICENSE +21 -0
- package/README.md +358 -0
- package/dist/applescript/account-repository.d.ts +29 -0
- package/dist/applescript/account-repository.d.ts.map +1 -0
- package/dist/applescript/account-repository.js +34 -0
- package/dist/applescript/account-repository.js.map +1 -0
- package/dist/applescript/account-scripts.d.ts +22 -0
- package/dist/applescript/account-scripts.d.ts.map +1 -0
- package/dist/applescript/account-scripts.js +176 -0
- package/dist/applescript/account-scripts.js.map +1 -0
- package/dist/applescript/calendar-manager.d.ts +45 -0
- package/dist/applescript/calendar-manager.d.ts.map +1 -0
- package/dist/applescript/calendar-manager.js +88 -0
- package/dist/applescript/calendar-manager.js.map +1 -0
- package/dist/applescript/calendar-writer.d.ts +38 -0
- package/dist/applescript/calendar-writer.d.ts.map +1 -0
- package/dist/applescript/calendar-writer.js +90 -0
- package/dist/applescript/calendar-writer.js.map +1 -0
- package/dist/applescript/content-readers.d.ts +93 -0
- package/dist/applescript/content-readers.d.ts.map +1 -0
- package/dist/applescript/content-readers.js +299 -0
- package/dist/applescript/content-readers.js.map +1 -0
- package/dist/applescript/executor.d.ts +62 -0
- package/dist/applescript/executor.d.ts.map +1 -0
- package/dist/applescript/executor.js +164 -0
- package/dist/applescript/executor.js.map +1 -0
- package/dist/applescript/index.d.ts +16 -0
- package/dist/applescript/index.d.ts.map +1 -0
- package/dist/applescript/index.js +25 -0
- package/dist/applescript/index.js.map +1 -0
- package/dist/applescript/mail-sender.d.ts +30 -0
- package/dist/applescript/mail-sender.d.ts.map +1 -0
- package/dist/applescript/mail-sender.js +53 -0
- package/dist/applescript/mail-sender.js.map +1 -0
- package/dist/applescript/parser.d.ts +215 -0
- package/dist/applescript/parser.d.ts.map +1 -0
- package/dist/applescript/parser.js +431 -0
- package/dist/applescript/parser.js.map +1 -0
- package/dist/applescript/repository.d.ts +58 -0
- package/dist/applescript/repository.d.ts.map +1 -0
- package/dist/applescript/repository.js +417 -0
- package/dist/applescript/repository.js.map +1 -0
- package/dist/applescript/scripts.d.ts +242 -0
- package/dist/applescript/scripts.d.ts.map +1 -0
- package/dist/applescript/scripts.js +1300 -0
- package/dist/applescript/scripts.js.map +1 -0
- package/dist/approval/hash.d.ts +26 -0
- package/dist/approval/hash.d.ts.map +1 -0
- package/dist/approval/hash.js +28 -0
- package/dist/approval/hash.js.map +1 -0
- package/dist/approval/index.d.ts +9 -0
- package/dist/approval/index.d.ts.map +1 -0
- package/dist/approval/index.js +8 -0
- package/dist/approval/index.js.map +1 -0
- package/dist/approval/token-manager.d.ts +48 -0
- package/dist/approval/token-manager.d.ts.map +1 -0
- package/dist/approval/token-manager.js +100 -0
- package/dist/approval/token-manager.js.map +1 -0
- package/dist/approval/types.d.ts +40 -0
- package/dist/approval/types.d.ts.map +1 -0
- package/dist/approval/types.js +8 -0
- package/dist/approval/types.js.map +1 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +38 -0
- package/dist/config.js.map +1 -0
- package/dist/database/connection.d.ts +73 -0
- package/dist/database/connection.d.ts.map +1 -0
- package/dist/database/connection.js +126 -0
- package/dist/database/connection.js.map +1 -0
- package/dist/database/index.d.ts +7 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +7 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/queries.d.ts +89 -0
- package/dist/database/queries.d.ts.map +1 -0
- package/dist/database/queries.js +422 -0
- package/dist/database/queries.js.map +1 -0
- package/dist/database/repository.d.ts +188 -0
- package/dist/database/repository.d.ts.map +1 -0
- package/dist/database/repository.js +187 -0
- package/dist/database/repository.js.map +1 -0
- package/dist/graph/auth/config.d.ts +33 -0
- package/dist/graph/auth/config.d.ts.map +1 -0
- package/dist/graph/auth/config.js +53 -0
- package/dist/graph/auth/config.js.map +1 -0
- package/dist/graph/auth/device-code-flow.d.ts +51 -0
- package/dist/graph/auth/device-code-flow.d.ts.map +1 -0
- package/dist/graph/auth/device-code-flow.js +176 -0
- package/dist/graph/auth/device-code-flow.js.map +1 -0
- package/dist/graph/auth/index.d.ts +9 -0
- package/dist/graph/auth/index.d.ts.map +1 -0
- package/dist/graph/auth/index.js +9 -0
- package/dist/graph/auth/index.js.map +1 -0
- package/dist/graph/auth/token-cache.d.ts +43 -0
- package/dist/graph/auth/token-cache.d.ts.map +1 -0
- package/dist/graph/auth/token-cache.js +99 -0
- package/dist/graph/auth/token-cache.js.map +1 -0
- package/dist/graph/client/cache.d.ts +65 -0
- package/dist/graph/client/cache.d.ts.map +1 -0
- package/dist/graph/client/cache.js +109 -0
- package/dist/graph/client/cache.js.map +1 -0
- package/dist/graph/client/graph-client.d.ts +150 -0
- package/dist/graph/client/graph-client.d.ts.map +1 -0
- package/dist/graph/client/graph-client.js +538 -0
- package/dist/graph/client/graph-client.js.map +1 -0
- package/dist/graph/client/index.d.ts +8 -0
- package/dist/graph/client/index.d.ts.map +1 -0
- package/dist/graph/client/index.js +8 -0
- package/dist/graph/client/index.js.map +1 -0
- package/dist/graph/content-readers.d.ts +102 -0
- package/dist/graph/content-readers.d.ts.map +1 -0
- package/dist/graph/content-readers.js +327 -0
- package/dist/graph/content-readers.js.map +1 -0
- package/dist/graph/index.d.ts +14 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +19 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/mailbox-adapter.d.ts +25 -0
- package/dist/graph/mailbox-adapter.d.ts.map +1 -0
- package/dist/graph/mailbox-adapter.js +56 -0
- package/dist/graph/mailbox-adapter.js.map +1 -0
- package/dist/graph/mappers/contact-mapper.d.ts +10 -0
- package/dist/graph/mappers/contact-mapper.d.ts.map +1 -0
- package/dist/graph/mappers/contact-mapper.js +19 -0
- package/dist/graph/mappers/contact-mapper.js.map +1 -0
- package/dist/graph/mappers/email-mapper.d.ts +10 -0
- package/dist/graph/mappers/email-mapper.d.ts.map +1 -0
- package/dist/graph/mappers/email-mapper.js +43 -0
- package/dist/graph/mappers/email-mapper.js.map +1 -0
- package/dist/graph/mappers/event-mapper.d.ts +10 -0
- package/dist/graph/mappers/event-mapper.d.ts.map +1 -0
- package/dist/graph/mappers/event-mapper.js +28 -0
- package/dist/graph/mappers/event-mapper.js.map +1 -0
- package/dist/graph/mappers/folder-mapper.d.ts +18 -0
- package/dist/graph/mappers/folder-mapper.d.ts.map +1 -0
- package/dist/graph/mappers/folder-mapper.js +50 -0
- package/dist/graph/mappers/folder-mapper.js.map +1 -0
- package/dist/graph/mappers/index.d.ts +12 -0
- package/dist/graph/mappers/index.d.ts.map +1 -0
- package/dist/graph/mappers/index.js +12 -0
- package/dist/graph/mappers/index.js.map +1 -0
- package/dist/graph/mappers/task-mapper.d.ts +16 -0
- package/dist/graph/mappers/task-mapper.d.ts.map +1 -0
- package/dist/graph/mappers/task-mapper.js +26 -0
- package/dist/graph/mappers/task-mapper.js.map +1 -0
- package/dist/graph/mappers/utils.d.ts +75 -0
- package/dist/graph/mappers/utils.d.ts.map +1 -0
- package/dist/graph/mappers/utils.js +130 -0
- package/dist/graph/mappers/utils.js.map +1 -0
- package/dist/graph/repository.d.ts +112 -0
- package/dist/graph/repository.d.ts.map +1 -0
- package/dist/graph/repository.js +549 -0
- package/dist/graph/repository.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1821 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/html-stripper.d.ts +43 -0
- package/dist/parsers/html-stripper.d.ts.map +1 -0
- package/dist/parsers/html-stripper.js +175 -0
- package/dist/parsers/html-stripper.js.map +1 -0
- package/dist/parsers/index.d.ts +8 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +8 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/olk15.d.ts +99 -0
- package/dist/parsers/olk15.d.ts.map +1 -0
- package/dist/parsers/olk15.js +364 -0
- package/dist/parsers/olk15.js.map +1 -0
- package/dist/tools/calendar.d.ts +203 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +251 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/contacts.d.ts +89 -0
- package/dist/tools/contacts.d.ts.map +1 -0
- package/dist/tools/contacts.js +129 -0
- package/dist/tools/contacts.js.map +1 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mail.d.ts +83 -0
- package/dist/tools/mail.d.ts.map +1 -0
- package/dist/tools/mail.js +217 -0
- package/dist/tools/mail.js.map +1 -0
- package/dist/tools/mailbox-organization.d.ts +337 -0
- package/dist/tools/mailbox-organization.d.ts.map +1 -0
- package/dist/tools/mailbox-organization.js +525 -0
- package/dist/tools/mailbox-organization.js.map +1 -0
- package/dist/tools/notes.d.ts +70 -0
- package/dist/tools/notes.d.ts.map +1 -0
- package/dist/tools/notes.js +132 -0
- package/dist/tools/notes.js.map +1 -0
- package/dist/tools/tasks.d.ts +70 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +122 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/types/calendar.d.ts +56 -0
- package/dist/types/calendar.d.ts.map +1 -0
- package/dist/types/calendar.js +14 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/contacts.d.ts +92 -0
- package/dist/types/contacts.d.ts.map +1 -0
- package/dist/types/contacts.js +37 -0
- package/dist/types/contacts.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mail.d.ts +87 -0
- package/dist/types/mail.d.ts.map +1 -0
- package/dist/types/mail.js +32 -0
- package/dist/types/mail.js.map +1 -0
- package/dist/types/notes.d.ts +22 -0
- package/dist/types/notes.d.ts.map +1 -0
- package/dist/types/notes.js +5 -0
- package/dist/types/notes.js.map +1 -0
- package/dist/types/tasks.d.ts +27 -0
- package/dist/types/tasks.d.ts.map +1 -0
- package/dist/types/tasks.js +5 -0
- package/dist/types/tasks.js.map +1 -0
- package/dist/utils/dates.d.ts +62 -0
- package/dist/utils/dates.d.ts.map +1 -0
- package/dist/utils/dates.js +90 -0
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/errors.d.ts +198 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +281 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OLK15 binary file parser.
|
|
3
|
+
*
|
|
4
|
+
* Parses Outlook for Mac's proprietary binary content files.
|
|
5
|
+
* These files contain email bodies, event details, contact information, etc.
|
|
6
|
+
*
|
|
7
|
+
* File types:
|
|
8
|
+
* - .olk15MsgSource / .olk15Message - Email content
|
|
9
|
+
* - .olk15Event - Calendar event details
|
|
10
|
+
* - .olk15Contact - Contact information
|
|
11
|
+
* - .olk15Note - Note content
|
|
12
|
+
* - .olk15Task - Task details
|
|
13
|
+
*
|
|
14
|
+
* The format is proprietary and not documented. This parser uses heuristics
|
|
15
|
+
* to extract text content and provides graceful fallbacks when parsing fails.
|
|
16
|
+
*/
|
|
17
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// Configuration
|
|
21
|
+
// =============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Default profile data directory path.
|
|
24
|
+
*/
|
|
25
|
+
export function getDefaultDataPath(profileName = 'Main Profile') {
|
|
26
|
+
const home = process.env.HOME ?? '';
|
|
27
|
+
return join(home, 'Library/Group Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles', profileName, 'Data');
|
|
28
|
+
}
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Binary Parsing Utilities
|
|
31
|
+
// =============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* Finds UTF-16LE encoded text in binary data.
|
|
34
|
+
* OLK15 files often store text as UTF-16LE.
|
|
35
|
+
*/
|
|
36
|
+
function findUtf16Text(buffer, minLength = 10) {
|
|
37
|
+
const results = [];
|
|
38
|
+
let start = -1;
|
|
39
|
+
let chars = [];
|
|
40
|
+
for (let i = 0; i < buffer.length - 1; i += 2) {
|
|
41
|
+
const char = buffer.readUInt16LE(i);
|
|
42
|
+
// Check if it's a printable character or common whitespace
|
|
43
|
+
if ((char >= 0x20 && char < 0x7f) || char === 0x0a || char === 0x0d || char === 0x09) {
|
|
44
|
+
if (start === -1)
|
|
45
|
+
start = i;
|
|
46
|
+
chars.push(String.fromCharCode(char));
|
|
47
|
+
}
|
|
48
|
+
else if (char === 0) {
|
|
49
|
+
// Null character - end of string
|
|
50
|
+
if (chars.length >= minLength) {
|
|
51
|
+
results.push(chars.join(''));
|
|
52
|
+
}
|
|
53
|
+
chars = [];
|
|
54
|
+
start = -1;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Non-printable, non-null - might be end of text section
|
|
58
|
+
if (chars.length >= minLength) {
|
|
59
|
+
results.push(chars.join(''));
|
|
60
|
+
}
|
|
61
|
+
chars = [];
|
|
62
|
+
start = -1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Don't forget the last string
|
|
66
|
+
if (chars.length >= minLength) {
|
|
67
|
+
results.push(chars.join(''));
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Finds UTF-8 encoded text in binary data.
|
|
73
|
+
*/
|
|
74
|
+
function findUtf8Text(buffer, minLength = 10) {
|
|
75
|
+
const results = [];
|
|
76
|
+
let start = -1;
|
|
77
|
+
let chars = [];
|
|
78
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
79
|
+
const byte = buffer[i];
|
|
80
|
+
if (byte !== undefined) {
|
|
81
|
+
// Check if it's a printable ASCII or common whitespace
|
|
82
|
+
if ((byte >= 0x20 && byte < 0x7f) || byte === 0x0a || byte === 0x0d || byte === 0x09) {
|
|
83
|
+
if (start === -1)
|
|
84
|
+
start = i;
|
|
85
|
+
chars.push(byte);
|
|
86
|
+
}
|
|
87
|
+
else if (byte === 0) {
|
|
88
|
+
// Null terminator
|
|
89
|
+
if (chars.length >= minLength) {
|
|
90
|
+
results.push(Buffer.from(chars).toString('utf8'));
|
|
91
|
+
}
|
|
92
|
+
chars = [];
|
|
93
|
+
start = -1;
|
|
94
|
+
}
|
|
95
|
+
else if (byte >= 0x80) {
|
|
96
|
+
// UTF-8 multi-byte - try to include
|
|
97
|
+
chars.push(byte);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// Control character - end of text
|
|
101
|
+
if (chars.length >= minLength) {
|
|
102
|
+
results.push(Buffer.from(chars).toString('utf8'));
|
|
103
|
+
}
|
|
104
|
+
chars = [];
|
|
105
|
+
start = -1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (chars.length >= minLength) {
|
|
110
|
+
results.push(Buffer.from(chars).toString('utf8'));
|
|
111
|
+
}
|
|
112
|
+
return results;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extracts the longest text block that looks like content.
|
|
116
|
+
*/
|
|
117
|
+
function extractPrimaryText(buffer) {
|
|
118
|
+
// Try UTF-16LE first (common in OLK15)
|
|
119
|
+
const utf16Texts = findUtf16Text(buffer, 20);
|
|
120
|
+
// Try UTF-8 as fallback
|
|
121
|
+
const utf8Texts = findUtf8Text(buffer, 20);
|
|
122
|
+
// Combine and find the longest meaningful text
|
|
123
|
+
const allTexts = [...utf16Texts, ...utf8Texts]
|
|
124
|
+
.filter((t) => t.trim().length > 0)
|
|
125
|
+
// eslint-disable-next-line no-control-regex
|
|
126
|
+
.filter((t) => !t.match(/^[\x00-\x1f\x7f-\x9f]+$/)) // Filter control chars
|
|
127
|
+
.sort((a, b) => b.length - a.length);
|
|
128
|
+
return allTexts[0] ?? null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Checks if text looks like HTML content.
|
|
132
|
+
*/
|
|
133
|
+
function looksLikeHtml(text) {
|
|
134
|
+
return /<\/?[a-z][\s\S]*>/i.test(text);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Finds HTML content in buffer.
|
|
138
|
+
*/
|
|
139
|
+
function findHtmlContent(buffer) {
|
|
140
|
+
const text = buffer.toString('utf8', 0, Math.min(buffer.length, 1024 * 1024));
|
|
141
|
+
// Look for HTML patterns
|
|
142
|
+
const htmlStart = text.search(/<html[^>]*>/i);
|
|
143
|
+
if (htmlStart >= 0) {
|
|
144
|
+
const htmlEnd = text.indexOf('</html>', htmlStart);
|
|
145
|
+
if (htmlEnd > htmlStart) {
|
|
146
|
+
return text.substring(htmlStart, htmlEnd + 7);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Look for body content
|
|
150
|
+
const bodyStart = text.search(/<body[^>]*>/i);
|
|
151
|
+
if (bodyStart >= 0) {
|
|
152
|
+
const bodyEnd = text.indexOf('</body>', bodyStart);
|
|
153
|
+
if (bodyEnd > bodyStart) {
|
|
154
|
+
return text.substring(bodyStart, bodyEnd + 7);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Parses an OLK15 file and extracts text content.
|
|
161
|
+
*/
|
|
162
|
+
export function parseOlk15File(filePath) {
|
|
163
|
+
try {
|
|
164
|
+
if (!existsSync(filePath)) {
|
|
165
|
+
return { success: false, text: null, html: null, error: 'File not found' };
|
|
166
|
+
}
|
|
167
|
+
const buffer = readFileSync(filePath);
|
|
168
|
+
if (buffer.length === 0) {
|
|
169
|
+
return { success: false, text: null, html: null, error: 'Empty file' };
|
|
170
|
+
}
|
|
171
|
+
// Try to find HTML content first
|
|
172
|
+
const html = findHtmlContent(buffer);
|
|
173
|
+
if (html != null) {
|
|
174
|
+
return { success: true, text: null, html };
|
|
175
|
+
}
|
|
176
|
+
// Extract text content
|
|
177
|
+
const text = extractPrimaryText(buffer);
|
|
178
|
+
if (text != null) {
|
|
179
|
+
// Check if the text is actually HTML
|
|
180
|
+
if (looksLikeHtml(text)) {
|
|
181
|
+
return { success: true, text: null, html: text };
|
|
182
|
+
}
|
|
183
|
+
return { success: true, text, html: null };
|
|
184
|
+
}
|
|
185
|
+
return { success: false, text: null, html: null, error: 'No text content found' };
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
189
|
+
return { success: false, text: null, html: null, error: message };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// =============================================================================
|
|
193
|
+
// Content Reader Implementations
|
|
194
|
+
// =============================================================================
|
|
195
|
+
/**
|
|
196
|
+
* OLK15 content reader for email bodies.
|
|
197
|
+
*/
|
|
198
|
+
export class Olk15EmailContentReader {
|
|
199
|
+
dataPath;
|
|
200
|
+
constructor(dataPath) {
|
|
201
|
+
this.dataPath = dataPath;
|
|
202
|
+
}
|
|
203
|
+
readEmailBody(dataFilePath) {
|
|
204
|
+
if (dataFilePath == null) {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
const fullPath = join(this.dataPath, dataFilePath);
|
|
208
|
+
const result = parseOlk15File(fullPath);
|
|
209
|
+
if (result.success) {
|
|
210
|
+
return result.html ?? result.text;
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* OLK15 content reader for calendar events.
|
|
217
|
+
*/
|
|
218
|
+
export class Olk15EventContentReader {
|
|
219
|
+
dataPath;
|
|
220
|
+
constructor(dataPath) {
|
|
221
|
+
this.dataPath = dataPath;
|
|
222
|
+
}
|
|
223
|
+
readEventDetails(dataFilePath) {
|
|
224
|
+
if (dataFilePath == null) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
const fullPath = join(this.dataPath, dataFilePath);
|
|
228
|
+
const result = parseOlk15File(fullPath);
|
|
229
|
+
if (!result.success) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const text = result.text ?? result.html ?? '';
|
|
233
|
+
// Basic extraction - can be improved with format knowledge
|
|
234
|
+
return {
|
|
235
|
+
title: this.extractTitle(text),
|
|
236
|
+
location: this.extractField(text, 'Location'),
|
|
237
|
+
description: text,
|
|
238
|
+
organizer: this.extractField(text, 'Organizer'),
|
|
239
|
+
attendees: [],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
extractTitle(text) {
|
|
243
|
+
// Try to find a subject/title line
|
|
244
|
+
const subjectMatch = text.match(/Subject:\s*(.+?)(?:\r?\n|$)/i);
|
|
245
|
+
if (subjectMatch?.[1] != null && subjectMatch[1].length > 0) {
|
|
246
|
+
return subjectMatch[1].trim();
|
|
247
|
+
}
|
|
248
|
+
// Use first line as title
|
|
249
|
+
const firstLine = text.split(/\r?\n/)[0]?.trim();
|
|
250
|
+
return firstLine != null && firstLine.length > 0 ? firstLine : null;
|
|
251
|
+
}
|
|
252
|
+
extractField(text, fieldName) {
|
|
253
|
+
const regex = new RegExp(`${fieldName}:\\s*(.+?)(?:\\r?\\n|$)`, 'i');
|
|
254
|
+
const match = text.match(regex);
|
|
255
|
+
return match?.[1]?.trim() ?? null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* OLK15 content reader for contacts.
|
|
260
|
+
*/
|
|
261
|
+
export class Olk15ContactContentReader {
|
|
262
|
+
dataPath;
|
|
263
|
+
constructor(dataPath) {
|
|
264
|
+
this.dataPath = dataPath;
|
|
265
|
+
}
|
|
266
|
+
readContactDetails(dataFilePath) {
|
|
267
|
+
if (dataFilePath == null) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const fullPath = join(this.dataPath, dataFilePath);
|
|
271
|
+
const result = parseOlk15File(fullPath);
|
|
272
|
+
if (!result.success) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
// Contact parsing would require understanding the binary format
|
|
276
|
+
// For now, return a basic structure
|
|
277
|
+
return {
|
|
278
|
+
firstName: null,
|
|
279
|
+
lastName: null,
|
|
280
|
+
middleName: null,
|
|
281
|
+
nickname: null,
|
|
282
|
+
company: null,
|
|
283
|
+
jobTitle: null,
|
|
284
|
+
department: null,
|
|
285
|
+
emails: [],
|
|
286
|
+
phones: [],
|
|
287
|
+
addresses: [],
|
|
288
|
+
notes: result.text,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* OLK15 content reader for tasks.
|
|
294
|
+
*/
|
|
295
|
+
export class Olk15TaskContentReader {
|
|
296
|
+
dataPath;
|
|
297
|
+
constructor(dataPath) {
|
|
298
|
+
this.dataPath = dataPath;
|
|
299
|
+
}
|
|
300
|
+
readTaskDetails(dataFilePath) {
|
|
301
|
+
if (dataFilePath == null) {
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
const fullPath = join(this.dataPath, dataFilePath);
|
|
305
|
+
const result = parseOlk15File(fullPath);
|
|
306
|
+
if (!result.success) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
body: result.text ?? result.html,
|
|
311
|
+
completedDate: null,
|
|
312
|
+
reminderDate: null,
|
|
313
|
+
categories: [],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* OLK15 content reader for notes.
|
|
319
|
+
*/
|
|
320
|
+
export class Olk15NoteContentReader {
|
|
321
|
+
dataPath;
|
|
322
|
+
constructor(dataPath) {
|
|
323
|
+
this.dataPath = dataPath;
|
|
324
|
+
}
|
|
325
|
+
readNoteDetails(dataFilePath) {
|
|
326
|
+
if (dataFilePath == null) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
const fullPath = join(this.dataPath, dataFilePath);
|
|
330
|
+
const result = parseOlk15File(fullPath);
|
|
331
|
+
if (!result.success) {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
const body = result.text ?? result.html ?? '';
|
|
335
|
+
const lines = body.split(/\r?\n/).filter((l) => l.trim().length > 0);
|
|
336
|
+
return {
|
|
337
|
+
title: lines[0] ?? null,
|
|
338
|
+
body,
|
|
339
|
+
preview: body.substring(0, 200),
|
|
340
|
+
createdDate: null,
|
|
341
|
+
categories: [],
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Creates content readers for all Outlook data types.
|
|
347
|
+
*/
|
|
348
|
+
export function createContentReaders(dataPath) {
|
|
349
|
+
return {
|
|
350
|
+
email: new Olk15EmailContentReader(dataPath),
|
|
351
|
+
event: new Olk15EventContentReader(dataPath),
|
|
352
|
+
contact: new Olk15ContactContentReader(dataPath),
|
|
353
|
+
task: new Olk15TaskContentReader(dataPath),
|
|
354
|
+
note: new Olk15NoteContentReader(dataPath),
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Creates content readers using the default profile path.
|
|
359
|
+
*/
|
|
360
|
+
export function createDefaultContentReaders(profileName) {
|
|
361
|
+
const dataPath = getDefaultDataPath(profileName);
|
|
362
|
+
return createContentReaders(dataPath);
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=olk15.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"olk15.js","sourceRoot":"","sources":["../../src/parsers/olk15.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,O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AAE;SACf,CAAC;IACJ,CAAC;CACF;AAiBD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,OAAO;QACL,KAAK,EAAE,IAAI,uBAAuB,CAAC,QAAQ,CAAC;QAC5C,KAAK,EAAE,IAAI,uBAAuB,CAAC,QAAQ,CAAC;QAC5C,OAAO,EAAE,IAAI,yBAAyB,CAAC,QAAQ,CAAC;QAChD,IAAI,EAAE,IAAI,sBAAsB,CAAC,QAAQ,CAAC;QAC1C,IAAI,EAAE,IAAI,sBAAsB,CAAC,QAAQ,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,WAAoB;IAC9D,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACjD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar-related MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for listing calendars, events, and searching.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import type { IRepository } from '../database/repository.js';
|
|
8
|
+
import type { CalendarFolder, EventSummary, Event, Attendee } from '../types/index.js';
|
|
9
|
+
export declare const ListCalendarsInput: z.ZodObject<{}, z.core.$strict>;
|
|
10
|
+
export declare const ListEventsInput: z.ZodObject<{
|
|
11
|
+
calendar_id: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
start_date: z.ZodOptional<z.ZodString>;
|
|
13
|
+
end_date: z.ZodOptional<z.ZodString>;
|
|
14
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export declare const GetEventInput: z.ZodObject<{
|
|
17
|
+
event_id: z.ZodNumber;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const SearchEventsInput: z.ZodObject<{
|
|
20
|
+
query: z.ZodString;
|
|
21
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const RespondToEventInput: z.ZodObject<{
|
|
24
|
+
event_id: z.ZodNumber;
|
|
25
|
+
response: z.ZodEnum<{
|
|
26
|
+
accept: "accept";
|
|
27
|
+
decline: "decline";
|
|
28
|
+
tentative: "tentative";
|
|
29
|
+
}>;
|
|
30
|
+
send_response: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export declare const RecurrenceInput: z.ZodObject<{
|
|
34
|
+
frequency: z.ZodEnum<{
|
|
35
|
+
daily: "daily";
|
|
36
|
+
weekly: "weekly";
|
|
37
|
+
monthly: "monthly";
|
|
38
|
+
yearly: "yearly";
|
|
39
|
+
}>;
|
|
40
|
+
interval: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
days_of_week: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
42
|
+
sunday: "sunday";
|
|
43
|
+
monday: "monday";
|
|
44
|
+
tuesday: "tuesday";
|
|
45
|
+
wednesday: "wednesday";
|
|
46
|
+
thursday: "thursday";
|
|
47
|
+
friday: "friday";
|
|
48
|
+
saturday: "saturday";
|
|
49
|
+
}>>>;
|
|
50
|
+
day_of_month: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
week_of_month: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
first: "first";
|
|
53
|
+
second: "second";
|
|
54
|
+
third: "third";
|
|
55
|
+
fourth: "fourth";
|
|
56
|
+
last: "last";
|
|
57
|
+
}>>;
|
|
58
|
+
day_of_week_monthly: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
sunday: "sunday";
|
|
60
|
+
monday: "monday";
|
|
61
|
+
tuesday: "tuesday";
|
|
62
|
+
wednesday: "wednesday";
|
|
63
|
+
thursday: "thursday";
|
|
64
|
+
friday: "friday";
|
|
65
|
+
saturday: "saturday";
|
|
66
|
+
}>>;
|
|
67
|
+
end: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"no_end">;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"end_date">;
|
|
71
|
+
date: z.ZodString;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"end_after_count">;
|
|
74
|
+
count: z.ZodNumber;
|
|
75
|
+
}, z.core.$strict>], "type">>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export declare const CreateEventInput: z.ZodObject<{
|
|
78
|
+
title: z.ZodString;
|
|
79
|
+
start_date: z.ZodString;
|
|
80
|
+
end_date: z.ZodString;
|
|
81
|
+
calendar_id: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
location: z.ZodOptional<z.ZodString>;
|
|
83
|
+
description: z.ZodOptional<z.ZodString>;
|
|
84
|
+
is_all_day: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
85
|
+
recurrence: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
frequency: z.ZodEnum<{
|
|
87
|
+
daily: "daily";
|
|
88
|
+
weekly: "weekly";
|
|
89
|
+
monthly: "monthly";
|
|
90
|
+
yearly: "yearly";
|
|
91
|
+
}>;
|
|
92
|
+
interval: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
days_of_week: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
94
|
+
sunday: "sunday";
|
|
95
|
+
monday: "monday";
|
|
96
|
+
tuesday: "tuesday";
|
|
97
|
+
wednesday: "wednesday";
|
|
98
|
+
thursday: "thursday";
|
|
99
|
+
friday: "friday";
|
|
100
|
+
saturday: "saturday";
|
|
101
|
+
}>>>;
|
|
102
|
+
day_of_month: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
week_of_month: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
first: "first";
|
|
105
|
+
second: "second";
|
|
106
|
+
third: "third";
|
|
107
|
+
fourth: "fourth";
|
|
108
|
+
last: "last";
|
|
109
|
+
}>>;
|
|
110
|
+
day_of_week_monthly: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
sunday: "sunday";
|
|
112
|
+
monday: "monday";
|
|
113
|
+
tuesday: "tuesday";
|
|
114
|
+
wednesday: "wednesday";
|
|
115
|
+
thursday: "thursday";
|
|
116
|
+
friday: "friday";
|
|
117
|
+
saturday: "saturday";
|
|
118
|
+
}>>;
|
|
119
|
+
end: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"no_end">;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"end_date">;
|
|
123
|
+
date: z.ZodString;
|
|
124
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
125
|
+
type: z.ZodLiteral<"end_after_count">;
|
|
126
|
+
count: z.ZodNumber;
|
|
127
|
+
}, z.core.$strict>], "type">>;
|
|
128
|
+
}, z.core.$strict>>;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
export type ListCalendarsParams = z.infer<typeof ListCalendarsInput>;
|
|
131
|
+
export type ListEventsParams = z.infer<typeof ListEventsInput>;
|
|
132
|
+
export type GetEventParams = z.infer<typeof GetEventInput>;
|
|
133
|
+
export type SearchEventsParams = z.infer<typeof SearchEventsInput>;
|
|
134
|
+
export type CreateEventParams = z.infer<typeof CreateEventInput>;
|
|
135
|
+
export type RecurrenceParams = z.infer<typeof RecurrenceInput>;
|
|
136
|
+
export type RespondToEventParams = z.infer<typeof RespondToEventInput>;
|
|
137
|
+
/**
|
|
138
|
+
* Result of creating a calendar event.
|
|
139
|
+
*/
|
|
140
|
+
export interface CreateEventResult {
|
|
141
|
+
readonly id: number;
|
|
142
|
+
readonly title: string;
|
|
143
|
+
readonly start_date: string;
|
|
144
|
+
readonly end_date: string;
|
|
145
|
+
readonly calendar_id: number | null;
|
|
146
|
+
readonly location: string | null;
|
|
147
|
+
readonly description: string | null;
|
|
148
|
+
readonly is_all_day: boolean;
|
|
149
|
+
readonly is_recurring: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Interface for reading event content from data files.
|
|
153
|
+
*/
|
|
154
|
+
export interface IEventContentReader {
|
|
155
|
+
/**
|
|
156
|
+
* Reads event details from the given data file path.
|
|
157
|
+
*/
|
|
158
|
+
readEventDetails(dataFilePath: string | null): EventDetails | null;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Event details from content file.
|
|
162
|
+
*/
|
|
163
|
+
export interface EventDetails {
|
|
164
|
+
readonly title: string | null;
|
|
165
|
+
readonly location: string | null;
|
|
166
|
+
readonly description: string | null;
|
|
167
|
+
readonly organizer: string | null;
|
|
168
|
+
readonly attendees: readonly Attendee[];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Default event content reader that returns null.
|
|
172
|
+
*/
|
|
173
|
+
export declare const nullEventContentReader: IEventContentReader;
|
|
174
|
+
/**
|
|
175
|
+
* Calendar tools implementation with dependency injection.
|
|
176
|
+
*/
|
|
177
|
+
export declare class CalendarTools {
|
|
178
|
+
private readonly repository;
|
|
179
|
+
private readonly contentReader;
|
|
180
|
+
constructor(repository: IRepository, contentReader?: IEventContentReader);
|
|
181
|
+
/**
|
|
182
|
+
* Lists all calendar folders.
|
|
183
|
+
*/
|
|
184
|
+
listCalendars(_params: ListCalendarsParams): CalendarFolder[];
|
|
185
|
+
/**
|
|
186
|
+
* Lists events with optional filtering.
|
|
187
|
+
*/
|
|
188
|
+
listEvents(params: ListEventsParams): EventSummary[];
|
|
189
|
+
/**
|
|
190
|
+
* Gets a single event by ID.
|
|
191
|
+
*/
|
|
192
|
+
getEvent(params: GetEventParams): Event | null;
|
|
193
|
+
/**
|
|
194
|
+
* Searches events by title (requires content reader).
|
|
195
|
+
* Note: Basic implementation - returns all events since title is in content files.
|
|
196
|
+
*/
|
|
197
|
+
searchEvents(params: SearchEventsParams): EventSummary[];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Creates calendar tools with the given repository.
|
|
201
|
+
*/
|
|
202
|
+
export declare function createCalendarTools(repository: IRepository, contentReader?: IEventContentReader): CalendarTools;
|
|
203
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/tools/calendar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,2BAA2B,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAOvF,eAAO,MAAM,kBAAkB,iCAAqB,CAAC;AAErD,eAAO,MAAM,eAAe;;;;;kBAW1B,CAAC;AAEH,eAAO,MAAM,aAAa;;kBAExB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;kBAS5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;kBAK9B,CAAC;AAkBH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqD1B,CAAC;AAMH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAY5B,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC/D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC3D,MAAM,MAAM,kBAA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