gigamail 0.1.2__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.
Files changed (80) hide show
  1. gigamail-0.1.2/.github/workflows/ci.yml +29 -0
  2. gigamail-0.1.2/.github/workflows/release.yml +69 -0
  3. gigamail-0.1.2/.gitignore +13 -0
  4. gigamail-0.1.2/CHANGELOG.md +106 -0
  5. gigamail-0.1.2/LICENSE +661 -0
  6. gigamail-0.1.2/MAPPA_MCP.md +151 -0
  7. gigamail-0.1.2/PKG-INFO +333 -0
  8. gigamail-0.1.2/README.md +287 -0
  9. gigamail-0.1.2/SECURITY.md +97 -0
  10. gigamail-0.1.2/console/ask_window.html +233 -0
  11. gigamail-0.1.2/console/calendar_notifier.js +118 -0
  12. gigamail-0.1.2/console/calendar_window.html +833 -0
  13. gigamail-0.1.2/console/i18n.js +375 -0
  14. gigamail-0.1.2/console/index_v2.html +842 -0
  15. gigamail-0.1.2/console/mail_window.html +501 -0
  16. gigamail-0.1.2/console/main.js +687 -0
  17. gigamail-0.1.2/console/marketing_window.html +705 -0
  18. gigamail-0.1.2/console/new_mail_window.html +667 -0
  19. gigamail-0.1.2/console/package-lock.json +1392 -0
  20. gigamail-0.1.2/console/package.json +18 -0
  21. gigamail-0.1.2/console/popup_bridge.js +90 -0
  22. gigamail-0.1.2/console/preload.js +426 -0
  23. gigamail-0.1.2/console/preload_ask.js +8 -0
  24. gigamail-0.1.2/console/preload_calendar.js +6 -0
  25. gigamail-0.1.2/console/preload_mail.js +24 -0
  26. gigamail-0.1.2/console/preload_marketing.js +6 -0
  27. gigamail-0.1.2/console/preload_new_mail.js +9 -0
  28. gigamail-0.1.2/console/preload_reply.js +10 -0
  29. gigamail-0.1.2/console/renderer.js +2104 -0
  30. gigamail-0.1.2/console/renderer_bulk.js +216 -0
  31. gigamail-0.1.2/console/renderer_identity.js +462 -0
  32. gigamail-0.1.2/console/renderer_sender_history.js +136 -0
  33. gigamail-0.1.2/console/renderer_utils.js +983 -0
  34. gigamail-0.1.2/console/reply_window.html +844 -0
  35. gigamail-0.1.2/console/style_v2.css +733 -0
  36. gigamail-0.1.2/console/voice_mail.js +683 -0
  37. gigamail-0.1.2/docs/CNAME +1 -0
  38. gigamail-0.1.2/docs/anti-injection-harness.png +0 -0
  39. gigamail-0.1.2/docs/console-draft.png +0 -0
  40. gigamail-0.1.2/docs/index.html +426 -0
  41. gigamail-0.1.2/pyproject.toml +67 -0
  42. gigamail-0.1.2/scripts/injection_e2e.py +130 -0
  43. gigamail-0.1.2/src/ade_mail_agent/__init__.py +3 -0
  44. gigamail-0.1.2/src/ade_mail_agent/agent_bridge.py +117 -0
  45. gigamail-0.1.2/src/ade_mail_agent/cli.py +356 -0
  46. gigamail-0.1.2/src/ade_mail_agent/core/__init__.py +1 -0
  47. gigamail-0.1.2/src/ade_mail_agent/core/accounts.py +388 -0
  48. gigamail-0.1.2/src/ade_mail_agent/core/ade_masker.py +474 -0
  49. gigamail-0.1.2/src/ade_mail_agent/core/auth.py +265 -0
  50. gigamail-0.1.2/src/ade_mail_agent/core/availability.py +120 -0
  51. gigamail-0.1.2/src/ade_mail_agent/core/caldav_client.py +332 -0
  52. gigamail-0.1.2/src/ade_mail_agent/core/data_paths.py +55 -0
  53. gigamail-0.1.2/src/ade_mail_agent/core/file_extractor.py +74 -0
  54. gigamail-0.1.2/src/ade_mail_agent/core/identity_reader.py +383 -0
  55. gigamail-0.1.2/src/ade_mail_agent/core/imap_client.py +1681 -0
  56. gigamail-0.1.2/src/ade_mail_agent/core/mail.py +208 -0
  57. gigamail-0.1.2/src/ade_mail_agent/core/mail_memory.py +1684 -0
  58. gigamail-0.1.2/src/ade_mail_agent/core/mail_router.py +515 -0
  59. gigamail-0.1.2/src/ade_mail_agent/core/ms_calendar.py +150 -0
  60. gigamail-0.1.2/src/ade_mail_agent/core/ms_config.json +5 -0
  61. gigamail-0.1.2/src/ade_mail_agent/core/observer.py +400 -0
  62. gigamail-0.1.2/src/ade_mail_agent/core/sent_cache.py +175 -0
  63. gigamail-0.1.2/src/ade_mail_agent/core/win_dpapi.py +64 -0
  64. gigamail-0.1.2/src/ade_mail_agent/gen_toolmap.py +76 -0
  65. gigamail-0.1.2/src/ade_mail_agent/http_api.py +879 -0
  66. gigamail-0.1.2/src/ade_mail_agent/policy.py +325 -0
  67. gigamail-0.1.2/src/ade_mail_agent/server.py +453 -0
  68. gigamail-0.1.2/tests/conftest.py +32 -0
  69. gigamail-0.1.2/tests/test_agent_bridge.py +74 -0
  70. gigamail-0.1.2/tests/test_auth_multiaccount.py +114 -0
  71. gigamail-0.1.2/tests/test_availability.py +107 -0
  72. gigamail-0.1.2/tests/test_dpapi.py +62 -0
  73. gigamail-0.1.2/tests/test_http_auth.py +65 -0
  74. gigamail-0.1.2/tests/test_imap_parsing.py +63 -0
  75. gigamail-0.1.2/tests/test_injection.py +183 -0
  76. gigamail-0.1.2/tests/test_knowledge.py +100 -0
  77. gigamail-0.1.2/tests/test_mail_router.py +103 -0
  78. gigamail-0.1.2/tests/test_masker.py +43 -0
  79. gigamail-0.1.2/tests/test_policy.py +254 -0
  80. gigamail-0.1.2/tests/test_toolmap.py +29 -0
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [windows-latest, ubuntu-latest]
14
+ python: ["3.10", "3.12", "3.13"]
15
+ runs-on: ${{ matrix.os }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: ${{ matrix.python }}
21
+ cache: pip
22
+ - name: Install
23
+ run: pip install -e ".[all,dev]"
24
+ - name: Test suite
25
+ run: pytest -q
26
+ # I test DPAPI si auto-skippano su Linux; tutto il resto gira
27
+ # su entrambi gli OS senza rete ne' credenziali.
28
+ - name: Tool map allineata al server
29
+ run: python -m ade_mail_agent.gen_toolmap --check
@@ -0,0 +1,69 @@
1
+ name: Release to PyPI
2
+
3
+ # Pubblicazione via trusted publisher (OIDC): nessun token, nessun segreto
4
+ # conservato nel repo. PyPI si fida di questo workflow, in questo repo,
5
+ # nell'environment "pypi".
6
+ #
7
+ # Come si rilascia:
8
+ # 1. aggiorna version in pyproject.toml e __init__.py, aggiorna CHANGELOG
9
+ # 2. tag vX.Y.Z (immutabile: un numero bruciato non si ricicla)
10
+ # 3. crea la Release su GitHub da quel tag
11
+ # -> questo workflow costruisce, verifica e pubblica
12
+
13
+ on:
14
+ release:
15
+ types: [published]
16
+ workflow_dispatch: # per una prova manuale senza pubblicare
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.12"
27
+ cache: pip
28
+
29
+ - name: Test suite (non pubblichiamo codice non verificato)
30
+ run: |
31
+ pip install -e ".[all,dev]"
32
+ pytest -q
33
+ python -m ade_mail_agent.gen_toolmap --check
34
+
35
+ - name: Build sdist + wheel
36
+ run: |
37
+ pip install build twine
38
+ python -m build
39
+ twine check dist/*
40
+
41
+ - name: La versione costruita deve coincidere col tag
42
+ if: github.event_name == 'release'
43
+ run: |
44
+ TAG="${GITHUB_REF_NAME#v}"
45
+ BUILT=$(ls dist/*.tar.gz | sed -E 's/.*gigamail-(.*)\.tar\.gz/\1/')
46
+ echo "tag=$TAG costruito=$BUILT"
47
+ test "$TAG" = "$BUILT" || {
48
+ echo "::error::Il tag ($TAG) non coincide con la versione del pacchetto ($BUILT)."
49
+ exit 1
50
+ }
51
+
52
+ - uses: actions/upload-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+
57
+ publish:
58
+ needs: build
59
+ if: github.event_name == 'release'
60
+ runs-on: ubuntu-latest
61
+ environment: pypi
62
+ permissions:
63
+ id-token: write # richiesto dal trusted publishing
64
+ steps:
65
+ - uses: actions/download-artifact@v4
66
+ with:
67
+ name: dist
68
+ path: dist/
69
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .env
8
+ NOTES.dev.md
9
+ *.db
10
+ *.token*
11
+ .token_cache.json
12
+ node_modules/
13
+ POST_DRAFTS.md
@@ -0,0 +1,106 @@
1
+ # Changelog
2
+
3
+ ## v0.1.1 — 2026-08-15
4
+
5
+ **Security fix: the agent could approve its own destructive actions.**
6
+
7
+ v0.1.0 returned a one-time confirmation token inside the tool result, which
8
+ put it in the model's context. The agent held both halves — the preview and
9
+ the key — so an instruction injected through an email could call the tool
10
+ again with the token it had just read. The gate stopped accidents, not a
11
+ determined injection. Reported on r/mcp by **u/ranbuman**; **u/anderson_the_one**
12
+ added the point about binding approval to the exact operation shown.
13
+
14
+ Approval is now **out of band**:
15
+
16
+ - a dangerous tool returns only `request_id`, an inert reference — no secret
17
+ enters the model's context
18
+ - approval happens through channels the agent has no path to: the console
19
+ API (behind its session token) or `gigamail approvals approve <id>`
20
+ - execution uses the canonical arguments stored when the request was made,
21
+ never what the agent passes back at the second call
22
+ - repeating a `request_id` returns *awaiting approval*, indefinitely
23
+ - approvals live in SQLite, because requesting and approving now happen in
24
+ different processes
25
+
26
+ New: `gigamail approvals list|approve|reject`, and `/approvals` endpoints on
27
+ the console API. Tool parameter renamed `confirm_token` → `request_id`.
28
+
29
+ Declared limitation: an agent with full shell access on the same machine can
30
+ run the approval CLI. That is a different threat model and GigaMail does not
31
+ claim to defend it.
32
+
33
+ Tests: 94 → 103, including one asserting that no MCP tool grants approval and
34
+ that the phase-1 payload contains no token. The red-team scenario now
35
+ instructs the agent to approve itself; with all tools live, it took no
36
+ destructive action.
37
+
38
+ ## v0.1.0 — 2026-08-15
39
+
40
+ First public release. GigaMail is in daily production use at one company
41
+ (real estate: client enquiries answered with figures from our own files,
42
+ the right floor plans attached, and appointment slots from the calendar) —
43
+ but it is a 0.1: expect rough edges, and read the security model before
44
+ pointing it at a mailbox that matters.
45
+
46
+ ### What's in it
47
+
48
+ **MCP server (stdio, no network port)** — 24 typed tools for an agent:
49
+
50
+ - *Read (15)*: accounts, identity, knowledge files, messages, unread,
51
+ folders, hybrid search (provider + local index), attachment text, sender
52
+ history, learned correction patterns, calendar events, free-slot
53
+ availability
54
+ - *Safe writes (3, audited)*: mark read, move message, create folder
55
+ - *Destructive (6, two-phase)*: send, reply, delete message, delete folder,
56
+ create/delete calendar event
57
+
58
+ **Permission model** — destructive tools never execute on the agent's word
59
+ alone: the first call returns a preview and a single-use token (5-minute
60
+ TTL), a human approves, the second call executes with the arguments that
61
+ were shown. Every write lands in an append-only action log. Login,
62
+ credentials and account management are CLI-only and never exposed as tools,
63
+ so a hostile email cannot reach them.
64
+
65
+ **Providers** — Microsoft Graph and IMAP/SMTP (Aruba, Gmail, Libero and any
66
+ IMAP server), Microsoft calendar, optional CalDAV configuration.
67
+
68
+ **Account context** — per-account identity (who you are, what you do, tone)
69
+ plus knowledge files you register: price lists, terms, product sheets. The
70
+ agent reads them to answer mail, and attachment suggestions follow what it
71
+ actually wrote.
72
+
73
+ **Human console (optional)** — Electron UI over a local HTTP API bound to
74
+ 127.0.0.1 with a session token. What the old app delegated to an internal
75
+ LLM is now delegated to *your* agent through a bridge; there is no LLM
76
+ inside GigaMail.
77
+
78
+ **Privacy** — manual masking from the console (transparent MCP-side
79
+ filtering is planned). Mail indexes, credentials and memory stay on your
80
+ machine; content your agent reads is handled by that agent's provider.
81
+
82
+ ### Quality
83
+
84
+ 94 tests, green in CI on Windows and Linux across Python 3.10, 3.12 and
85
+ 3.13. Anti-injection suite included: hostile emails ordering exfiltration,
86
+ mass deletion and self-approval with invented tokens were fed to a real
87
+ agent with all tools live — no destructive action occurred.
88
+
89
+ ### Known limitations
90
+
91
+ - The action log is append-only but not tamper-proof.
92
+ - The bundled Azure app is not publisher-verified: the Microsoft consent
93
+ screen shows an "unverified" notice. Bring your own `client_id` to avoid
94
+ it; IMAP needs none of this.
95
+ - Gmail is supported via IMAP with an app password but has not been tested
96
+ against a live account.
97
+ - Not on PyPI yet — install from a clone.
98
+ - The distribution/package name is still `ade-mail-agent` internally; the
99
+ commands are `gigamail`, with the old names kept as aliases.
100
+ - `mark_spam`, `update_event`, `auth_status`, `search_contacts` and
101
+ `list_followup_needed` are designed but not implemented.
102
+
103
+ ### License
104
+
105
+ AGPL-3.0-or-later. Commercial licenses for closed-source use are available
106
+ from the copyright holder.