proton-mail-bridge-client 1.18.4 → 1.18.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAA2E,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC/I,OAAO,EAAkB,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAUV,WAAW,EAEX,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAmqD1B,eAAO,MAAM,eAAe,aAyB1B,CAAC;AAuLH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK3G;AAKD,wBAAgB,0BAA0B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAI1G;AASD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAa9E;AAED,wBAAgB,sBAAsB,CAAC,MA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uLH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK3G;AAKD,wBAAgB,0BAA0B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAI1G;AASD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAa9E;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAS7F;AA4KD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,GAChB;IAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,CAyBhC;AAuuBD,wBAAgB,kBAAkB,IAAI,gBAAgB,CAgGrD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqwFP;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAqD1C"}
package/dist/index.js CHANGED
@@ -342,7 +342,7 @@ const TOOLS = [
342
342
  },
343
343
  {
344
344
  name: "create_forward_draft",
345
- description: "Create a forward draft for an existing email, pre-filling the original message as quoted body. Use when you have an emailId and want to stage a forward for review before sending. Prefer forward_email to send immediately without saving. Returns a draftId for later update or send via send_draft.",
345
+ description: "Create a forward draft for an existing email, pre-filling the original message as quoted body and preserving its attachments. Use when you have an emailId and want to stage a forward for review before sending. Prefer forward_email to send immediately without saving. Returns a draftId for later update or send via send_draft.",
346
346
  annotations: { destructiveHint: false },
347
347
  inputSchema: {
348
348
  type: "object",
@@ -359,6 +359,7 @@ const TOOLS = [
359
359
  description: "Whether to sync the draft to the Proton Drafts mailbox when IMAP is available.",
360
360
  default: true,
361
361
  },
362
+ includeAttachments: { type: "boolean", description: "Include the original email's attachments in the draft.", default: true },
362
363
  attachments: {
363
364
  type: "array",
364
365
  description: "Attachments with base64 encoded content.",
@@ -468,7 +469,7 @@ const TOOLS = [
468
469
  },
469
470
  {
470
471
  name: "send_draft",
471
- description: "Send a previously saved local draft through Proton Bridge SMTP. Use as the final step in a draft-review-send workflow after create_draft and optional update_draft. Marks the draft as sent in the local store but does not delete it. Requires PROTONMAIL_ALLOW_SEND.",
472
+ description: "Send a previously saved local draft through Proton Bridge SMTP. Use as the final step in a draft-review-send workflow after create_draft and optional update_draft. Marks the draft as sent in the local store but does not delete it. Refuses if this draft has a still-pending scheduled send (from schedule_draft) — cancel that with cancel_send first, otherwise sending now would deliver the draft twice. Requires PROTONMAIL_ALLOW_SEND.",
472
473
  annotations: { destructiveHint: true },
473
474
  inputSchema: {
474
475
  type: "object",
@@ -3400,10 +3401,23 @@ export function createServer(config, options = {}) {
3400
3401
  const to = parseEmails(requireString(args, "to"));
3401
3402
  const cc = parseEmails(optionalString(args, "cc"));
3402
3403
  const bcc = parseEmails(optionalString(args, "bcc"));
3403
- const attachments = optionalAttachmentList(args.attachments);
3404
+ const callerAttachments = optionalAttachmentList(args.attachments) ?? [];
3404
3405
  ensureValidEmails(to, "to");
3405
3406
  ensureValidEmails(cc, "cc");
3406
3407
  ensureValidEmails(bcc, "bcc");
3408
+ // Same bug fixed earlier this session in forward_email: only the
3409
+ // caller-supplied `attachments` (new attachments to add) were ever
3410
+ // used — the original email's own attachments were never fetched,
3411
+ // regardless of the tool's "preserving attachments" description.
3412
+ // Found live: forwarding a fixture with one attachment produced a
3413
+ // draft with zero attachments.
3414
+ const includeAttachments = normalizeBoolean(args.includeAttachments, true);
3415
+ const originalAttachments = includeAttachments
3416
+ ? await Promise.all(detail.attachments
3417
+ .filter((a) => a.id)
3418
+ .map((a) => imapService.getAttachmentForForward(detail.id, a.id)))
3419
+ : [];
3420
+ const attachments = [...originalAttachments, ...callerAttachments];
3407
3421
  const result = await withAudit(auditService, name, args, async () => {
3408
3422
  const draft = await draftStore.createDraft({
3409
3423
  mode: "forward",
@@ -3555,6 +3569,15 @@ export function createServer(config, options = {}) {
3555
3569
  ensureDestructiveConfirmed(config.runtime, normalizeBoolean(args.confirmed, false), `Send draft ${String(args.draftId ?? "?")}`);
3556
3570
  ensureSendAllowed(config.runtime);
3557
3571
  const draft = await draftStore.getDraft(requireString(args, "draftId"));
3572
+ // Found live: schedule_draft followed by send_draft on the same
3573
+ // draft sent it twice — two independent, successful SMTP
3574
+ // transactions, since nothing here knew about the still-pending
3575
+ // scheduled send. Refuse instead; cancel_send first if the
3576
+ // immediate send is actually what's wanted.
3577
+ const pendingScheduled = (await deliveryQueueService.list()).find((record) => record.sourceDraftId === draft.id && record.status === "pending");
3578
+ if (pendingScheduled) {
3579
+ throw new McpError(ErrorCode.InvalidParams, `This draft already has a pending scheduled send (id ${pendingScheduled.id}, sendAt ${pendingScheduled.sendAt}). Sending now would deliver it twice. Cancel that scheduled send with cancel_send first, or wait for it to fire.`);
3580
+ }
3558
3581
  ensureValidEmails(draft.to, "to");
3559
3582
  ensureValidEmails(draft.cc, "cc");
3560
3583
  ensureValidEmails(draft.bcc, "bcc");
@@ -3680,7 +3703,7 @@ export function createServer(config, options = {}) {
3680
3703
  // Draft content is already finalized and reviewed — see the
3681
3704
  // identical note on send_draft.
3682
3705
  appendSignature: false,
3683
- }, new Date(sendAtTime).toISOString(), "scheduled_send"));
3706
+ }, new Date(sendAtTime).toISOString(), "scheduled_send", draft.id));
3684
3707
  return createTextResult({
3685
3708
  queued: true,
3686
3709
  id: queued.id,