@mgcrea/mcp-apple-mail 1.20.1 → 1.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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-Bk26ykNa.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
@@ -158,7 +158,10 @@ declare class MailAxLane {
158
158
  * milliseconds.
159
159
  *
160
160
  * The subject is the identity, and requiring a body area with it rejects the
161
- * main window and the drafts list. Counting windows does not work: Mail closes
161
+ * main window and the drafts list. It is an identity only because `compose.ts`
162
+ * refuses when a composer under the same subject was already open before the
163
+ * call: a leftover from an earlier attempt matches here just as well, and is
164
+ * readable first. Counting windows does not work: Mail closes
162
165
  * and reuses windows around a compose, so the count comes back unchanged with
163
166
  * a new composer on screen.
164
167
  */
@@ -189,8 +192,18 @@ declare class MailAxLane {
189
192
  * `matched` rather than the returned length, because the response is byte
190
193
  * capped and a long quoted message will truncate — a fingerprint taken from a
191
194
  * truncated list would compare two different bounds rather than two states.
195
+ *
196
+ * **Null when the body cannot be read at all, and that is the whole point.**
197
+ * This returned -1 for a failed read, and the caller compared it as a count.
198
+ * A composer that CLOSES takes its element handle with it — the driver answers
199
+ * `staleHandle` — so a body that had gone in perfectly read back as -1 and
200
+ * compared unequal to the size before, which is the signature of "something
201
+ * landed that cannot be matched". A reply sent by hand mid-call was reported
202
+ * as a body that never went in, with a warning against the retry that was in
203
+ * fact the safe move. Blind and different are not the same answer, exactly as
204
+ * `bodyText` above insists, and this is where that was forgotten.
192
205
  */
193
- bodySize(body: string): Promise<number>;
206
+ bodySize(body: string): Promise<number | null>;
194
207
  /**
195
208
  * Focus the body and paste, and say whether the focus took.
196
209
  *
@@ -210,6 +223,13 @@ declare class MailAxLane {
210
223
  *
211
224
  * The guard itself stays. Posting command-V without knowing where the focus is
212
225
  * types into whatever happens to be in front, and that is the user's window.
226
+ *
227
+ * **A composer that has gone answers false rather than throwing.** Both handles
228
+ * die with the window, so raising or focusing one afterwards is a `staleHandle`
229
+ * — and letting that escape turns a describable failure into a bare channel
230
+ * error with no note attached, on the one path whose whole job is to say what
231
+ * happened. False is the honest answer: the focus was not taken, so nothing was
232
+ * typed.
213
233
  */
214
234
  paste(ref: ComposerRef, focusTimeoutMs?: number): Promise<boolean>;
215
235
  /**
@@ -228,8 +248,31 @@ declare class MailAxLane {
228
248
  * alternative and is worse — drafts are discovered by subject, so two with the
229
249
  * same one are indistinguishable, on the single path whose named failure is
230
250
  * sending the wrong thing.
251
+ *
252
+ * **The window is raised again first, and the answer says whether that took.**
253
+ * The focus is only known to be in the composer at the moment of the paste;
254
+ * between the read that verifies the body and this keystroke the person at the
255
+ * keyboard can move the foreground, and command-shift-D would then be posted
256
+ * into whatever they moved to. Re-raising costs two round trips and closes
257
+ * that window.
258
+ *
259
+ * The keystroke also names the composer's window, which closes the gap that
260
+ * remains between the re-raise and the key: the desktop server brings Mail
261
+ * forward again and refuses rather than posting into something else.
262
+ *
263
+ * Only `"pressed"` means anything was pressed. The other two answers are both
264
+ * refusals, and they are kept apart because they mean opposite things to the
265
+ * person reading the result:
266
+ *
267
+ * * `"gone"`: the composer could not be raised. Its handle died with the
268
+ * window, so somebody sent or closed it.
269
+ * * `"refused"`: raised, but the keystroke was refused because Mail would
270
+ * not come forward. The composer is still on screen, unsent.
271
+ *
272
+ * Posting a send into an unknown foreground is the one outcome worth refusing
273
+ * outright, which is why neither of them throws.
231
274
  */
232
- finish(sendNow: boolean): Promise<void>;
275
+ finish(sendNow: boolean, ref: ComposerRef): Promise<"pressed" | "gone" | "refused">;
233
276
  /**
234
277
  * Has the composer for this subject gone?
235
278
  *
@@ -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;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;;;;;;;;;;;;;EA4BxB,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;EAiCxB,MAAM,KAAK,aAAa,0BAAoC;;;;;;;;;;;;;;;;;;EA+B5D,OAAO,mBAAmB;;;;;;;;;EAoB1B,aAAa,iBAAiB,oBAAoB;;EAclD,aAAa;;;;;;;;;EAYb,cAAc,eAAe;;;;KChWzB;EACV;EACA;EACA;;;;;;;;;EASA;;EAEA;;;;;;;;;;;;;;;;;;;;;KCEU;EACV,SAAS;EACT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,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"}
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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AS,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-Bk26ykNa.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 };