docker-mailagent 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docker_mailagent-0.1.1/PKG-INFO +260 -0
- docker_mailagent-0.1.1/README.md +228 -0
- docker_mailagent-0.1.1/pyproject.toml +53 -0
- docker_mailagent-0.1.1/setup.cfg +4 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/PKG-INFO +260 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/SOURCES.txt +41 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/dependency_links.txt +1 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/entry_points.txt +2 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/requires.txt +16 -0
- docker_mailagent-0.1.1/src/docker_mailagent.egg-info/top_level.txt +1 -0
- docker_mailagent-0.1.1/src/mailagent/__init__.py +5 -0
- docker_mailagent-0.1.1/src/mailagent/classifier.py +143 -0
- docker_mailagent-0.1.1/src/mailagent/cli.py +374 -0
- docker_mailagent-0.1.1/src/mailagent/config.py +404 -0
- docker_mailagent-0.1.1/src/mailagent/mailer.py +87 -0
- docker_mailagent-0.1.1/src/mailagent/parser.py +94 -0
- docker_mailagent-0.1.1/src/mailagent/providers/__init__.py +170 -0
- docker_mailagent-0.1.1/src/mailagent/providers/anthropic.py +34 -0
- docker_mailagent-0.1.1/src/mailagent/providers/gemini.py +42 -0
- docker_mailagent-0.1.1/src/mailagent/providers/groq.py +16 -0
- docker_mailagent-0.1.1/src/mailagent/providers/openai.py +16 -0
- docker_mailagent-0.1.1/src/mailagent/providers/openrouter.py +34 -0
- docker_mailagent-0.1.1/src/mailagent/schema.json +500 -0
- docker_mailagent-0.1.1/src/mailagent/setup_wizard.py +208 -0
- docker_mailagent-0.1.1/src/mailagent/state.py +47 -0
- docker_mailagent-0.1.1/src/mailagent/testing/__init__.py +1 -0
- docker_mailagent-0.1.1/src/mailagent/testing/generator.py +100 -0
- docker_mailagent-0.1.1/src/mailagent/testing/inbucket.py +114 -0
- docker_mailagent-0.1.1/src/mailagent/testing/reporter.py +68 -0
- docker_mailagent-0.1.1/src/mailagent/testing/runner.py +784 -0
- docker_mailagent-0.1.1/src/mailagent/testing/webhook_capture.py +71 -0
- docker_mailagent-0.1.1/src/mailagent/utils/__init__.py +1 -0
- docker_mailagent-0.1.1/src/mailagent/utils/env.py +51 -0
- docker_mailagent-0.1.1/src/mailagent/utils/logging.py +16 -0
- docker_mailagent-0.1.1/src/mailagent/watcher.py +181 -0
- docker_mailagent-0.1.1/src/mailagent/workflows.py +342 -0
- docker_mailagent-0.1.1/tests/test_classifier.py +118 -0
- docker_mailagent-0.1.1/tests/test_config.py +155 -0
- docker_mailagent-0.1.1/tests/test_parser.py +34 -0
- docker_mailagent-0.1.1/tests/test_providers.py +162 -0
- docker_mailagent-0.1.1/tests/test_state.py +35 -0
- docker_mailagent-0.1.1/tests/test_watcher.py +143 -0
- docker_mailagent-0.1.1/tests/test_workflows.py +147 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docker-mailagent
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Your inbox, on autopilot.
|
|
5
|
+
Author: vrag99
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/vrag99/mailagent
|
|
8
|
+
Project-URL: Repository, https://github.com/vrag99/mailagent
|
|
9
|
+
Project-URL: Issues, https://github.com/vrag99/mailagent/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: System Administrators
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Communications :: Email
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
21
|
+
Requires-Dist: httpx>=0.27.0
|
|
22
|
+
Requires-Dist: imapclient>=3.0.0
|
|
23
|
+
Requires-Dist: inotify_simple>=2.0.0; sys_platform == "linux"
|
|
24
|
+
Requires-Dist: jsonschema>=4.23.0
|
|
25
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
26
|
+
Requires-Dist: questionary>=2.0.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: docker>=7.0.0; extra == "test"
|
|
32
|
+
|
|
33
|
+
# mailagent
|
|
34
|
+
|
|
35
|
+
General-purpose agentic inbox for docker-mailserver.
|
|
36
|
+
|
|
37
|
+
`mailagent` watches one or more Maildir inboxes, classifies incoming email with LLM providers, and executes workflows (`reply`, `ignore`, `notify`, `webhook`). It is designed to run as a sidecar container in an existing docker-mailserver stack.
|
|
38
|
+
|
|
39
|
+
## What you get
|
|
40
|
+
|
|
41
|
+
- Multi-inbox support in one config file (`mailagent.yml`)
|
|
42
|
+
- Named provider configs (`openai`, `anthropic`, `gemini`, `openrouter`, `groq`)
|
|
43
|
+
- LLM-first classification with keyword fallback
|
|
44
|
+
- Per-inbox workflow pipelines (first match wins)
|
|
45
|
+
- JSON Schema autocomplete for editor-driven config authoring
|
|
46
|
+
- CLI for daemon, validation, dry-run testing, and schema output
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
Use the published image with docker-mailserver:
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
services:
|
|
54
|
+
mailserver:
|
|
55
|
+
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
|
56
|
+
# ... your existing config
|
|
57
|
+
|
|
58
|
+
mailagent:
|
|
59
|
+
image: ghcr.io/vrag99/mailagent:latest
|
|
60
|
+
env_file: ./mailagent.env
|
|
61
|
+
volumes:
|
|
62
|
+
- ./docker-data/dms/mail-data/:/var/mail/:ro
|
|
63
|
+
- ./mailagent.yml:/app/config.yml:ro
|
|
64
|
+
- ./mailagent-data/:/app/data/
|
|
65
|
+
depends_on:
|
|
66
|
+
mailserver:
|
|
67
|
+
condition: service_healthy
|
|
68
|
+
restart: unless-stopped
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then:
|
|
72
|
+
|
|
73
|
+
1. Copy `examples/mailagent.minimal.yml` to `mailagent.yml` and configure your inboxes and workflows.
|
|
74
|
+
2. Create a `mailagent.env` file with the secrets referenced in your config:
|
|
75
|
+
```env
|
|
76
|
+
GROQ_API_KEY=gsk_...
|
|
77
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
78
|
+
MAIL_PASSWORD=your-mailbox-password
|
|
79
|
+
# Add any other ${VAR} values used in mailagent.yml
|
|
80
|
+
```
|
|
81
|
+
3. Start the stack and check logs:
|
|
82
|
+
```bash
|
|
83
|
+
docker compose up -d
|
|
84
|
+
docker compose logs -f mailagent
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## CLI
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Usage: mailagent <command> [options]
|
|
91
|
+
|
|
92
|
+
Commands:
|
|
93
|
+
run Start the mail agent daemon (default)
|
|
94
|
+
validate Validate the config file and exit
|
|
95
|
+
test Dry-run a .eml file through the pipeline
|
|
96
|
+
schema Print the JSON Schema to stdout
|
|
97
|
+
|
|
98
|
+
Options:
|
|
99
|
+
-c, --config PATH Config file path (default: /app/config.yml)
|
|
100
|
+
-v, --verbose Enable debug logging
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Examples:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mailagent run
|
|
107
|
+
mailagent run -c ./mailagent.yml
|
|
108
|
+
mailagent validate -c ./mailagent.yml
|
|
109
|
+
mailagent test ./some-email.eml -c ./mailagent.yml
|
|
110
|
+
mailagent schema > schema.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### `mailagent validate`
|
|
114
|
+
|
|
115
|
+
- Loads YAML config
|
|
116
|
+
- Interpolates env vars (`${VAR}` and `${VAR:-default}`)
|
|
117
|
+
- Validates against `schema.json`
|
|
118
|
+
- Applies extra semantic checks (provider refs, fallback placement, duplicates)
|
|
119
|
+
- Warns when maildir paths are missing (does not fail)
|
|
120
|
+
|
|
121
|
+
Returns exit code `0` on success, `1` on error.
|
|
122
|
+
|
|
123
|
+
### `mailagent test <file.eml>`
|
|
124
|
+
|
|
125
|
+
- Parses a single `.eml`
|
|
126
|
+
- Runs classification (real LLM call if configured)
|
|
127
|
+
- Prints selected workflow + action preview
|
|
128
|
+
- Does not send email or call webhooks
|
|
129
|
+
|
|
130
|
+
### `mailagent schema`
|
|
131
|
+
|
|
132
|
+
Prints the full JSON Schema to stdout for local editor setup.
|
|
133
|
+
|
|
134
|
+
## Schema-powered autocomplete
|
|
135
|
+
|
|
136
|
+
Default schema file is at repo root: `schema.json`.
|
|
137
|
+
|
|
138
|
+
In YAML files:
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
# yaml-language-server: $schema=https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
VS Code mapping:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"yaml.schemas": {
|
|
149
|
+
"https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json": "mailagent.yml"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Configuration model
|
|
155
|
+
|
|
156
|
+
Top-level sections:
|
|
157
|
+
|
|
158
|
+
- `providers`: named provider configs
|
|
159
|
+
- `defaults`: default providers, prompt, blocklist
|
|
160
|
+
- `inboxes`: per-inbox credentials + workflows
|
|
161
|
+
- `settings`: runtime behavior
|
|
162
|
+
|
|
163
|
+
Key behavior:
|
|
164
|
+
|
|
165
|
+
- Workflows are inbox-local and evaluated in order
|
|
166
|
+
- `match.intent: default` is catch-all fallback
|
|
167
|
+
- `keywords.any` / `keywords.all` are fallback matcher if LLM fails
|
|
168
|
+
- Global + inbox blocklists are merged
|
|
169
|
+
- Global + inbox system prompts are merged
|
|
170
|
+
|
|
171
|
+
See full examples:
|
|
172
|
+
|
|
173
|
+
- `examples/mailagent.yml`
|
|
174
|
+
- `examples/mailagent.minimal.yml`
|
|
175
|
+
- `examples/docker-compose.yml`
|
|
176
|
+
|
|
177
|
+
Sample addresses in examples use `you@example.com`.
|
|
178
|
+
|
|
179
|
+
## Build and run locally
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pip install -e .
|
|
183
|
+
mailagent validate -c ./examples/mailagent.minimal.yml
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Docker build:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
docker build -t mailagent/mailagent:local .
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Testing
|
|
193
|
+
|
|
194
|
+
Run unit tests:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
pytest -q
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Test coverage includes:
|
|
201
|
+
|
|
202
|
+
- config loading + schema validation
|
|
203
|
+
- provider adapters + retry/timeout paths
|
|
204
|
+
- parser fixtures (plain/html/multipart/non-utf8/mailing-list)
|
|
205
|
+
- classifier fallback behavior
|
|
206
|
+
- workflows execution behavior (dry-run and delivery path)
|
|
207
|
+
- watcher event routing
|
|
208
|
+
- state idempotency and pruning
|
|
209
|
+
|
|
210
|
+
## Project structure
|
|
211
|
+
|
|
212
|
+
```text
|
|
213
|
+
mailagent/
|
|
214
|
+
├── Dockerfile
|
|
215
|
+
├── pyproject.toml
|
|
216
|
+
├── README.md
|
|
217
|
+
├── schema.json
|
|
218
|
+
├── examples/
|
|
219
|
+
│ ├── mailagent.yml
|
|
220
|
+
│ ├── mailagent.minimal.yml
|
|
221
|
+
│ └── docker-compose.yml
|
|
222
|
+
├── src/
|
|
223
|
+
│ └── mailagent/
|
|
224
|
+
│ ├── __init__.py
|
|
225
|
+
│ ├── cli.py
|
|
226
|
+
│ ├── config.py
|
|
227
|
+
│ ├── watcher.py
|
|
228
|
+
│ ├── parser.py
|
|
229
|
+
│ ├── classifier.py
|
|
230
|
+
│ ├── workflows.py
|
|
231
|
+
│ ├── mailer.py
|
|
232
|
+
│ ├── state.py
|
|
233
|
+
│ ├── schema.json
|
|
234
|
+
│ ├── providers/
|
|
235
|
+
│ │ ├── __init__.py
|
|
236
|
+
│ │ ├── openai.py
|
|
237
|
+
│ │ ├── anthropic.py
|
|
238
|
+
│ │ ├── gemini.py
|
|
239
|
+
│ │ ├── openrouter.py
|
|
240
|
+
│ │ └── groq.py
|
|
241
|
+
│ └── utils/
|
|
242
|
+
│ ├── __init__.py
|
|
243
|
+
│ ├── logging.py
|
|
244
|
+
│ └── env.py
|
|
245
|
+
└── tests/
|
|
246
|
+
├── conftest.py
|
|
247
|
+
├── fixtures/
|
|
248
|
+
│ ├── plain_text.eml
|
|
249
|
+
│ ├── html_only.eml
|
|
250
|
+
│ ├── multipart.eml
|
|
251
|
+
│ ├── non_utf8.eml
|
|
252
|
+
│ └── mailing_list.eml
|
|
253
|
+
├── test_config.py
|
|
254
|
+
├── test_parser.py
|
|
255
|
+
├── test_classifier.py
|
|
256
|
+
├── test_workflows.py
|
|
257
|
+
├── test_providers.py
|
|
258
|
+
├── test_state.py
|
|
259
|
+
└── test_watcher.py
|
|
260
|
+
```
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# mailagent
|
|
2
|
+
|
|
3
|
+
General-purpose agentic inbox for docker-mailserver.
|
|
4
|
+
|
|
5
|
+
`mailagent` watches one or more Maildir inboxes, classifies incoming email with LLM providers, and executes workflows (`reply`, `ignore`, `notify`, `webhook`). It is designed to run as a sidecar container in an existing docker-mailserver stack.
|
|
6
|
+
|
|
7
|
+
## What you get
|
|
8
|
+
|
|
9
|
+
- Multi-inbox support in one config file (`mailagent.yml`)
|
|
10
|
+
- Named provider configs (`openai`, `anthropic`, `gemini`, `openrouter`, `groq`)
|
|
11
|
+
- LLM-first classification with keyword fallback
|
|
12
|
+
- Per-inbox workflow pipelines (first match wins)
|
|
13
|
+
- JSON Schema autocomplete for editor-driven config authoring
|
|
14
|
+
- CLI for daemon, validation, dry-run testing, and schema output
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
Use the published image with docker-mailserver:
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
services:
|
|
22
|
+
mailserver:
|
|
23
|
+
image: ghcr.io/docker-mailserver/docker-mailserver:latest
|
|
24
|
+
# ... your existing config
|
|
25
|
+
|
|
26
|
+
mailagent:
|
|
27
|
+
image: ghcr.io/vrag99/mailagent:latest
|
|
28
|
+
env_file: ./mailagent.env
|
|
29
|
+
volumes:
|
|
30
|
+
- ./docker-data/dms/mail-data/:/var/mail/:ro
|
|
31
|
+
- ./mailagent.yml:/app/config.yml:ro
|
|
32
|
+
- ./mailagent-data/:/app/data/
|
|
33
|
+
depends_on:
|
|
34
|
+
mailserver:
|
|
35
|
+
condition: service_healthy
|
|
36
|
+
restart: unless-stopped
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then:
|
|
40
|
+
|
|
41
|
+
1. Copy `examples/mailagent.minimal.yml` to `mailagent.yml` and configure your inboxes and workflows.
|
|
42
|
+
2. Create a `mailagent.env` file with the secrets referenced in your config:
|
|
43
|
+
```env
|
|
44
|
+
GROQ_API_KEY=gsk_...
|
|
45
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
46
|
+
MAIL_PASSWORD=your-mailbox-password
|
|
47
|
+
# Add any other ${VAR} values used in mailagent.yml
|
|
48
|
+
```
|
|
49
|
+
3. Start the stack and check logs:
|
|
50
|
+
```bash
|
|
51
|
+
docker compose up -d
|
|
52
|
+
docker compose logs -f mailagent
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## CLI
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Usage: mailagent <command> [options]
|
|
59
|
+
|
|
60
|
+
Commands:
|
|
61
|
+
run Start the mail agent daemon (default)
|
|
62
|
+
validate Validate the config file and exit
|
|
63
|
+
test Dry-run a .eml file through the pipeline
|
|
64
|
+
schema Print the JSON Schema to stdout
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
-c, --config PATH Config file path (default: /app/config.yml)
|
|
68
|
+
-v, --verbose Enable debug logging
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Examples:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mailagent run
|
|
75
|
+
mailagent run -c ./mailagent.yml
|
|
76
|
+
mailagent validate -c ./mailagent.yml
|
|
77
|
+
mailagent test ./some-email.eml -c ./mailagent.yml
|
|
78
|
+
mailagent schema > schema.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `mailagent validate`
|
|
82
|
+
|
|
83
|
+
- Loads YAML config
|
|
84
|
+
- Interpolates env vars (`${VAR}` and `${VAR:-default}`)
|
|
85
|
+
- Validates against `schema.json`
|
|
86
|
+
- Applies extra semantic checks (provider refs, fallback placement, duplicates)
|
|
87
|
+
- Warns when maildir paths are missing (does not fail)
|
|
88
|
+
|
|
89
|
+
Returns exit code `0` on success, `1` on error.
|
|
90
|
+
|
|
91
|
+
### `mailagent test <file.eml>`
|
|
92
|
+
|
|
93
|
+
- Parses a single `.eml`
|
|
94
|
+
- Runs classification (real LLM call if configured)
|
|
95
|
+
- Prints selected workflow + action preview
|
|
96
|
+
- Does not send email or call webhooks
|
|
97
|
+
|
|
98
|
+
### `mailagent schema`
|
|
99
|
+
|
|
100
|
+
Prints the full JSON Schema to stdout for local editor setup.
|
|
101
|
+
|
|
102
|
+
## Schema-powered autocomplete
|
|
103
|
+
|
|
104
|
+
Default schema file is at repo root: `schema.json`.
|
|
105
|
+
|
|
106
|
+
In YAML files:
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
# yaml-language-server: $schema=https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
VS Code mapping:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"yaml.schemas": {
|
|
117
|
+
"https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json": "mailagent.yml"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Configuration model
|
|
123
|
+
|
|
124
|
+
Top-level sections:
|
|
125
|
+
|
|
126
|
+
- `providers`: named provider configs
|
|
127
|
+
- `defaults`: default providers, prompt, blocklist
|
|
128
|
+
- `inboxes`: per-inbox credentials + workflows
|
|
129
|
+
- `settings`: runtime behavior
|
|
130
|
+
|
|
131
|
+
Key behavior:
|
|
132
|
+
|
|
133
|
+
- Workflows are inbox-local and evaluated in order
|
|
134
|
+
- `match.intent: default` is catch-all fallback
|
|
135
|
+
- `keywords.any` / `keywords.all` are fallback matcher if LLM fails
|
|
136
|
+
- Global + inbox blocklists are merged
|
|
137
|
+
- Global + inbox system prompts are merged
|
|
138
|
+
|
|
139
|
+
See full examples:
|
|
140
|
+
|
|
141
|
+
- `examples/mailagent.yml`
|
|
142
|
+
- `examples/mailagent.minimal.yml`
|
|
143
|
+
- `examples/docker-compose.yml`
|
|
144
|
+
|
|
145
|
+
Sample addresses in examples use `you@example.com`.
|
|
146
|
+
|
|
147
|
+
## Build and run locally
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install -e .
|
|
151
|
+
mailagent validate -c ./examples/mailagent.minimal.yml
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Docker build:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
docker build -t mailagent/mailagent:local .
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Testing
|
|
161
|
+
|
|
162
|
+
Run unit tests:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pytest -q
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Test coverage includes:
|
|
169
|
+
|
|
170
|
+
- config loading + schema validation
|
|
171
|
+
- provider adapters + retry/timeout paths
|
|
172
|
+
- parser fixtures (plain/html/multipart/non-utf8/mailing-list)
|
|
173
|
+
- classifier fallback behavior
|
|
174
|
+
- workflows execution behavior (dry-run and delivery path)
|
|
175
|
+
- watcher event routing
|
|
176
|
+
- state idempotency and pruning
|
|
177
|
+
|
|
178
|
+
## Project structure
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
mailagent/
|
|
182
|
+
├── Dockerfile
|
|
183
|
+
├── pyproject.toml
|
|
184
|
+
├── README.md
|
|
185
|
+
├── schema.json
|
|
186
|
+
├── examples/
|
|
187
|
+
│ ├── mailagent.yml
|
|
188
|
+
│ ├── mailagent.minimal.yml
|
|
189
|
+
│ └── docker-compose.yml
|
|
190
|
+
├── src/
|
|
191
|
+
│ └── mailagent/
|
|
192
|
+
│ ├── __init__.py
|
|
193
|
+
│ ├── cli.py
|
|
194
|
+
│ ├── config.py
|
|
195
|
+
│ ├── watcher.py
|
|
196
|
+
│ ├── parser.py
|
|
197
|
+
│ ├── classifier.py
|
|
198
|
+
│ ├── workflows.py
|
|
199
|
+
│ ├── mailer.py
|
|
200
|
+
│ ├── state.py
|
|
201
|
+
│ ├── schema.json
|
|
202
|
+
│ ├── providers/
|
|
203
|
+
│ │ ├── __init__.py
|
|
204
|
+
│ │ ├── openai.py
|
|
205
|
+
│ │ ├── anthropic.py
|
|
206
|
+
│ │ ├── gemini.py
|
|
207
|
+
│ │ ├── openrouter.py
|
|
208
|
+
│ │ └── groq.py
|
|
209
|
+
│ └── utils/
|
|
210
|
+
│ ├── __init__.py
|
|
211
|
+
│ ├── logging.py
|
|
212
|
+
│ └── env.py
|
|
213
|
+
└── tests/
|
|
214
|
+
├── conftest.py
|
|
215
|
+
├── fixtures/
|
|
216
|
+
│ ├── plain_text.eml
|
|
217
|
+
│ ├── html_only.eml
|
|
218
|
+
│ ├── multipart.eml
|
|
219
|
+
│ ├── non_utf8.eml
|
|
220
|
+
│ └── mailing_list.eml
|
|
221
|
+
├── test_config.py
|
|
222
|
+
├── test_parser.py
|
|
223
|
+
├── test_classifier.py
|
|
224
|
+
├── test_workflows.py
|
|
225
|
+
├── test_providers.py
|
|
226
|
+
├── test_state.py
|
|
227
|
+
└── test_watcher.py
|
|
228
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "docker-mailagent"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Your inbox, on autopilot."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "vrag99" }]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: System Administrators",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Topic :: Communications :: Email",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"beautifulsoup4>=4.12.0",
|
|
25
|
+
"httpx>=0.27.0",
|
|
26
|
+
"imapclient>=3.0.0",
|
|
27
|
+
"inotify_simple>=2.0.0; sys_platform == 'linux'",
|
|
28
|
+
"jsonschema>=4.23.0",
|
|
29
|
+
"pyyaml>=6.0.0",
|
|
30
|
+
"questionary>=2.0.0",
|
|
31
|
+
"rich>=13.0.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = ["pytest>=8.0.0"]
|
|
36
|
+
test = ["docker>=7.0.0"]
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
mailagent = "mailagent.cli:main"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/vrag99/mailagent"
|
|
43
|
+
Repository = "https://github.com/vrag99/mailagent"
|
|
44
|
+
Issues = "https://github.com/vrag99/mailagent/issues"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools]
|
|
47
|
+
package-dir = {"" = "src"}
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["src"]
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.package-data]
|
|
53
|
+
mailagent = ["schema.json", "schema.test.json"]
|