proton-mail-bridge-client 1.18.11 → 1.19.1

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;AAqqD1B,eAAO,MAAM,eAAe,aAyB1B,CAAC;AAgGH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC,CAwBZ;AA0DD,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,E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B,CAgGrD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmyFP;AAED,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAqD1C"}
package/dist/index.js CHANGED
@@ -15,11 +15,11 @@ import { BackgroundSyncService } from "./services/background-sync-service.js";
15
15
  import { DeliveryQueueService } from "./services/delivery-queue-service.js";
16
16
  import { DraftStoreService } from "./services/draft-store-service.js";
17
17
  import { LocalIndexService } from "./services/local-index-service.js";
18
- import { describeImapError, isLikelyAuthenticationError, isLikelyConnectionError, SimpleIMAPService } from "./services/simple-imap-service.js";
18
+ import { BULK_ITEM_TIMEOUT_MS, describeImapError, isLikelyAuthenticationError, isLikelyConnectionError, SimpleIMAPService } from "./services/simple-imap-service.js";
19
19
  import { applySignature, SMTPService } from "./services/smtp-service.js";
20
20
  import { SnoozeService } from "./services/snooze-service.js";
21
21
  import { TemplateService } from "./services/template-service.js";
22
- import { ensureValidEmails, isTextLikeMimeType, isValidEmail, lowerCaseAddress, normalizeBoolean, normalizeLimit, normalizeJsonValue, parseEmailId, parseEmails, projectFields, renderMarkdown, stringifyForJson, } from "./utils/helpers.js";
22
+ import { ensureValidEmails, foldQuotedHistory, isTextLikeMimeType, isValidEmail, lowerCaseAddress, normalizeBoolean, normalizeLimit, normalizeJsonValue, parseEmailId, parseEmails, projectFields, renderMarkdown, stringifyForJson, } from "./utils/helpers.js";
23
23
  import { logger } from "./utils/logger.js";
24
24
  import { ensureDestructiveConfirmed, ensureEmailActionAllowed, ensureMailboxWriteAllowed, ensureOutboundRecipientsAllowed, ensureRemoteDraftSyncAllowed, ensureSendAllowed, resolveRemoteDraftSync, sanitizeRuntimeConfig, } from "./utils/runtime-policy.js";
25
25
  const require = createRequire(import.meta.url);
@@ -1822,6 +1822,15 @@ function formatEmailDetailOutput(detail, preferHtml, maxBodyLength) {
1822
1822
  let displayBody = preferHtml
1823
1823
  ? (typeof detail.html === "string" ? detail.html : detail.text ?? "")
1824
1824
  : (detail.text ?? "");
1825
+ // Only the plain-text path: quote-boundary detection is regex-based on
1826
+ // ">"-prefixed lines and "wrote:" markers, which doesn't map onto HTML
1827
+ // (blockquotes, interspersed tags) — folding raw HTML here would corrupt
1828
+ // it, not shrink it. Comparison against other Proton MCP servers found
1829
+ // this is real, avoidable token bloat on a message deep in a thread that
1830
+ // repeats every prior reply verbatim at the bottom.
1831
+ if (!preferHtml && displayBody) {
1832
+ displayBody = foldQuotedHistory(displayBody);
1833
+ }
1825
1834
  if (maxBodyLength) {
1826
1835
  const codepoints = [...displayBody];
1827
1836
  if (codepoints.length > maxBodyLength) {
@@ -2400,9 +2409,17 @@ function emailSourceFromActionResult(result) {
2400
2409
  async function applyBatchEmailAction(imapService, entries, input) {
2401
2410
  for (const emailId of input.emailIds) {
2402
2411
  try {
2403
- const result = input.dryRun
2404
- ? await previewEmailAction(imapService, emailId, input.action, input.targetFolder)
2405
- : await runEmailAction(imapService, emailId, input.action, input.targetFolder);
2412
+ // Unlike SimpleIMAPService's own bulk*/thread* loops, this one had no
2413
+ // per-item bound — a single wedged IMAP call (same shared connection,
2414
+ // same churn from the perpetual IDLE watcher) hung the *entire*
2415
+ // tools/call response forever, with no timeout to degrade it to a
2416
+ // per-item failure. Reused verbatim rather than duplicated, since it
2417
+ // also forces the same reconnect-on-timeout SimpleIMAPService's other
2418
+ // callers rely on to keep the item after it from wedging too.
2419
+ const action = input.dryRun
2420
+ ? previewEmailAction(imapService, emailId, input.action, input.targetFolder)
2421
+ : runEmailAction(imapService, emailId, input.action, input.targetFolder);
2422
+ const result = await imapService.withTimeout(action, BULK_ITEM_TIMEOUT_MS, `Timed out after ${BULK_ITEM_TIMEOUT_MS}ms running ${input.action} on ${emailId}`);
2406
2423
  entries.push({
2407
2424
  emailId,
2408
2425
  ok: true,