@mgcrea/mcp-apple-mail 1.20.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as loadConfig, b as MAIL_SURFACE, j as BUILD_INFO, r as createServer } from "./server-DdKWlMP9.js";
2
+ import { a as loadConfig, b as MAIL_SURFACE, j as BUILD_INFO, r as createServer } from "./server-CcHy5Pw4.js";
3
3
  import { runStdioServer } from "@mgcrea/mcp-apple-core";
4
4
  //#region src/cli.ts
5
5
  const LOG_PREFIX = "apple-mail-mcp";
package/dist/index.d.ts CHANGED
@@ -189,8 +189,18 @@ declare class MailAxLane {
189
189
  * `matched` rather than the returned length, because the response is byte
190
190
  * capped and a long quoted message will truncate — a fingerprint taken from a
191
191
  * truncated list would compare two different bounds rather than two states.
192
+ *
193
+ * **Null when the body cannot be read at all, and that is the whole point.**
194
+ * This returned -1 for a failed read, and the caller compared it as a count.
195
+ * A composer that CLOSES takes its element handle with it — the driver answers
196
+ * `staleHandle` — so a body that had gone in perfectly read back as -1 and
197
+ * compared unequal to the size before, which is the signature of "something
198
+ * landed that cannot be matched". A reply sent by hand mid-call was reported
199
+ * as a body that never went in, with a warning against the retry that was in
200
+ * fact the safe move. Blind and different are not the same answer, exactly as
201
+ * `bodyText` above insists, and this is where that was forgotten.
192
202
  */
193
- bodySize(body: string): Promise<number>;
203
+ bodySize(body: string): Promise<number | null>;
194
204
  /**
195
205
  * Focus the body and paste, and say whether the focus took.
196
206
  *
@@ -210,6 +220,13 @@ declare class MailAxLane {
210
220
  *
211
221
  * The guard itself stays. Posting command-V without knowing where the focus is
212
222
  * types into whatever happens to be in front, and that is the user's window.
223
+ *
224
+ * **A composer that has gone answers false rather than throwing.** Both handles
225
+ * die with the window, so raising or focusing one afterwards is a `staleHandle`
226
+ * — and letting that escape turns a describable failure into a bare channel
227
+ * error with no note attached, on the one path whose whole job is to say what
228
+ * happened. False is the honest answer: the focus was not taken, so nothing was
229
+ * typed.
213
230
  */
214
231
  paste(ref: ComposerRef, focusTimeoutMs?: number): Promise<boolean>;
215
232
  /**
@@ -228,8 +245,31 @@ declare class MailAxLane {
228
245
  * alternative and is worse — drafts are discovered by subject, so two with the
229
246
  * same one are indistinguishable, on the single path whose named failure is
230
247
  * sending the wrong thing.
248
+ *
249
+ * **The window is raised again first, and the answer says whether that took.**
250
+ * The focus is only known to be in the composer at the moment of the paste;
251
+ * between the read that verifies the body and this keystroke the person at the
252
+ * keyboard can move the foreground, and command-shift-D would then be posted
253
+ * into whatever they moved to. Re-raising costs two round trips and closes
254
+ * that window.
255
+ *
256
+ * The keystroke also names the composer's window, which closes the gap that
257
+ * remains between the re-raise and the key: the desktop server brings Mail
258
+ * forward again and refuses rather than posting into something else.
259
+ *
260
+ * Only `"pressed"` means anything was pressed. The other two answers are both
261
+ * refusals, and they are kept apart because they mean opposite things to the
262
+ * person reading the result:
263
+ *
264
+ * * `"gone"`: the composer could not be raised. Its handle died with the
265
+ * window, so somebody sent or closed it.
266
+ * * `"refused"`: raised, but the keystroke was refused because Mail would
267
+ * not come forward. The composer is still on screen, unsent.
268
+ *
269
+ * Posting a send into an unknown foreground is the one outcome worth refusing
270
+ * outright, which is why neither of them throws.
231
271
  */
232
- finish(sendNow: boolean): Promise<void>;
272
+ finish(sendNow: boolean, ref: ComposerRef): Promise<"pressed" | "gone" | "refused">;
233
273
  /**
234
274
  * Has the composer for this subject gone?
235
275
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/errors.ts","../src/client/locate.ts","../src/config.ts","../src/client/ax.ts","../src/client/mime.ts","../src/client/emlx.ts","../src/client/schema.ts","../src/client/envelope.ts","../src/client/mailbox-map.ts","../src/client/mail.ts","../src/client/ref.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;;cCWZ,6BAA6B;WACt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vwCQ;KAED;EACV;EACA;EACA;;cAKW,YAAS,KAAS;cAGlB,YAAS,gBAAkB;;cA2B3B,qBAAkB,MAAU,iBAAe,YAAY;;;cChDvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KCrB7C;;;;;EAKV;;;;;;;;;;;;cAaW,gBAAa,QAChB,WAAS,QACT,iBAAe,KAClB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/errors.ts","../src/client/locate.ts","../src/config.ts","../src/client/ax.ts","../src/client/mime.ts","../src/client/emlx.ts","../src/client/schema.ts","../src/client/envelope.ts","../src/client/mailbox-map.ts","../src/client/mail.ts","../src/client/ref.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;;cCWZ,6BAA6B;WACtB;EAElB,YAAY;;;;;;;;;;;;;;;;;;;;KCTF;;EAEV;;EAEA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;;KAKU;;EAEV;;EAEA;;EAEA;;EAEA;;cAiBW,sBAAmB,OAAU,kBAAqB;;;;;;;;;;;;;;;cC3CzD,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;;GA8CP,EAAA,KAAA;KAEC,SAAS,EAAE,aAAa;;;;;cAMvB,aAAU,MAAS,OAAO,eAA2B;;;KCmBtD;EAAgB;EAAgB;EAAc;;KAE9C;EACV;;EAEA;EACA;;cAGW;;UAGJ;;SAKA,KAAK,MAAK,OAAO,aAA2B;EAKnD;;EAKA,SAAS;;;;;;;;;;;;;;;;;;EAyBH,SAAS,QAAQ;;;;;;;;;SAqBhB,aAAa;;;;;;;;;;;;;;EAuBd,aAAa,iBAAiB,oBAAoB,QAAQ;;EA4B1D,YAAY;;;;;;;;;;;;;EAgBZ,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;EAsCxB,SAAS,eAAe;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B;MACvB;IACD;IACA;IACA;IACA;IACA;;;;;;;;;;;;;;;EA2HI,oBAAoB;IAEtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;;;;;;;;EA0HE,eACJ,aACA,kBACA;IAAQ;MACP;IAAU;IAAc;IAAe;;;EA+CpC,SACJ,gBACA;IAAS;IAAgB;IAAmB;IAAoB;MAC/D;IAAU;IAAiB;IAAgB;;EA6BxC,aACJ,gBACA;IAAQ;IAA4B;MACnC;IAAU;IAAe;IAAgB;IAAqB;;EAqD3D,eAAe,iBAAiB;IACpC;IACA;IACA;IACA;;;;;;;;;;;;;;EAuCI,cACJ,cACA,mBACC;IACD;IACA;IACA;IACA;IACA;;;;;;;;;;;;;;;EAkDI,YACJ,aACA;IAAQ;IAAc;MACrB,QAAQ;EAoBL,gBAAgB,mBAAmB;EAKnC,YAAY;IAChB;IACA;IACA;IACA;IACA;IACA;IACA;MACE;EAaE,eACJ,aACA;IACE;IACA;IACA;IACA;IACA;MAED;;;;;;;;;;;;;;;;;;;;;cCvwCQ;KAED;EACV;EACA;EACA;;cAKW,YAAS,KAAS;cAGlB,YAAS,gBAAkB;;cA2B3B,qBAAkB,MAAU,iBAAe,YAAY;;;cChDvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KCrB7C;;;;;EAKV;;;;;;;;;;;;cAaW,gBAAa,QAChB,WAAS,QACT,iBAAe,KAClB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as WritesDisabledError, C as MessageNotFoundError, D as ProtocolError, E as PreconditionError, O as SchemaDriftError, S as MailNotRunningError, T as PlatformError, _ as locateEnvelopeIndex, a as loadConfig, c as decodeRef, d as assertStaticScript, f as createOsascriptRunner, g as inspectFile, h as MailboxMap, i as registerTools, j as BUILD_INFO, k as TccDeniedError, l as encodeRef, m as withBusyRetry, n as SERVER_VERSION, o as AppleMailClient, p as mapOsaError, r as createServer, s as REF_VERSION, t as SERVER_NAME, u as groupRefsByMailbox, v as AppleMailError, w as OsascriptTimeoutError, x as MailBusyError, y as IndexUnavailableError } from "./server-DdKWlMP9.js";
1
+ import { A as WritesDisabledError, C as MessageNotFoundError, D as ProtocolError, E as PreconditionError, O as SchemaDriftError, S as MailNotRunningError, T as PlatformError, _ as locateEnvelopeIndex, a as loadConfig, c as decodeRef, d as assertStaticScript, f as createOsascriptRunner, g as inspectFile, h as MailboxMap, i as registerTools, j as BUILD_INFO, k as TccDeniedError, l as encodeRef, m as withBusyRetry, n as SERVER_VERSION, o as AppleMailClient, p as mapOsaError, r as createServer, s as REF_VERSION, t as SERVER_NAME, u as groupRefsByMailbox, v as AppleMailError, w as OsascriptTimeoutError, x as MailBusyError, y as IndexUnavailableError } from "./server-CcHy5Pw4.js";
2
2
  export { AppleMailClient, AppleMailError, BUILD_INFO, IndexUnavailableError, MailBusyError, MailNotRunningError, MailboxMap, MessageNotFoundError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, REF_VERSION, SERVER_NAME, SERVER_VERSION, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, createOsascriptRunner, createServer, decodeRef, encodeRef, groupRefsByMailbox, inspectFile, loadConfig, locateEnvelopeIndex, mapOsaError, registerTools, withBusyRetry };