apple-mail-mcp 2.10.31 → 2.10.33

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.
Files changed (4) hide show
  1. package/README.md +40 -6
  2. package/build/cli.js +236 -136
  3. package/build/index.js +1330 -783
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -1399,6 +1399,7 @@ batch of only `imap:` ids returns no `countDelta` rather than a fabricated one.
1399
1399
  | `APPLE_MAIL_MCP_AUDIT_LOG` | *(off)* | Absolute path to an NDJSON file. Setting it enables the audit log **and** the collateral diff below |
1400
1400
  | `APPLE_MAIL_MCP_AUDIT_SUBJECTS` | `0` | Set `1` to also record message **subjects**. Separate, deliberate second opt-in — see Privacy |
1401
1401
  | `APPLE_MAIL_MCP_AUDIT_SNAPSHOT_MAX` | `2000` | Skip the collateral snapshot for mailboxes larger than this many messages. `0` disables the snapshot entirely |
1402
+ | `APPLE_MAIL_MCP_AUDIT_SNAPSHOT_CHUNK` | `250` | How many messages the collateral snapshot reads from Mail per request. Lower it if Mail declines slices on a very large mailbox |
1402
1403
 
1403
1404
  When set, each destructive operation appends **one JSON object per line**
1404
1405
  containing: timestamp, tool name, server version, the arguments it was called
@@ -1451,12 +1452,45 @@ exceed AppleScript's 2^29 integer range (where Mail hands them back as
1451
1452
  compared in the raw form, a message you explicitly asked to delete would be
1452
1453
  reported here as collateral.
1453
1454
 
1454
- This costs one bulk property read per snapshot and is O(mailbox size), so it is
1455
- bounded by `APPLE_MAIL_MCP_AUDIT_SNAPSHOT_MAX`. When the bound bites, the record
1456
- says so explicitly (`"snapshot": "skipped"` with a reason) rather than omitting
1457
- the field a silently skipped snapshot would read as "nothing collateral
1458
- happened", which is worse than no snapshot at all. `countDelta` is unaffected by
1459
- the skip and still reconciles the counts.
1455
+ This is O(mailbox size), so it is bounded by `APPLE_MAIL_MCP_AUDIT_SNAPSHOT_MAX`.
1456
+ When the bound bites, the record says so explicitly (`"snapshot": "skipped"` with
1457
+ a reason) rather than omitting the field — a silently skipped snapshot would read
1458
+ as "nothing collateral happened", which is worse than no snapshot at all.
1459
+ `countDelta` is unaffected by the skip and still reconciles the counts.
1460
+
1461
+ #### Partial snapshots on large mailboxes
1462
+
1463
+ The mailbox is read in `APPLE_MAIL_MCP_AUDIT_SNAPSHOT_CHUNK`-sized slices, each
1464
+ retried once on its own. It used to be a single whole-mailbox read, which meant
1465
+ Mail declining that one request lost the **entire** diff — and the bigger the
1466
+ mailbox, the more likely that was. The mechanism that attributes collateral
1467
+ damage was therefore least reliable exactly when the blast radius was largest.
1468
+
1469
+ When a slice still will not read, the snapshot is reported as `partial` and it
1470
+ **names its own gap**:
1471
+
1472
+ ```json
1473
+ {
1474
+ "snapshot": "partial",
1475
+ "unobserved": [{ "phase": "after", "ranges": "251-500" }],
1476
+ "appeared": [],
1477
+ "skipReason": "Mail would not read 251-500 (after) of this mailbox, so the snapshot has a hole in it. …"
1478
+ }
1479
+ ```
1480
+
1481
+ Each half of the diff is withheld when the snapshot that could **refute** it has
1482
+ a hole, because a wrong name here is worse than a missing one:
1483
+
1484
+ | Hole in | `disappeared` / `unrequested` | `appeared` |
1485
+ |---------|-------------------------------|------------|
1486
+ | neither (`"ok"`) | reported | reported |
1487
+ | `before` | reported (an undercount — a message never read before cannot be missed after) | withheld |
1488
+ | `after` | **withheld** — a message absent from a partial `after` may merely be unread, and naming it would present an innocent message as evidence of data loss | reported |
1489
+ | both | withheld | withheld |
1490
+
1491
+ **An absent field means "not computable", never "empty".** Check
1492
+ `"snapshot": "ok"` before reading `disappeared` as a clean bill of health — the
1493
+ false-ok warning does exactly that, so a `partial` snapshot never triggers it.
1460
1494
 
1461
1495
  ### Privacy, and what the file costs you
1462
1496