proton-mail-bridge-client 2.1.33 → 2.1.35
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 +19 -12
- package/dist/index.js.map +1 -1
- package/dist/services/smtp-service.d.ts.map +1 -1
- package/dist/services/smtp-service.js +32 -2
- package/dist/services/smtp-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,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAu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AAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAs5IP;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
|
},
|
|
@@ -5197,7 +5200,6 @@ export function createServer(config, options = {}) {
|
|
|
5197
5200
|
return createTextResult(result, false, [emailSource({ id: prefixedIdFor(bundle, emailId) })]);
|
|
5198
5201
|
}
|
|
5199
5202
|
case "update_message_flags": {
|
|
5200
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5201
5203
|
const rawEmailId = requireString(args, "emailId");
|
|
5202
5204
|
const { bundle, rest: emailId } = resolveAccountForEmailId(rawEmailId);
|
|
5203
5205
|
const flagsToAdd = Array.isArray(args.flagsToAdd)
|
|
@@ -5209,6 +5211,7 @@ export function createServer(config, options = {}) {
|
|
|
5209
5211
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0) {
|
|
5210
5212
|
throw new McpError(ErrorCode.InvalidParams, "Provide at least one flag in flagsToAdd or flagsToRemove.");
|
|
5211
5213
|
}
|
|
5214
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5212
5215
|
const uidValidity = parseEmailId(emailId).uidValidity;
|
|
5213
5216
|
const result = await withAudit(auditService, name, args, async () => bundle.imapService.updateMessageFlags(emailId, flagsToAdd, flagsToRemove, uidValidity));
|
|
5214
5217
|
return createTextResult(result, false, [emailSource({ id: prefixedIdFor(bundle, emailId) })]);
|
|
@@ -5272,7 +5275,7 @@ export function createServer(config, options = {}) {
|
|
|
5272
5275
|
if (!config.runtime.allowEmptyFolder) {
|
|
5273
5276
|
throw new McpError(ErrorCode.InvalidParams, "empty_folder is disabled. Set PROTONMAIL_ALLOW_EMPTY_FOLDER=true to enable.");
|
|
5274
5277
|
}
|
|
5275
|
-
|
|
5278
|
+
ensureEmailActionAllowed(config.runtime, "delete");
|
|
5276
5279
|
const folder = requireString(args, "folder");
|
|
5277
5280
|
const confirmed = normalizeBoolean(args.confirmed, false);
|
|
5278
5281
|
if (!confirmed) {
|
|
@@ -5357,10 +5360,13 @@ export function createServer(config, options = {}) {
|
|
|
5357
5360
|
return createTextResult(mergeBulkResults(outputs));
|
|
5358
5361
|
}
|
|
5359
5362
|
case "bulk_delete": {
|
|
5360
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5361
5363
|
const permanent = normalizeBoolean(args.permanent, false);
|
|
5362
5364
|
if (permanent)
|
|
5363
5365
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), "Permanently delete multiple emails");
|
|
5366
|
+
// Same distinction as delete_email/delete_thread: a non-permanent
|
|
5367
|
+
// bulk_delete only moves messages to Trash, so it's gated as
|
|
5368
|
+
// "trash" (which a policy may allow independently of "delete").
|
|
5369
|
+
ensureEmailActionAllowed(config.runtime, permanent ? "delete" : "trash");
|
|
5364
5370
|
const emailIds = Array.isArray(args.emailIds)
|
|
5365
5371
|
? args.emailIds.map(String) : undefined;
|
|
5366
5372
|
const match = args.match && typeof args.match === "object"
|
|
@@ -5429,7 +5435,6 @@ export function createServer(config, options = {}) {
|
|
|
5429
5435
|
return createTextResult(mergeBulkResults(outputs));
|
|
5430
5436
|
}
|
|
5431
5437
|
case "bulk_update_flags": {
|
|
5432
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5433
5438
|
const emailIds = Array.isArray(args.emailIds)
|
|
5434
5439
|
? args.emailIds.map(String) : undefined;
|
|
5435
5440
|
const match = args.match && typeof args.match === "object"
|
|
@@ -5444,6 +5449,7 @@ export function createServer(config, options = {}) {
|
|
|
5444
5449
|
const flagsToRemove = Array.isArray(args.flagsToRemove) ? args.flagsToRemove.map(String) : [];
|
|
5445
5450
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0)
|
|
5446
5451
|
throw new McpError(ErrorCode.InvalidParams, "Provide flagsToAdd or flagsToRemove.");
|
|
5452
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5447
5453
|
const folder = optionalString(args, "folder") ?? "INBOX";
|
|
5448
5454
|
const max = getBulkMaxBatchSize(args);
|
|
5449
5455
|
const dryRun = normalizeBoolean(args.dryRun, false);
|
|
@@ -5604,7 +5610,7 @@ export function createServer(config, options = {}) {
|
|
|
5604
5610
|
});
|
|
5605
5611
|
}
|
|
5606
5612
|
case "move_thread": {
|
|
5607
|
-
|
|
5613
|
+
ensureEmailActionAllowed(config.runtime, "move");
|
|
5608
5614
|
// A threadId only ever names ONE account — a thread can't span
|
|
5609
5615
|
// multiple mailboxes/accounts — so this reuses
|
|
5610
5616
|
// resolveAccountForEmailId's generic "<slug>::" prefix stripping
|
|
@@ -5624,10 +5630,11 @@ export function createServer(config, options = {}) {
|
|
|
5624
5630
|
return createTextResult(result);
|
|
5625
5631
|
}
|
|
5626
5632
|
case "delete_thread": {
|
|
5627
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5628
5633
|
const permanentThread = normalizeBoolean(args.permanent, false);
|
|
5629
5634
|
if (permanentThread)
|
|
5630
5635
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), "Permanently delete thread");
|
|
5636
|
+
// Same "trash" vs "delete" distinction as bulk_delete above.
|
|
5637
|
+
ensureEmailActionAllowed(config.runtime, permanentThread ? "delete" : "trash");
|
|
5631
5638
|
// See move_thread's comment on scoping by the threadId's own
|
|
5632
5639
|
// "<slug>::" prefix — same convention, same single-account
|
|
5633
5640
|
// limitation.
|
|
@@ -5641,11 +5648,11 @@ export function createServer(config, options = {}) {
|
|
|
5641
5648
|
return createTextResult(result);
|
|
5642
5649
|
}
|
|
5643
5650
|
case "flag_thread": {
|
|
5644
|
-
ensureMailboxWriteAllowed(config.runtime);
|
|
5645
5651
|
const flagsToAdd = Array.isArray(args.flagsToAdd) ? args.flagsToAdd.map(String) : [];
|
|
5646
5652
|
const flagsToRemove = Array.isArray(args.flagsToRemove) ? args.flagsToRemove.map(String) : [];
|
|
5647
5653
|
if (flagsToAdd.length === 0 && flagsToRemove.length === 0)
|
|
5648
5654
|
throw new McpError(ErrorCode.InvalidParams, "Provide flagsToAdd or flagsToRemove.");
|
|
5655
|
+
ensureFlagChangeAllowed(config.runtime, flagsToAdd, flagsToRemove, normalizeBoolean(args.confirmed, false));
|
|
5649
5656
|
// See move_thread's comment on scoping by the threadId's own
|
|
5650
5657
|
// "<slug>::" prefix — same convention, same single-account
|
|
5651
5658
|
// limitation.
|
|
@@ -5915,7 +5922,7 @@ export function createServer(config, options = {}) {
|
|
|
5915
5922
|
}
|
|
5916
5923
|
case "delete_email": {
|
|
5917
5924
|
ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), `Permanently delete ${String(args.emailId ?? "?")} (cannot be recovered)`);
|
|
5918
|
-
|
|
5925
|
+
ensureEmailActionAllowed(config.runtime, "delete");
|
|
5919
5926
|
const rawEmailId = requireString(args, "emailId");
|
|
5920
5927
|
const { bundle, rest: emailId } = resolveAccountForEmailId(rawEmailId);
|
|
5921
5928
|
const uidValidity = parseEmailId(emailId).uidValidity;
|