proton-mail-bridge-client 2.1.34 → 2.1.36
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -12
- package/dist/index.js.map +1 -1
- package/dist/services/background-sync-service.d.ts.map +1 -1
- package/dist/services/background-sync-service.js +1 -0
- package/dist/services/background-sync-service.js.map +1 -1
- package/dist/services/local-index-service.d.ts +1 -0
- package/dist/services/local-index-service.d.ts.map +1 -1
- package/dist/services/local-index-service.js +25 -0
- package/dist/services/local-index-service.js.map +1 -1
- package/dist/utils/runtime-policy.d.ts +1 -0
- package/dist/utils/runtime-policy.d.ts.map +1 -1
- package/dist/utils/runtime-policy.js +32 -0
- package/dist/utils/runtime-policy.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAuD,MAAM,mCAAmC,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAA2H,iBAAiB,EAA+B,MAAM,mCAAmC,CAAC;AAC5N,OAAO,EAAmC,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,KAAK,EAMV,mBAAmB,EACnB,cAAc,EACd,WAAW,EAIX,WAAW,EAIX,gBAAgB,EAChB,cAAc,EAGf,MAAM,kBAAkB,CAAC;AAoB1B,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,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Q,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,EAAE,CAK/G;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,CASpF;AAsQD,wBAAgB,kBAAkB,IAAI,gBAAgB,CAoGrD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAu5IP;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAmE1C"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { applySignature, plainTextToHtml } from "./services/smtp-service.js";
|
|
|
17
17
|
import { ensureValidEmails, foldQuotedHistory, isTextLikeMimeType, isValidEmail, lowerCaseAddress, normalizeBoolean, normalizeLimit, normalizeJsonValue, parseEmailId, parseEmails, projectFields, trimAttachmentsForListing, renderMarkdown, slugifyAccountAddress, splitAccountPrefix, stringifyForJson, withAccountPrefix, } from "./utils/helpers.js";
|
|
18
18
|
import { AccountManager } from "./services/account-manager.js";
|
|
19
19
|
import { logger } from "./utils/logger.js";
|
|
20
|
-
import { ensureDestructiveConfirmed, ensureEmailActionAllowed, ensureMailboxWriteAllowed, ensureOutboundRecipientsAllowed, ensureRemoteDraftSyncAllowed, ensureSendAllowed, resolveRemoteDraftSync, sanitizeRuntimeConfig, } from "./utils/runtime-policy.js";
|
|
20
|
+
import { ensureDestructiveConfirmed, ensureEmailActionAllowed, ensureFlagChangeAllowed, ensureMailboxWriteAllowed, ensureOutboundRecipientsAllowed, ensureRemoteDraftSyncAllowed, ensureSendAllowed, resolveRemoteDraftSync, sanitizeRuntimeConfig, } from "./utils/runtime-policy.js";
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
const packageJson = require("../package.json");
|
|
23
23
|
const PACKAGE_VERSION = packageJson.version ?? process.env.npm_package_version ?? "0.0.0";
|
|
@@ -881,7 +881,7 @@ const TOOLS = [
|
|
|
881
881
|
},
|
|
882
882
|
{
|
|
883
883
|
name: "update_message_flags",
|
|
884
|
-
description: "Add or remove arbitrary IMAP flags on a single message, then verify the server applied them. Returns notApplied[] listing flags the server silently dropped. Use for custom IMAP flags (e.g. \\\\Answered) or when mark_email_read / star_email don't cover the flag you need. Prefer bulk_update_flags to update flags across multiple messages at once.",
|
|
884
|
+
description: "Add or remove arbitrary IMAP flags on a single message, then verify the server applied them. Returns notApplied[] listing flags the server silently dropped. Use for custom IMAP flags (e.g. \\\\Answered) or when mark_email_read / star_email don't cover the flag you need. Prefer bulk_update_flags to update flags across multiple messages at once. \\\\Seen/\\\\Flagged/\\\\Deleted are gated the same as mark_email_read/star_email/delete_email: each requires the matching action in PROTONMAIL_ALLOWED_ACTIONS, and setting \\\\Deleted also requires confirmed:true when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled.",
|
|
885
885
|
annotations: { destructiveHint: false },
|
|
886
886
|
inputSchema: {
|
|
887
887
|
type: "object",
|
|
@@ -897,6 +897,7 @@ const TOOLS = [
|
|
|
897
897
|
items: { type: "string" },
|
|
898
898
|
description: "IMAP flags to clear.",
|
|
899
899
|
},
|
|
900
|
+
confirmed: { type: "boolean", description: "Pass true to confirm setting \\\\Deleted. Required when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled." },
|
|
900
901
|
},
|
|
901
902
|
required: ["emailId"],
|
|
902
903
|
},
|
|
@@ -985,7 +986,7 @@ const TOOLS = [
|
|
|
985
986
|
},
|
|
986
987
|
{
|
|
987
988
|
name: "bulk_update_flags",
|
|
988
|
-
description: "Add or remove IMAP flags on multiple messages simultaneously. Use when the same flag change (e.g. \\\\Seen, \\\\Flagged) should apply to several messages. Accepts emailIds[] OR match+folder (XOR). Returns notApplied[] per message for flags the server silently dropped. Prefer update_message_flags for a single message when you need per-flag server verification.",
|
|
989
|
+
description: "Add or remove IMAP flags on multiple messages simultaneously. Use when the same flag change (e.g. \\\\Seen, \\\\Flagged) should apply to several messages. Accepts emailIds[] OR match+folder (XOR). Returns notApplied[] per message for flags the server silently dropped. Prefer update_message_flags for a single message when you need per-flag server verification. \\\\Seen/\\\\Flagged/\\\\Deleted are gated the same as mark_email_read/star_email/bulk_delete: each requires the matching action in PROTONMAIL_ALLOWED_ACTIONS, and setting \\\\Deleted also requires confirmed:true when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled.",
|
|
989
990
|
annotations: { destructiveHint: false },
|
|
990
991
|
inputSchema: {
|
|
991
992
|
type: "object",
|
|
@@ -997,6 +998,7 @@ const TOOLS = [
|
|
|
997
998
|
flagsToRemove: { type: "array", items: { type: "string" }, description: "IMAP flags to clear." },
|
|
998
999
|
dryRun: { type: "boolean", default: false },
|
|
999
1000
|
maxBatchSize: { type: "number", description: "Maximum number of messages to process. Defaults to 500. Use to prevent runaway operations." },
|
|
1001
|
+
confirmed: { type: "boolean", description: "Pass true to confirm setting \\\\Deleted. Required when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled." },
|
|
1000
1002
|
},
|
|
1001
1003
|
},
|
|
1002
1004
|
},
|
|
@@ -1066,7 +1068,7 @@ const TOOLS = [
|
|
|
1066
1068
|
},
|
|
1067
1069
|
{
|
|
1068
1070
|
name: "flag_thread",
|
|
1069
|
-
description: "Add or remove IMAP flags across all messages in a thread, identified by RFC 5322 Message-ID header. Use when you have the raw Message-ID and want to flag an entire conversation at once. Prefer apply_thread_action with action 'mark_read', 'mark_unread', 'star', or 'unstar' when you have a local threadId from get_threads.",
|
|
1071
|
+
description: "Add or remove IMAP flags across all messages in a thread, identified by RFC 5322 Message-ID header. Use when you have the raw Message-ID and want to flag an entire conversation at once. Prefer apply_thread_action with action 'mark_read', 'mark_unread', 'star', or 'unstar' when you have a local threadId from get_threads. \\\\Seen/\\\\Flagged/\\\\Deleted are gated the same as mark_email_read/star_email/delete_email: each requires the matching action in PROTONMAIL_ALLOWED_ACTIONS, and setting \\\\Deleted also requires confirmed:true when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled.",
|
|
1070
1072
|
annotations: { destructiveHint: false },
|
|
1071
1073
|
inputSchema: {
|
|
1072
1074
|
type: "object",
|
|
@@ -1076,6 +1078,7 @@ const TOOLS = [
|
|
|
1076
1078
|
flagsToRemove: { type: "array", items: { type: "string" } },
|
|
1077
1079
|
acrossFolders: { type: "boolean", default: false },
|
|
1078
1080
|
dryRun: { type: "boolean", default: false },
|
|
1081
|
+
confirmed: { type: "boolean", description: "Pass true to confirm setting \\\\Deleted. Required when PROTONMAIL_CONFIRM_DESTRUCTIVE is enabled." },
|
|
1079
1082
|
},
|
|
1080
1083
|
required: ["messageId"],
|
|
1081
1084
|
},
|
|
@@ -2736,6 +2739,7 @@ async function ensureFreshLocalIndex(imapService, localIndexService, input = {})
|
|
|
2736
2739
|
});
|
|
2737
2740
|
const indexStatus = await localIndexService.recordSnapshot({
|
|
2738
2741
|
folders: snapshot.folders,
|
|
2742
|
+
folderListComplete: true,
|
|
2739
2743
|
emails: snapshot.emails,
|
|
2740
2744
|
syncedAt: snapshot.syncedAt,
|
|
2741
2745
|
folderStats: snapshot.folderStats,
|
|
@@ -5197,7 +5201,6 @@ export function createServer(config, options = {}) {
|
|
|
5197
5201
|
return createTextResult(result, false, [emailSource({ id: prefixedIdFor(bundle, emailId) })]);
|
|
5198
5202
|
}
|
|
5199
5203
|
case "update_message_flags": {
|
|
5200
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5201
5204
|
const rawEmailId = requireString(args, "emailId");
|
|
5202
5205
|
const { bundle, rest: emailId } = resolveAccountForEmailId(rawEmailId);
|
|
5203
5206
|
const flagsToAdd = Array.isArray(args.flagsToAdd)
|
|
@@ -5209,6 +5212,7 @@ export function createServer(config, options = {}) {
|
|
|
5209
5212
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0) {
|
|
5210
5213
|
throw new McpError(ErrorCode.InvalidParams, "Provide at least one flag in flagsToAdd or flagsToRemove.");
|
|
5211
5214
|
}
|
|
5215
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5212
5216
|
const uidValidity = parseEmailId(emailId).uidValidity;
|
|
5213
5217
|
const result = await withAudit(auditService, name, args, async () => bundle.imapService.updateMessageFlags(emailId, flagsToAdd, flagsToRemove, uidValidity));
|
|
5214
5218
|
return createTextResult(result, false, [emailSource({ id: prefixedIdFor(bundle, emailId) })]);
|
|
@@ -5272,7 +5276,7 @@ export function createServer(config, options = {}) {
|
|
|
5272
5276
|
if (!config.runtime.allowEmptyFolder) {
|
|
5273
5277
|
throw new McpError(ErrorCode.InvalidParams, "empty_folder is disabled. Set PROTONMAIL_ALLOW_EMPTY_FOLDER=true to enable.");
|
|
5274
5278
|
}
|
|
5275
|
-
|
|
5279
|
+
ensureEmailActionAllowed(config.runtime, "delete");
|
|
5276
5280
|
const folder = requireString(args, "folder");
|
|
5277
5281
|
const confirmed = normalizeBoolean(args.confirmed, false);
|
|
5278
5282
|
if (!confirmed) {
|
|
@@ -5357,10 +5361,13 @@ export function createServer(config, options = {}) {
|
|
|
5357
5361
|
return createTextResult(mergeBulkResults(outputs));
|
|
5358
5362
|
}
|
|
5359
5363
|
case "bulk_delete": {
|
|
5360
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5361
5364
|
const permanent = normalizeBoolean(args.permanent, false);
|
|
5362
5365
|
if (permanent)
|
|
5363
5366
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), "Permanently delete multiple emails");
|
|
5367
|
+
// Same distinction as delete_email/delete_thread: a non-permanent
|
|
5368
|
+
// bulk_delete only moves messages to Trash, so it's gated as
|
|
5369
|
+
// "trash" (which a policy may allow independently of "delete").
|
|
5370
|
+
ensureEmailActionAllowed(config.runtime, permanent ? "delete" : "trash");
|
|
5364
5371
|
const emailIds = Array.isArray(args.emailIds)
|
|
5365
5372
|
? args.emailIds.map(String) : undefined;
|
|
5366
5373
|
const match = args.match && typeof args.match === "object"
|
|
@@ -5429,7 +5436,6 @@ export function createServer(config, options = {}) {
|
|
|
5429
5436
|
return createTextResult(mergeBulkResults(outputs));
|
|
5430
5437
|
}
|
|
5431
5438
|
case "bulk_update_flags": {
|
|
5432
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5433
5439
|
const emailIds = Array.isArray(args.emailIds)
|
|
5434
5440
|
? args.emailIds.map(String) : undefined;
|
|
5435
5441
|
const match = args.match && typeof args.match === "object"
|
|
@@ -5444,6 +5450,7 @@ export function createServer(config, options = {}) {
|
|
|
5444
5450
|
const flagsToRemove = Array.isArray(args.flagsToRemove) ? args.flagsToRemove.map(String) : [];
|
|
5445
5451
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0)
|
|
5446
5452
|
throw new McpError(ErrorCode.InvalidParams, "Provide flagsToAdd or flagsToRemove.");
|
|
5453
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5447
5454
|
const folder = optionalString(args, "folder") ?? "INBOX";
|
|
5448
5455
|
const max = getBulkMaxBatchSize(args);
|
|
5449
5456
|
const dryRun = normalizeBoolean(args.dryRun, false);
|
|
@@ -5604,7 +5611,7 @@ export function createServer(config, options = {}) {
|
|
|
5604
5611
|
});
|
|
5605
5612
|
}
|
|
5606
5613
|
case "move_thread": {
|
|
5607
|
-
|
|
5614
|
+
ensureEmailActionAllowed(config.runtime, "move");
|
|
5608
5615
|
// A threadId only ever names ONE account — a thread can't span
|
|
5609
5616
|
// multiple mailboxes/accounts — so this reuses
|
|
5610
5617
|
// resolveAccountForEmailId's generic "<slug>::" prefix stripping
|
|
@@ -5624,10 +5631,11 @@ export function createServer(config, options = {}) {
|
|
|
5624
5631
|
return createTextResult(result);
|
|
5625
5632
|
}
|
|
5626
5633
|
case "delete_thread": {
|
|
5627
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5628
5634
|
const permanentThread = normalizeBoolean(args.permanent, false);
|
|
5629
5635
|
if (permanentThread)
|
|
5630
5636
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), "Permanently delete thread");
|
|
5637
|
+
// Same "trash" vs "delete" distinction as bulk_delete above.
|
|
5638
|
+
ensureEmailActionAllowed(config.runtime, permanentThread ? "delete" : "trash");
|
|
5631
5639
|
// See move_thread's comment on scoping by the threadId's own
|
|
5632
5640
|
// "<slug>::" prefix — same convention, same single-account
|
|
5633
5641
|
// limitation.
|
|
@@ -5641,11 +5649,11 @@ export function createServer(config, options = {}) {
|
|
|
5641
5649
|
return createTextResult(result);
|
|
5642
5650
|
}
|
|
5643
5651
|
case "flag_thread": {
|
|
5644
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5645
5652
|
const flagsToAdd = Array.isArray(args.flagsToAdd) ? args.flagsToAdd.map(String) : [];
|
|
5646
5653
|
const flagsToRemove = Array.isArray(args.flagsToRemove) ? args.flagsToRemove.map(String) : [];
|
|
5647
5654
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0)
|
|
5648
5655
|
throw new McpError(ErrorCode.InvalidParams, "Provide flagsToAdd or flagsToRemove.");
|
|
5656
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5649
5657
|
// See move_thread's comment on scoping by the threadId's own
|
|
5650
5658
|
// "<slug>::" prefix — same convention, same single-account
|
|
5651
5659
|
// limitation.
|
|
@@ -5915,7 +5923,7 @@ export function createServer(config, options = {}) {
|
|
|
5915
5923
|
}
|
|
5916
5924
|
case "delete_email": {
|
|
5917
5925
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), `Permanently delete ${String(args.emailId ?? "?")} (cannot be recovered)`);
|
|
5918
|
-
|
|
5926
|
+
ensureEmailActionAllowed(config.runtime, "delete");
|
|
5919
5927
|
const rawEmailId = requireString(args, "emailId");
|
|
5920
5928
|
const { bundle, rest: emailId } = resolveAccountForEmailId(rawEmailId);
|
|
5921
5929
|
const uidValidity = parseEmailId(emailId).uidValidity;
|
|
@@ -6417,6 +6425,7 @@ export function createServer(config, options = {}) {
|
|
|
6417
6425
|
});
|
|
6418
6426
|
const indexStatus = await localIndexService.recordSnapshot({
|
|
6419
6427
|
folders: snapshot.folders,
|
|
6428
|
+
folderListComplete: true,
|
|
6420
6429
|
emails: snapshot.emails,
|
|
6421
6430
|
syncedAt: snapshot.syncedAt,
|
|
6422
6431
|
folderStats: snapshot.folderStats,
|