proton-mail-bridge-client 2.3.2 → 2.4.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.
Files changed (68) hide show
  1. package/README.md +8 -2
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +348 -202
  5. package/dist/cli.js.map +1 -1
  6. package/dist/index.d.ts +10 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +251 -133
  9. package/dist/index.js.map +1 -1
  10. package/dist/scripts/check-claude-desktop.d.ts +18 -0
  11. package/dist/scripts/check-claude-desktop.d.ts.map +1 -1
  12. package/dist/scripts/check-claude-desktop.js +91 -30
  13. package/dist/scripts/check-claude-desktop.js.map +1 -1
  14. package/dist/scripts/install-claude-desktop.d.ts +12 -0
  15. package/dist/scripts/install-claude-desktop.d.ts.map +1 -1
  16. package/dist/scripts/install-claude-desktop.js +211 -43
  17. package/dist/scripts/install-claude-desktop.js.map +1 -1
  18. package/dist/services/analytics-service.d.ts +1 -1
  19. package/dist/services/analytics-service.d.ts.map +1 -1
  20. package/dist/services/analytics-service.js +2 -2
  21. package/dist/services/analytics-service.js.map +1 -1
  22. package/dist/services/audit-service.d.ts.map +1 -1
  23. package/dist/services/audit-service.js +7 -2
  24. package/dist/services/audit-service.js.map +1 -1
  25. package/dist/services/background-sync-service.d.ts.map +1 -1
  26. package/dist/services/background-sync-service.js +10 -2
  27. package/dist/services/background-sync-service.js.map +1 -1
  28. package/dist/services/delivery-queue-service.d.ts.map +1 -1
  29. package/dist/services/delivery-queue-service.js +3 -8
  30. package/dist/services/delivery-queue-service.js.map +1 -1
  31. package/dist/services/draft-store-service.d.ts.map +1 -1
  32. package/dist/services/draft-store-service.js +3 -4
  33. package/dist/services/draft-store-service.js.map +1 -1
  34. package/dist/services/local-index-service.d.ts +2 -1
  35. package/dist/services/local-index-service.d.ts.map +1 -1
  36. package/dist/services/local-index-service.js +45 -9
  37. package/dist/services/local-index-service.js.map +1 -1
  38. package/dist/services/simple-imap-service.d.ts +21 -2
  39. package/dist/services/simple-imap-service.d.ts.map +1 -1
  40. package/dist/services/simple-imap-service.js +271 -103
  41. package/dist/services/simple-imap-service.js.map +1 -1
  42. package/dist/services/smtp-service.d.ts.map +1 -1
  43. package/dist/services/smtp-service.js +15 -0
  44. package/dist/services/smtp-service.js.map +1 -1
  45. package/dist/services/snooze-service.d.ts.map +1 -1
  46. package/dist/services/snooze-service.js +40 -20
  47. package/dist/services/snooze-service.js.map +1 -1
  48. package/dist/services/template-service.d.ts +4 -2
  49. package/dist/services/template-service.d.ts.map +1 -1
  50. package/dist/services/template-service.js +43 -10
  51. package/dist/services/template-service.js.map +1 -1
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/types/index.d.ts.map +1 -1
  54. package/dist/utils/atomic-write.d.ts +2 -0
  55. package/dist/utils/atomic-write.d.ts.map +1 -0
  56. package/dist/utils/atomic-write.js +36 -0
  57. package/dist/utils/atomic-write.js.map +1 -0
  58. package/dist/utils/file-lock.d.ts.map +1 -1
  59. package/dist/utils/file-lock.js +39 -4
  60. package/dist/utils/file-lock.js.map +1 -1
  61. package/dist/utils/helpers.d.ts +14 -0
  62. package/dist/utils/helpers.d.ts.map +1 -1
  63. package/dist/utils/helpers.js +222 -21
  64. package/dist/utils/helpers.js.map +1 -1
  65. package/dist/utils/logger.d.ts.map +1 -1
  66. package/dist/utils/logger.js +29 -12
  67. package/dist/utils/logger.js.map +1 -1
  68. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ Give Claude Desktop (or Cline, or any MCP client) full access to your Proton Mai
34
34
 
35
35
  1. **Install and sign in to [Proton Mail Bridge](https://proton.me/mail/bridge)**, and leave it running. In the Bridge app, open your account and copy the **Bridge password** (it is not your Proton password).
36
36
  2. **Connect Claude Desktop**, either way:
37
- - **Bundle:** download the `proton-mail-bridge-client-<your-os>.mcpb` for macOS (`darwin-arm64`), Linux (`linux-x64`) or Windows (`win32-x64`) from the [latest release](https://github.com/googlarz/proton-mail-bridge-client/releases/latest) and open it. Claude Desktop asks for your Proton address and the Bridge password.
37
+ - **Bundle:** download the `proton-mail-bridge-client-<your-os>.mcpb` for macOS (`darwin-arm64` Apple silicon, `darwin-x64` Intel), Linux (`linux-x64`, `linux-arm64`) or Windows (`win32-x64`) from the [latest release](https://github.com/googlarz/proton-mail-bridge-client/releases/latest) and open it. Claude Desktop asks for your Proton address and the Bridge password, plus optional settings (Bridge IMAP/SMTP host and port, read-only, allow sending, signature, extra accounts, data and download folders, tool tier); the defaults match a standard Bridge install.
38
38
  - **npm:** `npm install -g proton-mail-bridge-client`, then `proton-mail-bridge-client setup-claude-desktop` (it checks your Bridge ports and writes the config). Fully quit and reopen Claude Desktop afterwards.
39
39
  3. **Check it works:** run `proton-mail-bridge-client doctor`, or ask Claude "run the Proton Mail doctor".
40
40
  4. **Try these prompts:**
@@ -129,6 +129,8 @@ The wizard:
129
129
  - asks for your Bridge username and Bridge password
130
130
  - writes the Claude Desktop MCP config entry
131
131
 
132
+ The runtime is installed into a staging directory first, checked (Node starts, `better-sqlite3` opens a database, `dist` imports, version matches) and only then swapped in; the previous runtime stays next to it as `<runtime dir>.previous`, and a failed install leaves the working one untouched. The config is merged, not replaced: existing `env` keys you added by hand are kept, and the config is rewritten atomically (the newest 5 `.bak-*` copies are kept). Passwords are never printed. Run `npm run check:claude-desktop` to verify an install; it exits non-zero when the command, the runtime or the database module is broken.
133
+
132
134
  **After setup:** restart Claude Desktop, make sure Proton Bridge is open, then check **`+` → Connectors → proton-mail-bridge**.
133
135
 
134
136
  ### Updating
@@ -416,6 +418,8 @@ proton-mail-bridge-client notify & # background
416
418
 
417
419
  All commands support `--json` for machine-readable output, and any MCP tool is directly callable via `proton-mail-bridge-client tool <name> --args '{...}'`.
418
420
 
421
+ `<command> --help` prints that command's usage without running it. Flags accept `--flag value` or `--flag=value` (a value starting with `--` needs the `=` form, or must come after a bare `--`); unknown flags are an error. Exit codes: `0` success, `1` failure (including a failed `doctor` or `connection-status` check, or a failed item in a `batch`/`bulk-*` run), `2` usage error.
422
+
419
423
  **Full command reference: [docs/cli.md](docs/cli.md)** (a named command for every one of the 96 tools, across read, triage, compose, mailbox actions, folders, drafts, templates, analytics, and diagnostics).
420
424
 
421
425
  ---
@@ -436,6 +440,8 @@ PROTONMAIL_ALLOWED_ACTIONS='mark_read,archive,trash' # per-action allowlist
436
440
 
437
441
  `batch_email_action` and `apply_thread_action` both support `dryRun: true` regardless of the above flags.
438
442
 
443
+ `PROTONMAIL_ALLOWED_ACTIONS` gates message actions (mark read/unread, star/unstar, archive, trash, restore, move, delete, and the flag/bulk/thread variants) and deleting folders or labels (as `delete`). Creating or renaming folders and labels, creating or deleting templates, importing messages, and clearing the cache or index are not in that list: they are blocked by `PROTONMAIL_READ_ONLY=true` and nothing else. To forbid them, run read-only.
444
+
439
445
  **Trying it safely: `PROTONMAIL_RESTRICT_OUTBOUND_TO_SELF=true`.** With this on, the server can compose, draft, reply, forward and send for real, but every recipient (To, CC and BCC) must be your own Bridge login address; a `+tag` alias of it counts as yours. Anything else is refused with `RESTRICT_OUTBOUND_TO_SELF is enabled. Cannot send to: …` before any mail is built or queued. It covers `send_email`, `reply_to_email`, `reply_all_email`, `forward_email`, `send_draft`, `schedule_draft`, `send_test_email` and `unsubscribe_sender`, and it is checked again when a queued or scheduled send fires, so a send queued before you turned it on cannot slip out later. It does not stop the model from *writing* a message to someone else into a draft; it stops it from being sent.
440
446
 
441
447
  **`PROTONMAIL_ALLOW_EMPTY_FOLDER`.** `empty_folder` deletes every message in a folder at once and cannot be undone, so it is switched off unless this is `true` (the call then fails with a message naming the variable). When enabled it still needs an explicit `confirmed: true` to delete: without it, it only returns a preview of what would be removed. For anything less than an entire folder use `bulk_delete`.
@@ -507,7 +513,7 @@ PROTONMAIL_CLAUDE_RUNTIME_DIR='' # where the Claude Desktop installer puts
507
513
 
508
514
  ## Ask before sending: address and signature (optional skill)
509
515
 
510
- With several accounts or a signature, the server sends from whichever `from` the caller passes and cannot know which one you meant. [`skills/send-with-identity`](skills/send-with-identity/SKILL.md) is a Claude skill that makes the agent ask "from which address, and with which signature?" before every send, reply, forward or schedule, then pass `from` and its own signature with `appendSignature: false` so nothing is doubled. It does not replace your explicit approval to send. Copy the folder to `~/.claude/skills/send-with-identity`, and fill in your addresses and signatures there (keep that copy private).
516
+ With several accounts or a signature, the server sends from whichever `from` the caller passes and cannot know which one you meant. [`skills/send-with-identity`](skills/send-with-identity/SKILL.md) is a Claude skill that makes the agent ask "from which address, and with which signature?" before every send, reply, forward or schedule, then pass `from` and its own signature. On the four immediate-send tools (`send_email`, `reply_to_email`, `reply_all_email`, `forward_email`) that means `appendSignature: false` plus `isHtml: true` for an HTML signature, so nothing is doubled; drafts never get `PROTONMAIL_SIGNATURE` appended, so the skill writes the signature into the draft body, and `send_draft`/`schedule_draft` take no `from`, so the address and signature are settled on the draft first. It does not replace your explicit approval to send. Copy the folder to `~/.claude/skills/send-with-identity`, and fill in your addresses and signatures there (keep that copy private).
511
517
 
512
518
  ## Compared with Claude's native Gmail connector
513
519
 
package/dist/cli.d.ts CHANGED
@@ -6,7 +6,17 @@ export interface ParsedCliArgs {
6
6
  positionals: string[];
7
7
  flags: CliFlags;
8
8
  }
9
+ export declare class CliUsageError extends Error {
10
+ }
9
11
  export declare function parseCliArgs(argv: string[]): ParsedCliArgs;
12
+ interface CommandSpec {
13
+ usage: string;
14
+ description: string;
15
+ flags: string[];
16
+ }
17
+ export declare const COMMAND_SPECS: Record<string, CommandSpec>;
18
+ export declare function commandHelpText(command: string): string | undefined;
19
+ export declare function toolResultExitCode(toolName: string, result: Record<string, unknown>): number;
10
20
  interface ToolOnlyCommand {
11
21
  command: string;
12
22
  tool: string;
@@ -14,6 +24,7 @@ interface ToolOnlyCommand {
14
24
  help: string;
15
25
  fileField?: string;
16
26
  fileFieldBase64?: string;
27
+ boolFlags?: string[];
17
28
  }
18
29
  export declare const TOOL_ONLY_COMMANDS: ToolOnlyCommand[];
19
30
  export declare function main(): Promise<void>;
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA4BA,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAeD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAgC1D;AAunDD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IAIb,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,EA+D/C,CAAC;AA2DF,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAyN1C"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA4BA,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,QAAQ,CAAC;CACjB;AAiBD,qBAAa,aAAc,SAAQ,KAAK;CAAG;AAM3C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAuD1D;AA0ID,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAOD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAkErD,CAAC;AAkBF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcnE;AAyKD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAY5F;AAk0CD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IAIb,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,EA+D/C,CAAC;AA2EF,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA+N1C"}