apple-mail-mcp 2.20.11 → 2.20.13

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/index.js CHANGED
@@ -52613,7 +52613,7 @@ var require_imap_flow = __commonJS({
52613
52613
  }
52614
52614
  });
52615
52615
 
52616
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/punycode/index.js
52616
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/punycode/index.js
52617
52617
  function error2(type) {
52618
52618
  throw new RangeError(errors[type]);
52619
52619
  }
@@ -52659,7 +52659,7 @@ function ucs2decode(string3) {
52659
52659
  }
52660
52660
  var maxInt, base, tMin, tMax, skew, damp, initialBias, initialN, delimiter, regexPunycode, regexNonASCII, regexSeparators, errors, baseMinusTMin, floor, stringFromCharCode, basicToDigit, digitToBasic, adapt, decode, encode, toUnicode, toASCII;
52661
52661
  var init_punycode = __esm({
52662
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/punycode/index.js"() {
52662
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/punycode/index.js"() {
52663
52663
  maxInt = 2147483647;
52664
52664
  base = 36;
52665
52665
  tMin = 1;
@@ -52830,7 +52830,7 @@ var init_punycode = __esm({
52830
52830
  }
52831
52831
  });
52832
52832
 
52833
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/url.js
52833
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/url.js
52834
52834
  import net from "node:net";
52835
52835
  import urllib from "node:url";
52836
52836
  function invalidUrl(input) {
@@ -52883,7 +52883,7 @@ function normalizeHostname(raw, href) {
52883
52883
  }
52884
52884
  var SLASHLESS_AUTHORITY, SURROUNDING_WHITESPACE, LEGACY_TRIM, AUTHORITY, FORBIDDEN_HOST_CHARS, CONTROL_CHARS, parse3, resolve;
52885
52885
  var init_url = __esm({
52886
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/url.js"() {
52886
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/url.js"() {
52887
52887
  init_punycode();
52888
52888
  SLASHLESS_AUTHORITY = /^([a-zA-Z][a-zA-Z0-9+.-]*:)(?!\/\/)([\s\S]+)$/;
52889
52889
  SURROUNDING_WHITESPACE = /^[\x00-\x20]+|[\x00-\x20]+$/g;
@@ -52959,11 +52959,11 @@ var init_url = __esm({
52959
52959
  }
52960
52960
  });
52961
52961
 
52962
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/fetch/cookies.js
52962
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/fetch/cookies.js
52963
52963
  import net2 from "node:net";
52964
52964
  var SESSION_TIMEOUT, Cookies, cookies_default;
52965
52965
  var init_cookies = __esm({
52966
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/fetch/cookies.js"() {
52966
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/fetch/cookies.js"() {
52967
52967
  init_url();
52968
52968
  SESSION_TIMEOUT = 1800;
52969
52969
  Cookies = class {
@@ -53041,15 +53041,24 @@ var init_cookies = __esm({
53041
53041
  */
53042
53042
  parse(cookieStr) {
53043
53043
  const cookie = {};
53044
+ let hasNameValue = false;
53044
53045
  (cookieStr || "").toString().split(";").forEach((cookiePart) => {
53046
+ if (!cookiePart.trim()) {
53047
+ return;
53048
+ }
53045
53049
  const valueParts = cookiePart.split("=");
53046
- const key = valueParts.shift().trim().toLowerCase();
53050
+ const name2 = valueParts.shift().trim();
53047
53051
  let value = valueParts.join("=").trim();
53048
53052
  let domain;
53049
- if (!key) {
53053
+ if (!hasNameValue) {
53054
+ hasNameValue = true;
53055
+ if (name2) {
53056
+ cookie.name = name2;
53057
+ cookie.value = value;
53058
+ }
53050
53059
  return;
53051
53060
  }
53052
- switch (key) {
53061
+ switch (name2.toLowerCase()) {
53053
53062
  case "expires": {
53054
53063
  const expires = new Date(value);
53055
53064
  if (expires.toString() !== "Invalid Date") {
@@ -53076,11 +53085,6 @@ var init_cookies = __esm({
53076
53085
  case "httponly":
53077
53086
  cookie.httponly = true;
53078
53087
  break;
53079
- default:
53080
- if (!cookie.name) {
53081
- cookie.name = key;
53082
- cookie.value = value;
53083
- }
53084
53088
  }
53085
53089
  });
53086
53090
  return cookie;
@@ -53173,20 +53177,20 @@ var init_cookies = __esm({
53173
53177
  }
53174
53178
  });
53175
53179
 
53176
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/package-info.js
53180
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/package-info.js
53177
53181
  var name, version2, homepage;
53178
53182
  var init_package_info = __esm({
53179
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/package-info.js"() {
53183
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/package-info.js"() {
53180
53184
  name = "nodemailer";
53181
- version2 = "10.0.13";
53185
+ version2 = "10.0.16";
53182
53186
  homepage = "https://nodemailer.com/";
53183
53187
  }
53184
53188
  });
53185
53189
 
53186
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/errors.js
53190
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/errors.js
53187
53191
  var ECONNECTION, ENOAUTH, EOAUTH2, EMAXLIMIT, EMAXRECIPIENTS, ESENDMAIL, ESES, ECONFIG, EPROXY, EFILEACCESS, EURLACCESS, EFETCH;
53188
53192
  var init_errors = __esm({
53189
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/errors.js"() {
53193
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/errors.js"() {
53190
53194
  ECONNECTION = "ECONNECTION";
53191
53195
  ENOAUTH = "ENOAUTH";
53192
53196
  EOAUTH2 = "EOAUTH2";
@@ -53202,10 +53206,10 @@ var init_errors = __esm({
53202
53206
  }
53203
53207
  });
53204
53208
 
53205
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/objects.js
53209
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/objects.js
53206
53210
  var isProtoKey, copyOwnKeys;
53207
53211
  var init_objects = __esm({
53208
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/objects.js"() {
53212
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/objects.js"() {
53209
53213
  isProtoKey = (key) => key === "__proto__";
53210
53214
  copyOwnKeys = (target, source, skip) => {
53211
53215
  Object.keys(source || {}).forEach((key) => {
@@ -53219,7 +53223,7 @@ var init_objects = __esm({
53219
53223
  }
53220
53224
  });
53221
53225
 
53222
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/fetch/index.js
53226
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/fetch/index.js
53223
53227
  import http from "node:http";
53224
53228
  import https from "node:https";
53225
53229
  import zlib from "node:zlib";
@@ -53466,7 +53470,7 @@ function nmfetch(url, options) {
53466
53470
  }
53467
53471
  var MAX_REDIRECTS, DEFAULT_TIMEOUT, DEFAULT_MAX_BYTES, TLS_OPTION_KEYS, fetch_default;
53468
53472
  var init_fetch = __esm({
53469
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/fetch/index.js"() {
53473
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/fetch/index.js"() {
53470
53474
  init_url();
53471
53475
  init_cookies();
53472
53476
  init_package_info();
@@ -53504,7 +53508,7 @@ var init_fetch = __esm({
53504
53508
  }
53505
53509
  });
53506
53510
 
53507
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/index.js
53511
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/index.js
53508
53512
  import util2 from "node:util";
53509
53513
  import fs from "node:fs";
53510
53514
  import dns from "node:dns";
@@ -53645,7 +53649,7 @@ function createDefaultLogger(levels) {
53645
53649
  }
53646
53650
  var DNS_TTL, CACHE_CLEANUP_INTERVAL, MAX_CACHE_SIZE, lastCacheCleanup, networkInterfaces, isFamilySupported, resolve2, dnsCache, formatDNSValue, resolveHostname, parseConnectionUrl, _logFunc, getLogger, callbackPromise, parseDataURI, assign, encodeXText;
53647
53651
  var init_shared = __esm({
53648
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/shared/index.js"() {
53652
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/shared/index.js"() {
53649
53653
  init_url();
53650
53654
  init_fetch();
53651
53655
  init_errors();
@@ -54025,7 +54029,7 @@ var init_shared = __esm({
54025
54029
  }
54026
54030
  });
54027
54031
 
54028
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.js
54032
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.js
54029
54033
  import path from "node:path";
54030
54034
  function detectMimeType(filename) {
54031
54035
  if (!filename) {
@@ -54062,7 +54066,7 @@ function detectExtension(mimeType) {
54062
54066
  }
54063
54067
  var defaultMimeType, defaultExtension, mimeTypes, extensions;
54064
54068
  var init_mime_types = __esm({
54065
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.js"() {
54069
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-funcs/mime-types.js"() {
54066
54070
  defaultMimeType = "application/octet-stream";
54067
54071
  defaultExtension = "bin";
54068
54072
  mimeTypes = /* @__PURE__ */ new Map([
@@ -56127,7 +56131,7 @@ var init_mime_types = __esm({
56127
56131
  }
56128
56132
  });
56129
56133
 
56130
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/base64/index.js
56134
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/base64/index.js
56131
56135
  var base64_exports = {};
56132
56136
  __export(base64_exports, {
56133
56137
  Encoder: () => Encoder,
@@ -56160,7 +56164,7 @@ function wrap(str2, lineLength) {
56160
56164
  }
56161
56165
  var Encoder;
56162
56166
  var init_base64 = __esm({
56163
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/base64/index.js"() {
56167
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/base64/index.js"() {
56164
56168
  Encoder = class extends Transform {
56165
56169
  constructor(options) {
56166
56170
  super();
@@ -56228,7 +56232,7 @@ var init_base64 = __esm({
56228
56232
  }
56229
56233
  });
56230
56234
 
56231
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/qp/index.js
56235
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/qp/index.js
56232
56236
  var qp_exports = {};
56233
56237
  __export(qp_exports, {
56234
56238
  Encoder: () => Encoder2,
@@ -56334,7 +56338,7 @@ function checkRanges(nr, ranges) {
56334
56338
  }
56335
56339
  var MIN_LINE_LENGTH, QP_RANGES, Encoder2;
56336
56340
  var init_qp = __esm({
56337
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/qp/index.js"() {
56341
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/qp/index.js"() {
56338
56342
  MIN_LINE_LENGTH = 4;
56339
56343
  QP_RANGES = [
56340
56344
  [9],
@@ -56399,7 +56403,7 @@ var init_qp = __esm({
56399
56403
  }
56400
56404
  });
56401
56405
 
56402
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-funcs/index.js
56406
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-funcs/index.js
56403
56407
  function isPlainText(value, isParam) {
56404
56408
  const re = isParam ? /[\x00-\x1f\x7f"\u0080-\uFFFF]/ : /[\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]/;
56405
56409
  return typeof value === "string" && !re.test(value);
@@ -56497,7 +56501,7 @@ function buildHeaderValue(structured) {
56497
56501
  paramsArray.push(encodedParam.key + "=" + JSON.stringify(encodedParam.value));
56498
56502
  }
56499
56503
  });
56500
- } else if (/[\s'"\\;:/=(),<>@[\]?]|^-/.test(value2)) {
56504
+ } else if (!value2.length || /[\s'"\\;:/=(),<>@[\]?]|^-/.test(value2)) {
56501
56505
  paramsArray.push(param + "=" + JSON.stringify(value2));
56502
56506
  } else {
56503
56507
  paramsArray.push(param + "=" + value2);
@@ -56605,108 +56609,150 @@ function buildHeaderParam(key, data, maxLength) {
56605
56609
  value: item.line
56606
56610
  }));
56607
56611
  }
56612
+ function _isParamName(name2) {
56613
+ return !!name2 && !isProtoKey(name2);
56614
+ }
56608
56615
  function parseHeaderValue(str2) {
56609
56616
  const response = {
56610
56617
  value: "",
56611
56618
  params: {}
56612
56619
  };
56613
56620
  const setParam = (name2, value2) => {
56614
- if (!isProtoKey(name2)) {
56621
+ name2 = name2.toLowerCase();
56622
+ if (_isParamName(name2) && !Object.prototype.hasOwnProperty.call(response.params, name2)) {
56615
56623
  response.params[name2] = value2;
56616
56624
  }
56617
56625
  };
56618
56626
  let key = false;
56619
56627
  let value = "";
56620
- let type = "value";
56628
+ let stage = "value";
56621
56629
  let quote = false;
56622
56630
  let escaped = false;
56623
56631
  let chr;
56632
+ let pendingSpace = "";
56633
+ let quoteClosed = false;
56634
+ const flushSpace = () => {
56635
+ if (value.length) {
56636
+ value += pendingSpace;
56637
+ }
56638
+ pendingSpace = "";
56639
+ };
56640
+ const addChr = (c) => {
56641
+ flushSpace();
56642
+ value += c;
56643
+ };
56644
+ const takeValue = () => {
56645
+ const taken = value;
56646
+ value = "";
56647
+ pendingSpace = "";
56648
+ quoteClosed = false;
56649
+ return taken;
56650
+ };
56651
+ const storeValue = () => {
56652
+ const taken = takeValue();
56653
+ if (key === false) {
56654
+ response.value = taken;
56655
+ } else {
56656
+ setParam(key, taken);
56657
+ }
56658
+ };
56659
+ const storeEmptyKey = () => {
56660
+ setParam(takeValue().trim(), "");
56661
+ };
56624
56662
  for (let i = 0, len = str2.length; i < len; i++) {
56625
56663
  chr = str2.charAt(i);
56626
- if (type === "key") {
56664
+ if (stage === "key") {
56627
56665
  if (chr === "=") {
56628
- key = value.trim().toLowerCase();
56629
- type = "value";
56630
- value = "";
56666
+ key = takeValue().trim();
56667
+ stage = "value";
56668
+ continue;
56669
+ }
56670
+ if (chr === ";") {
56671
+ storeEmptyKey();
56631
56672
  continue;
56632
56673
  }
56633
56674
  value += chr;
56634
56675
  } else {
56676
+ if (quoteClosed && chr !== ";") {
56677
+ escaped = false;
56678
+ continue;
56679
+ }
56635
56680
  if (escaped) {
56636
- value += chr;
56637
- } else if (chr === "\\") {
56681
+ addChr(chr);
56682
+ } else if (quote && chr === "\\") {
56638
56683
  escaped = true;
56639
56684
  continue;
56640
56685
  } else if (quote && chr === quote) {
56641
56686
  quote = false;
56687
+ quoteClosed = true;
56642
56688
  } else if (!quote && chr === '"') {
56643
56689
  quote = chr;
56690
+ flushSpace();
56644
56691
  } else if (!quote && chr === ";") {
56645
- if (key === false) {
56646
- response.value = value.trim();
56647
- } else {
56648
- setParam(key, value.trim());
56649
- }
56650
- type = "key";
56651
- value = "";
56692
+ storeValue();
56693
+ stage = "key";
56694
+ } else if (!quote && (chr === " " || chr === " ")) {
56695
+ pendingSpace += chr;
56652
56696
  } else {
56653
- value += chr;
56697
+ addChr(chr);
56654
56698
  }
56655
56699
  escaped = false;
56656
56700
  }
56657
56701
  }
56658
- if (type === "value") {
56659
- if (key === false) {
56660
- response.value = value.trim();
56661
- } else {
56662
- setParam(key, value.trim());
56663
- }
56664
- } else if (value.trim()) {
56665
- setParam(value.trim().toLowerCase(), "");
56702
+ if (stage === "value") {
56703
+ storeValue();
56704
+ } else {
56705
+ storeEmptyKey();
56666
56706
  }
56707
+ const continuations = /* @__PURE__ */ new Map();
56667
56708
  Object.keys(response.params).forEach((key2) => {
56668
- let actualKey, nr, match, value2;
56669
- if (match = key2.match(/(\*(\d+)|\*(\d+)\*|\*)$/)) {
56670
- actualKey = key2.substr(0, match.index);
56671
- nr = Number(match[2] || match[3]) || 0;
56672
- if (isProtoKey(actualKey)) {
56673
- delete response.params[key2];
56674
- return;
56675
- }
56676
- if (!response.params[actualKey] || typeof response.params[actualKey] !== "object") {
56677
- response.params[actualKey] = {
56678
- charset: false,
56679
- values: []
56680
- };
56681
- }
56682
- value2 = response.params[key2];
56683
- if (nr === 0 && match[0].substr(-1) === "*" && (match = value2.match(/^([^']*)'[^']*'(.*)$/))) {
56684
- response.params[actualKey].charset = match[1] || "iso-8859-1";
56685
- value2 = match[2];
56686
- }
56687
- response.params[actualKey].values[nr] = value2;
56688
- delete response.params[key2];
56709
+ const match = key2.match(/(\*(\d+)|\*(\d+)\*|\*)$/);
56710
+ if (!match) {
56711
+ return;
56689
56712
  }
56713
+ const actualKey = key2.substr(0, match.index);
56714
+ const nr = Number(match[2] || match[3]) || 0;
56715
+ const encoded = match[0].substr(-1) === "*";
56716
+ let value2 = response.params[key2];
56717
+ delete response.params[key2];
56718
+ if (!_isParamName(actualKey)) {
56719
+ return;
56720
+ }
56721
+ let continuation = continuations.get(actualKey);
56722
+ if (!continuation) {
56723
+ continuation = { charset: false, sections: [] };
56724
+ continuations.set(actualKey, continuation);
56725
+ }
56726
+ const charsetMatch = nr === 0 && encoded ? value2.match(/^([^']*)'[^']*'(.*)$/) : null;
56727
+ if (charsetMatch) {
56728
+ continuation.charset = TOKEN.test(charsetMatch[1]) ? charsetMatch[1] : "iso-8859-1";
56729
+ value2 = charsetMatch[2];
56730
+ }
56731
+ continuation.sections.push({ nr, value: value2, encoded });
56690
56732
  });
56691
- Object.keys(response.params).forEach((key2) => {
56692
- let value2;
56693
- if (response.params[key2] && Array.isArray(response.params[key2].values)) {
56694
- value2 = response.params[key2].values.map((val) => val || "").join("");
56695
- if (response.params[key2].charset) {
56696
- response.params[key2] = "=?" + response.params[key2].charset + "?Q?" + value2.replace(/[=?_\s]/g, (s) => {
56697
- const c = s.charCodeAt(0).toString(16);
56698
- if (s === " ") {
56699
- return "_";
56700
- }
56701
- return "%" + (c.length < 2 ? "0" : "") + c;
56702
- }).replace(/%/g, "=") + "?=";
56703
- } else {
56704
- response.params[key2] = value2;
56705
- }
56733
+ continuations.forEach((continuation, key2) => {
56734
+ if (Object.prototype.hasOwnProperty.call(response.params, key2)) {
56735
+ return;
56736
+ }
56737
+ continuation.sections.sort((a, b) => a.nr - b.nr);
56738
+ if (!continuation.charset) {
56739
+ response.params[key2] = continuation.sections.map((section) => section.value).join("");
56740
+ return;
56706
56741
  }
56742
+ response.params[key2] = "=?" + continuation.charset + "?Q?" + continuation.sections.map(_encodeContinuationSection).join("") + "?=";
56707
56743
  });
56708
56744
  return response;
56709
56745
  }
56746
+ function _encodeContinuationSection(section) {
56747
+ const specials = section.encoded ? /[=?_\s]/g : /[=?_\s%]/g;
56748
+ return section.value.replace(specials, (s) => {
56749
+ const c = s.charCodeAt(0).toString(16);
56750
+ if (s === " ") {
56751
+ return "_";
56752
+ }
56753
+ return "%" + (c.length < 2 ? "0" : "") + c;
56754
+ }).replace(/%/g, "=");
56755
+ }
56710
56756
  function detectExtension2(mimeType) {
56711
56757
  return detectExtension(mimeType);
56712
56758
  }
@@ -56797,16 +56843,18 @@ function safeEncodeURIComponent(str2) {
56797
56843
  }
56798
56844
  return str2.replace(/[\x00-\x1F *'()<>@,;:\\"[\]?=\u007F-\uFFFF]/g, (chr) => encodeURICharComponent(chr));
56799
56845
  }
56846
+ var TOKEN;
56800
56847
  var init_mime_funcs = __esm({
56801
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-funcs/index.js"() {
56848
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-funcs/index.js"() {
56802
56849
  init_base64();
56803
56850
  init_qp();
56804
56851
  init_mime_types();
56805
56852
  init_objects();
56853
+ TOKEN = /^[^\x00-\x20\x7f()<>@,;:\\"/[\]?=]+$/;
56806
56854
  }
56807
56855
  });
56808
56856
 
56809
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/addressparser/index.js
56857
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/addressparser/index.js
56810
56858
  function _quoteLocalPart(address) {
56811
56859
  const lastAt = address.lastIndexOf("@");
56812
56860
  if (lastAt < 0) {
@@ -57039,7 +57087,7 @@ function _handleAddress(tokens, depth) {
57039
57087
  data.text = data.text.join(" ");
57040
57088
  let groupMembers = [];
57041
57089
  if (data.group.length) {
57042
- const parsedGroup = addressparser(data.group.join(","), { _depth: depth + 1 });
57090
+ const parsedGroup = _parseAddressList(data.group.join(","), depth + 1);
57043
57091
  parsedGroup.forEach((member) => {
57044
57092
  if (member.group) {
57045
57093
  groupMembers = groupMembers.concat(member.group);
@@ -57111,7 +57159,7 @@ function _handleAddress(tokens, depth) {
57111
57159
  const addressFromQuotedText = !data.address.length && data.textWasQuoted.some((wasQuoted) => wasQuoted);
57112
57160
  data.text = data.text.join(" ");
57113
57161
  data.address = data.address.join(" ");
57114
- if (addressFromQuotedText && data.text) {
57162
+ if (addressFromQuotedText && data.text.indexOf("@") >= 0) {
57115
57163
  data.address = _quoteLocalPart(data.text);
57116
57164
  data.text = "";
57117
57165
  }
@@ -57134,9 +57182,7 @@ function _handleAddress(tokens, depth) {
57134
57182
  }
57135
57183
  return addresses;
57136
57184
  }
57137
- function addressparser(str2, options) {
57138
- options = options || {};
57139
- const depth = options._depth || 0;
57185
+ function _parseAddressList(str2, depth) {
57140
57186
  if (depth > MAX_NESTED_GROUP_DEPTH) {
57141
57187
  return [];
57142
57188
  }
@@ -57144,7 +57190,7 @@ function addressparser(str2, options) {
57144
57190
  const tokens = tokenizer.tokenize();
57145
57191
  const addresses = [];
57146
57192
  let address = [];
57147
- let parsedAddresses = [];
57193
+ const parsedAddresses = [];
57148
57194
  tokens.forEach((token) => {
57149
57195
  if (token.type === "operator" && (token.value === "," || token.value === ";")) {
57150
57196
  if (address.length) {
@@ -57175,8 +57221,11 @@ function addressparser(str2, options) {
57175
57221
  }
57176
57222
  }
57177
57223
  mergedAddresses.reverse();
57178
- parsedAddresses = mergedAddresses;
57179
- if (options.flatten) {
57224
+ return mergedAddresses;
57225
+ }
57226
+ function addressparser(str2, options) {
57227
+ const parsedAddresses = _parseAddressList(str2, 0);
57228
+ if (options?.flatten) {
57180
57229
  const flatAddresses = [];
57181
57230
  const walkAddressList = (list) => {
57182
57231
  list.forEach((entry) => {
@@ -57193,7 +57242,7 @@ function addressparser(str2, options) {
57193
57242
  }
57194
57243
  var HAS_WHITESPACE, QUOTED_LOCAL_ADDR, ADDR_SPEC, LOOSE_ADDR_SPEC, LOOSE_TEXT_ADDR, Tokenizer, MAX_NESTED_GROUP_DEPTH, addressparser_default;
57195
57244
  var init_addressparser = __esm({
57196
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/addressparser/index.js"() {
57245
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/addressparser/index.js"() {
57197
57246
  HAS_WHITESPACE = /\s/;
57198
57247
  QUOTED_LOCAL_ADDR = /^("(?:[^"\\]|\\[\s\S])*"@\S+)(?:\s+([\s\S]+))?$/;
57199
57248
  ADDR_SPEC = /^[^@\s]+@[^@\s]+$/;
@@ -57207,6 +57256,7 @@ var init_addressparser = __esm({
57207
57256
  this.node = null;
57208
57257
  this.escaped = false;
57209
57258
  this.inDomainLiteral = false;
57259
+ this.afterAt = false;
57210
57260
  this.list = [];
57211
57261
  this.operators = {
57212
57262
  '"': '"',
@@ -57247,10 +57297,11 @@ var init_addressparser = __esm({
57247
57297
  * Checks if a character is an operator or text and acts accordingly
57248
57298
  *
57249
57299
  * @param chr Character from the address field
57300
+ * @param nextChr Character following chr, null at the end of the field
57250
57301
  */
57251
57302
  checkChar(chr, nextChr) {
57252
57303
  if (!this.escaped && !this.operatorExpecting) {
57253
- if (!this.inDomainLiteral && chr === "[") {
57304
+ if (!this.inDomainLiteral && chr === "[" && this.afterAt) {
57254
57305
  this.inDomainLiteral = true;
57255
57306
  } else if (this.inDomainLiteral && (chr === "]" || chr === "," || chr === ";")) {
57256
57307
  this.inDomainLiteral = false;
@@ -57267,20 +57318,26 @@ var init_addressparser = __esm({
57267
57318
  }
57268
57319
  this.list.push(this.node);
57269
57320
  this.node = null;
57321
+ if (chr !== ")") {
57322
+ this.afterAt = false;
57323
+ }
57270
57324
  this.operatorExpecting = "";
57271
57325
  this.escaped = false;
57272
57326
  return;
57273
- } else if (!this.operatorExpecting && !this.inDomainLiteral && chr in this.operators) {
57327
+ } else if (!this.operatorExpecting && !(this.inDomainLiteral && chr === ":") && chr in this.operators) {
57274
57328
  this.node = {
57275
57329
  type: "operator",
57276
57330
  value: chr
57277
57331
  };
57278
57332
  this.list.push(this.node);
57279
57333
  this.node = null;
57334
+ if (chr !== "(") {
57335
+ this.afterAt = false;
57336
+ }
57280
57337
  this.operatorExpecting = this.operators[chr];
57281
57338
  this.escaped = false;
57282
57339
  return;
57283
- } else if (['"', "'"].includes(this.operatorExpecting) && chr === "\\") {
57340
+ } else if (['"', "'", ")"].includes(this.operatorExpecting) && chr === "\\") {
57284
57341
  this.escaped = true;
57285
57342
  return;
57286
57343
  }
@@ -57296,6 +57353,9 @@ var init_addressparser = __esm({
57296
57353
  }
57297
57354
  if (chr.charCodeAt(0) >= 33 || [" ", " "].includes(chr)) {
57298
57355
  this.node.value += chr;
57356
+ if (!this.operatorExpecting && chr !== " " && chr !== " ") {
57357
+ this.afterAt = chr === "@";
57358
+ }
57299
57359
  }
57300
57360
  this.escaped = false;
57301
57361
  }
@@ -57305,11 +57365,11 @@ var init_addressparser = __esm({
57305
57365
  }
57306
57366
  });
57307
57367
 
57308
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/last-newline.js
57368
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/last-newline.js
57309
57369
  import { Transform as Transform3 } from "node:stream";
57310
57370
  var LastNewline;
57311
57371
  var init_last_newline = __esm({
57312
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/last-newline.js"() {
57372
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/last-newline.js"() {
57313
57373
  LastNewline = class extends Transform3 {
57314
57374
  constructor() {
57315
57375
  super();
@@ -57339,11 +57399,11 @@ var init_last_newline = __esm({
57339
57399
  }
57340
57400
  });
57341
57401
 
57342
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/le-windows.js
57402
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/le-windows.js
57343
57403
  import { Transform as Transform4 } from "node:stream";
57344
57404
  var LeWindows;
57345
57405
  var init_le_windows = __esm({
57346
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/le-windows.js"() {
57406
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/le-windows.js"() {
57347
57407
  LeWindows = class extends Transform4 {
57348
57408
  constructor(options) {
57349
57409
  super(options);
@@ -57381,11 +57441,11 @@ var init_le_windows = __esm({
57381
57441
  }
57382
57442
  });
57383
57443
 
57384
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/le-unix.js
57444
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/le-unix.js
57385
57445
  import { Transform as Transform5 } from "node:stream";
57386
57446
  var LeUnix;
57387
57447
  var init_le_unix = __esm({
57388
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/le-unix.js"() {
57448
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/le-unix.js"() {
57389
57449
  LeUnix = class extends Transform5 {
57390
57450
  constructor(options) {
57391
57451
  super(options);
@@ -57416,7 +57476,7 @@ var init_le_unix = __esm({
57416
57476
  }
57417
57477
  });
57418
57478
 
57419
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/index.js
57479
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/index.js
57420
57480
  import crypto from "node:crypto";
57421
57481
  import fs2 from "node:fs";
57422
57482
  import { PassThrough as PassThrough2 } from "node:stream";
@@ -57436,7 +57496,7 @@ function _stripBoundaryControls(value) {
57436
57496
  }
57437
57497
  var FORMATTED_HEADERS, ATEXT, DOT_ATOM, QUOTED_STRING, PLAIN_ADDRESS, URL_PARSER_UNSAFE, MimeNode, mime_node_default;
57438
57498
  var init_mime_node = __esm({
57439
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mime-node/index.js"() {
57499
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mime-node/index.js"() {
57440
57500
  init_punycode();
57441
57501
  init_shared();
57442
57502
  init_mime_funcs();
@@ -58402,6 +58462,7 @@ var init_mime_node = __esm({
58402
58462
  *
58403
58463
  * @param addresses An array of address objects
58404
58464
  * @param [uniqueList] An array to be populated with addresses
58465
+ * @param [seenAddresses] Addresses already added to uniqueList, shared with recursive calls to keep deduplication linear
58405
58466
  * @return address string
58406
58467
  * @internal
58407
58468
  */
@@ -58513,7 +58574,7 @@ var init_mime_node = __esm({
58513
58574
  /**
58514
58575
  * If needed, mime encodes the name part
58515
58576
  *
58516
- * @param name Name part of an address
58577
+ * @param value Name part of an address
58517
58578
  * @returns Mime word encoded string if needed
58518
58579
  * @internal
58519
58580
  */
@@ -58563,14 +58624,14 @@ var init_mime_node = __esm({
58563
58624
  }
58564
58625
  });
58565
58626
 
58566
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mail-composer/index.js
58627
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mail-composer/index.js
58567
58628
  function isContentObject(value) {
58568
58629
  const content = value;
58569
58630
  return typeof value === "object" && !!(content.content || content.path || content.href || content.raw);
58570
58631
  }
58571
58632
  var MailComposer, mail_composer_default;
58572
58633
  var init_mail_composer = __esm({
58573
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mail-composer/index.js"() {
58634
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mail-composer/index.js"() {
58574
58635
  init_mime_node();
58575
58636
  init_mime_funcs();
58576
58637
  init_shared();
@@ -59057,11 +59118,22 @@ var init_mail_composer = __esm({
59057
59118
  }
59058
59119
  });
59059
59120
 
59060
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/message-parser.js
59121
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/message-parser.js
59061
59122
  import { Transform as Transform6 } from "node:stream";
59123
+ function _trimFieldName(str2) {
59124
+ let start = 0;
59125
+ let end = str2.length;
59126
+ while (start < end && (str2.charCodeAt(start) === 32 || str2.charCodeAt(start) === 9)) {
59127
+ start++;
59128
+ }
59129
+ while (end > start && (str2.charCodeAt(end - 1) === 32 || str2.charCodeAt(end - 1) === 9)) {
59130
+ end--;
59131
+ }
59132
+ return str2.slice(start, end);
59133
+ }
59062
59134
  var MessageParser, message_parser_default;
59063
59135
  var init_message_parser = __esm({
59064
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/message-parser.js"() {
59136
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/message-parser.js"() {
59065
59137
  MessageParser = class extends Transform6 {
59066
59138
  constructor(options) {
59067
59139
  super(options);
@@ -59180,7 +59252,7 @@ var init_message_parser = __esm({
59180
59252
  }
59181
59253
  }
59182
59254
  return lines.filter((line) => /[^ \t\r]/.test(line)).map((line) => ({
59183
- key: line.substr(0, line.indexOf(":")).replace(/^[ \t]+|[ \t]+$/g, "").toLowerCase(),
59255
+ key: _trimFieldName(line.substr(0, line.indexOf(":"))).toLowerCase(),
59184
59256
  line
59185
59257
  }));
59186
59258
  }
@@ -59189,12 +59261,12 @@ var init_message_parser = __esm({
59189
59261
  }
59190
59262
  });
59191
59263
 
59192
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js
59264
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js
59193
59265
  import { Transform as Transform7 } from "node:stream";
59194
59266
  import crypto2 from "node:crypto";
59195
59267
  var CHAR_CR, CHAR_LF, CHAR_SPACE, CHAR_TAB, CRLF, EMPTY_LINES, RelaxedBody, relaxed_body_default;
59196
59268
  var init_relaxed_body = __esm({
59197
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js"() {
59269
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/relaxed-body.js"() {
59198
59270
  CHAR_CR = 13;
59199
59271
  CHAR_LF = 10;
59200
59272
  CHAR_SPACE = 32;
@@ -59316,7 +59388,7 @@ var init_relaxed_body = __esm({
59316
59388
  }
59317
59389
  });
59318
59390
 
59319
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/sign.js
59391
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/sign.js
59320
59392
  import crypto3 from "node:crypto";
59321
59393
  function unsupportedHashAlgoError(hashAlgo) {
59322
59394
  const err = new Error('Unsupported DKIM hash algorithm "' + hashAlgo + '"');
@@ -59393,7 +59465,7 @@ function relaxedHeaderLine(line) {
59393
59465
  }
59394
59466
  var sign_default;
59395
59467
  var init_sign = __esm({
59396
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/sign.js"() {
59468
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/sign.js"() {
59397
59469
  init_punycode();
59398
59470
  init_mime_funcs();
59399
59471
  init_errors();
@@ -59403,14 +59475,14 @@ var init_sign = __esm({
59403
59475
  }
59404
59476
  });
59405
59477
 
59406
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/index.js
59478
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/index.js
59407
59479
  import { PassThrough as PassThrough3 } from "node:stream";
59408
59480
  import fs3 from "node:fs";
59409
59481
  import path2 from "node:path";
59410
59482
  import crypto4 from "node:crypto";
59411
59483
  var DKIM_ALGO, MAX_MESSAGE_SIZE, DKIMSigner, DKIM, dkim_default;
59412
59484
  var init_dkim = __esm({
59413
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/dkim/index.js"() {
59485
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/dkim/index.js"() {
59414
59486
  init_message_parser();
59415
59487
  init_relaxed_body();
59416
59488
  init_sign();
@@ -59614,7 +59686,7 @@ var init_dkim = __esm({
59614
59686
  }
59615
59687
  });
59616
59688
 
59617
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js
59689
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js
59618
59690
  import net5 from "node:net";
59619
59691
  import tls from "node:tls";
59620
59692
  function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions, callback) {
@@ -59678,18 +59750,25 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
59678
59750
  Object.keys(reqHeaders).map((key) => key + ": " + reqHeaders[key]).join("\r\n") + // End request
59679
59751
  "\r\n\r\n"
59680
59752
  );
59681
- let headers = "";
59753
+ const chunks = [];
59754
+ let received = 0;
59755
+ let tail = "";
59682
59756
  const onSocketData = (chunk) => {
59683
59757
  let match;
59684
- let remainder;
59685
59758
  if (finished) {
59686
59759
  return;
59687
59760
  }
59688
- headers += chunk.toString("binary");
59689
- if (match = headers.match(/\r\n\r\n/)) {
59761
+ const window = tail + chunk.toString("binary");
59762
+ const windowEnd = window.indexOf("\r\n\r\n");
59763
+ chunks.push(chunk);
59764
+ received += chunk.length;
59765
+ tail = window.slice(-3);
59766
+ if (windowEnd >= 0) {
59690
59767
  socket.removeListener("data", onSocketData);
59691
- remainder = headers.substr(match.index + match[0].length);
59692
- headers = headers.substr(0, match.index);
59768
+ const headerEnd = received - window.length + windowEnd;
59769
+ const response = Buffer.concat(chunks, received).toString("binary");
59770
+ const headers = response.substr(0, headerEnd);
59771
+ const remainder = response.substr(headerEnd + 4);
59693
59772
  if (remainder) {
59694
59773
  socket.unshift(Buffer.from(remainder, "binary"));
59695
59774
  }
@@ -59709,7 +59788,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
59709
59788
  socket.setTimeout(0);
59710
59789
  return done(null, socket);
59711
59790
  }
59712
- if (headers.length > MAX_RESPONSE_HEADER_BYTES) {
59791
+ if (received > MAX_RESPONSE_HEADER_BYTES) {
59713
59792
  socket.removeListener("data", onSocketData);
59714
59793
  const err = new Error("Proxy response headers too large");
59715
59794
  err.code = EPROXY;
@@ -59724,7 +59803,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
59724
59803
  }
59725
59804
  var MAX_RESPONSE_HEADER_BYTES, http_proxy_client_default;
59726
59805
  var init_http_proxy_client = __esm({
59727
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js"() {
59806
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/http-proxy-client.js"() {
59728
59807
  init_url();
59729
59808
  init_errors();
59730
59809
  MAX_RESPONSE_HEADER_BYTES = 64 * 1024;
@@ -59732,10 +59811,10 @@ var init_http_proxy_client = __esm({
59732
59811
  }
59733
59812
  });
59734
59813
 
59735
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mailer/mail-message.js
59814
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mailer/mail-message.js
59736
59815
  var hasOwn, MailMessage;
59737
59816
  var init_mail_message = __esm({
59738
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mailer/mail-message.js"() {
59817
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mailer/mail-message.js"() {
59739
59818
  init_shared();
59740
59819
  init_mime_node();
59741
59820
  init_mime_funcs();
@@ -59992,7 +60071,7 @@ var init_mail_message = __esm({
59992
60071
  }
59993
60072
  });
59994
60073
 
59995
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mailer/index.js
60074
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mailer/index.js
59996
60075
  import { EventEmitter } from "node:events";
59997
60076
  import util3 from "node:util";
59998
60077
  import net6 from "node:net";
@@ -60000,7 +60079,7 @@ import dns2 from "node:dns";
60000
60079
  import crypto5 from "node:crypto";
60001
60080
  var DEFAULT_MAX_RECIPIENTS, Mail, mailer_default;
60002
60081
  var init_mailer = __esm({
60003
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/mailer/index.js"() {
60082
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/mailer/index.js"() {
60004
60083
  init_shared();
60005
60084
  init_mime_types();
60006
60085
  init_mail_composer();
@@ -60345,11 +60424,11 @@ var init_mailer = __esm({
60345
60424
  }
60346
60425
  });
60347
60426
 
60348
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js
60427
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js
60349
60428
  import { Transform as Transform8 } from "node:stream";
60350
60429
  var INSERT_LF, INSERT_LF_DOT, INSERT_CR, INSERT_DOT, DataStream;
60351
60430
  var init_data_stream = __esm({
60352
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js"() {
60431
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/data-stream.js"() {
60353
60432
  INSERT_LF = Buffer.from("\n");
60354
60433
  INSERT_LF_DOT = Buffer.from("\n.");
60355
60434
  INSERT_CR = Buffer.from("\r");
@@ -60436,7 +60515,7 @@ var init_data_stream = __esm({
60436
60515
  }
60437
60516
  });
60438
60517
 
60439
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/index.js
60518
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/index.js
60440
60519
  import { EventEmitter as EventEmitter2 } from "node:events";
60441
60520
  import net7 from "node:net";
60442
60521
  import tls2 from "node:tls";
@@ -60458,7 +60537,7 @@ function isPartialLine(line) {
60458
60537
  }
60459
60538
  var CONNECTION_TIMEOUT, SOCKET_TIMEOUT, GREETING_TIMEOUT, DNS_TIMEOUT, TEARDOWN_NOOP, MAX_RESPONSE_SIZE, SMTPConnection, smtp_connection_default;
60460
60539
  var init_smtp_connection = __esm({
60461
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-connection/index.js"() {
60540
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-connection/index.js"() {
60462
60541
  init_package_info();
60463
60542
  init_data_stream();
60464
60543
  init_shared();
@@ -60903,7 +60982,7 @@ var init_smtp_connection = __esm({
60903
60982
  *
60904
60983
  * @param envelope Envelope object, {from: addr, to: [addr]}
60905
60984
  * @param message String, Buffer or a Stream
60906
- * @param callback Callback to return once sending is completed
60985
+ * @param done Callback to return once sending is completed
60907
60986
  */
60908
60987
  send(envelope, message, done) {
60909
60988
  let returned = false;
@@ -61091,6 +61170,8 @@ var init_smtp_connection = __esm({
61091
61170
  * @event
61092
61171
  * @param err Error object
61093
61172
  * @param type Error name
61173
+ * @param data Server response that triggered the error, false if there is none
61174
+ * @param command SMTP command that was in flight
61094
61175
  * @internal
61095
61176
  */
61096
61177
  _onError(err, type, data, command) {
@@ -61318,6 +61399,7 @@ var init_smtp_connection = __esm({
61318
61399
  * {from:'...', to:['...']}
61319
61400
  * or
61320
61401
  * {from:{address:'...',name:'...'}, to:[address:'...',name:'...']}
61402
+ * @param callback Callback to run once the envelope is processed
61321
61403
  * @internal
61322
61404
  */
61323
61405
  _setEnvelope(envelope, callback) {
@@ -61662,6 +61744,7 @@ var init_smtp_connection = __esm({
61662
61744
  * hosts invalidly use a longer message than VXNlcm5hbWU6
61663
61745
  *
61664
61746
  * @param str Message from the server
61747
+ * @param callback Callback to run once the authentication sequence completes
61665
61748
  * @internal
61666
61749
  */
61667
61750
  _actionAUTH_LOGIN_USER(str2, callback) {
@@ -61682,6 +61765,7 @@ var init_smtp_connection = __esm({
61682
61765
  * base64 encoded again.
61683
61766
  *
61684
61767
  * @param str Message from the server
61768
+ * @param callback Callback to run once the authentication sequence completes
61685
61769
  * @internal
61686
61770
  */
61687
61771
  _actionAUTH_CRAM_MD5(str2, callback) {
@@ -61707,6 +61791,7 @@ var init_smtp_connection = __esm({
61707
61791
  * the user can be considered logged in. Start waiting for a message to send
61708
61792
  *
61709
61793
  * @param str Message from the server
61794
+ * @param callback Callback to run once the authentication sequence completes
61710
61795
  * @internal
61711
61796
  */
61712
61797
  _actionAUTH_CRAM_MD5_PASS(str2, callback) {
@@ -61728,6 +61813,7 @@ var init_smtp_connection = __esm({
61728
61813
  * response needs to be base64 encoded password.
61729
61814
  *
61730
61815
  * @param str Message from the server
61816
+ * @param callback Callback to run once the authentication sequence completes
61731
61817
  * @internal
61732
61818
  */
61733
61819
  _actionAUTH_LOGIN_PASS(str2, callback) {
@@ -61748,6 +61834,8 @@ var init_smtp_connection = __esm({
61748
61834
  * the user can be considered logged in. Start waiting for a message to send
61749
61835
  *
61750
61836
  * @param str Message from the server
61837
+ * @param isRetry True if this is a retry after a failed login, or the callback itself
61838
+ * @param [callback] Callback to run once the authentication sequence completes
61751
61839
  * @internal
61752
61840
  */
61753
61841
  _actionAUTHComplete(str2, isRetry, callback) {
@@ -61788,6 +61876,7 @@ var init_smtp_connection = __esm({
61788
61876
  * Handle response for a MAIL FROM: command
61789
61877
  *
61790
61878
  * @param str Message from the server
61879
+ * @param callback Callback to run once the envelope is processed
61791
61880
  * @internal
61792
61881
  */
61793
61882
  _actionMAIL(str2, callback) {
@@ -61814,6 +61903,7 @@ var init_smtp_connection = __esm({
61814
61903
  * Handle response for a RCPT TO: command
61815
61904
  *
61816
61905
  * @param str Message from the server
61906
+ * @param callback Callback to run once the envelope is processed
61817
61907
  * @internal
61818
61908
  */
61819
61909
  _actionRCPT(str2, callback) {
@@ -61856,6 +61946,7 @@ var init_smtp_connection = __esm({
61856
61946
  * Handle response for a DATA command
61857
61947
  *
61858
61948
  * @param str Message from the server
61949
+ * @param callback Callback to run once the envelope is processed
61859
61950
  * @internal
61860
61951
  */
61861
61952
  _actionDATA(str2, callback) {
@@ -61880,6 +61971,7 @@ var init_smtp_connection = __esm({
61880
61971
  * We expect a single response that defines if the sending succeeded or failed
61881
61972
  *
61882
61973
  * @param str Message from the server
61974
+ * @param callback Callback to run with the final send result
61883
61975
  * @internal
61884
61976
  */
61885
61977
  _actionSMTPStream(str2, callback) {
@@ -61896,6 +61988,7 @@ var init_smtp_connection = __esm({
61896
61988
  * @param recipient The recipient this response applies to
61897
61989
  * @param final Is this the final recipient?
61898
61990
  * @param str Message from the server
61991
+ * @param callback Callback to run with the final send result
61899
61992
  * @internal
61900
61993
  */
61901
61994
  _actionLMTPStream(recipient, final, str2, callback) {
@@ -61977,12 +62070,12 @@ var init_smtp_connection = __esm({
61977
62070
  }
61978
62071
  });
61979
62072
 
61980
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/xoauth2/index.js
62073
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/xoauth2/index.js
61981
62074
  import { Stream } from "node:stream";
61982
62075
  import crypto7 from "node:crypto";
61983
62076
  var XOAuth2, xoauth2_default;
61984
62077
  var init_xoauth2 = __esm({
61985
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/xoauth2/index.js"() {
62078
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/xoauth2/index.js"() {
61986
62079
  init_fetch();
61987
62080
  init_shared();
61988
62081
  init_errors();
@@ -62312,11 +62405,11 @@ var init_xoauth2 = __esm({
62312
62405
  }
62313
62406
  });
62314
62407
 
62315
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js
62408
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js
62316
62409
  import { EventEmitter as EventEmitter3 } from "node:events";
62317
62410
  var PoolResource;
62318
62411
  var init_pool_resource = __esm({
62319
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js"() {
62412
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-pool/pool-resource.js"() {
62320
62413
  init_smtp_connection();
62321
62414
  init_shared();
62322
62415
  init_xoauth2();
@@ -62520,10 +62613,10 @@ var init_pool_resource = __esm({
62520
62613
  }
62521
62614
  });
62522
62615
 
62523
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/well-known/services.js
62616
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/well-known/services.js
62524
62617
  var services;
62525
62618
  var init_services = __esm({
62526
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/well-known/services.js"() {
62619
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/well-known/services.js"() {
62527
62620
  services = {
62528
62621
  "126": {
62529
62622
  "description": "126 Mail (NetEase)",
@@ -62836,6 +62929,12 @@ var init_services = __esm({
62836
62929
  "host": "mailosaur.io",
62837
62930
  "port": 25
62838
62931
  },
62932
+ "MailSenpai": {
62933
+ "description": "MailSenpai (SMTP Senpai, EU)",
62934
+ "host": "relay.mailsenpai.com",
62935
+ "port": 2525,
62936
+ "secure": false
62937
+ },
62839
62938
  "Mailtrap": {
62840
62939
  "description": "Mailtrap",
62841
62940
  "host": "live.smtp.mailtrap.io",
@@ -63191,7 +63290,7 @@ var init_services = __esm({
63191
63290
  }
63192
63291
  });
63193
63292
 
63194
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/well-known/index.js
63293
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/well-known/index.js
63195
63294
  function normalizeKey(key) {
63196
63295
  return key.replace(/[^a-zA-Z0-9.-]/g, "").toLowerCase();
63197
63296
  }
@@ -63210,7 +63309,7 @@ function wellKnown(key) {
63210
63309
  }
63211
63310
  var normalized;
63212
63311
  var init_well_known = __esm({
63213
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/well-known/index.js"() {
63312
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/well-known/index.js"() {
63214
63313
  init_services();
63215
63314
  normalized = {};
63216
63315
  Object.keys(services).forEach((key) => {
@@ -63227,11 +63326,11 @@ var init_well_known = __esm({
63227
63326
  }
63228
63327
  });
63229
63328
 
63230
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-pool/index.js
63329
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-pool/index.js
63231
63330
  import { EventEmitter as EventEmitter4 } from "node:events";
63232
63331
  var REQUEUE_BASE_DELAY, REQUEUE_MAX_DELAY, SMTPPool, smtp_pool_default;
63233
63332
  var init_smtp_pool = __esm({
63234
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-pool/index.js"() {
63333
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-pool/index.js"() {
63235
63334
  init_pool_resource();
63236
63335
  init_smtp_connection();
63237
63336
  init_well_known();
@@ -63720,11 +63819,11 @@ var init_smtp_pool = __esm({
63720
63819
  }
63721
63820
  });
63722
63821
 
63723
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-transport/index.js
63822
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-transport/index.js
63724
63823
  import { EventEmitter as EventEmitter5 } from "node:events";
63725
63824
  var SMTPTransport, smtp_transport_default;
63726
63825
  var init_smtp_transport = __esm({
63727
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/smtp-transport/index.js"() {
63826
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/smtp-transport/index.js"() {
63728
63827
  init_smtp_connection();
63729
63828
  init_well_known();
63730
63829
  init_shared();
@@ -64044,11 +64143,11 @@ var init_smtp_transport = __esm({
64044
64143
  }
64045
64144
  });
64046
64145
 
64047
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/sendmail-transport/index.js
64146
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/sendmail-transport/index.js
64048
64147
  import { spawn } from "node:child_process";
64049
64148
  var SendmailTransport, sendmail_transport_default;
64050
64149
  var init_sendmail_transport = __esm({
64051
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/sendmail-transport/index.js"() {
64150
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/sendmail-transport/index.js"() {
64052
64151
  init_package_info();
64053
64152
  init_shared();
64054
64153
  init_errors();
@@ -64189,10 +64288,10 @@ var init_sendmail_transport = __esm({
64189
64288
  }
64190
64289
  });
64191
64290
 
64192
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/stream-transport/index.js
64291
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/stream-transport/index.js
64193
64292
  var StreamTransport, stream_transport_default;
64194
64293
  var init_stream_transport = __esm({
64195
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/stream-transport/index.js"() {
64294
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/stream-transport/index.js"() {
64196
64295
  init_package_info();
64197
64296
  init_shared();
64198
64297
  init_le_windows();
@@ -64286,10 +64385,10 @@ var init_stream_transport = __esm({
64286
64385
  }
64287
64386
  });
64288
64387
 
64289
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/json-transport/index.js
64388
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/json-transport/index.js
64290
64389
  var JSONTransport, json_transport_default;
64291
64390
  var init_json_transport = __esm({
64292
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/json-transport/index.js"() {
64391
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/json-transport/index.js"() {
64293
64392
  init_package_info();
64294
64393
  init_shared();
64295
64394
  JSONTransport = class {
@@ -64345,7 +64444,7 @@ var init_json_transport = __esm({
64345
64444
  }
64346
64445
  });
64347
64446
 
64348
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/ses-transport/index.js
64447
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/ses-transport/index.js
64349
64448
  import EventEmitter6 from "node:events";
64350
64449
  function tagSesError(err) {
64351
64450
  if (err && typeof err === "object" && !err.code) {
@@ -64355,7 +64454,7 @@ function tagSesError(err) {
64355
64454
  }
64356
64455
  var SESTransport, ses_transport_default;
64357
64456
  var init_ses_transport = __esm({
64358
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/ses-transport/index.js"() {
64457
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/ses-transport/index.js"() {
64359
64458
  init_package_info();
64360
64459
  init_shared();
64361
64460
  init_errors();
@@ -64537,7 +64636,7 @@ var init_ses_transport = __esm({
64537
64636
  }
64538
64637
  });
64539
64638
 
64540
- // node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/nodemailer.js
64639
+ // node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/nodemailer.js
64541
64640
  function createTransport(transporter, defaults) {
64542
64641
  let options;
64543
64642
  if (
@@ -64659,7 +64758,7 @@ function getTestMessageUrl(info) {
64659
64758
  }
64660
64759
  var ETHEREAL_API, ETHEREAL_WEB, ETHEREAL_API_KEY, ETHEREAL_CACHE, testAccount, nodemailer, nodemailer_default;
64661
64760
  var init_nodemailer = __esm({
64662
- "node_modules/.pnpm/nodemailer@10.0.13/node_modules/nodemailer/dist/esm/nodemailer.js"() {
64761
+ "node_modules/.pnpm/nodemailer@10.0.16/node_modules/nodemailer/dist/esm/nodemailer.js"() {
64663
64762
  init_mailer();
64664
64763
  init_shared();
64665
64764
  init_smtp_pool();
@@ -75651,7 +75750,7 @@ function object(shape, params) {
75651
75750
  return new ZodMiniObject(def);
75652
75751
  }
75653
75752
 
75654
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
75753
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
75655
75754
  function isZ4Schema(s) {
75656
75755
  const schema = s;
75657
75756
  return !!schema._zod;
@@ -76506,7 +76605,7 @@ function preprocess(fn, schema) {
76506
76605
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
76507
76606
  config(en_default2());
76508
76607
 
76509
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
76608
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
76510
76609
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
76511
76610
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
76512
76611
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -78037,7 +78136,7 @@ var UrlElicitationRequiredError = class extends McpError {
78037
78136
  }
78038
78137
  };
78039
78138
 
78040
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
78139
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
78041
78140
  function isTerminal(status) {
78042
78141
  return status === "completed" || status === "failed" || status === "cancelled";
78043
78142
  }
@@ -79326,7 +79425,7 @@ var zodToJsonSchema = (schema, options) => {
79326
79425
  return combined;
79327
79426
  };
79328
79427
 
79329
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
79428
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
79330
79429
  function mapMiniTarget(t) {
79331
79430
  if (!t)
79332
79431
  return "draft-7";
@@ -79368,7 +79467,7 @@ function parseWithCompat(schema, data) {
79368
79467
  return result.data;
79369
79468
  }
79370
79469
 
79371
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
79470
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
79372
79471
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
79373
79472
  var Protocol = class {
79374
79473
  constructor(_options) {
@@ -79409,6 +79508,9 @@ var Protocol = class {
79409
79508
  this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
79410
79509
  const handleTaskResult = async () => {
79411
79510
  const taskId = request.params.taskId;
79511
+ if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
79512
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
79513
+ }
79412
79514
  if (this._taskMessageQueue) {
79413
79515
  let queuedMessage;
79414
79516
  while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
@@ -79439,12 +79541,12 @@ var Protocol = class {
79439
79541
  throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
79440
79542
  }
79441
79543
  if (!isTerminal(task.status)) {
79442
- await this._waitForTaskUpdate(taskId, extra.signal);
79544
+ await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
79443
79545
  return await handleTaskResult();
79444
79546
  }
79445
79547
  if (isTerminal(task.status)) {
79446
79548
  const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
79447
- this._clearTaskQueue(taskId);
79549
+ this._clearTaskQueue(taskId, extra.sessionId);
79448
79550
  return {
79449
79551
  ...result,
79450
79552
  _meta: {
@@ -79481,7 +79583,7 @@ var Protocol = class {
79481
79583
  throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
79482
79584
  }
79483
79585
  await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
79484
- this._clearTaskQueue(request.params.taskId);
79586
+ this._clearTaskQueue(request.params.taskId, extra.sessionId);
79485
79587
  const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
79486
79588
  if (!cancelledTask) {
79487
79589
  throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
@@ -79609,6 +79711,19 @@ var Protocol = class {
79609
79711
  const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
79610
79712
  const capturedTransport = this._transport;
79611
79713
  const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
79714
+ const sessionId = capturedTransport?.sessionId;
79715
+ const store = this._taskStore;
79716
+ let relatedTaskFound = true;
79717
+ let relatedTaskLookup;
79718
+ if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
79719
+ relatedTaskFound = false;
79720
+ relatedTaskLookup = (async () => {
79721
+ if (!await store.getTask(relatedTaskId, sessionId)) {
79722
+ throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
79723
+ }
79724
+ relatedTaskFound = true;
79725
+ })();
79726
+ }
79612
79727
  if (handler === void 0) {
79613
79728
  const errorResponse2 = {
79614
79729
  jsonrpc: "2.0",
@@ -79618,7 +79733,10 @@ var Protocol = class {
79618
79733
  message: "Method not found"
79619
79734
  }
79620
79735
  };
79621
- if (relatedTaskId && this._taskMessageQueue) {
79736
+ if (relatedTaskId && relatedTaskLookup) {
79737
+ const queuedError = { type: "error", message: errorResponse2, timestamp: Date.now() };
79738
+ relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse2)).catch((error3) => this._onerror(new Error(`Failed to send an error response: ${error3}`)));
79739
+ } else if (relatedTaskId && this._taskMessageQueue) {
79622
79740
  this._enqueueTaskMessage(relatedTaskId, {
79623
79741
  type: "error",
79624
79742
  message: errorResponse2,
@@ -79669,7 +79787,10 @@ var Protocol = class {
79669
79787
  closeSSEStream: extra?.closeSSEStream,
79670
79788
  closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
79671
79789
  };
79672
- Promise.resolve().then(() => {
79790
+ (relatedTaskLookup ?? Promise.resolve()).then(() => {
79791
+ if (relatedTaskLookup && abortController.signal.aborted) {
79792
+ throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
79793
+ }
79673
79794
  if (taskCreationParams) {
79674
79795
  this.assertTaskHandlerCapability(request.method);
79675
79796
  }
@@ -79704,7 +79825,7 @@ var Protocol = class {
79704
79825
  ...error3["data"] !== void 0 && { data: error3["data"] }
79705
79826
  }
79706
79827
  };
79707
- if (relatedTaskId && this._taskMessageQueue) {
79828
+ if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
79708
79829
  await this._enqueueTaskMessage(relatedTaskId, {
79709
79830
  type: "error",
79710
79831
  message: errorResponse2,
@@ -80184,7 +80305,7 @@ var Protocol = class {
80184
80305
  throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
80185
80306
  }
80186
80307
  const maxQueueSize = this._options?.maxTaskQueueSize;
80187
- await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
80308
+ await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
80188
80309
  }
80189
80310
  /**
80190
80311
  * Clears the message queue for a task and rejects any pending request resolvers.
@@ -80213,12 +80334,13 @@ var Protocol = class {
80213
80334
  * Uses polling to check for updates at the task's configured poll interval.
80214
80335
  * @param taskId The task ID to wait for
80215
80336
  * @param signal Abort signal to cancel the wait
80337
+ * @param sessionId Session of the request that waits, passed to the task store
80216
80338
  * @returns Promise that resolves when an update occurs or rejects if aborted
80217
80339
  */
80218
- async _waitForTaskUpdate(taskId, signal) {
80340
+ async _waitForTaskUpdate(taskId, signal, sessionId) {
80219
80341
  let interval = this._options?.defaultTaskPollInterval ?? 1e3;
80220
80342
  try {
80221
- const task = await this._taskStore?.getTask(taskId);
80343
+ const task = await this._taskStore?.getTask(taskId, sessionId);
80222
80344
  if (task?.pollInterval) {
80223
80345
  interval = task.pollInterval;
80224
80346
  }
@@ -80322,7 +80444,7 @@ function mergeCapabilities(base2, additional) {
80322
80444
  return result;
80323
80445
  }
80324
80446
 
80325
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
80447
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
80326
80448
  var import_ajv = __toESM(require_ajv(), 1);
80327
80449
  var import_ajv_formats = __toESM(require_dist(), 1);
80328
80450
  function createDefaultAjvInstance() {
@@ -80390,7 +80512,7 @@ var AjvJsonSchemaValidator = class {
80390
80512
  }
80391
80513
  };
80392
80514
 
80393
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
80515
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
80394
80516
  var ExperimentalServerTasks = class {
80395
80517
  constructor(_server) {
80396
80518
  this._server = _server;
@@ -80603,7 +80725,7 @@ var ExperimentalServerTasks = class {
80603
80725
  }
80604
80726
  };
80605
80727
 
80606
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
80728
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
80607
80729
  function assertToolsCallTaskCapability(requests, method, entityName) {
80608
80730
  if (!requests) {
80609
80731
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -80638,7 +80760,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
80638
80760
  }
80639
80761
  }
80640
80762
 
80641
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
80763
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
80642
80764
  var Server = class extends Protocol {
80643
80765
  /**
80644
80766
  * Initializes this server with the given name and version information.
@@ -81009,7 +81131,7 @@ var Server = class extends Protocol {
81009
81131
  }
81010
81132
  };
81011
81133
 
81012
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
81134
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
81013
81135
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
81014
81136
  function isCompletable(schema) {
81015
81137
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -81023,7 +81145,7 @@ var McpZodTypeKind;
81023
81145
  McpZodTypeKind2["Completable"] = "McpCompletable";
81024
81146
  })(McpZodTypeKind || (McpZodTypeKind = {}));
81025
81147
 
81026
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
81148
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
81027
81149
  var MAX_TEMPLATE_LENGTH = 1e6;
81028
81150
  var MAX_VARIABLE_LENGTH = 1e6;
81029
81151
  var MAX_TEMPLATE_EXPRESSIONS = 1e4;
@@ -81245,7 +81367,7 @@ var UriTemplate = class _UriTemplate {
81245
81367
  }
81246
81368
  };
81247
81369
 
81248
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
81370
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
81249
81371
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
81250
81372
  function validateToolName(name2) {
81251
81373
  const warnings = [];
@@ -81303,7 +81425,7 @@ function validateAndWarnToolName(name2) {
81303
81425
  return result.isValid;
81304
81426
  }
81305
81427
 
81306
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
81428
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
81307
81429
  var ExperimentalMcpServerTasks = class {
81308
81430
  constructor(_mcpServer) {
81309
81431
  this._mcpServer = _mcpServer;
@@ -81318,7 +81440,43 @@ var ExperimentalMcpServerTasks = class {
81318
81440
  }
81319
81441
  };
81320
81442
 
81321
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
81443
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
81444
+ function toolInputElementCount(value, max) {
81445
+ let count = 0;
81446
+ const stack = [value];
81447
+ while (stack.length > 0) {
81448
+ const node = stack.pop();
81449
+ if (node === null || typeof node !== "object")
81450
+ continue;
81451
+ if (Array.isArray(node)) {
81452
+ for (const child of node) {
81453
+ if (++count > max)
81454
+ return count;
81455
+ if (child !== null && typeof child === "object")
81456
+ stack.push(child);
81457
+ }
81458
+ } else {
81459
+ for (const key in node) {
81460
+ if (!Object.prototype.hasOwnProperty.call(node, key))
81461
+ continue;
81462
+ if (++count > max)
81463
+ return count;
81464
+ const child = node[key];
81465
+ if (child !== null && typeof child === "object")
81466
+ stack.push(child);
81467
+ }
81468
+ }
81469
+ }
81470
+ return count;
81471
+ }
81472
+ function resolveMaxToolInputElements(value) {
81473
+ if (value === void 0 || value === Infinity)
81474
+ return void 0;
81475
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) {
81476
+ throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
81477
+ }
81478
+ return value;
81479
+ }
81322
81480
  var McpServer = class {
81323
81481
  constructor(serverInfo, options) {
81324
81482
  this._registeredResources = {};
@@ -81330,6 +81488,7 @@ var McpServer = class {
81330
81488
  this._resourceHandlersInitialized = false;
81331
81489
  this._promptHandlersInitialized = false;
81332
81490
  this.server = new Server(serverInfo, options);
81491
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
81333
81492
  }
81334
81493
  /**
81335
81494
  * Access experimental features.
@@ -81460,12 +81619,15 @@ var McpServer = class {
81460
81619
  * Validates tool input arguments against the tool's input schema.
81461
81620
  */
81462
81621
  async validateToolInput(tool, args, toolName) {
81622
+ if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) {
81623
+ throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
81624
+ }
81463
81625
  if (!tool.inputSchema) {
81464
81626
  return void 0;
81465
81627
  }
81466
81628
  const inputObj = normalizeObjectSchema(tool.inputSchema);
81467
81629
  const schemaToParse = inputObj ?? tool.inputSchema;
81468
- const parseResult = await safeParseAsync2(schemaToParse, args);
81630
+ const parseResult = await safeParseAsync2(schemaToParse, args ?? {});
81469
81631
  if (!parseResult.success) {
81470
81632
  const error3 = "error" in parseResult ? parseResult.error : "Unknown error";
81471
81633
  const errorMessage = getParseErrorMessage(error3);
@@ -81703,7 +81865,7 @@ var McpServer = class {
81703
81865
  }
81704
81866
  if (prompt.argsSchema) {
81705
81867
  const argsObj = normalizeObjectSchema(prompt.argsSchema);
81706
- const parseResult = await safeParseAsync2(argsObj, request.params.arguments);
81868
+ const parseResult = await safeParseAsync2(argsObj, request.params.arguments ?? {});
81707
81869
  if (!parseResult.success) {
81708
81870
  const error3 = "error" in parseResult ? parseResult.error : "Unknown error";
81709
81871
  const errorMessage = getParseErrorMessage(error3);
@@ -82134,10 +82296,10 @@ var EMPTY_COMPLETION_RESULT = {
82134
82296
  }
82135
82297
  };
82136
82298
 
82137
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
82299
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
82138
82300
  import process2 from "node:process";
82139
82301
 
82140
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
82302
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
82141
82303
  var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
82142
82304
  var ReadBuffer = class {
82143
82305
  constructor(options) {
@@ -82174,7 +82336,7 @@ function serializeMessage(message) {
82174
82336
  return JSON.stringify(message) + "\n";
82175
82337
  }
82176
82338
 
82177
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.31.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
82339
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
82178
82340
  var StdioServerTransport = class {
82179
82341
  constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
82180
82342
  this._stdin = _stdin;
@@ -82754,6 +82916,49 @@ function preflightAttachments(attachments) {
82754
82916
  }
82755
82917
  }
82756
82918
 
82919
+ // src/utils/senderAccount.ts
82920
+ function extractAddress(sender) {
82921
+ const angle = /<([^<>]*)>\s*$/.exec(sender);
82922
+ return (angle ? angle[1] : sender).trim();
82923
+ }
82924
+ var same = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
82925
+ function describe(accounts) {
82926
+ const usable = accounts.filter((a) => a.enabled && a.addresses.length > 0);
82927
+ if (usable.length === 0) return "No enabled Mail account with an address was found.";
82928
+ return `Available: ${usable.map((a) => `${a.name} <${a.addresses.join(", ")}>`).join("; ")}`;
82929
+ }
82930
+ function pickSenderAddress(input, accounts) {
82931
+ const wanted = extractAddress(input);
82932
+ const enabled = accounts.filter((a) => a.enabled);
82933
+ const address = enabled.flatMap((a) => a.addresses).find((addr) => same(addr, wanted));
82934
+ if (address) return { address };
82935
+ const byName = enabled.filter((a) => same(a.name, input));
82936
+ if (byName.length > 1) {
82937
+ return {
82938
+ error: `Account name "${input}" matches ${byName.length} accounts; pass the exact sender address instead. ${describe(accounts)}`
82939
+ };
82940
+ }
82941
+ if (byName.length === 1) {
82942
+ const { addresses } = byName[0];
82943
+ if (addresses.length === 1) return { address: addresses[0] };
82944
+ return {
82945
+ error: `Account "${input}" has ${addresses.length === 0 ? "no address" : `${addresses.length} addresses`}; pass the exact sender address instead. ${describe(accounts)}`
82946
+ };
82947
+ }
82948
+ return {
82949
+ error: `No enabled Mail account or address matches "${input}", so nothing was sent or saved. ${describe(accounts)}`
82950
+ };
82951
+ }
82952
+ function senderGuardScript(safeAddress) {
82953
+ const check2 = safeAddress ? `
82954
+ if not (actualSender is "${safeAddress}" or actualSender ends with "<${safeAddress}>") then
82955
+ delete newMessage
82956
+ return "error:Mail.app would send as " & actualSender & " instead of ${safeAddress}, so nothing was sent or saved."
82957
+ end if` : "";
82958
+ return `
82959
+ set actualSender to sender of newMessage as text${check2}`;
82960
+ }
82961
+
82757
82962
  // src/services/appleMailManager.ts
82758
82963
  init_attachmentReadPolicy();
82759
82964
 
@@ -82961,6 +83166,9 @@ function extractFreshlyStalledMailboxes(raw) {
82961
83166
  var GROUP_SEP = "";
82962
83167
  var FIELD_SEP = "";
82963
83168
  var RECORD_SEP = "";
83169
+ var ITEM_SEP = "";
83170
+ var SENT_PREFIX = "sent:";
83171
+ var DRAFT_PREFIX = "draft created:";
82964
83172
  var DIAG_MARKER = "DIAG";
82965
83173
  var DIAG_FIELD_SEP = "F";
82966
83174
  var DIAG_ITEM_SEP = "M";
@@ -83337,6 +83545,13 @@ function looksLikeMailNotRunning(error3) {
83337
83545
  error3
83338
83546
  );
83339
83547
  }
83548
+ function parseComposeOutput(output, prefix) {
83549
+ const out = output.trim();
83550
+ if (out.startsWith(prefix)) return { success: true, from: out.slice(prefix.length) };
83551
+ if (out.startsWith("error:")) return { success: false, error: out.slice("error:".length) };
83552
+ console.error(`Unexpected compose output: ${out.slice(0, 200)}`);
83553
+ return { success: false };
83554
+ }
83340
83555
  function mailboxPathFragment(mailboxVar, outputVar) {
83341
83556
  return `
83342
83557
  set ${outputVar} to name of ${mailboxVar}
@@ -85384,8 +85599,9 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85384
85599
  * @param body - Email body (plain text)
85385
85600
  * @param cc - CC recipients
85386
85601
  * @param bcc - BCC recipients
85387
- * @param account - Account to send from
85388
- * @returns true if sent successfully
85602
+ * @param account - Account name or exact address to send from; resolved to one
85603
+ * address and verified before sending (see `utils/senderAccount.ts`)
85604
+ * @returns `from` is the sender Mail.app actually used
85389
85605
  */
85390
85606
  // ───────────────────────────────────────────────────────────────────
85391
85607
  // KNOWN BUG: outgoing emails sent via AppleScript on macOS 15+ get wrapped
@@ -85431,7 +85647,8 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85431
85647
  }
85432
85648
  const mat = materializeAttachments(attachments);
85433
85649
  try {
85434
- return this.sendEmailWithPaths(
85650
+ return this.composeWithCommands(
85651
+ "send",
85435
85652
  recipientCommands,
85436
85653
  safeSubject,
85437
85654
  safeBody,
@@ -85442,38 +85659,55 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85442
85659
  mat.cleanup();
85443
85660
  }
85444
85661
  }
85445
- sendEmailWithPaths(recipientCommands, safeSubject, safeBody, account, attachmentCommands) {
85446
- let sendCommand;
85447
- if (account) {
85448
- const safeAccount = escapeForAppleScript(account);
85449
- sendCommand = `
85450
- set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:true}
85451
- tell newMessage
85452
- ${recipientCommands}
85453
- set sender to "${safeAccount}"
85454
- ${attachmentCommands}
85455
- end tell
85456
- send newMessage
85457
- return "sent"
85458
- `;
85459
- } else {
85460
- sendCommand = `
85461
- set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:true}
85662
+ /**
85663
+ * Build and run the AppleScript compose for send-email (`send`) and
85664
+ * create-draft (`draft`): pin the sender when `account` is given, verify it
85665
+ * before the message leaves, and report the sender Mail actually used.
85666
+ */
85667
+ composeWithCommands(mode, recipientCommands, safeSubject, safeBody, account, attachmentCommands) {
85668
+ const sender = this.resolveSender(account);
85669
+ if ("error" in sender) return { success: false, error: sender.error };
85670
+ const prefix = mode === "send" ? SENT_PREFIX : DRAFT_PREFIX;
85671
+ const script = buildAppLevelScript(`
85672
+ set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:${mode === "send"}}
85462
85673
  tell newMessage
85463
85674
  ${recipientCommands}
85675
+ ${sender.setSender}
85464
85676
  ${attachmentCommands}
85465
85677
  end tell
85466
- send newMessage
85467
- return "sent"
85468
- `;
85469
- }
85470
- const script = buildAppLevelScript(sendCommand);
85678
+ ${sender.guard}
85679
+ ${mode === "send" ? "send newMessage" : ""}
85680
+ return "${prefix}" & actualSender
85681
+ `);
85471
85682
  const result = executeAppleScript(script, { timeoutMs: 6e4, maxRetries: 1 });
85472
85683
  if (!result.success) {
85473
- console.error(`Failed to send email: ${result.error}`);
85474
- return false;
85684
+ console.error(
85685
+ `Failed to ${mode === "send" ? "send email" : "create draft"}: ${result.error}`
85686
+ );
85687
+ return { success: false };
85475
85688
  }
85476
- return result.output.includes("sent");
85689
+ return parseComposeOutput(result.output, prefix);
85690
+ }
85691
+ /**
85692
+ * Turn the caller's `account` into the AppleScript pieces that pin the
85693
+ * sender and verify it. No `account` → no pin, but the script still reports
85694
+ * the sender Mail picked. Uses the cached account list: a stale list can only
85695
+ * turn a valid account into a refusal, and the in-script guard re-checks the
85696
+ * real sender before anything leaves.
85697
+ */
85698
+ resolveSender(account) {
85699
+ if (!account) return { setSender: "", guard: senderGuardScript(void 0) };
85700
+ const { accounts, failed } = this.listAccountsChecked({ timeoutMs: 3e4 });
85701
+ if (failed) {
85702
+ return { error: "Could not read Mail accounts to resolve the sender; nothing was sent." };
85703
+ }
85704
+ const picked = pickSenderAddress(account, accounts);
85705
+ if ("error" in picked) return { error: picked.error };
85706
+ const safeAddress = escapeForAppleScript(picked.address);
85707
+ return {
85708
+ setSender: `set sender to "${safeAddress}"`,
85709
+ guard: senderGuardScript(safeAddress)
85710
+ };
85477
85711
  }
85478
85712
  /**
85479
85713
  * Send individual personalized emails to a list of recipients (mail merge).
@@ -85491,6 +85725,10 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85491
85725
  sendSerialEmail(recipients, subject, body, account, delayMs = 500) {
85492
85726
  const effectiveDelay = Math.min(Math.max(delayMs, 0), 1e4);
85493
85727
  const results = [];
85728
+ const sender = this.resolveSender(account);
85729
+ if ("error" in sender) {
85730
+ return recipients.map((r) => ({ email: r.email, success: false, error: sender.error }));
85731
+ }
85494
85732
  for (let i = 0; i < recipients.length; i++) {
85495
85733
  const recipient = recipients[i];
85496
85734
  try {
@@ -85502,7 +85740,7 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85502
85740
  personalizedSubject = personalizedSubject.replace(placeholder, value);
85503
85741
  personalizedBody = personalizedBody.replace(placeholder, value);
85504
85742
  }
85505
- const success = this.sendEmail(
85743
+ const sent = this.sendEmail(
85506
85744
  [recipient.email],
85507
85745
  personalizedSubject,
85508
85746
  personalizedBody,
@@ -85512,8 +85750,8 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85512
85750
  );
85513
85751
  results.push({
85514
85752
  email: recipient.email,
85515
- success,
85516
- error: success ? void 0 : "Failed to send email"
85753
+ success: sent.success,
85754
+ error: sent.success ? void 0 : sent.error ?? "Failed to send email"
85517
85755
  });
85518
85756
  } catch (error3) {
85519
85757
  results.push({
@@ -85537,7 +85775,7 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85537
85775
  * @param cc - CC recipients
85538
85776
  * @param bcc - BCC recipients
85539
85777
  * @param account - Account to create draft in
85540
- * @returns true if draft created successfully
85778
+ * @returns `from` is the sender Mail.app actually used
85541
85779
  */
85542
85780
  createDraft(to, subject, body, cc, bcc, account, attachments) {
85543
85781
  const safeSubject = escapeForAppleScript(subject);
@@ -85562,7 +85800,8 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85562
85800
  const mat = materializeAttachments(attachments);
85563
85801
  const attachmentCommands = buildAttachmentCommands(mat.paths);
85564
85802
  try {
85565
- return this.createDraftWithCommands(
85803
+ return this.composeWithCommands(
85804
+ "draft",
85566
85805
  recipientCommands,
85567
85806
  safeSubject,
85568
85807
  safeBody,
@@ -85573,37 +85812,6 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
85573
85812
  mat.cleanup();
85574
85813
  }
85575
85814
  }
85576
- createDraftWithCommands(recipientCommands, safeSubject, safeBody, account, attachmentCommands) {
85577
- let draftCommand;
85578
- if (account) {
85579
- const safeAccount = escapeForAppleScript(account);
85580
- draftCommand = `
85581
- set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:false}
85582
- tell newMessage
85583
- ${recipientCommands}
85584
- set sender to "${safeAccount}"
85585
- ${attachmentCommands}
85586
- end tell
85587
- return "draft created"
85588
- `;
85589
- } else {
85590
- draftCommand = `
85591
- set newMessage to make new outgoing message with properties {subject:"${safeSubject}", content:"${safeBody}", visible:false}
85592
- tell newMessage
85593
- ${recipientCommands}
85594
- ${attachmentCommands}
85595
- end tell
85596
- return "draft created"
85597
- `;
85598
- }
85599
- const script = buildAppLevelScript(draftCommand);
85600
- const result = executeAppleScript(script, { timeoutMs: 6e4, maxRetries: 1 });
85601
- if (!result.success) {
85602
- console.error(`Failed to create draft: ${result.error}`);
85603
- return false;
85604
- }
85605
- return result.output.includes("draft created");
85606
- }
85607
85815
  /**
85608
85816
  * Reply to a message.
85609
85817
  *
@@ -87334,12 +87542,9 @@ end tell`;
87334
87542
  set accountList to {}
87335
87543
  repeat with acct in accounts
87336
87544
  set acctName to name of acct
87337
- set acctEmail to email addresses of acct
87338
87545
  set acctEnabled to enabled of acct
87339
- set emailStr to ""
87340
- if (count of acctEmail) > 0 then
87341
- set emailStr to item 1 of acctEmail
87342
- end if
87546
+ set AppleScript's text item delimiters to "${ITEM_SEP}"
87547
+ set emailStr to (email addresses of acct) as text
87343
87548
  set end of accountList to acctName & "${FIELD_SEP}" & emailStr & "${FIELD_SEP}" & acctEnabled
87344
87549
  end repeat
87345
87550
  set AppleScript's text item delimiters to "${RECORD_SEP}"
@@ -87360,9 +87565,11 @@ end tell`;
87360
87565
  for (const item of items) {
87361
87566
  const parts = item.split(FIELD_SEP);
87362
87567
  if (parts.length < 3) continue;
87568
+ const addresses = parts[1].split(ITEM_SEP).filter(Boolean);
87363
87569
  accounts.push({
87364
87570
  name: parts[0],
87365
- email: parts[1],
87571
+ email: addresses[0] ?? "",
87572
+ addresses,
87366
87573
  enabled: parts[2] === "true"
87367
87574
  });
87368
87575
  }
@@ -87610,7 +87817,7 @@ ${actionStmts.join("\n")}
87610
87817
  const subject = overrides?.subject ?? template.subject;
87611
87818
  const body = overrides?.body ?? template.body;
87612
87819
  if (to.length === 0) return false;
87613
- return this.createDraft(to, subject, body, cc);
87820
+ return this.createDraft(to, subject, body, cc).success;
87614
87821
  }
87615
87822
  // ===========================================================================
87616
87823
  // Diagnostics
@@ -90013,6 +90220,9 @@ var SENT_COPY_SCHEMA = external_exports.boolean().optional().describe(
90013
90220
  "SMTP only: whether a best-effort copy was filed to the account's Sent mailbox over IMAP (issue #220). Absent when no configured IMAP account matches the SMTP identity \u2014 not a failure, the feature simply wasn't engaged."
90014
90221
  );
90015
90222
  var SENT_COPY_ERROR_SCHEMA = external_exports.string().optional().describe("Present only when sentCopy is false: why the Sent-folder copy failed.");
90223
+ var SEND_ACCOUNT_SCHEMA = external_exports.string().optional().describe(
90224
+ "Account to send from. AppleScript transport: a Mail account name or an exact sender address, resolved to one address and verified before sending; if it matches no enabled account, or Mail would use a different sender, nothing is sent and an error is returned. Omitted \u2192 Mail's default sender (reported back in `from`). SMTP transport: an email-form From override (see README)."
90225
+ );
90016
90226
  registerTool(
90017
90227
  "send-email",
90018
90228
  {
@@ -90023,7 +90233,7 @@ registerTool(
90023
90233
  body: external_exports.string().min(1, "Body is required"),
90024
90234
  cc: external_exports.array(external_exports.string()).optional().describe("CC recipients"),
90025
90235
  bcc: external_exports.array(external_exports.string()).optional().describe("BCC recipients"),
90026
- account: external_exports.string().optional().describe("Account to send from"),
90236
+ account: SEND_ACCOUNT_SCHEMA,
90027
90237
  attachments: ATTACHMENTS_SCHEMA,
90028
90238
  inReplyTo: IN_REPLY_TO_SCHEMA,
90029
90239
  references: REFERENCES_SCHEMA,
@@ -90039,6 +90249,7 @@ registerTool(
90039
90249
  recipients: external_exports.array(external_exports.string()).optional(),
90040
90250
  attachmentCount: external_exports.number().optional(),
90041
90251
  transport: external_exports.string().optional(),
90252
+ from: external_exports.string().optional().describe("AppleScript transport: the sender Mail.app used"),
90042
90253
  messageId: external_exports.string().optional(),
90043
90254
  sentCopy: SENT_COPY_SCHEMA,
90044
90255
  sentCopyError: SENT_COPY_ERROR_SCHEMA
@@ -90090,16 +90301,20 @@ registerTool(
90090
90301
  ...result.sentCopyError !== void 0 ? { sentCopyError: result.sentCopyError } : {}
90091
90302
  });
90092
90303
  }
90093
- const success = mailManager.sendEmail(to, subject, body, cc, bcc, account, attachments);
90094
- if (!success) {
90095
- return errorResponse("Failed to send email. Check Mail.app configuration.");
90304
+ const sent = mailManager.sendEmail(to, subject, body, cc, bcc, account, attachments);
90305
+ if (!sent.success) {
90306
+ return errorResponse(sent.error ?? "Failed to send email. Check Mail.app configuration.");
90096
90307
  }
90097
- return successResponse(`Email sent to ${to.join(", ")}${attachInfo}`, {
90098
- ok: true,
90099
- recipients: to,
90100
- attachmentCount,
90101
- transport: "applescript"
90102
- });
90308
+ return successResponse(
90309
+ `Email sent to ${to.join(", ")}${attachInfo}${sent.from ? ` from ${sent.from}` : ""}`,
90310
+ {
90311
+ ok: true,
90312
+ recipients: to,
90313
+ attachmentCount,
90314
+ transport: "applescript",
90315
+ from: sent.from
90316
+ }
90317
+ );
90103
90318
  },
90104
90319
  "Error sending email"
90105
90320
  )
@@ -90117,7 +90332,7 @@ registerTool(
90117
90332
  ).min(1, "At least one recipient is required").max(100, "Cannot send to more than 100 recipients in a single batch").describe("List of recipients with personalization variables (max 100)"),
90118
90333
  subject: external_exports.string().min(1, "Subject is required").describe("Subject line \u2014 use {{Key}} for placeholders"),
90119
90334
  body: external_exports.string().min(1, "Body is required").describe("Email body \u2014 use {{Key}} for placeholders"),
90120
- account: external_exports.string().optional().describe("Account to send from"),
90335
+ account: SEND_ACCOUNT_SCHEMA,
90121
90336
  delayMs: external_exports.number().min(0).max(1e4).optional().describe("Delay between sends in ms (default: 500, max: 10000)")
90122
90337
  },
90123
90338
  outputSchema: {
@@ -90171,7 +90386,7 @@ registerTool(
90171
90386
  cc: external_exports.array(external_exports.string()).optional().describe("CC recipients"),
90172
90387
  bcc: external_exports.array(external_exports.string()).optional().describe("BCC recipients"),
90173
90388
  account: external_exports.string().optional().describe(
90174
- "Account to create draft in. With inReplyTo/references this must name a configured IMAP account (label or login); when omitted, the IMAP account matching the SMTP identity, else the only IMAP account, is used."
90389
+ "Account to create draft in: a Mail account name or an exact sender address, resolved and verified before the draft is saved (no match or a different sender \u2192 error, no draft). With inReplyTo/references this must name a configured IMAP account (label or login); when omitted, the IMAP account matching the SMTP identity, else the only IMAP account, is used."
90175
90390
  ),
90176
90391
  attachments: ATTACHMENTS_SCHEMA,
90177
90392
  inReplyTo: IN_REPLY_TO_SCHEMA,
@@ -90182,6 +90397,7 @@ registerTool(
90182
90397
  recipients: external_exports.array(external_exports.string()).optional(),
90183
90398
  attachmentCount: external_exports.number().optional(),
90184
90399
  transport: external_exports.enum(["applescript", "imap"]).optional(),
90400
+ from: external_exports.string().optional().describe("AppleScript draft: the sender Mail.app used"),
90185
90401
  account: external_exports.string().optional().describe("Threaded draft only: IMAP account it was filed in"),
90186
90402
  mailbox: external_exports.string().optional().describe("Threaded draft only: Drafts mailbox path"),
90187
90403
  messageId: external_exports.string().optional().describe("Threaded draft only: the draft's Message-ID"),
@@ -90204,18 +90420,24 @@ registerTool(
90204
90420
  references
90205
90421
  });
90206
90422
  }
90207
- const success = mailManager.createDraft(to, subject, body, cc, bcc, account, attachments);
90208
- if (!success) {
90209
- return errorResponse("Failed to create draft. Check Mail.app configuration.");
90423
+ const drafted = mailManager.createDraft(to, subject, body, cc, bcc, account, attachments);
90424
+ if (!drafted.success) {
90425
+ return errorResponse(
90426
+ drafted.error ?? "Failed to create draft. Check Mail.app configuration."
90427
+ );
90210
90428
  }
90211
90429
  const attachmentCount = attachments?.length ?? 0;
90212
90430
  const attachInfo = attachmentCount ? ` with ${attachmentCount} attachment(s)` : "";
90213
- return successResponse(`Draft created for ${to.join(", ")}${attachInfo}`, {
90214
- ok: true,
90215
- recipients: to,
90216
- attachmentCount,
90217
- transport: "applescript"
90218
- });
90431
+ return successResponse(
90432
+ `Draft created for ${to.join(", ")}${attachInfo}${drafted.from ? ` from ${drafted.from}` : ""}`,
90433
+ {
90434
+ ok: true,
90435
+ recipients: to,
90436
+ attachmentCount,
90437
+ transport: "applescript",
90438
+ from: drafted.from
90439
+ }
90440
+ );
90219
90441
  },
90220
90442
  "Error creating draft"
90221
90443
  )