Skip to content

feat: stream new received email from the CLI - #82

Draft
yhay81 wants to merge 1 commit into
agent/receiving-clifrom
agent/receiving-listen-cli
Draft

feat: stream new received email from the CLI#82
yhay81 wants to merge 1 commit into
agent/receiving-clifrom
agent/receiving-listen-cli

Conversation

@yhay81

@yhay81 yhay81 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add hayasend emails receiving listen for chronological, metadata-only NDJSON
  • seed existing mail without output and keep stdout safe for agents and pipelines
  • retain bounded pagination state across polling ticks so bursts above 500 messages are resumed instead of silently dropped
  • retry partial API failures from the failed cursor with sanitized stderr warnings
  • fail loudly after five consecutive failures or before the in-memory backlog exceeds 5,000 messages
  • document continuous and bounded (--max-polls) operation

Privacy and reliability

The command never emits sender or recipient addresses, subject, body, headers, attachment filenames, signed URLs, or unrecognized server fields. A page sequence is printed only after it reaches the prior seen boundary or list end, preserving oldest-first order without partial reordering.

Validation

  • npm run check
  • npm test — 23 files / 166 tests
  • npm run build
  • npm audit --omit=dev --audit-level=high
  • Redocly OpenAPI lint
  • cfn-lint
  • Lambda esbuild bundle
  • Docker build check, build, and hardened non-root/read-only smoke test
  • actionlint
  • gitleaks (only two pre-existing documented local-development bearer examples)

Dependency

This PR is intentionally stacked on #77 (agent/receiving-cli). Keep it on that base until #77 lands; then retarget it to main and re-run required checks.

Fixes #80

Stream new received-email summaries as chronological NDJSON without exposing message content or recipient data.

Carry bounded pagination state across polling ticks, retry partial failures safely, and fail loudly before messages can be dropped.

Document agent and CI usage and cover burst, retry, privacy, cursor, and backlog behavior.

Fixes #80

Signed-off-by: Yusuke Hayashi <yusuke8h@gmail.com>
yhay81 added a commit that referenced this pull request Jul 26, 2026
## Outcome

Turn the accepted direction in #81 into a stage-gated implementation
plan: production semantics first, then a provider-neutral Cloudflare
proof, controlled FolioMCP dogfood, and only then agent-safe policy.

## What changed

- define ten non-negotiable customer-owned data-plane invariants
- document the current AWS gaps instead of treating aggregate status and
client-triggered dispatch repair as the final model
- specify canonical message, recipient, attempt, provider-event, and
transactional-outbox records
- define honest at-least-once boundaries and provider-acceptance
ambiguity
- require a versioned provider capability contract and common
conformance report
- add entry criteria, deliverables, exit evidence, and non-goals for
five gates
- ground the Cloudflare proof in current official Email Service, D1, R2,
and Queues behavior
- enumerate eleven focused implementation slices
- classify all 23 post-v0.1 drafts exactly once as rebase/review,
combine into the semantics series, or park
- align the public roadmap and commercial/support boundary with a
content-blind optional management plane

## Draft disposition

The plan preserves production-focused work, combines #49/#51/#53 into an
ordered semantics series, and parks #33/#55/#77/#82. Existing stacks
#59#61 and #73#75 remain ordered.

## Post-release refresh

- HayaSend v0.1.0 is fully released from protected `main`.
- The former stacked ancestry was replaced with one GPG-signed plan
commit on current `main`.
- The PR now changes only `README.md`, `ROADMAP.md`, `SUPPORT.md`,
`docs/commercial.md`, and the new `docs/execution-plan.md`.
- No feature draft is included or authorized for premature merge.

## Validation

- `npm ci`
- `npm run check`
- `npm test` — 22 files / 146 tests
- `npm run build`
- `npm audit --omit=dev --audit-level=high` — 0 vulnerabilities
- `npm outdated --depth=0 --json` — no direct updates
- Prettier check for all five changed Markdown files
- `git diff --check`
- signed commit with DCO sign-off

Closes #83
Relates to #81

Signed-off-by: Yusuke Hayashi <yusuke8h@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant