feat(email): add email client tools for agents#558
Merged
zbigniewsobiecki merged 1 commit intodevfrom Feb 26, 2026
Merged
Conversation
Implement comprehensive email integration for CASCADE agents: Core features: - IMAP client for searching, reading emails (imapflow) - SMTP client for sending emails, replying to threads (nodemailer) - AsyncLocalStorage-based credential scoping (withEmailIntegration) - Database migration for email integration credentials Gadgets (SearchEmails, ReadEmail, SendEmail, ReplyToEmail): - Full schema validation (RFC 2822 subject length, date formats, UID validation) - Error logging for all gadget operations - HTML body fallback when text body unavailable - Proper email threading support (In-Reply-To, References headers) Agent execution integration: - Email credential scoping in manual-runner, GitHub webhook handler, PM webhook handler - Integration role definitions for email provider credentials - canAccessEmail capability flag in agent definitions Improvements from code review: - IMAP connection timeouts (30s connect, 15s greeting, 60s socket) - Awaited transport.close() to prevent connection leaks - Credential resolution error logging - Reduced cognitive complexity via helper function extraction Tests: - Email integration tests (credential resolution, withEmailIntegration) - Email client credential scoping tests - Gadget core function tests (27 tests total) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement comprehensive email integration for CASCADE agents, enabling them to interact with email via IMAP (read/search) and SMTP (send/reply).
Core Features
withEmailIntegration()Gadgets (SearchEmails, ReadEmail, SendEmail, ReplyToEmail)
Agent Execution Integration
canAccessEmailcapability flag in agent definitionsCode Quality Improvements
transport.close()to prevent connection leaksTest plan
🤖 Generated with Claude Code