agenticmail 0.3.0
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/LICENSE +35 -0
- package/README.md +352 -0
- package/REFERENCE.md +597 -0
- package/dist/chat-ui-MQIYQOFL.js +139 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5180 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -0
- package/dist/ws-chat-OVLCQILI.js +242 -0
- package/package.json +67 -0
package/REFERENCE.md
ADDED
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
# agenticmail — Technical Reference
|
|
2
|
+
|
|
3
|
+
Complete technical reference for the AgenticMail CLI and facade package. Covers CLI commands, interactive shell commands, keyboard shortcuts, re-exports, and all configuration.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Package Structure
|
|
8
|
+
|
|
9
|
+
| Entry | File | Purpose |
|
|
10
|
+
|-------|------|---------|
|
|
11
|
+
| CLI binary | `dist/cli.js` | Command-line interface |
|
|
12
|
+
| Library | `dist/index.js` | Re-exports from `@agenticmail/core` |
|
|
13
|
+
| Shell | (bundled in cli) | Interactive REPL |
|
|
14
|
+
|
|
15
|
+
**Bin:** `agenticmail` → `./dist/cli.js`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Re-Exports from @agenticmail/core
|
|
20
|
+
|
|
21
|
+
The package re-exports the entire public API of `@agenticmail/core`:
|
|
22
|
+
|
|
23
|
+
### Classes
|
|
24
|
+
|
|
25
|
+
| Export | Description |
|
|
26
|
+
|--------|-------------|
|
|
27
|
+
| `AgenticMailClient` | High-level client for sending/receiving |
|
|
28
|
+
| `StalwartAdmin` | Stalwart mail server admin interface |
|
|
29
|
+
| `AccountManager` | Agent CRUD operations |
|
|
30
|
+
| `MailSender` | SMTP email sending |
|
|
31
|
+
| `MailReceiver` | IMAP email receiving |
|
|
32
|
+
| `InboxWatcher` | Real-time inbox monitoring via IMAP IDLE |
|
|
33
|
+
| `GatewayManager` | Email gateway orchestration |
|
|
34
|
+
| `RelayGateway` | Gmail/Outlook relay |
|
|
35
|
+
| `CloudflareClient` | Cloudflare API client |
|
|
36
|
+
| `DomainPurchaser` | Domain search and purchase |
|
|
37
|
+
| `DNSConfigurator` | DNS record management |
|
|
38
|
+
| `TunnelManager` | Cloudflare Tunnel management |
|
|
39
|
+
| `DomainManager` | Domain setup and verification |
|
|
40
|
+
| `EmailSearchIndex` | Full-text email search |
|
|
41
|
+
|
|
42
|
+
### Functions
|
|
43
|
+
|
|
44
|
+
| Export | Description |
|
|
45
|
+
|--------|-------------|
|
|
46
|
+
| `parseEmail` | MIME email parser |
|
|
47
|
+
| `resolveConfig` | Config resolution |
|
|
48
|
+
| `ensureDataDir` | Data directory creation |
|
|
49
|
+
| `saveConfig` | Config persistence |
|
|
50
|
+
| `getDatabase` | SQLite database access |
|
|
51
|
+
| `closeDatabase` | Database cleanup |
|
|
52
|
+
| `createTestDatabase` | In-memory test database |
|
|
53
|
+
|
|
54
|
+
### Types
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
AgenticMailClientOptions, AgenticMailConfig, StalwartAdminOptions,
|
|
58
|
+
StalwartPrincipal, Agent, CreateAgentOptions, MailSenderOptions,
|
|
59
|
+
MailReceiverOptions, SendMailOptions, SendResult, EmailEnvelope,
|
|
60
|
+
ParsedEmail, AddressInfo, Attachment, ParsedAttachment, MailboxInfo,
|
|
61
|
+
SearchCriteria, InboxWatcherOptions, InboxEvent, InboxNewEvent,
|
|
62
|
+
InboxExpungeEvent, InboxFlagsEvent, WatcherOptions, SearchableEmail,
|
|
63
|
+
DomainInfo, DnsRecord, DomainSetupResult, GatewayManagerOptions,
|
|
64
|
+
InboundEmail, DomainSearchResult, DomainPurchaseResult, DnsSetupResult,
|
|
65
|
+
TunnelConfig, GatewayMode, GatewayConfig, GatewayStatus, RelayConfig,
|
|
66
|
+
RelayProvider, DomainModeConfig, PurchasedDomain
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Constants
|
|
70
|
+
|
|
71
|
+
| Export | Description |
|
|
72
|
+
|--------|-------------|
|
|
73
|
+
| `RELAY_PRESETS` | Gmail/Outlook SMTP/IMAP server presets |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## CLI Commands
|
|
78
|
+
|
|
79
|
+
### agenticmail setup
|
|
80
|
+
|
|
81
|
+
Interactive setup wizard.
|
|
82
|
+
|
|
83
|
+
**Steps:**
|
|
84
|
+
1. System dependency check (Docker, Stalwart, Cloudflared)
|
|
85
|
+
2. Account creation (master key, data directory, database)
|
|
86
|
+
3. Service startup (Docker, Stalwart)
|
|
87
|
+
4. Email connection (relay or domain)
|
|
88
|
+
|
|
89
|
+
**Relay Setup Flow:**
|
|
90
|
+
- Provider selection: Gmail, Outlook, Custom
|
|
91
|
+
- Credentials: email + app password (Gmail spaces auto-stripped)
|
|
92
|
+
- Agent name input
|
|
93
|
+
- 3-attempt retry on auth failure
|
|
94
|
+
- Welcome test email
|
|
95
|
+
- Friendly error parsing
|
|
96
|
+
|
|
97
|
+
**Domain Setup Flow:**
|
|
98
|
+
- Cloudflare token + account ID
|
|
99
|
+
- Optional domain search (keywords + TLD)
|
|
100
|
+
- Automatic DNS: MX, SPF, DKIM, DMARC
|
|
101
|
+
- Cloudflare Tunnel setup
|
|
102
|
+
- Email Worker + catch-all routing
|
|
103
|
+
- Manual verification instructions
|
|
104
|
+
|
|
105
|
+
### agenticmail start
|
|
106
|
+
|
|
107
|
+
**Flow:**
|
|
108
|
+
1. Check config exists (auto-setup if missing)
|
|
109
|
+
2. Verify Docker + Stalwart running
|
|
110
|
+
3. Check if API already running on port
|
|
111
|
+
4. Fork `@agenticmail/api` as child process
|
|
112
|
+
5. Capture stderr (last 50 lines for crash diagnostics)
|
|
113
|
+
6. Wait up to 20s for health check
|
|
114
|
+
7. Launch `interactiveShell()`
|
|
115
|
+
|
|
116
|
+
**Child Process:**
|
|
117
|
+
- Forked via `child_process.fork()`
|
|
118
|
+
- Monitored for crashes with exit code reporting
|
|
119
|
+
- Environment variables passed from config
|
|
120
|
+
|
|
121
|
+
### agenticmail status
|
|
122
|
+
|
|
123
|
+
**Checks:**
|
|
124
|
+
- Docker daemon
|
|
125
|
+
- Stalwart mail server
|
|
126
|
+
- Cloudflared binary
|
|
127
|
+
- Config file existence
|
|
128
|
+
- API server health (`GET /api/agenticmail/health`)
|
|
129
|
+
- Gateway status (mode, provider, domain, polling)
|
|
130
|
+
|
|
131
|
+
### agenticmail openclaw
|
|
132
|
+
|
|
133
|
+
5-step OpenClaw integration:
|
|
134
|
+
1. Infrastructure check (Docker, Stalwart)
|
|
135
|
+
2. Start API server (fork)
|
|
136
|
+
3. Create/select agent account
|
|
137
|
+
4. Merge plugin config into `openclaw.json` (searches cwd, `~/.openclaw/`)
|
|
138
|
+
5. Offer gateway restart
|
|
139
|
+
|
|
140
|
+
**Config file support:** JSON, JSONC (via json5), warns about YAML
|
|
141
|
+
|
|
142
|
+
### agenticmail help
|
|
143
|
+
|
|
144
|
+
Displays usage and all available commands.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Interactive Shell
|
|
149
|
+
|
|
150
|
+
### Entry
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
function interactiveShell(options: ShellOptions): void
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**ShellOptions:**
|
|
157
|
+
```typescript
|
|
158
|
+
{
|
|
159
|
+
apiUrl: string; // e.g., 'http://127.0.0.1:3100'
|
|
160
|
+
masterKey: string;
|
|
161
|
+
onExit: () => void; // Cleanup callback
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Prompt Format
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
│ {agent-name} ❯ _
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Agent name in cyan. Pipe character in dim.
|
|
172
|
+
|
|
173
|
+
### Command Menu
|
|
174
|
+
|
|
175
|
+
- Typing `/` shows a filtered command list
|
|
176
|
+
- Arrow keys navigate, Enter selects, Tab auto-completes
|
|
177
|
+
- Escape dismisses menu
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Shell Commands (36)
|
|
182
|
+
|
|
183
|
+
### Email Commands
|
|
184
|
+
|
|
185
|
+
#### /inbox
|
|
186
|
+
|
|
187
|
+
Interactive inbox viewer with pagination.
|
|
188
|
+
|
|
189
|
+
**Controls:**
|
|
190
|
+
| Key | Action |
|
|
191
|
+
|-----|--------|
|
|
192
|
+
| ↑ / ↓ | Move cursor (green `❯` indicator) |
|
|
193
|
+
| ← / `p` | Previous page |
|
|
194
|
+
| → / `n` | Next page |
|
|
195
|
+
| Enter | Open selected email (full-screen, any key to return) |
|
|
196
|
+
| `v` | Toggle body previews on/off |
|
|
197
|
+
| Escape | Exit inbox |
|
|
198
|
+
|
|
199
|
+
**Display:**
|
|
200
|
+
- 10 emails per page
|
|
201
|
+
- Unread: cyan `★` star, bold text
|
|
202
|
+
- Color-coded dots (8 rotating colors)
|
|
203
|
+
- Shows: sender address, subject (truncated), date
|
|
204
|
+
|
|
205
|
+
#### /send
|
|
206
|
+
|
|
207
|
+
Compose email interactively.
|
|
208
|
+
|
|
209
|
+
**Prompts:**
|
|
210
|
+
1. To (email address)
|
|
211
|
+
2. Subject
|
|
212
|
+
3. Body (multiline, empty line to finish)
|
|
213
|
+
4. Attachments (file path or drag-drop, empty to skip, can repeat)
|
|
214
|
+
|
|
215
|
+
**Attachment handling:** Base64 encoding, size display in KB, filename sanitization.
|
|
216
|
+
|
|
217
|
+
#### /read
|
|
218
|
+
|
|
219
|
+
Read specific email by number.
|
|
220
|
+
|
|
221
|
+
**Display:** Full headers (From, To, CC, Date, Subject, Message-ID), body (text or HTML-stripped), attachment list with sizes.
|
|
222
|
+
|
|
223
|
+
#### /reply
|
|
224
|
+
|
|
225
|
+
Reply to email.
|
|
226
|
+
|
|
227
|
+
**Auto-fills:** To (original sender), Subject (`Re: ...`), In-Reply-To, References.
|
|
228
|
+
**Body:** Quoted original with `> ` prefix.
|
|
229
|
+
**Supports:** Attachments, reply-all option.
|
|
230
|
+
|
|
231
|
+
#### /forward
|
|
232
|
+
|
|
233
|
+
Forward email.
|
|
234
|
+
|
|
235
|
+
**Auto-fills:** Subject (`Fwd: ...`), forwarded message header.
|
|
236
|
+
**Preserves:** Original attachments.
|
|
237
|
+
|
|
238
|
+
#### /search
|
|
239
|
+
|
|
240
|
+
Two modes:
|
|
241
|
+
1. **Local search** — searches IMAP inbox by keyword
|
|
242
|
+
2. **Relay search** — searches connected Gmail/Outlook account
|
|
243
|
+
|
|
244
|
+
Shows up to 10 local results, 15 relay results. Relay results offer import option.
|
|
245
|
+
|
|
246
|
+
#### /delete
|
|
247
|
+
|
|
248
|
+
Shows inbox preview, prompts for email number, confirms deletion.
|
|
249
|
+
|
|
250
|
+
#### /save
|
|
251
|
+
|
|
252
|
+
Download attachments. Interactive picker: `[1]`, `[2]`, ... or `[a]` for all. Prompts for save directory.
|
|
253
|
+
|
|
254
|
+
#### /thread
|
|
255
|
+
|
|
256
|
+
View email conversation. Groups by subject (strips `Re:` / `Fwd:` prefixes). Shows up to 20 messages chronologically.
|
|
257
|
+
|
|
258
|
+
#### /unread
|
|
259
|
+
|
|
260
|
+
Mark email as unread by number.
|
|
261
|
+
|
|
262
|
+
#### /archive
|
|
263
|
+
|
|
264
|
+
Move email to Archive folder.
|
|
265
|
+
|
|
266
|
+
#### /trash
|
|
267
|
+
|
|
268
|
+
Move email to Trash folder.
|
|
269
|
+
|
|
270
|
+
#### /sent
|
|
271
|
+
|
|
272
|
+
Browse sent emails with left/right arrow pagination.
|
|
273
|
+
|
|
274
|
+
#### /digest
|
|
275
|
+
|
|
276
|
+
Inbox preview with body snippets (first ~200 chars per message).
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Organization Commands
|
|
281
|
+
|
|
282
|
+
#### /folders
|
|
283
|
+
|
|
284
|
+
Three actions:
|
|
285
|
+
1. **List** — show all IMAP folders
|
|
286
|
+
2. **Create** — create new folder by name
|
|
287
|
+
3. **Browse** — paginated folder viewer (← → navigation)
|
|
288
|
+
|
|
289
|
+
#### /contacts
|
|
290
|
+
|
|
291
|
+
Three actions:
|
|
292
|
+
1. **List** — show all contacts with name and email
|
|
293
|
+
2. **Add** — name + email
|
|
294
|
+
3. **Delete** — by number from list
|
|
295
|
+
|
|
296
|
+
#### /drafts
|
|
297
|
+
|
|
298
|
+
Five actions:
|
|
299
|
+
1. **List** — show all drafts
|
|
300
|
+
2. **New** — compose a draft (to, subject, body)
|
|
301
|
+
3. **Send** — send a draft immediately
|
|
302
|
+
4. **Delete** — remove a draft
|
|
303
|
+
5. **Browse** — view the Drafts IMAP folder
|
|
304
|
+
|
|
305
|
+
#### /signature
|
|
306
|
+
|
|
307
|
+
Three actions:
|
|
308
|
+
1. **List** — show all signatures (default marked with `★`)
|
|
309
|
+
2. **Create** — name + text + optional "set as default"
|
|
310
|
+
3. **Delete** — by number from list
|
|
311
|
+
|
|
312
|
+
Setting as default automatically unsets previous default.
|
|
313
|
+
|
|
314
|
+
#### /templates
|
|
315
|
+
|
|
316
|
+
Four actions:
|
|
317
|
+
1. **List** — show all templates
|
|
318
|
+
2. **Create** — name + subject + body
|
|
319
|
+
3. **Use** — send from template (prompts for recipient and variable values)
|
|
320
|
+
4. **Delete** — by number from list
|
|
321
|
+
|
|
322
|
+
Variable substitution: `{{ variableName }}` in subject and body.
|
|
323
|
+
|
|
324
|
+
#### /schedule
|
|
325
|
+
|
|
326
|
+
**Quick presets:**
|
|
327
|
+
1. In 30 minutes
|
|
328
|
+
2. In 1 hour
|
|
329
|
+
3. In 3 hours
|
|
330
|
+
4. Tomorrow 8:00 AM
|
|
331
|
+
5. Tomorrow 9:00 AM
|
|
332
|
+
6. Custom date/time
|
|
333
|
+
|
|
334
|
+
**Custom format:** `MM-DD-YYYY H:MM AM/PM [TZ]`
|
|
335
|
+
|
|
336
|
+
**Supported timezones:** EST, EDT, CST, CDT, MST, MDT, PST, PDT, GMT, UTC, BST, CET, CEST, IST, JST, AEST, AEDT, NZST, NZDT, WAT, EAT, SAST, HKT, SGT, KST, HST, AKST, AKDT, AST, ADT, NST, NDT
|
|
337
|
+
|
|
338
|
+
**Also accepts:** ISO 8601, relative (`in 30 minutes`), named (`tomorrow 2pm`), day-based (`next monday 9am`), casual (`tonight`).
|
|
339
|
+
|
|
340
|
+
Validation: must be in the future. Lists pending scheduled emails with countdown.
|
|
341
|
+
|
|
342
|
+
#### /tag
|
|
343
|
+
|
|
344
|
+
Five actions:
|
|
345
|
+
1. **List** — show all tags with colors
|
|
346
|
+
2. **Create** — name + color (hex)
|
|
347
|
+
3. **Tag message** — apply tag to email by UID
|
|
348
|
+
4. **View by tag** — show all emails with a specific tag
|
|
349
|
+
5. **Delete** — remove a tag
|
|
350
|
+
|
|
351
|
+
#### /rules
|
|
352
|
+
|
|
353
|
+
Three actions:
|
|
354
|
+
1. **List** — show all rules with conditions and actions
|
|
355
|
+
2. **Create** — conditions (from_contains, subject_contains) + actions (move_to, mark_read, delete) + priority
|
|
356
|
+
3. **Delete** — by number from list
|
|
357
|
+
|
|
358
|
+
Rules evaluated on new email arrival (via SSE event handler). Higher priority checked first, first match wins.
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
### Agent Commands
|
|
363
|
+
|
|
364
|
+
#### /agents
|
|
365
|
+
|
|
366
|
+
Shows all agents with: email address, API key (first 8 chars + ...), owner name (from metadata).
|
|
367
|
+
|
|
368
|
+
#### /switch
|
|
369
|
+
|
|
370
|
+
Multi-agent selection. Changes which inbox is viewed and which agent sends email. Persists for the session.
|
|
371
|
+
|
|
372
|
+
#### /deleteagent
|
|
373
|
+
|
|
374
|
+
Three-attempt name confirmation. Archives all emails. Generates deletion report with email count and top correspondents.
|
|
375
|
+
|
|
376
|
+
#### /deletions
|
|
377
|
+
|
|
378
|
+
Browse past deletion reports. Shows: agent name, deletion date, reason, deleted by, email count, top correspondents.
|
|
379
|
+
|
|
380
|
+
#### /name
|
|
381
|
+
|
|
382
|
+
Set display name (stored as `ownerName` in agent metadata). Appears in From: header as `"agentname from YourName"`.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Security Commands
|
|
387
|
+
|
|
388
|
+
#### /spam
|
|
389
|
+
|
|
390
|
+
Four actions:
|
|
391
|
+
1. **View** — list spam folder contents
|
|
392
|
+
2. **Report** — move email to Spam folder
|
|
393
|
+
3. **Not spam** — move email back to INBOX
|
|
394
|
+
4. **Score** — detailed spam analysis with rule matches and point values
|
|
395
|
+
|
|
396
|
+
#### /pending
|
|
397
|
+
|
|
398
|
+
Three actions:
|
|
399
|
+
1. **List** — show all pending (blocked) outbound emails with warnings
|
|
400
|
+
2. **Approve** — send the blocked email (master key required)
|
|
401
|
+
3. **Reject** — discard the blocked email (master key required)
|
|
402
|
+
|
|
403
|
+
Agents cannot self-approve — only the master key holder (human) can approve or reject. The human can also reply to the notification email with "approve"/"yes" or "reject"/"no".
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
### Gateway Commands
|
|
408
|
+
|
|
409
|
+
#### /relay
|
|
410
|
+
|
|
411
|
+
Two actions:
|
|
412
|
+
1. **Search** — search connected relay account (Gmail/Outlook)
|
|
413
|
+
2. **Import** — import a specific email from relay into local inbox
|
|
414
|
+
|
|
415
|
+
#### /setup
|
|
416
|
+
|
|
417
|
+
Displays message to run `agenticmail setup` from the command line.
|
|
418
|
+
|
|
419
|
+
#### /status
|
|
420
|
+
|
|
421
|
+
Shows server health, Stalwart status, gateway mode, and agent count.
|
|
422
|
+
|
|
423
|
+
#### /openclaw
|
|
424
|
+
|
|
425
|
+
Launches OpenClaw TUI in a new terminal window:
|
|
426
|
+
- **macOS:** `open -a Terminal`
|
|
427
|
+
- **Linux:** `gnome-terminal`, `xterm`, or `konsole` (tries in order)
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
### System Commands
|
|
432
|
+
|
|
433
|
+
#### /help
|
|
434
|
+
|
|
435
|
+
Formatted list of all commands with descriptions.
|
|
436
|
+
|
|
437
|
+
#### /clear
|
|
438
|
+
|
|
439
|
+
Clears terminal screen (`\x1b[2J\x1b[H`).
|
|
440
|
+
|
|
441
|
+
#### /exit, /quit
|
|
442
|
+
|
|
443
|
+
Calls `onExit()` cleanup callback. Exits process.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## Configuration
|
|
448
|
+
|
|
449
|
+
### Config File
|
|
450
|
+
|
|
451
|
+
Location: `~/.agenticmail/config.json`
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
interface SetupConfig {
|
|
455
|
+
dataDir: string;
|
|
456
|
+
masterKey: string;
|
|
457
|
+
stalwart: {
|
|
458
|
+
adminUser: string;
|
|
459
|
+
adminPassword: string;
|
|
460
|
+
url: string;
|
|
461
|
+
};
|
|
462
|
+
api: {
|
|
463
|
+
port: number;
|
|
464
|
+
host: string;
|
|
465
|
+
};
|
|
466
|
+
smtp: { host: string; port: number };
|
|
467
|
+
imap: { host: string; port: number };
|
|
468
|
+
}
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Environment Variables
|
|
472
|
+
|
|
473
|
+
| Variable | Description |
|
|
474
|
+
|----------|-------------|
|
|
475
|
+
| `AGENTICMAIL_MASTER_KEY` | Master API key |
|
|
476
|
+
| `AGENTICMAIL_DATA_DIR` | Data directory (default: `~/.agenticmail`) |
|
|
477
|
+
| `STALWART_ADMIN_USER` | Stalwart admin username |
|
|
478
|
+
| `STALWART_ADMIN_PASSWORD` | Stalwart admin password |
|
|
479
|
+
| `STALWART_URL` | Stalwart HTTP admin URL |
|
|
480
|
+
| `AGENTICMAIL_API_PORT` | API server port |
|
|
481
|
+
| `AGENTICMAIL_API_HOST` | API server host |
|
|
482
|
+
| `SMTP_HOST` | SMTP server host |
|
|
483
|
+
| `SMTP_PORT` | SMTP server port |
|
|
484
|
+
| `IMAP_HOST` | IMAP server host |
|
|
485
|
+
| `IMAP_PORT` | IMAP server port |
|
|
486
|
+
| `AGENTICMAIL_DEBUG` | Enable verbose per-message logging |
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## UI Elements
|
|
491
|
+
|
|
492
|
+
### Colors
|
|
493
|
+
|
|
494
|
+
| Color | Usage |
|
|
495
|
+
|-------|-------|
|
|
496
|
+
| Green (`✓`) | Success, active, confirmation |
|
|
497
|
+
| Red (`✗`) | Error, warning, danger |
|
|
498
|
+
| Cyan | Links, primary info, agent name |
|
|
499
|
+
| Yellow | Warnings, loading, time info |
|
|
500
|
+
| Magenta | Prompts |
|
|
501
|
+
| Dim | Secondary text, navigation hints |
|
|
502
|
+
|
|
503
|
+
### Layout
|
|
504
|
+
|
|
505
|
+
| Element | Character |
|
|
506
|
+
|---------|-----------|
|
|
507
|
+
| Box border | `╭─╮`, `│`, `╰─╯` |
|
|
508
|
+
| Horizontal rule | `─` |
|
|
509
|
+
| Bullet | `●` (8 rotating colors) |
|
|
510
|
+
| Menu pointer | `▸` |
|
|
511
|
+
| Unread star | `★` (cyan) |
|
|
512
|
+
| Active agent | `◂` |
|
|
513
|
+
|
|
514
|
+
### Spinner Messages
|
|
515
|
+
|
|
516
|
+
Category-specific loading messages:
|
|
517
|
+
|
|
518
|
+
| Category | Example Messages |
|
|
519
|
+
|----------|-----------------|
|
|
520
|
+
| docker | "Getting the engine ready...", "Just warming things up..." |
|
|
521
|
+
| stalwart | "Setting up your personal post office..." |
|
|
522
|
+
| cloudflared | "Opening a secure path to the internet..." |
|
|
523
|
+
| config | "Creating your private settings..." |
|
|
524
|
+
| relay | "Connecting to your email account..." |
|
|
525
|
+
| domain | "Pointing your domain to AgenticMail..." |
|
|
526
|
+
| server | "Firing up the server..." |
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## Input Helpers
|
|
531
|
+
|
|
532
|
+
### ask(prompt)
|
|
533
|
+
|
|
534
|
+
Standard readline input with prompt text.
|
|
535
|
+
|
|
536
|
+
### askSecret(prompt)
|
|
537
|
+
|
|
538
|
+
Raw-mode password input. Characters displayed as `*`. Supports backspace.
|
|
539
|
+
|
|
540
|
+
### pick(options)
|
|
541
|
+
|
|
542
|
+
Single-keypress selection. Arrow keys move cursor, Enter or number key selects.
|
|
543
|
+
|
|
544
|
+
### askNumber(prompt)
|
|
545
|
+
|
|
546
|
+
Integer input with retry logic.
|
|
547
|
+
|
|
548
|
+
### askChoice(options)
|
|
549
|
+
|
|
550
|
+
Numbered list selection with validation.
|
|
551
|
+
|
|
552
|
+
### cleanFilePath(path)
|
|
553
|
+
|
|
554
|
+
Handles:
|
|
555
|
+
- Drag-and-drop paths (strips quotes, trailing spaces)
|
|
556
|
+
- Home directory expansion (`~`)
|
|
557
|
+
- Backslash conversion
|
|
558
|
+
- Quote removal
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## Process Management
|
|
563
|
+
|
|
564
|
+
### Server Forking
|
|
565
|
+
|
|
566
|
+
```typescript
|
|
567
|
+
const child = fork(apiEntryPath, [], {
|
|
568
|
+
env: { ...process.env, ...configToEnv(setupConfig) },
|
|
569
|
+
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
|
|
570
|
+
});
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
- Stderr captured (last 50 lines) for crash diagnostics
|
|
574
|
+
- Health check polling: `GET /api/agenticmail/health` with 20s timeout
|
|
575
|
+
- Signal forwarding: SIGINT and SIGTERM
|
|
576
|
+
|
|
577
|
+
### API Resolution
|
|
578
|
+
|
|
579
|
+
`resolveApiEntry()` finds `@agenticmail/api` entry point:
|
|
580
|
+
1. `require.resolve('@agenticmail/api')` (npm install)
|
|
581
|
+
2. `../packages/api/dist/index.js` (monorepo)
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Dependencies
|
|
586
|
+
|
|
587
|
+
| Package | Purpose |
|
|
588
|
+
|---------|---------|
|
|
589
|
+
| `@agenticmail/api` | Server process (forked) |
|
|
590
|
+
| `@agenticmail/core` | Re-exported SDK |
|
|
591
|
+
| `json5` | JSONC config parsing (OpenClaw) |
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## License
|
|
596
|
+
|
|
597
|
+
[MIT](./LICENSE) - Ope Olatunji ([@ope-olatunji](https://github.com/ope-olatunji))
|