@agenticmail/core 0.7.1 → 0.7.2

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 CHANGED
@@ -174,7 +174,7 @@ Full custom domain through Cloudflare. Agents send from `agent@yourdomain.com` w
174
174
  4. Stalwart hostname set to the domain (critical for SMTP EHLO greeting)
175
175
  5. DKIM signing key generated in Stalwart (selector: `agenticmail`)
176
176
  6. DNS records configured: MX (via Email Routing), SPF, DMARC, DKIM TXT, tunnel CNAME
177
- 7. Tunnel started with ingress rules routing traffic to the API server (port 3100) and Stalwart (port 8080)
177
+ 7. Tunnel started with ingress rules routing traffic to the API server (port 3829) and Stalwart (port 8080)
178
178
  8. Cloudflare Email Routing enabled on the zone
179
179
  9. Email Worker deployed — catches all inbound email, base64-encodes the raw RFC822 content, and POSTs it to the AgenticMail inbound webhook with a shared secret
180
180
  10. Catch-all Email Routing rule set to route all `*@domain` to the Worker
@@ -410,7 +410,9 @@ Limits: minimum 1 result, maximum 1000 results per query (default 20).
410
410
 
411
411
  ## Data Storage
412
412
 
413
- AgenticMail uses a SQLite database with WAL mode (Write-Ahead Logging) for better concurrent access and foreign keys enabled for referential integrity. The database is initialized with automatic migrations that run on first access.
413
+ AgenticMail uses Node's built-in **`node:sqlite`** module (stable since Node 22). The database runs with WAL mode (Write-Ahead Logging) for better concurrent access and foreign keys enabled for referential integrity. Automatic migrations run on first `getDatabase()` call.
414
+
415
+ > **Why `node:sqlite` instead of `better-sqlite3`?** Before `0.7.0` this package depended on `better-sqlite3`, a native module that ships pre-built binaries per `NODE_MODULE_VERSION` and intermittently lags new Node releases. When prebuilds were missing, installers fell back to `node-gyp` compile-from-source — which requires Python, a C++ toolchain, and a working network at install time. `node:sqlite` is part of Node itself, so by definition it always matches the runtime. No prebuilds, no gyp, no native compilation, no Python prereq. The on-disk database format is unchanged (still SQLite 3); existing data files migrate transparently. **Cost:** Node 22+ is now the minimum supported runtime.
414
416
 
415
417
  **Database location:** `~/.agenticmail/agenticmail.db`
416
418
 
@@ -447,14 +449,14 @@ The SetupManager handles getting everything installed and configured for the fir
447
449
  - cloudflared — checks managed binary at `~/.agenticmail/bin/cloudflared` or system-wide via `which`
448
450
 
449
451
  **Automatic installation:**
450
- - Docker: via Homebrew (`brew install --cask docker`) on macOS, or the official install script on Linux. Opens Docker Desktop on macOS and waits up to 60 seconds for the daemon to start.
452
+ - Docker: via Homebrew (`brew install colima docker docker-compose`) on macOS — **uses Colima, not Docker Desktop**, so there's no GUI gate and no terms-acceptance dialog. On Linux, the official install script. Starts Colima (`colima start --cpu 2 --memory 2 --disk 10`) and waits for the daemon to come up.
451
453
  - Stalwart: starts the container via `docker compose up -d` and waits up to 30 seconds for it to be running.
452
454
  - cloudflared: downloads the platform-specific binary from GitHub releases (supports macOS ARM/Intel and Linux ARM/Intel). Installs atomically (write to temp file, chmod, rename) at `~/.agenticmail/bin/cloudflared`.
453
455
 
454
456
  **Configuration generation:**
455
457
  - `docker-compose.yml` — Stalwart service with ports 8080 (HTTP admin), 587 (SMTP submission), 143 (IMAP), 25 (SMTP inbound)
456
458
  - `stalwart.toml` — Stalwart configuration with RocksDB storage, internal directory, stdout logging, and fallback admin credentials
457
- - `config.json` — Master key, Stalwart URL/credentials, SMTP/IMAP host/port, API host/port, data directory (written with mode 0600 for security)
459
+ - `config.json` — Master key, Stalwart URL/credentials, SMTP/IMAP host/port, API host (default `127.0.0.1`) and API port (**default `3829`** — chosen to avoid common dev-tool ports like 3000/3100/3200/3300/4000/5000/8000/8080), data directory (written with mode 0600 for security)
458
460
  - `.env` — Environment variables (written with mode 0600)
459
461
 
460
462
  Configuration files are placed in the data directory (default: `~/.agenticmail/`). Calling `initConfig()` is idempotent — it loads existing config if present, but always regenerates Docker files to keep passwords in sync.
package/REFERENCE.md CHANGED
@@ -825,7 +825,7 @@ class CloudflareClient {
825
825
 
826
826
  **`createTunnel()`** — Reuses existing tunnel if name matches. Generates random 32-byte secret.
827
827
 
828
- **`createTunnelRoute()`** — Creates ingress: `/api/agenticmail/*` → apiService (port 3100), `*` → primary service (port 8080), catch-all → 404.
828
+ **`createTunnelRoute()`** — Creates ingress: `/api/agenticmail/*` → apiService (port 3829), `*` → primary service (port 8080), catch-all → 404.
829
829
 
830
830
  **`deployEmailWorker()`** — Multipart form upload with ES module metadata and plain_text env var bindings. Compatibility date: 2024-01-01.
831
831
 
package/dist/index.cjs CHANGED
@@ -894,6 +894,10 @@ var MailReceiver = class {
894
894
  async getMailboxInfo(mailbox = "INBOX") {
895
895
  const lock = await this.client.getMailboxLock(mailbox);
896
896
  try {
897
+ try {
898
+ await this.client.noop();
899
+ } catch {
900
+ }
897
901
  const status = this.client.mailbox;
898
902
  if (!status) {
899
903
  return { name: mailbox, exists: 0, recent: 0, unseen: 0 };
@@ -912,12 +916,8 @@ var MailReceiver = class {
912
916
  const lock = await this.client.getMailboxLock(mailbox);
913
917
  try {
914
918
  const envelopes = [];
915
- const mb = this.client.mailbox;
916
- const total = mb ? mb.exists ?? 0 : 0;
917
- if (total === 0) return envelopes;
918
919
  const limit = Math.min(Math.max(options?.limit ?? 20, 1), 1e3);
919
920
  const offset = Math.max(options?.offset ?? 0, 0);
920
- if (offset >= total) return envelopes;
921
921
  const allUids = await this.client.search({ all: true }, { uid: true });
922
922
  if (!allUids || allUids.length === 0) return envelopes;
923
923
  const sortedUids = Array.from(allUids).sort((a, b) => b - a);
package/dist/index.js CHANGED
@@ -140,6 +140,10 @@ var MailReceiver = class {
140
140
  async getMailboxInfo(mailbox = "INBOX") {
141
141
  const lock = await this.client.getMailboxLock(mailbox);
142
142
  try {
143
+ try {
144
+ await this.client.noop();
145
+ } catch {
146
+ }
143
147
  const status = this.client.mailbox;
144
148
  if (!status) {
145
149
  return { name: mailbox, exists: 0, recent: 0, unseen: 0 };
@@ -158,12 +162,8 @@ var MailReceiver = class {
158
162
  const lock = await this.client.getMailboxLock(mailbox);
159
163
  try {
160
164
  const envelopes = [];
161
- const mb = this.client.mailbox;
162
- const total = mb ? mb.exists ?? 0 : 0;
163
- if (total === 0) return envelopes;
164
165
  const limit = Math.min(Math.max(options?.limit ?? 20, 1), 1e3);
165
166
  const offset = Math.max(options?.offset ?? 0, 0);
166
- if (offset >= total) return envelopes;
167
167
  const allUids = await this.client.search({ all: true }, { uid: true });
168
168
  if (!allUids || allUids.length === 0) return envelopes;
169
169
  const sortedUids = Array.from(allUids).sort((a, b) => b - a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Core SDK for AgenticMail — email, SMS, and phone number access for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",