2.3 KiB
2.3 KiB
ThunderAI Project Agent Context
Project Overview
ThunderAI is a Mozilla Thunderbird add-on that integrates Large Language Models (LLMs) such as ChatGPT, Gemini, Claude, and Ollama for advanced email management. It allows users to analyze, draft, correct, tag, and create calendar events directly from the email client.
Technical Stack
- Languages: JavaScript (ES6+), HTML5, CSS3.
- Environment: Thunderbird MailExtension API (based on WebExtensions).
- Core Logic: Primarily located in
background.jsand UI-specific scripts. - API Integrations: Specific logic is contained within dedicated API provider files (e.g.,
api_openai.js,api_google_gemini.js).
Development Rules & Style Guide
- Code Style: Use modern JavaScript. Prefer
async/awaitover chained Promises. - Naming Conventions: Use
camelCasefor variables and functions. - Security: - Never hardcode API keys in the source code.
- Use
messenger.storage.localfor data persistence. - Strictly adhere to CORS policies for external API calls.
- Use
- i18n:
- The project supports multiple languages via
_locales/. When adding UI strings, always usemessenger.i18n.getMessage(). - When you need to modify language file, modify only the english version.
- The project supports multiple languages via
Files & Directories Structure
manifest.json: Extension entry point and permission definitions.api_*.js: Modules for integration with different AI providers.options/: Configuration and settings pages._locales/: Translation files (JSON format).graphics/: Visual assets and icons.
Important Commands & Workflow
- Testing: Since this is a Thunderbird add-on, testing is performed by loading the extension as a "Temporary Add-on" via Thunderbird's
Debug Add-onsmenu. - Build: The project does not use complex build tools (no Webpack/Vite by default); it is a "pure" MailExtension.
Agent Instructions
- Context Awareness: When modifying API-related files, ensure compatibility with the existing placeholder system (e.g.,
{%mail_body%},{%additional_text%}). - Permission Review: Before modifying
manifest.json, verify that any new permissions requested are strictly necessary for the feature. - Compatibility: Ensure code is compatible with the latest Thunderbird ESR (Extended Support Release) versions.