Skip to content

Conversation

@brainless
Copy link
Owner

No description provided.

brainless and others added 5 commits January 20, 2026 16:02
Implement read-only IMAP email query tool for AI agents with:
- IMAP client using rustls for cross-platform TLS
- Operations: list mailboxes, search, fetch headers, fetch emails
- Email parsing with mail-parser for text/HTML bodies and attachments
- Type-safe request/response structures with JsonSchema
- Integration with ToolExecutor and ToolRequest/ToolResponse enums

Dependencies added: imap (rustls-tls), imap-proto, mail-parser

All unit tests passing (84 tests).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…lysis

- Create ImapEmailAgent module with complete Agent trait implementation
- Add IMAP credential management via agent settings (host, port, username, password)
- Implement two-phase workflow: analyze headers first, then selective email download
- Add ImapReader to AgentTool enum with tool parsing
- Add IMAP tool schema with support for list_mailboxes, mailbox_status, search, fetch_headers, fetch_email operations
- Add 6 unit tests for settings schema, tools, objective, and credential loading
- Update README with IMAP Email Agent documentation
- Fix sqlite_reader test naming (SqliteAnalysisAgent → SqliteReaderAgent)
- Add task documentation for future reference
…est binary

This commit fixes three critical issues preventing the IMAP Email Agent from working:

## Fix 1: TLS Encryption for IMAPS (nocodo-tools)
- IMAP client was connecting to port 993 without TLS, causing auth failures
- Refactored client.rs to explicitly use rustls for TLS encryption
- Changed from ClientBuilder to manual: TCP → TLS handshake → IMAP client
- Now properly supports IMAPS with cross-platform rustls (no OpenSSL)

## Fix 2: Credential Injection (nocodo-agents)
- Agent was logging injection intent but not actually passing credentials
- Implemented temp config file creation with NamedTempFile (auto-cleanup)
- Inject config file path into ImapReaderRequest.config_path
- Added tempfile to runtime dependencies
- Removed #[allow(dead_code)] warnings (all fields now used)

## Fix 3: Test Binary with Pre-Connection Validation
- Created imap-email-runner binary for manual testing
- Secure password input with rpassword (not echoed)
- Pre-connection test runs BEFORE calling LLM (saves API costs)
- Interactive and single-query modes supported
- Clear error messages for common auth issues

Files changed:
- nocodo-tools/src/imap/client.rs - TLS implementation
- nocodo-agents/src/imap_email/mod.rs - Credential injection
- nocodo-agents/bin/imap_email_runner.rs - Test binary (252 lines)
- nocodo-agents/bin/README-imap-email-runner.md - Usage guide
- nocodo-agents/Cargo.toml - Added dependencies (tempfile, rpassword, imap, rustls-connector)
- nocodo-agents/tasks/add-imap-email-agent.md - Updated with fixes and completion notes

All tests passing. Binary tested and working with real IMAP server.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add IMAP agent execution handler with endpoint /agents/imap/execute
- Register IMAP agent in supported agents list
- Add create_imap_agent helper function for agent instantiation
- Add ImapAgentConfig to shared types and generate TypeScript types
- Add IMAP agent form inputs in GUI (host, port, username, password)
- Add validation for IMAP configuration fields
- Update agent selection logic to handle IMAP agent
@brainless brainless merged commit cd1bf42 into main Jan 21, 2026
4 checks passed
@github-actions
Copy link

📊 Code Complexity Analysis

  • Lines added: 4572
  • Lines removed: 18
  • Net change: 4554

💡 Suggestion: This is a large PR with 4572 added lines. Consider:

  • Breaking it into smaller, focused PRs
  • Adding comprehensive tests for the new functionality
  • Updating documentation as needed

Automated analysis by GitHub Actions

@brainless brainless deleted the feature/imap-email-tool-agent branch January 21, 2026 07:52
@github-actions
Copy link

🤖 Automated Code Review Summary

This automated review was generated to help ensure code quality and security standards.

Rust Code Analysis

  • Code formatting: All Rust files are properly formatted.

  • ⚠️ Linting: Clippy found potential issues in Rust code.

    • Run cargo clippy --workspace --all-targets -- --deny warnings to see detailed warnings.

TypeScript/JavaScript Code Analysis

Security Analysis

  • ⚠️ Potential secrets: Found references to passwords, secrets, or tokens.

    • Please verify no hardcoded credentials are present.
  • ℹ️ Debug output: Found debug print statements.

    • Consider removing or replacing with proper logging.

Recommendations

  • Run the full CI pipeline to ensure all tests pass
  • Consider adding tests for any new functionality
  • Update documentation if API changes are involved
  • Follow the development workflow described in CLAUDE.md

This review was automatically generated. Please address any issues before merging.

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