Intake Pipeline

Email → R2 → Parse → Dual-converter → Match → review_queue → Admin → NS push

01 Email Ingress 02 Raw Storage + Parse 03 Extract + Match 04 Review Queue 05 Admin Action 06 NS Push Email arrives bids@ai-globalfoodsolutions.co CF Email Routing MX → Worker src/email.ts handler validate sender · spam check R2: raw/<msg_id>.eml raw email blob Parse attachments PDF · XLSX · HTML R2: attachments/ extracted files Dual-converter (R43) Anthropic Vision + Workers AI Compare outputs disagreement → flag for review Match to D1 customers fuzzy · items vector+exact bid_lines insert extracted line items review_queue insert status=pending Admin notify email / dashboard badge /intake.html review · edit · approve · reject preview→confirm X-Edit-Token required Approve write bid → NS NS_PUSH_QUEUE Queue binding PushMutexDO single-flight lock per record NetSuite TBA OAuth1 · RESTlet write Legend User UI Worker / agent D1 table / store CF binding Tool / action External system Policy / gate

Dual-converter (R43)

  • • Two independent extractions: Anthropic Vision + Workers AI
  • • Disagreement triggers admin flag
  • • Agreement = high-confidence extraction
  • • Audit trail preserves both outputs

HITL gates

  • • review_queue is mandatory stop
  • • /intake.html admin reviews + edits
  • • preview→confirm with X-Edit-Token
  • • No NS write without admin approval

Resilience

  • • Raw email always preserved in R2
  • • Re-extract possible from raw
  • • PushMutexDO prevents double-write
  • • NS_PUSH_QUEUE retries with backoff

Failure paths

  • • Parser fail → human-review queue with raw blob
  • • No match → admin manually maps customer/item
  • • NS push fail → DLQ + admin alert