apple-mail-mcp 2.20.18 → 2.20.20
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/build/cli.js +9 -5
- package/build/index.js +46 -14
- package/package.json +1 -1
package/build/cli.js
CHANGED
|
@@ -58581,10 +58581,13 @@ async function searchUids(client, path3, criteria, size) {
|
|
|
58581
58581
|
async function filterUidsByColor(client, uids, colorIndex) {
|
|
58582
58582
|
if (uids.length === 0) return uids;
|
|
58583
58583
|
const keep = /* @__PURE__ */ new Set();
|
|
58584
|
-
for
|
|
58585
|
-
|
|
58586
|
-
const
|
|
58587
|
-
|
|
58584
|
+
for (let i = 0; i < uids.length; i += COLOR_FETCH_CHUNK) {
|
|
58585
|
+
const slice = uids.slice(i, i + COLOR_FETCH_CHUNK).join(",");
|
|
58586
|
+
for await (const msg of client.fetch(slice, { uid: true, flags: true }, { uid: true })) {
|
|
58587
|
+
if (typeof msg?.uid !== "number") continue;
|
|
58588
|
+
const idx = mailFlagColorIndex(msg.flags);
|
|
58589
|
+
if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
|
|
58590
|
+
}
|
|
58588
58591
|
}
|
|
58589
58592
|
return uids.filter((uid) => keep.has(uid));
|
|
58590
58593
|
}
|
|
@@ -60075,7 +60078,7 @@ async function imapThread(id, deps = {}, limit = 50) {
|
|
|
60075
60078
|
true
|
|
60076
60079
|
);
|
|
60077
60080
|
}
|
|
60078
|
-
var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
|
|
60081
|
+
var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, COLOR_FETCH_CHUNK, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
|
|
60079
60082
|
var init_imapClient = __esm({
|
|
60080
60083
|
"src/services/imapClient.ts"() {
|
|
60081
60084
|
"use strict";
|
|
@@ -60151,6 +60154,7 @@ var init_imapClient = __esm({
|
|
|
60151
60154
|
FIRST_SEARCH_WINDOW = 5e3;
|
|
60152
60155
|
MAX_WINDOW = 5e4;
|
|
60153
60156
|
MAX_UNSCOPED_SEARCH_DEPTH = 5e3;
|
|
60157
|
+
COLOR_FETCH_CHUNK = 500;
|
|
60154
60158
|
ROW_QUERY = {
|
|
60155
60159
|
envelope: true,
|
|
60156
60160
|
flags: true,
|
package/build/index.js
CHANGED
|
@@ -66334,10 +66334,13 @@ async function searchUids(client, path3, criteria, size) {
|
|
|
66334
66334
|
async function filterUidsByColor(client, uids, colorIndex) {
|
|
66335
66335
|
if (uids.length === 0) return uids;
|
|
66336
66336
|
const keep = /* @__PURE__ */ new Set();
|
|
66337
|
-
for
|
|
66338
|
-
|
|
66339
|
-
const
|
|
66340
|
-
|
|
66337
|
+
for (let i = 0; i < uids.length; i += COLOR_FETCH_CHUNK) {
|
|
66338
|
+
const slice = uids.slice(i, i + COLOR_FETCH_CHUNK).join(",");
|
|
66339
|
+
for await (const msg of client.fetch(slice, { uid: true, flags: true }, { uid: true })) {
|
|
66340
|
+
if (typeof msg?.uid !== "number") continue;
|
|
66341
|
+
const idx = mailFlagColorIndex(msg.flags);
|
|
66342
|
+
if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
|
|
66343
|
+
}
|
|
66341
66344
|
}
|
|
66342
66345
|
return uids.filter((uid) => keep.has(uid));
|
|
66343
66346
|
}
|
|
@@ -67828,7 +67831,7 @@ async function imapThread(id, deps = {}, limit = 50) {
|
|
|
67828
67831
|
true
|
|
67829
67832
|
);
|
|
67830
67833
|
}
|
|
67831
|
-
var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
|
|
67834
|
+
var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, COLOR_FETCH_CHUNK, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
|
|
67832
67835
|
var init_imapClient = __esm({
|
|
67833
67836
|
"src/services/imapClient.ts"() {
|
|
67834
67837
|
"use strict";
|
|
@@ -67904,6 +67907,7 @@ var init_imapClient = __esm({
|
|
|
67904
67907
|
FIRST_SEARCH_WINDOW = 5e3;
|
|
67905
67908
|
MAX_WINDOW = 5e4;
|
|
67906
67909
|
MAX_UNSCOPED_SEARCH_DEPTH = 5e3;
|
|
67910
|
+
COLOR_FETCH_CHUNK = 500;
|
|
67907
67911
|
ROW_QUERY = {
|
|
67908
67912
|
envelope: true,
|
|
67909
67913
|
flags: true,
|
|
@@ -83560,10 +83564,17 @@ function buildMessageRowLoop(opts) {
|
|
|
83560
83564
|
set _dates to date received of _msgs
|
|
83561
83565
|
set _reads to read status of _msgs
|
|
83562
83566
|
set _flags to flagged status of _msgs
|
|
83563
|
-
set _flagColors to flag index of _msgs
|
|
83564
83567
|
on error
|
|
83565
83568
|
set _bulkOK to false
|
|
83566
83569
|
end try
|
|
83570
|
+
-- Its own try, like the sent dates: a getter that fails on one account type must
|
|
83571
|
+
-- not send every other property down the slow per-message path.
|
|
83572
|
+
set _flagBulkOK to true
|
|
83573
|
+
try
|
|
83574
|
+
set _flagColors to flag index of _msgs
|
|
83575
|
+
on error
|
|
83576
|
+
set _flagBulkOK to false
|
|
83577
|
+
end try
|
|
83567
83578
|
set _sentBulkOK to true
|
|
83568
83579
|
try
|
|
83569
83580
|
set _sentDates to date sent of _msgs
|
|
@@ -83591,15 +83602,21 @@ function buildMessageRowLoop(opts) {
|
|
|
83591
83602
|
set msgSender to item _i of _sndrs
|
|
83592
83603
|
set msgRead to (item _i of _reads) as string
|
|
83593
83604
|
set msgFlagged to (item _i of _flags) as string
|
|
83594
|
-
set msgFlagColorRaw to (item _i of _flagColors) as string
|
|
83595
83605
|
else
|
|
83596
83606
|
set _m to item _i of _msgs
|
|
83597
83607
|
set msgSubject to subject of _m
|
|
83598
83608
|
set msgSender to sender of _m
|
|
83599
83609
|
set msgRead to read status of _m as string
|
|
83600
83610
|
set msgFlagged to flagged status of _m as string
|
|
83601
|
-
|
|
83602
|
-
|
|
83611
|
+
end if
|
|
83612
|
+
set msgFlagColorRaw to "-1"
|
|
83613
|
+
try
|
|
83614
|
+
if _bulkOK and _flagBulkOK then
|
|
83615
|
+
set msgFlagColorRaw to (item _i of _flagColors) as string
|
|
83616
|
+
else
|
|
83617
|
+
set msgFlagColorRaw to (flag index of (item _i of _msgs)) as string
|
|
83618
|
+
end if
|
|
83619
|
+
end try${attRow}
|
|
83603
83620
|
set msgDateStr to ${AS_DATE_TO_STRING}
|
|
83604
83621
|
set msgDateSentStr to ""
|
|
83605
83622
|
try
|
|
@@ -85104,9 +85121,13 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
|
|
|
85104
85121
|
if (scoped.kind === "hit") return scoped.output;
|
|
85105
85122
|
if (scoped.kind === "done") return null;
|
|
85106
85123
|
}
|
|
85107
|
-
const
|
|
85108
|
-
|
|
85109
|
-
|
|
85124
|
+
const account = hint?.account && !hint?.mailbox ? hint.account : void 0;
|
|
85125
|
+
const result = executeAppleScript(
|
|
85126
|
+
this.unscopedByIdScript(id, innerAction, { ...opts, account }),
|
|
85127
|
+
{
|
|
85128
|
+
timeoutMs: READ_ONLY_BYID_TIMEOUT_MS
|
|
85129
|
+
}
|
|
85130
|
+
);
|
|
85110
85131
|
if (!result.success || !result.output.trim()) {
|
|
85111
85132
|
if (!result.success) {
|
|
85112
85133
|
if (result.timedOut) this.lastMessageLookupError = timedOutScanningForId(id);
|
|
@@ -85223,6 +85244,7 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
|
|
|
85223
85244
|
*/
|
|
85224
85245
|
unscopedByIdScript(id, innerAction, opts = {}) {
|
|
85225
85246
|
const threshold = getByIdScanThreshold();
|
|
85247
|
+
const scopeAcct = escapeForAppleScript(opts.account ?? "");
|
|
85226
85248
|
const stalledKeys = threshold > 0 ? this.stalledMailboxes.keys() : [];
|
|
85227
85249
|
const stalledList = `{${stalledKeys.map((key) => {
|
|
85228
85250
|
const i = key.indexOf(STALLED_KEY_SEP);
|
|
@@ -85282,6 +85304,8 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
|
|
|
85282
85304
|
set _probeStalled to false
|
|
85283
85305
|
set _stopAt to 0
|
|
85284
85306
|
set _stalledKeys to ${stalledList}
|
|
85307
|
+
set _scopeAcct to "${scopeAcct}"
|
|
85308
|
+
set _acctSeen to false
|
|
85285
85309
|
set _startedAt to current date
|
|
85286
85310
|
set _acctNames to {}
|
|
85287
85311
|
try
|
|
@@ -85298,10 +85322,14 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
|
|
|
85298
85322
|
set _acctName to ""
|
|
85299
85323
|
if _ai <= (length of _acctNames) then set _acctName to item _ai of _acctNames
|
|
85300
85324
|
if _acctName is "" then set _acctName to (name of acct)
|
|
85301
|
-
if
|
|
85325
|
+
if _scopeAcct is not "" and _acctName is not _scopeAcct then
|
|
85326
|
+
-- Scoped to one account: leave the others alone.
|
|
85327
|
+
set _ai to _ai + 0
|
|
85328
|
+
else if _budgetHit or _probeStalled then
|
|
85302
85329
|
-- Stopped early: name what is left without asking Mail.app.
|
|
85303
85330
|
set _unreached to _unreached & _acctName & " (every mailbox)${DIAG_ITEM_SEP}"
|
|
85304
85331
|
else
|
|
85332
|
+
set _acctSeen to true
|
|
85305
85333
|
set _mbNames to {}
|
|
85306
85334
|
try
|
|
85307
85335
|
set _mbNames to name of mailboxes of acct
|
|
@@ -85347,7 +85375,11 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
|
|
|
85347
85375
|
-- reach them. Collect into the SAME _hits/_names, which means an id
|
|
85348
85376
|
-- present both in an account and locally is now correctly reported as
|
|
85349
85377
|
-- ambiguous rather than silently resolving to the account copy.
|
|
85350
|
-
if
|
|
85378
|
+
if _scopeAcct is not "" and not _acctSeen then return "${LOOKUP_ERROR_MARKER}Account \\"" & _scopeAcct & "\\" not found \u2014 check the name with list-accounts."
|
|
85379
|
+
if _scopeAcct is not "" then
|
|
85380
|
+
-- Local mailboxes belong to no account.
|
|
85381
|
+
set _ai to _ai + 0
|
|
85382
|
+
else if _budgetHit or _probeStalled then
|
|
85351
85383
|
set _unreached to _unreached & "${LOCAL_STORE_LABEL} (any local mailboxes)${DIAG_ITEM_SEP}"
|
|
85352
85384
|
else if not (${hitFound}) then${localMailboxBindingFragment()}
|
|
85353
85385
|
set _mi to 0
|
package/package.json
CHANGED