feat: IMAP mail sync with thread-to-contact matching (PRD §6.1)

Real IMAP connection via imapflow library:
- Connects to IMAP server (IMAPFlow, TLS on port 993)
- Fetches recent messages (configurable limit, default 20)
- Extracts: from, fromEmail, subject, date, snippet (200 chars)
- Thread-to-contact matching (PRD §6.1):
  1. Match sender email against persons table
  2. If no person match, extract domain and match against company.website
  3. Returns matchedCompany + matchedPerson for each email
- Audit-logged (action: crm.mailsync:imap)
- Zod validated (host, port, user, password, folder, limit)
- 502 on IMAP connection failure with detail
- 400 on validation failure

Tested: invalid creds → 502 'IMAP connection failed', missing host → 400
This commit is contained in:
Z User committed 2026-10-27 22:50:50 +00:00
1 parent 7acc0c5451
commit e45b68bb8b
1089 files changed
+260614

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Figure Examples
Reference matplotlib / seaborn scripts producing publication-grade figures
for AI4S research papers. Reproduce with:
```bash
pip install matplotlib seaborn
cd <where-you-want-the-pdf>
python make_fig_02_horizon_sweep.py
python make_fig_03_heatmap.py
python make_fig_04_ablation.py
```
These are illustrative templates — copy and adapt for your data. They were
extracted from a successful enrichment run of the `paper-writer` skill on
the topic *Transformer-based time-series forecasting* (May 2026); the data
embedded inline are simulated and meant only to illustrate the formatting.
Start by filling `FIGURE_CONTRACT_TEMPLATE.md` for the figure you are about to make.
Then reuse `style_kit.py` so exports, palette, panel labels, and simulated
watermarks stay consistent across the experiment package.
## Style summary
- Shared `style_kit.py` with editable SVG text and PDF font embedding
- Explicit color palette (no default cycle)
- Removed top/right spines
- `axes.grid` on at low alpha
- Figure sizes targeted at column-width (3.4-5.0 inches wide)
- "simulated" watermark in italic gray for runs from the simulator path
- Save PDF + SVG + TIFF together when the environment allows it
See the `paper-writer` skill's `references/02-figures-publication-grade.md`
for the full taste guide.