feat(platform): add new services, tools, tests and crews modules
New router intelligence modules (26 files): alert_ingest/store, audit_store, architecture_pressure, backlog_generator/store, cost_analyzer, data_governance, dependency_scanner, drift_analyzer, incident_* (5 files), llm_enrichment, platform_priority_digest, provider_budget, release_check_runner, risk_* (6 files), signature_state_store, sofiia_auto_router, tool_governance New services: - sofiia-console: Dockerfile, adapters/, monitor/nodes/ops/voice modules, launchd, react static - memory-service: integration_endpoints, integrations, voice_endpoints, static UI - aurora-service: full app suite (analysis, job_store, orchestrator, reporting, schemas, subagents) - sofiia-supervisor: new supervisor service - aistalk-bridge-lite: Telegram bridge lite - calendar-service: CalDAV calendar service with reminders - mlx-stt-service / mlx-tts-service: Apple Silicon speech services - binance-bot-monitor: market monitor service - node-worker: STT/TTS memory providers New tools (9): agent_email, browser_tool, contract_tool, observability_tool, oncall_tool, pr_reviewer_tool, repo_tool, safe_code_executor, secure_vault New crews: agromatrix_crew (10 modules: depth_classifier, doc_facts, doc_focus, farm_state, light_reply, llm_factory, memory_manager, proactivity, reflection_engine, session_context, style_adapter, telemetry) Tests: 85+ test files for all new modules Made-with: Cursor
This commit is contained in:
113
tools/agent_email/tests/test_receive_analyze.py
Normal file
113
tools/agent_email/tests/test_receive_analyze.py
Normal file
@@ -0,0 +1,113 @@
|
||||
"""
|
||||
Test 2: Receive and Analyze Email
|
||||
|
||||
Demonstrates receiving emails and analyzing them for credentials/auth.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
from agent_email import AgentEmailTool
|
||||
|
||||
os.environ["AGENTMAIL_API_KEY"] = "your-api-key-here"
|
||||
|
||||
|
||||
def test_receive_and_analyze():
|
||||
"""Test receiving and analyzing emails"""
|
||||
|
||||
tool = AgentEmailTool(agent_id="sofiia-test")
|
||||
|
||||
# Get unread emails
|
||||
print("Checking for unread emails...")
|
||||
emails = tool.receive(unread_only=True, limit=10)
|
||||
|
||||
print(f"Found {len(emails)} unread emails\n")
|
||||
|
||||
for email in emails:
|
||||
print(f"From: {email.get('from')}")
|
||||
print(f"Subject: {email.get('subject')}")
|
||||
print(f"Date: {email.get('date')}")
|
||||
|
||||
# Analyze email
|
||||
analysis = tool.analyze_and_extract(email)
|
||||
|
||||
print("\n--- Analysis ---")
|
||||
print(f"Summary: {analysis['summary']}")
|
||||
|
||||
if analysis['action_items']:
|
||||
print(f"Action Items: {analysis['action_items']}")
|
||||
|
||||
if analysis['credentials']:
|
||||
print(f"Credentials Found:")
|
||||
for cred in analysis['credentials']:
|
||||
print(f" - {cred['type']}: {cred['redacted']}")
|
||||
|
||||
if analysis['auth_urls']:
|
||||
print(f"Auth URLs: {analysis['auth_urls']}")
|
||||
|
||||
if analysis['files']:
|
||||
print(f"Files: {analysis['files']}")
|
||||
|
||||
print(f"Sentiment: {analysis['sentiment']}")
|
||||
print("\n" + "="*50 + "\n")
|
||||
|
||||
return emails
|
||||
|
||||
|
||||
# Test with sample email data
|
||||
def test_analysis_only():
|
||||
"""Test analysis without actual API calls"""
|
||||
|
||||
tool = AgentEmailTool(agent_id="sofiia-test")
|
||||
|
||||
# Sample OTP email
|
||||
sample_email = {
|
||||
"id": "test-123",
|
||||
"from": "service@example.com",
|
||||
"to": ["sofiia@agentmail.to"],
|
||||
"subject": "Your verification code",
|
||||
"body": """Your verification code is: 123456
|
||||
|
||||
This code will expire in 5 minutes.
|
||||
|
||||
If you didn't request this, please ignore.""",
|
||||
"html": """<p>Your verification code is: <strong>123456</strong></p>""",
|
||||
"date": "2026-02-23T10:00:00Z"
|
||||
}
|
||||
|
||||
analysis = tool.analyze_and_extract(sample_email)
|
||||
|
||||
print("=== OTP Email Analysis ===")
|
||||
print(f"Summary: {analysis['summary']}")
|
||||
print(f"Credentials: {analysis['credentials']}")
|
||||
print(f"Auth URLs: {analysis['auth_urls']}")
|
||||
print(f"Sentiment: {analysis['sentiment']}")
|
||||
|
||||
# Sample magic link email
|
||||
sample_email2 = {
|
||||
"id": "test-456",
|
||||
"from": "github@github.com",
|
||||
"to": ["sofiia@agentmail.to"],
|
||||
"subject": "Sign in to GitHub",
|
||||
"body": """Click the link below to sign in to GitHub:
|
||||
|
||||
https://github.com/session/abc123def
|
||||
|
||||
If you didn't request this, you can ignore this email.""",
|
||||
"date": "2026-02-23T09:00:00Z"
|
||||
}
|
||||
|
||||
analysis2 = tool.analyze_and_extract(sample_email2)
|
||||
|
||||
print("\n=== Magic Link Email Analysis ===")
|
||||
print(f"Summary: {analysis2['summary']}")
|
||||
print(f"Auth URLs: {analysis2['auth_urls']}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Run analysis test first
|
||||
test_analysis_only()
|
||||
|
||||
# Then try receiving real emails
|
||||
# test_receive_and_analyze()
|
||||
60
tools/agent_email/tests/test_send_email.py
Normal file
60
tools/agent_email/tests/test_send_email.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Test 1: Send Email
|
||||
|
||||
Demonstrates creating an inbox and sending an email.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
from agent_email import AgentEmailTool
|
||||
|
||||
# Set API key (use env var or set directly)
|
||||
os.environ["AGENTMAIL_API_KEY"] = "your-api-key-here"
|
||||
|
||||
def test_send_email():
|
||||
"""Test sending an email"""
|
||||
|
||||
# Initialize tool
|
||||
tool = AgentEmailTool(agent_id="sofiia-test")
|
||||
|
||||
# Create inbox (or use existing)
|
||||
print("Creating inbox...")
|
||||
inbox = tool.create_inbox(
|
||||
username="sofiia-test",
|
||||
display_name="Sofiia Test Agent"
|
||||
)
|
||||
print(f"Inbox created: {inbox['email_address']}")
|
||||
|
||||
# Send email
|
||||
print("\nSending email...")
|
||||
result = tool.send(
|
||||
to=["recipient@example.com"],
|
||||
subject="Test from Sofiia Agent",
|
||||
body="""Hello!
|
||||
|
||||
This is a test email sent from Sofiia Agent via AgentMail.
|
||||
|
||||
Best regards,
|
||||
Sofiia""",
|
||||
html="""<html>
|
||||
<body>
|
||||
<p>Hello!</p>
|
||||
<p>This is a test email sent from <strong>Sofiia Agent</strong> via AgentMail.</p>
|
||||
<p>Best regards,<br>Sofiia</p>
|
||||
</body>
|
||||
</html>"""
|
||||
)
|
||||
|
||||
print(f"Email sent: {result['message_id']}")
|
||||
print(f"Status: {result['status']}")
|
||||
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
test_send_email()
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
Reference in New Issue
Block a user