Files
Z User e45b68bb8b 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
2026-10-27 22:50:50 +00:00

62 lines
2.0 KiB
TeX
Executable File

% =================================================================
% SURVEY PAPER TEMPLATE
% =================================================================
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath,amssymb,amsfonts}
% Helvetica for \sffamily so figure labels match the Nature/Science sans-serif
% convention, while body text stays serif (familydefault unchanged).
\usepackage[scaled]{helvet}
% Nature-ish figure palette (used by TikZ/forest diagrams). Wong palette in scripts.
\usepackage{xcolor}
\definecolor{nblue}{HTML}{0072B2}
\definecolor{ngrey}{HTML}{4D4D4D}
\definecolor{nfill}{HTML}{EAF2FB}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{microtype}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{enumitem}
\usepackage{array}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{subcaption}
% Taxonomy/diagram figures: TikZ for drawing, forest for auto-spaced trees
% (taxonomies MUST use forest, not hand-tuned sibling distances — see
% references/02-survey-figures.md). graphicx
% (above) provides \resizebox for clamping any figure to \linewidth.
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.geometric, arrows.meta, fit, backgrounds, calc, trees}
\usepackage{forest}
% Custom commands
\newcommand{\todo}[1]{\textcolor{red}{[TODO: #1]}}
\title{\textbf{{{TITLE}}}}
% Author defaults to "AI4S Agent". The enrichment step
% (see SKILL.md Step 3) is responsible for
% adding a \thanks footnote that recommends human review. Surveys do NOT
% include a simulated clause (no numerical experiments).
\author{AI4S Agent}
\date{\today}
\begin{document}
\maketitle
\input{sections/abstract}
\input{sections/introduction}
\input{sections/related_work}
\input{sections/background}
\input{sections/methods}
\input{sections/discussion}
\input{sections/conclusion}
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}