@sullux/event-engine-email-plugin
v1.0.0
Published
Email synchronization bridge and event engine plugin for IMAP/SMTP.
Downloads
65
Maintainers
Readme
@sullux/coms-email-daemon
A persistent, local-first background supervisor daemon that bridges the @sullux/coms-lake Event Lake and the @sullux/coms-email engine. It handles bidirectional mail synchronization via IMAP IDLE push listeners and secure outbound SMTP routing.
Architecture Overview
The daemon serves as the core connection broker between standard email accounts and your central, event-sourced database.
[ Internet Mail Servers ]
▲ │
(SMTP)│ ▼ (IMAP IDLE)
┌────┴────────────────┴────┐
│ @sullux/coms-email-daemon │
└────┬────────────────▲────┘
│ │
(Append)▼ ▼ (Subscribe)
[ Local SQLite Event Lake ]Core Design Principles:
- True Single Responsibility: Contains only the orchestration layers bridging the lake to email protocols. Delegates protocol definitions entirely to
@sullux/coms-email. - Out-of-Band Threading Discovery: Traverses the local SQLite ledger synchronously to dynamically build and inject RFC-compliant threading headers (
In-Reply-ToandReferences) on outbound mail replies. - Resilient Media Pipeline: Synchronously looks up database metadata (
coms.file.created) to package inline elements or attachments securely before outbound SMTP transmission. - Process-per-Account Isolation: Meant to be executed under standard process supervisors (such as
systemd) with separate configurations per email address, confining connection issues and crash loops to a single account.
Configuration Schema
Driven by a standard JSON config file:
{
"channelId": "chan-email-sullux",
"emailAddress": "[email protected]",
"imap": {
"host": "imap.fastmail.com",
"port": 993,
"username": "[email protected]",
"password": "my-secret-imap-app-password"
},
"smtp": {
"host": "smtp.fastmail.com",
"port": 465,
"username": "[email protected]",
"password": "my-secret-smtp-app-password"
}
}Usage
Start the persistent listener process:
coms-email-daemon --config /path/to/account.jsonBehavior Lifecycle:
- Backlog Sync on Boot: Connects to the IMAP server, queries the lake over IPC for the last synchronized IMAP UID, syncs everything since that UID, registers matching
coms.interaction.emittedevents, and commits the cursor. - Listen (IMAP IDLE): Establishes a persistent
IDLEloop. When the server pushes anEXISTSsignal, the daemon triggers a sync instantly. - Listen (Outbound Lake Events): Subscribes to the Event Lake's stream socket. When a matching outbound interaction is emitted by this email address, the daemon builds the MIME payload and transmits it via SMTP.
