apple-mail-mcp 1.6.0 → 1.6.2
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/README.md +28 -0
- package/build/index.js +24 -3
- package/build/services/appleMailManager.d.ts +47 -1
- package/build/services/appleMailManager.d.ts.map +1 -1
- package/build/services/appleMailManager.js +225 -52
- package/build/types.d.ts +33 -0
- package/build/types.d.ts.map +1 -1
- package/build/utils/applescript.d.ts.map +1 -1
- package/build/utils/applescript.js +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,6 +149,27 @@ Search for messages matching criteria. Searches all accounts by default.
|
|
|
149
149
|
| `dateTo` | string | No | End date filter (e.g., "March 1, 2026") |
|
|
150
150
|
| `limit` | number | No | Max results (default: 50) |
|
|
151
151
|
|
|
152
|
+
**Large mailboxes & partial results.** Apple Mail's AppleScript bridge cannot
|
|
153
|
+
search very large IMAP/Gmail mailboxes (tens of thousands of messages) before
|
|
154
|
+
the Apple Event times out — empirically even reading the newest 20 messages of
|
|
155
|
+
a 44k-message mailbox takes ~45s. To avoid burning minutes only to return a
|
|
156
|
+
misleading empty result, an unscoped (all-mailboxes) search **skips** mailboxes
|
|
157
|
+
whose message count exceeds a threshold (default **5000**), enforces a
|
|
158
|
+
per-account time budget, and **reports** anything it skipped or that timed out
|
|
159
|
+
rather than silently returning nothing. When coverage is incomplete the result
|
|
160
|
+
includes an explicit warning, e.g.:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
⚠️ Partial results — this is NOT a confirmed "no such mail":
|
|
164
|
+
- skipped mailbox(es) too large to search via AppleScript: Gmail / All Mail (44287) — scope the search with `mailbox` + a `dateFrom`/`dateTo` window to target them
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
To search inside a large mailbox, scope the call with `mailbox` (and ideally a
|
|
168
|
+
`dateFrom`/`dateTo` window). Tune or disable the skip threshold with the
|
|
169
|
+
`APPLE_MAIL_MAX_SEARCH_MAILBOX` environment variable (default `5000`; set to `0`
|
|
170
|
+
to disable the guard and attempt every mailbox regardless of size).
|
|
171
|
+
([#24](https://github.com/sweetrb/apple-mail-mcp/issues/24))
|
|
172
|
+
|
|
152
173
|
---
|
|
153
174
|
|
|
154
175
|
#### `get-message`
|
|
@@ -778,6 +799,7 @@ The entrypoint is written as:
|
|
|
778
799
|
| No sending HTML email | Emails are sent as plain text; reading HTML content is supported |
|
|
779
800
|
| Attachments require absolute paths | File attachments must use full absolute paths (e.g., `/Users/me/file.pdf`) |
|
|
780
801
|
| No smart mailboxes | Cannot access Smart Mailboxes via AppleScript |
|
|
802
|
+
| Very large mailboxes not searchable | Apple Mail's AppleScript bridge times out on mailboxes with tens of thousands of messages, so unscoped `search-messages` skips mailboxes above `APPLE_MAIL_MAX_SEARCH_MAILBOX` (default 5000) and reports them as a partial result. Scope with `mailbox` + a date window to search inside one. ([#24](https://github.com/sweetrb/apple-mail-mcp/issues/24)) |
|
|
781
803
|
| In-memory templates | Email templates are not persisted across server restarts |
|
|
782
804
|
| Numeric-only message IDs | Message IDs must contain only digits (validated by schema) |
|
|
783
805
|
| Batch size cap | Batch operations are limited to 100 messages per request |
|
|
@@ -849,6 +871,12 @@ The `\\\\` in JSON becomes `\\` in the actual string, which represents a single
|
|
|
849
871
|
- Message IDs change if the message is moved between mailboxes
|
|
850
872
|
- Use `search-messages` to find the current message ID
|
|
851
873
|
|
|
874
|
+
### `search-messages` says "Partial results" or skips a mailbox
|
|
875
|
+
- This is expected for very large IMAP/Gmail mailboxes (e.g. Gmail's `All Mail`, `Important`): Apple Mail can't scan them via AppleScript before timing out, so they're skipped and named in the result rather than silently returning empty.
|
|
876
|
+
- To search inside one, scope the call with `mailbox` **and** a `dateFrom`/`dateTo` window.
|
|
877
|
+
- Raise or disable the threshold with `APPLE_MAIL_MAX_SEARCH_MAILBOX` (default `5000`; `0` disables the guard) — note that disabling it can make a single search take minutes.
|
|
878
|
+
- A `Partial results` warning means coverage was incomplete; it is **not** a confirmed "no such mail."
|
|
879
|
+
|
|
852
880
|
### "Account not found"
|
|
853
881
|
- Account names must match exactly (case-sensitive)
|
|
854
882
|
- Use `list-accounts` to see exact account names
|
package/build/index.js
CHANGED
|
@@ -136,14 +136,35 @@ server.tool("search-messages", {
|
|
|
136
136
|
dateTo: DATE_FILTER_SCHEMA.describe("End date filter (e.g., 'March 1, 2026')"),
|
|
137
137
|
limit: z.number().optional().describe("Maximum number of results (default: 50)"),
|
|
138
138
|
}, withErrorHandling(({ query, mailbox, account, limit = 50, dateFrom, dateTo, from, subject, isRead, isFlagged, }) => {
|
|
139
|
-
const messages = mailManager.
|
|
139
|
+
const { messages, diagnostics } = mailManager.searchMessagesWithDiagnostics(query, mailbox, account, limit, dateFrom, dateTo, from, subject, isRead, isFlagged);
|
|
140
|
+
// Build a coverage note when the search couldn't reach everything, so a
|
|
141
|
+
// caller never mistakes an incomplete search for a confirmed "no matches"
|
|
142
|
+
// (issue #24).
|
|
143
|
+
const coverageNotes = [];
|
|
144
|
+
if (diagnostics.timedOutAccounts.length > 0) {
|
|
145
|
+
coverageNotes.push(`timed out (no results) for account(s): ${diagnostics.timedOutAccounts.join(", ")}`);
|
|
146
|
+
}
|
|
147
|
+
if (diagnostics.skippedLargeMailboxes.length > 0) {
|
|
148
|
+
coverageNotes.push(`skipped mailbox(es) too large to search via AppleScript: ${diagnostics.skippedLargeMailboxes.join(", ")} — scope the search with \`mailbox\` + a \`dateFrom\`/\`dateTo\` window to target them`);
|
|
149
|
+
}
|
|
150
|
+
if (diagnostics.notSearchedMailboxes.length > 0) {
|
|
151
|
+
coverageNotes.push(`could not finish searching mailbox(es): ${diagnostics.notSearchedMailboxes.join(", ")}`);
|
|
152
|
+
}
|
|
153
|
+
const coverageBlock = coverageNotes.length > 0
|
|
154
|
+
? `\n\n⚠️ Partial results — this is NOT a confirmed "no such mail":\n${coverageNotes
|
|
155
|
+
.map((n) => ` - ${n}`)
|
|
156
|
+
.join("\n")}`
|
|
157
|
+
: "";
|
|
140
158
|
if (messages.length === 0) {
|
|
141
|
-
|
|
159
|
+
const base = diagnostics.partial
|
|
160
|
+
? "No messages found in the portions that were searched."
|
|
161
|
+
: "No messages found matching criteria";
|
|
162
|
+
return successResponse(`${base}${coverageBlock}`);
|
|
142
163
|
}
|
|
143
164
|
const messageList = messages
|
|
144
165
|
.map((m) => ` - ID: ${m.id} | ${m.dateReceived.toLocaleDateString()} | ${m.subject} (from: ${m.sender}) [${m.isRead ? "read" : "unread"}]`)
|
|
145
166
|
.join("\n");
|
|
146
|
-
return successResponse(`Found ${messages.length} message(s):\n${messageList}`);
|
|
167
|
+
return successResponse(`Found ${messages.length} message(s):\n${messageList}${coverageBlock}`);
|
|
147
168
|
}, "Error searching messages"));
|
|
148
169
|
// --- get-message ---
|
|
149
170
|
server.tool("get-message", {
|
|
@@ -12,7 +12,29 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @module services/appleMailManager
|
|
14
14
|
*/
|
|
15
|
-
import type { Message, MessageContent, Mailbox, Account, Attachment, HealthCheckResult, MailStats, BatchOperationResult, SyncStatus, RecentlyReceivedStats, MailRule, Contact, EmailTemplate, SerialEmailRecipient, SerialEmailResult } from "../types.js";
|
|
15
|
+
import type { Message, MessageContent, Mailbox, Account, Attachment, HealthCheckResult, MailStats, BatchOperationResult, SyncStatus, RecentlyReceivedStats, MailRule, Contact, EmailTemplate, SerialEmailRecipient, SerialEmailResult, SearchDiagnostics, SearchResult } from "../types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Merge a per-account SearchDiagnostics into an aggregate (all-accounts) one.
|
|
18
|
+
*
|
|
19
|
+
* Exported for unit testing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mergeSearchDiagnostics(into: SearchDiagnostics, from: SearchDiagnostics): void;
|
|
22
|
+
/**
|
|
23
|
+
* Split a per-account search payload into its message-list portion and parsed
|
|
24
|
+
* diagnostics. The AppleScript appends a trailer of the form:
|
|
25
|
+
*
|
|
26
|
+
* <messages>|||DIAG|||timedOut=true|||F|||skipped=Foo (9000)|||M||||||F|||notSearched=Bar|||M|||
|
|
27
|
+
*
|
|
28
|
+
* `skipped`/`notSearched` are `|||M|||`-separated mailbox names, each prefixed
|
|
29
|
+
* with the account name on the way out so the aggregate result is unambiguous.
|
|
30
|
+
*
|
|
31
|
+
* Exported (pure, no Mail.app dependency) for unit testing — this is the logic
|
|
32
|
+
* that turns a swallowed timeout into a visible partial result (issue #24).
|
|
33
|
+
*/
|
|
34
|
+
export declare function splitSearchDiagnostics(output: string, account: string): {
|
|
35
|
+
payload: string;
|
|
36
|
+
diagnostics: SearchDiagnostics;
|
|
37
|
+
};
|
|
16
38
|
/**
|
|
17
39
|
* Emits AppleScript that builds a date into the variable `varName` from numeric
|
|
18
40
|
* components.
|
|
@@ -127,6 +149,30 @@ export declare class AppleMailManager {
|
|
|
127
149
|
* @returns Array of matching messages
|
|
128
150
|
*/
|
|
129
151
|
searchMessages(query?: string, mailbox?: string, account?: string, limit?: number, dateFrom?: string, dateTo?: string, from?: string, subject?: string, isRead?: boolean, isFlagged?: boolean): Message[];
|
|
152
|
+
/**
|
|
153
|
+
* Search for messages, returning both the matches and diagnostics describing
|
|
154
|
+
* how complete the search was.
|
|
155
|
+
*
|
|
156
|
+
* This is the correctness fix for issue #24. The previous implementation ran
|
|
157
|
+
* an unbounded `messages of mb whose <predicate>` over every mailbox in an
|
|
158
|
+
* account; on large IMAP/Gmail mailboxes (tens of thousands of messages) that
|
|
159
|
+
* single Apple Event exceeded the timeout, the error was swallowed by a `try`,
|
|
160
|
+
* and the function returned a clean — but wrong — empty result. Callers/agents
|
|
161
|
+
* then confidently reported "no such mail."
|
|
162
|
+
*
|
|
163
|
+
* Two changes fix that:
|
|
164
|
+
* 1. Cheap count-guard: mailboxes larger than the scan threshold are skipped
|
|
165
|
+
* (Apple Mail can't search them before timing out anyway) and reported.
|
|
166
|
+
* 2. Honest diagnostics: per-account/per-mailbox timeouts are surfaced as a
|
|
167
|
+
* `partial` result with the affected scopes named, instead of an empty
|
|
168
|
+
* "success."
|
|
169
|
+
*/
|
|
170
|
+
searchMessagesWithDiagnostics(query?: string, mailbox?: string, account?: string, limit?: number, dateFrom?: string, dateTo?: string, from?: string, subject?: string, isRead?: boolean, isFlagged?: boolean): SearchResult;
|
|
171
|
+
/**
|
|
172
|
+
* Split a per-account search payload into its message list and the DIAG
|
|
173
|
+
* trailer, parse both, and return a SearchResult. See searchMessagesWithDiagnostics.
|
|
174
|
+
*/
|
|
175
|
+
private parseSearchResult;
|
|
130
176
|
/**
|
|
131
177
|
* Get a message by ID.
|
|
132
178
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appleMailManager.d.ts","sourceRoot":"","sources":["../../src/services/appleMailManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"appleMailManager.d.ts","sourceRoot":"","sources":["../../src/services/appleMailManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,SAAS,EAET,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACb,MAAM,YAAY,CAAC;AAwCpB;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAK7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE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G;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,SAAS,IAAI,QAAQ,EAAE;IAiCvB;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO;IA+B3D;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE;IA4DxC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,cAAc,CAAK;IAE3B;;OAEG;IACH,aAAa,IAAI,aAAa,EAAE;IAIhC;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAI7C;;OAEG;IACH,YAAY,CACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,CAAC,EAAE,MAAM,EAAE,EACb,EAAE,CAAC,EAAE,MAAM,EAAE,EACb,EAAE,CAAC,EAAE,MAAM,GACV,aAAa;IAOhB;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAInC;;OAEG;IACH,WAAW,CACT,EAAE,EAAE,MAAM,EACV,SAAS,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5E,OAAO;IAkBV;;OAEG;IACH,WAAW,IAAI,iBAAiB;IA8EhC;;OAEG;IACH,YAAY,IAAI,SAAS;IA4CzB;;;;;;;OAOG;IACH,wBAAwB,IAAI,qBAAqB;IAyEjD;;;;;;;;;OASG;IACH,aAAa,IAAI,UAAU;CA+D5B"}
|
|
@@ -19,6 +19,94 @@ import { homedir } from "os";
|
|
|
19
19
|
import { executeAppleScript } from "../utils/applescript.js";
|
|
20
20
|
import { parseMimeAttachments, extractMimeAttachment } from "../utils/mimeParse.js";
|
|
21
21
|
// =============================================================================
|
|
22
|
+
// Search Tuning (issue #24)
|
|
23
|
+
// =============================================================================
|
|
24
|
+
/**
|
|
25
|
+
* Mailboxes larger than this are skipped during an unscoped (all-mailboxes)
|
|
26
|
+
* search rather than scanned. Apple Mail's AppleScript bridge cannot search a
|
|
27
|
+
* mailbox of this size before the Apple Event timeout fires — empirically even
|
|
28
|
+
* reading the newest 20 messages of a 44k-message Gmail mailbox took ~47s — so
|
|
29
|
+
* attempting it only burns the time budget and yields a misleading empty
|
|
30
|
+
* result. `count of messages` is cheap (Mail keeps it cached), so the guard is
|
|
31
|
+
* effectively free. The skipped mailboxes are reported back to the caller.
|
|
32
|
+
*
|
|
33
|
+
* Override with APPLE_MAIL_MAX_SEARCH_MAILBOX (set to 0 to disable the guard).
|
|
34
|
+
*/
|
|
35
|
+
function getMailboxScanThreshold() {
|
|
36
|
+
const raw = process.env.APPLE_MAIL_MAX_SEARCH_MAILBOX;
|
|
37
|
+
if (raw !== undefined) {
|
|
38
|
+
const n = Number(raw);
|
|
39
|
+
if (Number.isFinite(n) && n >= 0)
|
|
40
|
+
return n;
|
|
41
|
+
}
|
|
42
|
+
return 5000;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Per-account wall-clock budget (seconds) enforced *inside* the AppleScript so
|
|
46
|
+
* a single account can't consume minutes. Kept comfortably below the osascript
|
|
47
|
+
* process timeout (see searchMessages) so the script exits and reports a
|
|
48
|
+
* partial result rather than being SIGKILLed with no diagnostics.
|
|
49
|
+
*/
|
|
50
|
+
const SEARCH_ACCOUNT_BUDGET_SECONDS = 30;
|
|
51
|
+
/** osascript process timeout for a per-account search (ms). */
|
|
52
|
+
const SEARCH_ACCOUNT_TIMEOUT_MS = 45000;
|
|
53
|
+
/** Separator between the message payload and the diagnostics trailer. */
|
|
54
|
+
const DIAG_MARKER = "|||DIAG|||";
|
|
55
|
+
/**
|
|
56
|
+
* Merge a per-account SearchDiagnostics into an aggregate (all-accounts) one.
|
|
57
|
+
*
|
|
58
|
+
* Exported for unit testing.
|
|
59
|
+
*/
|
|
60
|
+
export function mergeSearchDiagnostics(into, from) {
|
|
61
|
+
into.timedOutAccounts.push(...from.timedOutAccounts);
|
|
62
|
+
into.skippedLargeMailboxes.push(...from.skippedLargeMailboxes);
|
|
63
|
+
into.notSearchedMailboxes.push(...from.notSearchedMailboxes);
|
|
64
|
+
if (from.partial)
|
|
65
|
+
into.partial = true;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Split a per-account search payload into its message-list portion and parsed
|
|
69
|
+
* diagnostics. The AppleScript appends a trailer of the form:
|
|
70
|
+
*
|
|
71
|
+
* <messages>|||DIAG|||timedOut=true|||F|||skipped=Foo (9000)|||M||||||F|||notSearched=Bar|||M|||
|
|
72
|
+
*
|
|
73
|
+
* `skipped`/`notSearched` are `|||M|||`-separated mailbox names, each prefixed
|
|
74
|
+
* with the account name on the way out so the aggregate result is unambiguous.
|
|
75
|
+
*
|
|
76
|
+
* Exported (pure, no Mail.app dependency) for unit testing — this is the logic
|
|
77
|
+
* that turns a swallowed timeout into a visible partial result (issue #24).
|
|
78
|
+
*/
|
|
79
|
+
export function splitSearchDiagnostics(output, account) {
|
|
80
|
+
const markerIdx = output.lastIndexOf(DIAG_MARKER);
|
|
81
|
+
const payload = markerIdx >= 0 ? output.slice(0, markerIdx) : output;
|
|
82
|
+
const trailer = markerIdx >= 0 ? output.slice(markerIdx + DIAG_MARKER.length) : "";
|
|
83
|
+
const diagnostics = {
|
|
84
|
+
partial: false,
|
|
85
|
+
timedOutAccounts: [],
|
|
86
|
+
skippedLargeMailboxes: [],
|
|
87
|
+
notSearchedMailboxes: [],
|
|
88
|
+
};
|
|
89
|
+
if (trailer) {
|
|
90
|
+
const fields = trailer.split("|||F|||");
|
|
91
|
+
const getField = (key) => {
|
|
92
|
+
const f = fields.find((x) => x.startsWith(`${key}=`));
|
|
93
|
+
return f ? f.slice(key.length + 1) : "";
|
|
94
|
+
};
|
|
95
|
+
const splitList = (raw) => raw
|
|
96
|
+
.split("|||M|||")
|
|
97
|
+
.map((s) => s.trim())
|
|
98
|
+
.filter((s) => s.length > 0);
|
|
99
|
+
diagnostics.skippedLargeMailboxes = splitList(getField("skipped")).map((mb) => `${account} / ${mb}`);
|
|
100
|
+
diagnostics.notSearchedMailboxes = splitList(getField("notSearched")).map((mb) => `${account} / ${mb}`);
|
|
101
|
+
if (getField("timedOut") === "true")
|
|
102
|
+
diagnostics.partial = true;
|
|
103
|
+
}
|
|
104
|
+
if (diagnostics.skippedLargeMailboxes.length > 0 || diagnostics.notSearchedMailboxes.length > 0) {
|
|
105
|
+
diagnostics.partial = true;
|
|
106
|
+
}
|
|
107
|
+
return { payload, diagnostics };
|
|
108
|
+
}
|
|
109
|
+
// =============================================================================
|
|
22
110
|
// Text Processing Utilities
|
|
23
111
|
// =============================================================================
|
|
24
112
|
/**
|
|
@@ -336,18 +424,46 @@ export class AppleMailManager {
|
|
|
336
424
|
* @returns Array of matching messages
|
|
337
425
|
*/
|
|
338
426
|
searchMessages(query, mailbox, account, limit = 50, dateFrom, dateTo, from, subject, isRead, isFlagged) {
|
|
339
|
-
|
|
427
|
+
return this.searchMessagesWithDiagnostics(query, mailbox, account, limit, dateFrom, dateTo, from, subject, isRead, isFlagged).messages;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Search for messages, returning both the matches and diagnostics describing
|
|
431
|
+
* how complete the search was.
|
|
432
|
+
*
|
|
433
|
+
* This is the correctness fix for issue #24. The previous implementation ran
|
|
434
|
+
* an unbounded `messages of mb whose <predicate>` over every mailbox in an
|
|
435
|
+
* account; on large IMAP/Gmail mailboxes (tens of thousands of messages) that
|
|
436
|
+
* single Apple Event exceeded the timeout, the error was swallowed by a `try`,
|
|
437
|
+
* and the function returned a clean — but wrong — empty result. Callers/agents
|
|
438
|
+
* then confidently reported "no such mail."
|
|
439
|
+
*
|
|
440
|
+
* Two changes fix that:
|
|
441
|
+
* 1. Cheap count-guard: mailboxes larger than the scan threshold are skipped
|
|
442
|
+
* (Apple Mail can't search them before timing out anyway) and reported.
|
|
443
|
+
* 2. Honest diagnostics: per-account/per-mailbox timeouts are surfaced as a
|
|
444
|
+
* `partial` result with the affected scopes named, instead of an empty
|
|
445
|
+
* "success."
|
|
446
|
+
*/
|
|
447
|
+
searchMessagesWithDiagnostics(query, mailbox, account, limit = 50, dateFrom, dateTo, from, subject, isRead, isFlagged) {
|
|
448
|
+
// If no account specified, search across all accounts and merge diagnostics.
|
|
340
449
|
if (!account) {
|
|
341
450
|
const accounts = this.listAccounts();
|
|
342
451
|
const allMessages = [];
|
|
452
|
+
const diagnostics = {
|
|
453
|
+
partial: false,
|
|
454
|
+
timedOutAccounts: [],
|
|
455
|
+
skippedLargeMailboxes: [],
|
|
456
|
+
notSearchedMailboxes: [],
|
|
457
|
+
};
|
|
343
458
|
for (const acct of accounts) {
|
|
344
459
|
if (allMessages.length >= limit)
|
|
345
460
|
break;
|
|
346
461
|
const remaining = limit - allMessages.length;
|
|
347
|
-
const
|
|
348
|
-
allMessages.push(...
|
|
462
|
+
const res = this.searchMessagesWithDiagnostics(query, mailbox, acct.name, remaining, dateFrom, dateTo, from, subject, isRead, isFlagged);
|
|
463
|
+
allMessages.push(...res.messages);
|
|
464
|
+
mergeSearchDiagnostics(diagnostics, res.diagnostics);
|
|
349
465
|
}
|
|
350
|
-
return allMessages.slice(0, limit);
|
|
466
|
+
return { messages: allMessages.slice(0, limit), diagnostics };
|
|
351
467
|
}
|
|
352
468
|
const targetAccount = this.resolveAccount(account);
|
|
353
469
|
// `query` is a subject-OR-sender substring match; from/subject/isRead/isFlagged
|
|
@@ -379,79 +495,136 @@ export class AppleMailManager {
|
|
|
379
495
|
}
|
|
380
496
|
dateFilter = dateChecks.join(" and ");
|
|
381
497
|
}
|
|
498
|
+
const scanThreshold = getMailboxScanThreshold();
|
|
382
499
|
let searchCommand;
|
|
383
500
|
if (mailbox) {
|
|
384
|
-
// Search a specific mailbox
|
|
501
|
+
// Search a specific mailbox. The caller explicitly chose this mailbox, so
|
|
502
|
+
// we don't apply the count-guard skip — but we still wrap the scan so a
|
|
503
|
+
// timeout is reported as a partial result rather than a false empty.
|
|
385
504
|
const targetMailbox = this.resolveMailbox(mailbox, targetAccount);
|
|
386
505
|
searchCommand = `
|
|
387
506
|
${dateSetup}set outputText to ""
|
|
507
|
+
set _timedOut to false
|
|
508
|
+
set _notSearched to ""
|
|
388
509
|
set theMailbox to mailbox "${escapeForAppleScript(targetMailbox)}"
|
|
389
|
-
set allMessages to messages of theMailbox ${searchCondition}
|
|
390
510
|
set msgCount to 0
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
511
|
+
try
|
|
512
|
+
set allMessages to messages of theMailbox ${searchCondition}
|
|
513
|
+
repeat with msg in allMessages
|
|
514
|
+
if msgCount >= ${limit} then exit repeat
|
|
515
|
+
try
|
|
516
|
+
${dateFilter ? `set msgDate to date received of msg\n if not (${dateFilter}) then\n -- skip message outside date range\n else` : ""}
|
|
517
|
+
set msgId to id of msg as string
|
|
518
|
+
set msgSubject to subject of msg
|
|
519
|
+
set msgSender to sender of msg
|
|
520
|
+
set d to date received of msg
|
|
521
|
+
set msgDateStr to ${AS_DATE_TO_STRING}
|
|
522
|
+
set msgRead to read status of msg as string
|
|
523
|
+
set msgFlagged to flagged status of msg as string
|
|
524
|
+
if msgCount > 0 then set outputText to outputText & "|||ITEM|||"
|
|
525
|
+
set outputText to outputText & msgId & "|||" & msgSubject & "|||" & msgSender & "|||" & msgDateStr & "|||" & msgRead & "|||" & msgFlagged
|
|
526
|
+
set msgCount to msgCount + 1
|
|
527
|
+
${dateFilter ? "end if" : ""}
|
|
528
|
+
end try
|
|
529
|
+
end repeat
|
|
530
|
+
on error _errMsg number _errNum
|
|
531
|
+
set _timedOut to true
|
|
532
|
+
set _notSearched to "${escapeForAppleScript(targetMailbox)}|||M|||"
|
|
533
|
+
end try
|
|
534
|
+
return outputText & "${DIAG_MARKER}timedOut=" & (_timedOut as string) & "|||F|||skipped=|||F|||notSearched=" & _notSearched
|
|
409
535
|
`;
|
|
410
536
|
}
|
|
411
537
|
else {
|
|
412
|
-
// Search ALL mailboxes — iterate every mailbox in the account, dedup by
|
|
538
|
+
// Search ALL mailboxes — iterate every mailbox in the account, dedup by
|
|
539
|
+
// message ID. Skip mailboxes that exceed the scan threshold (they can't be
|
|
540
|
+
// searched before timing out), enforce a per-account wall-clock budget, and
|
|
541
|
+
// capture per-mailbox timeouts. All three are reported via the DIAG trailer.
|
|
542
|
+
const scanGuard = scanThreshold > 0 ? `mbCount > ${scanThreshold}` : "false";
|
|
413
543
|
searchCommand = `
|
|
414
544
|
${dateSetup}set outputText to ""
|
|
415
545
|
set msgCount to 0
|
|
416
546
|
set seenIds to {}
|
|
547
|
+
set _timedOut to false
|
|
548
|
+
set _skipped to ""
|
|
549
|
+
set _notSearched to ""
|
|
550
|
+
set _startedAt to current date
|
|
417
551
|
repeat with mb in mailboxes
|
|
418
552
|
if msgCount >= ${limit} then exit repeat
|
|
553
|
+
set mbName to ""
|
|
419
554
|
try
|
|
420
|
-
set
|
|
421
|
-
|
|
422
|
-
|
|
555
|
+
set mbName to name of mb
|
|
556
|
+
end try
|
|
557
|
+
if ((current date) - _startedAt) > ${SEARCH_ACCOUNT_BUDGET_SECONDS} then
|
|
558
|
+
set _timedOut to true
|
|
559
|
+
set _notSearched to _notSearched & mbName & "|||M|||"
|
|
560
|
+
else
|
|
561
|
+
set mbCount to 0
|
|
562
|
+
try
|
|
563
|
+
set mbCount to count of messages of mb
|
|
564
|
+
end try
|
|
565
|
+
if (${scanGuard}) then
|
|
566
|
+
set _timedOut to true
|
|
567
|
+
set _skipped to _skipped & mbName & " (" & (mbCount as string) & ")|||M|||"
|
|
568
|
+
else
|
|
423
569
|
try
|
|
424
|
-
set
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
570
|
+
set allMessages to messages of mb ${searchCondition}
|
|
571
|
+
repeat with msg in allMessages
|
|
572
|
+
if msgCount >= ${limit} then exit repeat
|
|
573
|
+
try
|
|
574
|
+
set msgId to id of msg as string
|
|
575
|
+
if seenIds does not contain msgId then
|
|
576
|
+
set end of seenIds to msgId
|
|
577
|
+
${dateFilter ? `set msgDate to date received of msg\n if not (${dateFilter}) then\n -- skip message outside date range\n else` : ""}
|
|
578
|
+
set msgSubject to subject of msg
|
|
579
|
+
set msgSender to sender of msg
|
|
580
|
+
set d to date received of msg
|
|
581
|
+
set msgDateStr to ${AS_DATE_TO_STRING}
|
|
582
|
+
set msgRead to read status of msg as string
|
|
583
|
+
set msgFlagged to flagged status of msg as string
|
|
584
|
+
if msgCount > 0 then set outputText to outputText & "|||ITEM|||"
|
|
585
|
+
set outputText to outputText & msgId & "|||" & msgSubject & "|||" & msgSender & "|||" & msgDateStr & "|||" & msgRead & "|||" & msgFlagged & "|||" & mbName
|
|
586
|
+
set msgCount to msgCount + 1
|
|
587
|
+
${dateFilter ? "end if" : ""}
|
|
588
|
+
end if
|
|
589
|
+
end try
|
|
590
|
+
end repeat
|
|
591
|
+
on error _errMsg number _errNum
|
|
592
|
+
set _timedOut to true
|
|
593
|
+
set _notSearched to _notSearched & mbName & "|||M|||"
|
|
439
594
|
end try
|
|
440
|
-
end
|
|
441
|
-
end
|
|
595
|
+
end if
|
|
596
|
+
end if
|
|
442
597
|
end repeat
|
|
443
|
-
return outputText
|
|
598
|
+
return outputText & "${DIAG_MARKER}timedOut=" & (_timedOut as string) & "|||F|||skipped=" & _skipped & "|||F|||notSearched=" & _notSearched
|
|
444
599
|
`;
|
|
445
600
|
}
|
|
446
601
|
const script = buildAccountScopedScript(targetAccount, searchCommand);
|
|
447
|
-
const result = executeAppleScript(script, { timeoutMs:
|
|
602
|
+
const result = executeAppleScript(script, { timeoutMs: SEARCH_ACCOUNT_TIMEOUT_MS });
|
|
448
603
|
if (!result.success) {
|
|
449
|
-
|
|
450
|
-
|
|
604
|
+
// Whole-account script failed (most often the osascript process timeout /
|
|
605
|
+
// SIGKILL on an unresponsive account). Surface it as a timeout rather than
|
|
606
|
+
// a false empty result — that confusion is the heart of issue #24.
|
|
607
|
+
console.error(`Failed to search messages in "${targetAccount}": ${result.error}`);
|
|
608
|
+
return {
|
|
609
|
+
messages: [],
|
|
610
|
+
diagnostics: {
|
|
611
|
+
partial: true,
|
|
612
|
+
timedOutAccounts: [targetAccount],
|
|
613
|
+
skippedLargeMailboxes: [],
|
|
614
|
+
notSearchedMailboxes: [],
|
|
615
|
+
},
|
|
616
|
+
};
|
|
451
617
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
618
|
+
return this.parseSearchResult(result.output, mailbox || "INBOX", targetAccount);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Split a per-account search payload into its message list and the DIAG
|
|
622
|
+
* trailer, parse both, and return a SearchResult. See searchMessagesWithDiagnostics.
|
|
623
|
+
*/
|
|
624
|
+
parseSearchResult(output, mailbox, account) {
|
|
625
|
+
const { payload, diagnostics } = splitSearchDiagnostics(output, account);
|
|
626
|
+
const messages = payload.trim() ? this.parseMessageList(payload, mailbox, account) : [];
|
|
627
|
+
return { messages, diagnostics };
|
|
455
628
|
}
|
|
456
629
|
/**
|
|
457
630
|
* Get a message by ID.
|
package/build/types.d.ts
CHANGED
|
@@ -47,6 +47,39 @@ export interface Message {
|
|
|
47
47
|
/** Whether the message has attachments */
|
|
48
48
|
hasAttachments: boolean;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-account / per-mailbox diagnostics for a search, so callers can tell a
|
|
52
|
+
* genuine "no matches" apart from "we couldn't finish searching."
|
|
53
|
+
*
|
|
54
|
+
* Apple Mail's AppleScript bridge is pathologically slow on large IMAP/Gmail
|
|
55
|
+
* mailboxes (tens of thousands of messages): a single `whose` predicate — or
|
|
56
|
+
* even reading the newest 20 messages by index — can blow past the Apple Event
|
|
57
|
+
* timeout. Before this was tracked, those timeouts were swallowed and the
|
|
58
|
+
* search returned a clean (but wrong) empty result. See issue #24.
|
|
59
|
+
*/
|
|
60
|
+
export interface SearchDiagnostics {
|
|
61
|
+
/** True if any account/mailbox could not be fully searched (timeout or skip). */
|
|
62
|
+
partial: boolean;
|
|
63
|
+
/** Accounts that timed out entirely (whole-account AppleScript was killed). */
|
|
64
|
+
timedOutAccounts: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Mailboxes skipped because their message count exceeded the scan threshold,
|
|
67
|
+
* formatted as "Account / Mailbox (count)".
|
|
68
|
+
*/
|
|
69
|
+
skippedLargeMailboxes: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Mailboxes that were reached but timed out or errored mid-scan, formatted as
|
|
72
|
+
* "Account / Mailbox".
|
|
73
|
+
*/
|
|
74
|
+
notSearchedMailboxes: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A search result paired with diagnostics about coverage.
|
|
78
|
+
*/
|
|
79
|
+
export interface SearchResult {
|
|
80
|
+
messages: Message[];
|
|
81
|
+
diagnostics: SearchDiagnostics;
|
|
82
|
+
}
|
|
50
83
|
/**
|
|
51
84
|
* Represents the content of an email message.
|
|
52
85
|
*/
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,wCAAwC;IACxC,EAAE,EAAE,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AAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,sBAAsB;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,oBAAoB;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAMD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IAEX,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,yBAAyB;IACzB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IAEd,4BAA4B;IAC5B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;CACf;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,YAAY,EAAE,OAAO,CAAC;IAEtB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,cAAc,EAAE,OAAO,CAAC;IAExB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAC;IAE/B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA8RxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAwInB"}
|
|
@@ -13,6 +13,32 @@ import { execSync, spawnSync } from "child_process";
|
|
|
13
13
|
* searches on large mailboxes. Can be overridden per-call.
|
|
14
14
|
*/
|
|
15
15
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum stdout/stderr buffer (bytes) for an osascript invocation.
|
|
18
|
+
*
|
|
19
|
+
* Node's `execSync` defaults to a 1 MB `maxBuffer`; exceeding it throws
|
|
20
|
+
* `ENOBUFS`, which we surface as a failure and callers convert to `null`. Mail
|
|
21
|
+
* operations routinely exceed 1 MB — `getRawSource` reads the entire raw MIME
|
|
22
|
+
* (a 20 MB attachment is explicitly anticipated), `getMessageContent` returns
|
|
23
|
+
* the full source, and large `search`/`list` result sets accumulate — so the
|
|
24
|
+
* default silently breaks exactly the large / attachment-bearing messages where
|
|
25
|
+
* it matters most (issue #27). Default to 64 MB; override with
|
|
26
|
+
* `APPLE_MAIL_MCP_MAX_BUFFER` (bytes).
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the osascript output buffer size, honoring the
|
|
31
|
+
* `APPLE_MAIL_MCP_MAX_BUFFER` environment override (bytes).
|
|
32
|
+
*/
|
|
33
|
+
function getMaxBuffer() {
|
|
34
|
+
const raw = process.env.APPLE_MAIL_MCP_MAX_BUFFER;
|
|
35
|
+
if (raw !== undefined) {
|
|
36
|
+
const n = Number(raw);
|
|
37
|
+
if (Number.isFinite(n) && n > 0)
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
return DEFAULT_MAX_BUFFER_BYTES;
|
|
41
|
+
}
|
|
16
42
|
/**
|
|
17
43
|
* Default retry configuration.
|
|
18
44
|
* - 1 attempt means no retries (default behavior)
|
|
@@ -325,6 +351,10 @@ export function executeAppleScript(script, options = {}) {
|
|
|
325
351
|
// up and worsen the contention. SIGKILL guarantees the process is reaped
|
|
326
352
|
// when the timeout fires. (#11)
|
|
327
353
|
killSignal: "SIGKILL",
|
|
354
|
+
// Raise the output cap well above Node's 1 MB default so large message
|
|
355
|
+
// sources / attachment payloads aren't truncated into an ENOBUFS
|
|
356
|
+
// failure. (#27)
|
|
357
|
+
maxBuffer: getMaxBuffer(),
|
|
328
358
|
// Capture stderr separately to get error details
|
|
329
359
|
stdio: ["pipe", "pipe", "pipe"],
|
|
330
360
|
});
|