@ghostpaw/email 0.4.1 → 0.5.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/README.md +169 -16
- package/dist/cli.js +9987 -9747
- package/dist/index.cjs +14 -17
- package/dist/index.js +14 -17
- package/dist/mcp-server.js +25 -23
- package/dist/mcp.cjs +24 -22
- package/dist/mcp.d.cts +10 -0
- package/dist/mcp.d.ts +10 -0
- package/dist/mcp.js +24 -22
- package/package.json +15 -5
package/README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
<a href="https://email.ghostpaw.dev/"><img src="https://raw.githubusercontent.com/GhostPawJS/email/main/.github/social-preview.png" alt="GhostPaw email: Your agent can read the inbox. Sending is a separate tool." width="100%"></a>
|
|
2
|
+
|
|
1
3
|
# @ghostpaw/email
|
|
2
4
|
|
|
3
|
-
[](https://www.npmjs.com/package/@ghostpaw/email)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@ghostpaw/email) [](https://github.com/GhostPawJS/email/actions/workflows/ci.yml) [](https://email.ghostpaw.dev/) [](package.json) [](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.GhostPawJS%2Femail/versions/latest) [](https://nodejs.org) [](LICENSE)
|
|
6
|
+
|
|
7
|
+
**Agent email: IMAP and SMTP in-process, cached in SQLite, with reading and sending as separate tools.**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ghostpaw/email
|
|
11
|
+
```
|
|
9
12
|
|
|
10
13
|
A standalone email engine for Node.js, built on SQLite.
|
|
11
14
|
|
|
@@ -73,6 +76,63 @@ The surface database defaults to `~/.ghostpaw/email.db`; point `--db` at an
|
|
|
73
76
|
existing account cache to read it. Each network call opens and closes its IMAP
|
|
74
77
|
session. Connection commands do not retain a session between calls.
|
|
75
78
|
|
|
79
|
+
## Noun-verb CLI
|
|
80
|
+
|
|
81
|
+
Both `email` and `ghostpaw-email` accept this additive command tree. Existing
|
|
82
|
+
`account`, `read`, `search`, `compose`, `organize` and `sync` commands retain
|
|
83
|
+
their flags, output and exit codes. Use `mail --help` for the new tree and
|
|
84
|
+
`mail <verb> --help` for parameters.
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
mail read | search
|
|
88
|
+
mail send | reply | forward | draft | update-draft | send-draft
|
|
89
|
+
mail mark-read | mark-unread | star | unstar | mark-answered
|
|
90
|
+
mail copy | move | archive | trash | junk | not-junk
|
|
91
|
+
mail set-labels | add-labels | remove-labels
|
|
92
|
+
mail create-folder | rename-folder | delete-folder | subscribe-folder | unsubscribe-folder
|
|
93
|
+
mail connect | disconnect | reconnect | sync | refresh-folders | watch
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
These 33 paths map to the 5 aligned tools. Action verbs set the tool's action;
|
|
97
|
+
`draft` sets `save_draft`. Search accepts its query as a positional argument.
|
|
98
|
+
Other fields use kebab-case flags, such as `--folder INBOX --uids 1 --uids 2`
|
|
99
|
+
and `--input @message.json` for a compose payload. Arrays accept repeated
|
|
100
|
+
flags or JSON; objects accept JSON or `@file`. A single `-` reads stdin JSON;
|
|
101
|
+
explicit flags override stdin fields. `--` ends option parsing.
|
|
102
|
+
|
|
103
|
+
Global flags for the new commands: `--db <path>`, `--json`, `--quiet`,
|
|
104
|
+
`--compact`, `--help`/`-h`, `--version`/`-V`/`-v`, `--no-color`.
|
|
105
|
+
Output is JSON when piped or when `--json` is set. `--quiet` suppresses stdout.
|
|
106
|
+
`completions bash|zsh|fish` prints shell completion setup; `version` prints
|
|
107
|
+
the package version. The existing `tools [--json]`, `describe <tool>`,
|
|
108
|
+
`call <tool> [JSON|-]`, flat `mail_<tool> --parameter value`, `mcp` and `skill`
|
|
109
|
+
forms remain available.
|
|
110
|
+
|
|
111
|
+
| New command exit code | Meaning |
|
|
112
|
+
|---|---|
|
|
113
|
+
| 0 | Success or no-op |
|
|
114
|
+
| 1 | Tool error |
|
|
115
|
+
| 2 | Usage or schema error |
|
|
116
|
+
| 3 | Clarification needed or not found |
|
|
117
|
+
| 4 | Conflict or version mismatch |
|
|
118
|
+
| 70 | Unexpected internal error |
|
|
119
|
+
|
|
120
|
+
Offline examples, run against an empty cache:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
ghostpaw-email mail search invoice --db /tmp/email-port-example.db --json
|
|
124
|
+
ghostpaw-email mail read --view folders --db /tmp/email-port-example.db --json
|
|
125
|
+
ghostpaw-email mail --help
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Search returns 0 matches and folder reads return 0 folders in an empty cache.
|
|
129
|
+
`GHOSTPAW_EMAIL_DB` sets the default cache path, otherwise
|
|
130
|
+
`~/.ghostpaw/email.db` is used. Local search and cached reads need no
|
|
131
|
+
credentials. Network operations use `email account add` configuration or
|
|
132
|
+
`EMAIL_IMAP_HOST`, `EMAIL_SMTP_HOST`, `EMAIL_USER` and `EMAIL_PASS` (or
|
|
133
|
+
`EMAIL_ACCESS_TOKEN`). Each invocation closes its network session;
|
|
134
|
+
`mail connect` does not retain a session for later commands.
|
|
135
|
+
|
|
76
136
|
## Tool CLI
|
|
77
137
|
|
|
78
138
|
```bash
|
|
@@ -98,6 +158,84 @@ npx @ghostpaw/email --help # one-off, no install needed
|
|
|
98
158
|
|
|
99
159
|
Requires **Node.js 24+** (uses the built-in `node:sqlite` module).
|
|
100
160
|
|
|
161
|
+
Standalone binaries are available from [GitHub Releases](https://github.com/GhostPawJS/email/releases)
|
|
162
|
+
for linux-x64, linux-arm64, darwin-arm64, darwin-x64 and windows-x64.
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```powershell
|
|
169
|
+
irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Other release installers:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
mise use -g github:GhostPawJS/email
|
|
176
|
+
ubi --project GhostPawJS/email --exe ghostpaw-email --in ~/.local/bin
|
|
177
|
+
eget GhostPawJS/email
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
For [aqua](https://aquaproj.github.io/docs/reference/registry-config/), define a
|
|
181
|
+
`github_release` package in `aqua.yaml`:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
registries:
|
|
185
|
+
- name: email
|
|
186
|
+
type: local
|
|
187
|
+
path: email-registry.yaml
|
|
188
|
+
packages:
|
|
189
|
+
- name: GhostPawJS/email@v<VERSION>
|
|
190
|
+
registry: email
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`email-registry.yaml`:
|
|
194
|
+
|
|
195
|
+
```yaml
|
|
196
|
+
packages:
|
|
197
|
+
- type: github_release
|
|
198
|
+
repo_owner: GhostPawJS
|
|
199
|
+
repo_name: email
|
|
200
|
+
asset: ghostpaw-email-{{trimV .Version}}-{{.OS}}-{{.Arch}}.tar.gz
|
|
201
|
+
format: tar.gz
|
|
202
|
+
replacements: { amd64: x64 }
|
|
203
|
+
overrides:
|
|
204
|
+
- goos: windows
|
|
205
|
+
asset: ghostpaw-email-{{trimV .Version}}-windows-{{.Arch}}.zip
|
|
206
|
+
format: zip
|
|
207
|
+
files:
|
|
208
|
+
- name: ghostpaw-email
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Install scripts verify SHA256SUMS. To verify a downloaded archive's
|
|
212
|
+
[build attestation](https://cli.github.com/manual/gh_attestation_verify):
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
gh attestation verify <archive> -R GhostPawJS/email
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Set `GHOSTPAW_VERIFY=attestation` for attestation verification in `install.sh`.
|
|
219
|
+
Binaries are unsigned; macOS binaries carry an ad-hoc signature. For a browser
|
|
220
|
+
download on macOS, remove quarantine with
|
|
221
|
+
`xattr -d com.apple.quarantine /path/to/ghostpaw-email`.
|
|
222
|
+
Linux binaries require glibc 2.28+; use npx on Alpine.
|
|
223
|
+
See the [binary build workflow](.github/workflows/release-binaries.yml).
|
|
224
|
+
|
|
225
|
+
Sizes for 0.5.0 (Node 26.12.1 inside each binary):
|
|
226
|
+
|
|
227
|
+
| Target | Archive | Binary |
|
|
228
|
+
|---|---|---|
|
|
229
|
+
| linux-x64 | 41.7 MB tar.gz | 117.7 MB |
|
|
230
|
+
| linux-arm64 | 41.2 MB tar.gz | 115.4 MB |
|
|
231
|
+
| darwin-arm64 | 44.9 MB tar.gz | 146.9 MB |
|
|
232
|
+
| darwin-x64 | 46.4 MB tar.gz | 149.8 MB |
|
|
233
|
+
| windows-x64 | 38.5 MB zip | 105.8 MB |
|
|
234
|
+
|
|
235
|
+
The npm package is 1711 KB unpacked and needs Node 24+.
|
|
236
|
+
|
|
237
|
+
Release installation is checked on ubuntu-24.04, macos-15 and windows-2025.
|
|
238
|
+
|
|
101
239
|
## Quick Start
|
|
102
240
|
|
|
103
241
|
```ts
|
|
@@ -128,6 +266,31 @@ await mailbox.disconnect();
|
|
|
128
266
|
`connect()` opens the SQLite database, initialises the schema, upserts the
|
|
129
267
|
account, and authenticates the IMAP session — one call does everything.
|
|
130
268
|
|
|
269
|
+
## Docs
|
|
270
|
+
|
|
271
|
+
Read the manual for usage guides and the stored email model.
|
|
272
|
+
|
|
273
|
+
- [Overview](https://email.ghostpaw.dev/docs/): what the manual covers and where to start
|
|
274
|
+
- [Human usage](https://email.ghostpaw.dev/docs/human/): using the library directly in code
|
|
275
|
+
- [LLM building blocks](https://email.ghostpaw.dev/docs/llm/): tools, skills and the soul prompt for agents
|
|
276
|
+
- [Accounts](https://email.ghostpaw.dev/docs/entities/accounts/): one email identity and its connection
|
|
277
|
+
- [Folders](https://email.ghostpaw.dev/docs/entities/folders/): cached IMAP mailboxes
|
|
278
|
+
- [Messages](https://email.ghostpaw.dev/docs/entities/messages/): header records per folder and UID
|
|
279
|
+
- [Bodies](https://email.ghostpaw.dev/docs/entities/bodies/): decoded message content
|
|
280
|
+
- [Threads](https://email.ghostpaw.dev/docs/entities/threads/): JWZ conversation trees
|
|
281
|
+
- [Attachments](https://email.ghostpaw.dev/docs/entities/attachments/): cached MIME parts
|
|
282
|
+
- [Sync](https://email.ghostpaw.dev/docs/entities/sync/): the log of each sync pass
|
|
283
|
+
|
|
284
|
+
Repository references:
|
|
285
|
+
|
|
286
|
+
| Document | Audience |
|
|
287
|
+
|---|---|
|
|
288
|
+
| [SKILL.md](SKILL.md) | Agent operators and Claude Code users running `email` as a bash tool |
|
|
289
|
+
| [HUMAN.md](docs/HUMAN.md) | Human developers using the `Mailbox` API with `read` / `write` / `network` |
|
|
290
|
+
| [LLM.md](docs/LLM.md) | Agent builders wiring `soul`, `tools`, and `skills` into LLM systems |
|
|
291
|
+
| [docs/README.md](docs/README.md) | Architecture overview: model, invariants, protocol boundaries, source layout |
|
|
292
|
+
| [docs/entities/](docs/entities/) | Per-entity manuals with schema, operations, and invariants |
|
|
293
|
+
|
|
131
294
|
## The Model
|
|
132
295
|
|
|
133
296
|
Seven stored concepts and three derived ones:
|
|
@@ -333,16 +496,6 @@ import type {
|
|
|
333
496
|
} from '@ghostpaw/email';
|
|
334
497
|
```
|
|
335
498
|
|
|
336
|
-
## Documentation
|
|
337
|
-
|
|
338
|
-
| Document | Audience |
|
|
339
|
-
|---|---|
|
|
340
|
-
| [SKILL.md](SKILL.md) | Agent operators and Claude Code users running `email` as a bash tool |
|
|
341
|
-
| [HUMAN.md](docs/HUMAN.md) | Human developers using the `Mailbox` API with `read` / `write` / `network` |
|
|
342
|
-
| [LLM.md](docs/LLM.md) | Agent builders wiring `soul`, `tools`, and `skills` into LLM systems |
|
|
343
|
-
| [docs/README.md](docs/README.md) | Architecture overview: model, invariants, protocol boundaries, source layout |
|
|
344
|
-
| [docs/entities/](docs/entities/) | Per-entity manuals with schema, operations, and invariants |
|
|
345
|
-
|
|
346
499
|
## Development
|
|
347
500
|
|
|
348
501
|
```bash
|