Compare commits
25 Commits
412a9c7bec
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 346cc5f6fb | |||
| f7f9744e47 | |||
| 9d1635c043 | |||
| 32c2c07aa2 | |||
| d0978cea99 | |||
| 93b3718320 | |||
| 6a4aece659 | |||
| 3636e6edc8 | |||
| b6f64615ae | |||
| 9e534ed961 | |||
| 985194cd5b | |||
| 91eab636bb | |||
| 4e63c36199 | |||
| 24b3b04cfe | |||
| 08136d8a64 | |||
| 677ead8ef5 | |||
| 4cf5110684 | |||
| 77dabf8df8 | |||
| b14ffe9e44 | |||
| f22af90e98 | |||
| dbfef295b8 | |||
| 505950eafa | |||
| 3a550ab576 | |||
| 44d36575c6 | |||
| b18b717c52 |
129
.drone.yml
Normal file
129
.drone.yml
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-publish-pypi
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
workspace:
|
||||
path: /drone/src
|
||||
|
||||
steps:
|
||||
- name: check-version
|
||||
image: curlimages/curl:latest
|
||||
environment:
|
||||
PIP_REPO_URL:
|
||||
from_secret: PIP_REPO_URL
|
||||
PIP_USERNAME:
|
||||
from_secret: PIP_USERNAME
|
||||
PIP_PASSWORD:
|
||||
from_secret: PIP_PASSWORD
|
||||
commands:
|
||||
- PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | head -1 | cut -d'"' -f2)
|
||||
- VERSION=$(grep -E '^version\s*=' pyproject.toml | head -1 | cut -d'"' -f2)
|
||||
- echo "🔍 Checking if $PACKAGE_NAME==$VERSION exists on $PIP_REPO_URL ..."
|
||||
- |
|
||||
if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" "$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -q "$VERSION"; then
|
||||
echo "✅ $PACKAGE_NAME==$VERSION already exists — skipping build."
|
||||
exit 78
|
||||
else
|
||||
echo "🆕 New version detected: $PACKAGE_NAME==$VERSION"
|
||||
fi
|
||||
|
||||
- name: build-package
|
||||
image: python:3.13-slim
|
||||
commands:
|
||||
- pip install --upgrade pip build
|
||||
- echo "📦 Building Python package..."
|
||||
- python -m build
|
||||
- ls -l dist
|
||||
|
||||
- name: upload-to-private-pypi
|
||||
image: python:3.13-slim
|
||||
environment:
|
||||
PIP_REPO_URL:
|
||||
from_secret: PIP_REPO_URL
|
||||
PIP_USERNAME:
|
||||
from_secret: PIP_USERNAME
|
||||
PIP_PASSWORD:
|
||||
from_secret: PIP_PASSWORD
|
||||
commands:
|
||||
- pip install --upgrade twine
|
||||
- echo "🚀 Uploading to private PyPI at $PIP_REPO_URL ..."
|
||||
- |
|
||||
twine upload \
|
||||
--repository-url "$PIP_REPO_URL" \
|
||||
-u "$PIP_USERNAME" \
|
||||
-p "$PIP_PASSWORD" \
|
||||
dist/*
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: backfill-pypi-from-tags
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
workspace:
|
||||
path: /drone/src
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: build-and-upload-missing
|
||||
image: python:3.13-slim
|
||||
environment:
|
||||
PIP_REPO_URL:
|
||||
from_secret: PIP_REPO_URL
|
||||
PIP_USERNAME:
|
||||
from_secret: PIP_USERNAME
|
||||
PIP_PASSWORD:
|
||||
from_secret: PIP_PASSWORD
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install -y git curl ca-certificates
|
||||
- pip install --upgrade pip build twine
|
||||
- |
|
||||
set -e
|
||||
|
||||
PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | cut -d'"' -f2)
|
||||
echo "📦 Package: $PACKAGE_NAME"
|
||||
|
||||
for TAG in $(git tag --sort=version:refname); do
|
||||
VERSION="$TAG"
|
||||
echo "🔁 Version: $VERSION"
|
||||
|
||||
if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" \
|
||||
"$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -q "$VERSION"; then
|
||||
echo "⏭️ Exists, skipping"
|
||||
continue
|
||||
fi
|
||||
|
||||
git checkout --force "$TAG"
|
||||
|
||||
echo "🏗️ Building $VERSION"
|
||||
rm -rf dist
|
||||
python -m build
|
||||
|
||||
echo "⬆️ Uploading $VERSION"
|
||||
twine upload \
|
||||
--repository-url "$PIP_REPO_URL" \
|
||||
-u "$PIP_USERNAME" \
|
||||
-p "$PIP_PASSWORD" \
|
||||
dist/*
|
||||
done
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- custom
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -37,4 +37,10 @@ Thumbs.db
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
*.tmp
|
||||
*.tmp
|
||||
site
|
||||
|
||||
# Credentials
|
||||
client_secret_*.json
|
||||
token.pickle
|
||||
credentials*.json
|
||||
29
docforge.nav.yml
Normal file
29
docforge.nav.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
home: mail_intake/index.md
|
||||
groups:
|
||||
Core API:
|
||||
- mail_intake/ingestion/index.md
|
||||
- mail_intake/ingestion/reader.md
|
||||
Domain Models:
|
||||
- mail_intake/models/index.md
|
||||
- mail_intake/models/message.md
|
||||
- mail_intake/models/thread.md
|
||||
Provider Adapters:
|
||||
- mail_intake/adapters/index.md
|
||||
- mail_intake/adapters/base.md
|
||||
- mail_intake/adapters/gmail.md
|
||||
Authentication & Storage:
|
||||
- mail_intake/auth/index.md
|
||||
- mail_intake/auth/base.md
|
||||
- mail_intake/auth/google.md
|
||||
- mail_intake/credentials/index.md
|
||||
- mail_intake/credentials/store.md
|
||||
- mail_intake/credentials/pickle.md
|
||||
- mail_intake/credentials/redis.md
|
||||
Normalization & Parsing:
|
||||
- mail_intake/parsers/index.md
|
||||
- mail_intake/parsers/body.md
|
||||
- mail_intake/parsers/headers.md
|
||||
- mail_intake/parsers/subject.md
|
||||
Configuration & Errors:
|
||||
- mail_intake/config.md
|
||||
- mail_intake/exceptions.md
|
||||
3
docs/mail_intake/adapters/base.md
Normal file
3
docs/mail_intake/adapters/base.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Base
|
||||
|
||||
::: mail_intake.adapters.base
|
||||
3
docs/mail_intake/adapters/gmail.md
Normal file
3
docs/mail_intake/adapters/gmail.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Gmail
|
||||
|
||||
::: mail_intake.adapters.gmail
|
||||
3
docs/mail_intake/adapters/index.md
Normal file
3
docs/mail_intake/adapters/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Adapters
|
||||
|
||||
::: mail_intake.adapters
|
||||
3
docs/mail_intake/auth/base.md
Normal file
3
docs/mail_intake/auth/base.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Base
|
||||
|
||||
::: mail_intake.auth.base
|
||||
3
docs/mail_intake/auth/google.md
Normal file
3
docs/mail_intake/auth/google.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Google
|
||||
|
||||
::: mail_intake.auth.google
|
||||
3
docs/mail_intake/auth/index.md
Normal file
3
docs/mail_intake/auth/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Auth
|
||||
|
||||
::: mail_intake.auth
|
||||
3
docs/mail_intake/config.md
Normal file
3
docs/mail_intake/config.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Config
|
||||
|
||||
::: mail_intake.config
|
||||
3
docs/mail_intake/credentials/index.md
Normal file
3
docs/mail_intake/credentials/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Credentials
|
||||
|
||||
::: mail_intake.credentials
|
||||
3
docs/mail_intake/credentials/pickle.md
Normal file
3
docs/mail_intake/credentials/pickle.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pickle
|
||||
|
||||
::: mail_intake.credentials.pickle
|
||||
3
docs/mail_intake/credentials/redis.md
Normal file
3
docs/mail_intake/credentials/redis.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Redis
|
||||
|
||||
::: mail_intake.credentials.redis
|
||||
3
docs/mail_intake/credentials/store.md
Normal file
3
docs/mail_intake/credentials/store.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Store
|
||||
|
||||
::: mail_intake.credentials.store
|
||||
3
docs/mail_intake/exceptions.md
Normal file
3
docs/mail_intake/exceptions.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Exceptions
|
||||
|
||||
::: mail_intake.exceptions
|
||||
3
docs/mail_intake/index.md
Normal file
3
docs/mail_intake/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Mail Intake
|
||||
|
||||
::: mail_intake
|
||||
3
docs/mail_intake/ingestion/index.md
Normal file
3
docs/mail_intake/ingestion/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Ingestion
|
||||
|
||||
::: mail_intake.ingestion
|
||||
3
docs/mail_intake/ingestion/reader.md
Normal file
3
docs/mail_intake/ingestion/reader.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Reader
|
||||
|
||||
::: mail_intake.ingestion.reader
|
||||
3
docs/mail_intake/models/index.md
Normal file
3
docs/mail_intake/models/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Models
|
||||
|
||||
::: mail_intake.models
|
||||
3
docs/mail_intake/models/message.md
Normal file
3
docs/mail_intake/models/message.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Message
|
||||
|
||||
::: mail_intake.models.message
|
||||
3
docs/mail_intake/models/thread.md
Normal file
3
docs/mail_intake/models/thread.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Thread
|
||||
|
||||
::: mail_intake.models.thread
|
||||
3
docs/mail_intake/parsers/body.md
Normal file
3
docs/mail_intake/parsers/body.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Body
|
||||
|
||||
::: mail_intake.parsers.body
|
||||
3
docs/mail_intake/parsers/headers.md
Normal file
3
docs/mail_intake/parsers/headers.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Headers
|
||||
|
||||
::: mail_intake.parsers.headers
|
||||
3
docs/mail_intake/parsers/index.md
Normal file
3
docs/mail_intake/parsers/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Parsers
|
||||
|
||||
::: mail_intake.parsers
|
||||
3
docs/mail_intake/parsers/subject.md
Normal file
3
docs/mail_intake/parsers/subject.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Subject
|
||||
|
||||
::: mail_intake.parsers.subject
|
||||
176
generate_mcp.py
Normal file
176
generate_mcp.py
Normal file
@@ -0,0 +1,176 @@
|
||||
"""
|
||||
Generate a fully-contained MCP bundle by reading Python docstrings directly.
|
||||
|
||||
Uses Griffe (the same library mkdocstrings-python uses internally),
|
||||
but without MkDocs, Markdown, or HTML.
|
||||
|
||||
Output:
|
||||
mcp/
|
||||
├── index.json
|
||||
├── nav.json
|
||||
└── modules/
|
||||
└── package.module.json
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
from typing import Iterable
|
||||
|
||||
from griffe import GriffeLoader, ModulesCollection, LinesCollection, AliasResolutionError
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parent
|
||||
DEFAULT_PACKAGE_ROOT = "mail_intake"
|
||||
DEFAULT_MCP_DIR = PROJECT_ROOT / "mcp"
|
||||
|
||||
|
||||
# -------------------------
|
||||
# Utilities
|
||||
# -------------------------
|
||||
|
||||
def iter_modules(package_root: Path, package_name: str) -> Iterable[str]:
|
||||
for py in package_root.rglob("*.py"):
|
||||
rel = py.relative_to(package_root.parent)
|
||||
if py.name == "__init__.py":
|
||||
yield ".".join(rel.parent.parts)
|
||||
else:
|
||||
yield ".".join(rel.with_suffix("").parts)
|
||||
|
||||
|
||||
def serialize_object(obj) -> dict:
|
||||
"""Convert a Griffe object into MCP-friendly JSON (alias-safe)."""
|
||||
|
||||
try:
|
||||
docstring = obj.docstring.value if obj.docstring else None
|
||||
except AliasResolutionError:
|
||||
docstring = None
|
||||
|
||||
data = {
|
||||
"name": obj.name,
|
||||
"kind": obj.kind.value,
|
||||
"path": obj.path,
|
||||
"docstring": docstring,
|
||||
}
|
||||
|
||||
# Signature may also trigger alias resolution
|
||||
try:
|
||||
if hasattr(obj, "signature") and obj.signature:
|
||||
data["signature"] = str(obj.signature)
|
||||
except AliasResolutionError:
|
||||
pass
|
||||
|
||||
# Recurse into members, but never allow alias failure to bubble up
|
||||
members = {}
|
||||
if hasattr(obj, "members"):
|
||||
for name, member in obj.members.items():
|
||||
if name.startswith("_"):
|
||||
continue
|
||||
try:
|
||||
members[name] = serialize_object(member)
|
||||
except AliasResolutionError:
|
||||
continue
|
||||
|
||||
if members:
|
||||
data["members"] = members
|
||||
|
||||
return data
|
||||
|
||||
|
||||
# -------------------------
|
||||
# MCP generation
|
||||
# -------------------------
|
||||
|
||||
def build_mcp(package_root: Path, package_name: str, mcp_root: Path) -> None:
|
||||
modules_dir = mcp_root / "modules"
|
||||
modules_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
loader = GriffeLoader(
|
||||
search_paths=[str(package_root.parent)],
|
||||
modules_collection=ModulesCollection(),
|
||||
lines_collection=LinesCollection(),
|
||||
)
|
||||
|
||||
nav = []
|
||||
count = 0
|
||||
|
||||
for module in sorted(iter_modules(package_root, package_name)):
|
||||
loader.load(module)
|
||||
mod = loader.modules_collection[module]
|
||||
|
||||
payload = {
|
||||
"module": module,
|
||||
"content": serialize_object(mod),
|
||||
}
|
||||
|
||||
out = modules_dir / f"{module}.json"
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
out.write_text(json.dumps(payload, indent=2), encoding="utf-8")
|
||||
|
||||
nav.append({
|
||||
"module": module,
|
||||
"resource": f"docs://module/{module}",
|
||||
})
|
||||
|
||||
count += 1
|
||||
|
||||
(mcp_root / "nav.json").write_text(
|
||||
json.dumps(nav, indent=2),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
(mcp_root / "index.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"project": package_name,
|
||||
"type": "docstrings-direct",
|
||||
"modules_count": count,
|
||||
"source": "griffe",
|
||||
},
|
||||
indent=2,
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
print(f"MCP generated at: {mcp_root}")
|
||||
|
||||
|
||||
# -------------------------
|
||||
# CLI
|
||||
# -------------------------
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generate MCP directly from Python docstrings (Griffe-based)",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--package-root",
|
||||
default=DEFAULT_PACKAGE_ROOT,
|
||||
help="Root Python package name",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--mcp-dir",
|
||||
type=Path,
|
||||
default=DEFAULT_MCP_DIR,
|
||||
help="Output MCP directory",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
package_root = PROJECT_ROOT / args.package_root
|
||||
if not package_root.exists():
|
||||
raise FileNotFoundError(package_root)
|
||||
|
||||
build_mcp(
|
||||
package_root=package_root,
|
||||
package_name=args.package_root,
|
||||
mcp_root=args.mcp_dir,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,157 @@
|
||||
"""
|
||||
Mail Intake — provider-agnostic, read-only email ingestion framework.
|
||||
|
||||
Mail Intake is a **contract-first library** designed to ingest, parse, and
|
||||
normalize email data from external providers (such as Gmail) into clean,
|
||||
provider-agnostic domain models.
|
||||
|
||||
The library is intentionally structured around clear layers, each exposed
|
||||
as a first-class module at the package root:
|
||||
|
||||
- adapters: provider-specific access (e.g. Gmail)
|
||||
- auth: authentication providers and credential lifecycle management
|
||||
- credentials: credential persistence abstractions and implementations
|
||||
- parsers: extraction and normalization of message content
|
||||
- ingestion: orchestration and high-level ingestion workflows
|
||||
- models: canonical, provider-agnostic data representations
|
||||
- config: explicit global configuration
|
||||
- exceptions: library-defined error hierarchy
|
||||
|
||||
The package root acts as a **namespace**, not a facade. Consumers are
|
||||
expected to import functionality explicitly from the appropriate module.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Installation
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Install using pip:
|
||||
|
||||
pip install mail-intake
|
||||
|
||||
Or with Poetry:
|
||||
|
||||
poetry add mail-intake
|
||||
|
||||
Mail Intake is pure Python and has no runtime dependencies beyond those
|
||||
required by the selected provider (for example, Google APIs for Gmail).
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Basic Usage
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Minimal Gmail ingestion example (local development):
|
||||
|
||||
from mail_intake.ingestion import MailIntakeReader
|
||||
from mail_intake.adapters import MailIntakeGmailAdapter
|
||||
from mail_intake.auth import MailIntakeGoogleAuth
|
||||
from mail_intake.credentials import PickleCredentialStore
|
||||
|
||||
store = PickleCredentialStore(path="token.pickle")
|
||||
|
||||
auth = MailIntakeGoogleAuth(
|
||||
credentials_path="credentials.json",
|
||||
store=store,
|
||||
scopes=["https://www.googleapis.com/auth/gmail.readonly"],
|
||||
)
|
||||
|
||||
adapter = MailIntakeGmailAdapter(auth_provider=auth)
|
||||
reader = MailIntakeReader(adapter)
|
||||
|
||||
for message in reader.iter_messages("from:recruiter@example.com"):
|
||||
print(message.subject, message.from_email)
|
||||
|
||||
Iterating over threads:
|
||||
|
||||
for thread in reader.iter_threads("subject:Interview"):
|
||||
print(thread.normalized_subject, len(thread.messages))
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Extensibility Model
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Mail Intake is designed to be extensible via **public contracts** exposed
|
||||
through its modules:
|
||||
|
||||
- Users MAY implement their own mail adapters by subclassing
|
||||
``adapters.MailIntakeAdapter``
|
||||
- Users MAY implement their own authentication providers by subclassing
|
||||
``auth.MailIntakeAuthProvider[T]``
|
||||
- Users MAY implement their own credential persistence layers by
|
||||
implementing ``credentials.CredentialStore[T]``
|
||||
|
||||
Users SHOULD NOT subclass built-in adapter implementations. Built-in
|
||||
adapters (such as Gmail) are reference implementations and may change
|
||||
internally without notice.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Public API Surface
|
||||
----------------------------------------------------------------------
|
||||
|
||||
The supported public API consists of the following top-level modules:
|
||||
|
||||
- mail_intake.ingestion
|
||||
- mail_intake.adapters
|
||||
- mail_intake.auth
|
||||
- mail_intake.credentials
|
||||
- mail_intake.parsers
|
||||
- mail_intake.models
|
||||
- mail_intake.config
|
||||
- mail_intake.exceptions
|
||||
|
||||
Classes and functions should be imported explicitly from these modules.
|
||||
No individual symbols are re-exported at the package root.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Design Guarantees
|
||||
----------------------------------------------------------------------
|
||||
|
||||
- Read-only access: no mutation of provider state
|
||||
- Provider-agnostic domain models
|
||||
- Explicit configuration and dependency injection
|
||||
- No implicit global state or environment reads
|
||||
- Deterministic, testable behavior
|
||||
- Distributed-safe authentication design
|
||||
|
||||
Mail Intake favors correctness, clarity, and explicitness over convenience
|
||||
shortcuts.
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
`Mail Intake` is built as a **contract-first ingestion pipeline**:
|
||||
|
||||
1. **Layered Decoupling**: Adapters handle transport, Parsers handle format normalization, and Ingestion orchestrates.
|
||||
2. **Provider Agnosticism**: Domain models and core logic never depend on provider-specific (e.g., Gmail) API internals.
|
||||
3. **Stateless Workflows**: The library functions as a read-only pipe, ensuring side-effect-free ingestion.
|
||||
|
||||
## Documentation Design
|
||||
|
||||
Follow these "AI-Native" docstring principles across the codebase:
|
||||
|
||||
### For Humans
|
||||
- **Namespace Clarity**: Always specify which module a class or function belongs to.
|
||||
- **Contract Explanations**: Use the `adapters` and `auth` base classes to explain extension requirements.
|
||||
|
||||
### For LLMs
|
||||
- **Dotted Paths**: Use full dotted paths in docstrings to help agents link concepts across modules.
|
||||
- **Typed Interfaces**: Provide `.pyi` stubs for every public module to ensure perfect context for AI coding tools.
|
||||
- **Canonical Exceptions**: Always use `: description` pairs in `Raises` blocks to enable structured error analysis.
|
||||
"""
|
||||
|
||||
|
||||
from . import ingestion
|
||||
from . import adapters
|
||||
from . import auth
|
||||
from . import credentials
|
||||
from . import models
|
||||
from . import config
|
||||
from . import exceptions
|
||||
|
||||
__all__ = [
|
||||
"ingestion",
|
||||
"adapters",
|
||||
"auth",
|
||||
"credentials",
|
||||
"models",
|
||||
"config",
|
||||
"exceptions",
|
||||
]
|
||||
|
||||
17
mail_intake/__init__.pyi
Normal file
17
mail_intake/__init__.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from . import ingestion
|
||||
from . import adapters
|
||||
from . import auth
|
||||
from . import credentials
|
||||
from . import models
|
||||
from . import config
|
||||
from . import exceptions
|
||||
|
||||
__all__ = [
|
||||
"ingestion",
|
||||
"adapters",
|
||||
"auth",
|
||||
"credentials",
|
||||
"models",
|
||||
"config",
|
||||
"exceptions",
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Mail provider adapter implementations for Mail Intake.
|
||||
|
||||
This package contains **adapter-layer implementations** responsible for
|
||||
interfacing with external mail providers and exposing a normalized,
|
||||
provider-agnostic contract to the rest of the system.
|
||||
|
||||
Adapters in this package:
|
||||
- Implement the `MailIntakeAdapter` interface
|
||||
- Encapsulate all provider-specific APIs and semantics
|
||||
- Perform read-only access to mail data
|
||||
- Return provider-native payloads without interpretation
|
||||
|
||||
Provider-specific logic **must not leak** outside of adapter implementations.
|
||||
All parsings, normalizations, and transformations must be handled by downstream
|
||||
components.
|
||||
|
||||
Public adapters exported from this package are considered the supported
|
||||
integration surface for mail providers.
|
||||
"""
|
||||
|
||||
from .base import MailIntakeAdapter
|
||||
from .gmail import MailIntakeGmailAdapter
|
||||
|
||||
__all__ = [
|
||||
"MailIntakeAdapter",
|
||||
"MailIntakeGmailAdapter",
|
||||
]
|
||||
|
||||
4
mail_intake/adapters/__init__.pyi
Normal file
4
mail_intake/adapters/__init__.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from .base import MailIntakeAdapter
|
||||
from .gmail import MailIntakeGmailAdapter
|
||||
|
||||
__all__ = ["MailIntakeAdapter", "MailIntakeGmailAdapter"]
|
||||
@@ -1,3 +1,14 @@
|
||||
"""
|
||||
Mail provider adapter contracts for Mail Intake.
|
||||
|
||||
This module defines the **provider-agnostic adapter interface** used for
|
||||
read-only mail ingestion.
|
||||
|
||||
Adapters encapsulate all provider-specific access logic and expose a
|
||||
minimal, normalized contract to the rest of the system. No provider-specific
|
||||
types or semantics should leak beyond implementations of this interface.
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Iterator, Dict, Any
|
||||
|
||||
@@ -6,43 +17,60 @@ class MailIntakeAdapter(ABC):
|
||||
"""
|
||||
Base adapter interface for mail providers.
|
||||
|
||||
This interface defines the minimal contract required for
|
||||
read-only mail ingestion. No provider-specific concepts
|
||||
should leak beyond implementations of this class.
|
||||
This interface defines the minimal contract required to:
|
||||
- Discover messages matching a query
|
||||
- Retrieve full message payloads
|
||||
- Retrieve full thread payloads
|
||||
|
||||
Adapters are intentionally read-only and must not mutate provider state.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def iter_message_refs(self, query: str) -> Iterator[Dict[str, str]]:
|
||||
"""
|
||||
Iterate over lightweight message references.
|
||||
Iterate over lightweight message references matching a query.
|
||||
|
||||
Must yield dictionaries containing at least:
|
||||
- message_id
|
||||
- thread_id
|
||||
Implementations must yield dictionaries containing at least:
|
||||
- ``message_id``: Provider-specific message identifier
|
||||
- ``thread_id``: Provider-specific thread identifier
|
||||
|
||||
Args:
|
||||
query: Provider-specific query string used to filter messages.
|
||||
|
||||
Yields:
|
||||
Dictionaries containing message and thread identifiers.
|
||||
|
||||
Example yield:
|
||||
{
|
||||
"message_id": "...",
|
||||
"thread_id": "..."
|
||||
}
|
||||
{
|
||||
"message_id": "...",
|
||||
"thread_id": "..."
|
||||
}
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def fetch_message(self, message_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Fetch a full raw message by message_id.
|
||||
Fetch a full raw message by message identifier.
|
||||
|
||||
Returns the provider-native message payload
|
||||
(e.g., Gmail message JSON).
|
||||
Args:
|
||||
message_id: Provider-specific message identifier.
|
||||
|
||||
Returns:
|
||||
Provider-native message payload
|
||||
(e.g., Gmail message JSON structure).
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def fetch_thread(self, thread_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Fetch a full raw thread by thread_id.
|
||||
Fetch a full raw thread by thread identifier.
|
||||
|
||||
Returns the provider-native thread payload.
|
||||
Args:
|
||||
thread_id: Provider-specific thread identifier.
|
||||
|
||||
Returns:
|
||||
Provider-native thread payload.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
10
mail_intake/adapters/base.pyi
Normal file
10
mail_intake/adapters/base.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Iterator, Dict, Any
|
||||
|
||||
class MailIntakeAdapter(ABC):
|
||||
@abstractmethod
|
||||
def iter_message_refs(self, query: str) -> Iterator[Dict[str, str]]: ...
|
||||
@abstractmethod
|
||||
def fetch_message(self, message_id: str) -> Dict[str, Any]: ...
|
||||
@abstractmethod
|
||||
def fetch_thread(self, thread_id: str) -> Dict[str, Any]: ...
|
||||
@@ -1,3 +1,17 @@
|
||||
"""
|
||||
Gmail adapter implementation for Mail Intake.
|
||||
|
||||
This module provides a **Gmail-specific implementation** of the
|
||||
`MailIntakeAdapter` contract.
|
||||
|
||||
It is the only place in the codebase where:
|
||||
- `googleapiclient` is imported
|
||||
- Gmail REST API semantics are known
|
||||
- Low-level `.execute()` calls are made
|
||||
|
||||
All Gmail-specific behavior must be strictly contained within this module.
|
||||
"""
|
||||
|
||||
from typing import Iterator, Dict, Any
|
||||
|
||||
from googleapiclient.discovery import build
|
||||
@@ -12,12 +26,19 @@ class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
"""
|
||||
Gmail read-only adapter.
|
||||
|
||||
This adapter implements the `MailIntakeAdapter` interface using the
|
||||
Gmail REST API. It translates the generic mail intake contract into
|
||||
Gmail-specific API calls.
|
||||
|
||||
This class is the ONLY place where:
|
||||
- googleapiclient is imported
|
||||
- Gmail REST semantics are known
|
||||
- .execute() is called
|
||||
|
||||
It must remain thin and dumb by design.
|
||||
Design constraints:
|
||||
- Must remain thin and imperative
|
||||
- Must not perform parsing or interpretation
|
||||
- Must not expose Gmail-specific types beyond this class
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -25,12 +46,29 @@ class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
auth_provider: MailIntakeAuthProvider,
|
||||
user_id: str = "me",
|
||||
):
|
||||
"""
|
||||
Initialize the Gmail adapter.
|
||||
|
||||
Args:
|
||||
auth_provider: Authentication provider capable of supplying
|
||||
valid Gmail API credentials.
|
||||
user_id: Gmail user identifier. Defaults to `"me"`.
|
||||
"""
|
||||
self._auth_provider = auth_provider
|
||||
self._user_id = user_id
|
||||
self._service = None
|
||||
|
||||
@property
|
||||
def service(self):
|
||||
"""
|
||||
Lazily initialize and return the Gmail API service client.
|
||||
|
||||
Returns:
|
||||
Initialized Gmail API service instance.
|
||||
|
||||
Raises:
|
||||
MailIntakeAdapterError: If the Gmail service cannot be initialized.
|
||||
"""
|
||||
if self._service is None:
|
||||
try:
|
||||
creds = self._auth_provider.get_credentials()
|
||||
@@ -45,11 +83,16 @@ class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
"""
|
||||
Iterate over message references matching the query.
|
||||
|
||||
Args:
|
||||
query: Gmail search query string.
|
||||
|
||||
Yields:
|
||||
{
|
||||
"message_id": "...",
|
||||
"thread_id": "..."
|
||||
}
|
||||
Dictionaries containing:
|
||||
- ``message_id``: Gmail message ID
|
||||
- ``thread_id``: Gmail thread ID
|
||||
|
||||
Raises:
|
||||
MailIntakeAdapterError: If the Gmail API returns an error.
|
||||
"""
|
||||
try:
|
||||
request = (
|
||||
@@ -79,6 +122,18 @@ class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
) from exc
|
||||
|
||||
def fetch_message(self, message_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Fetch a full Gmail message by message ID.
|
||||
|
||||
Args:
|
||||
message_id: Gmail message identifier.
|
||||
|
||||
Returns:
|
||||
Provider-native Gmail message payload.
|
||||
|
||||
Raises:
|
||||
MailIntakeAdapterError: If the Gmail API returns an error.
|
||||
"""
|
||||
try:
|
||||
return (
|
||||
self.service.users()
|
||||
@@ -92,6 +147,18 @@ class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
) from exc
|
||||
|
||||
def fetch_thread(self, thread_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Fetch a full Gmail thread by thread ID.
|
||||
|
||||
Args:
|
||||
thread_id: Gmail thread identifier.
|
||||
|
||||
Returns:
|
||||
Provider-native Gmail thread payload.
|
||||
|
||||
Raises:
|
||||
MailIntakeAdapterError: If the Gmail API returns an error.
|
||||
"""
|
||||
try:
|
||||
return (
|
||||
self.service.users()
|
||||
|
||||
11
mail_intake/adapters/gmail.pyi
Normal file
11
mail_intake/adapters/gmail.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Iterator, Dict, Any
|
||||
from mail_intake.adapters.base import MailIntakeAdapter
|
||||
from mail_intake.auth.base import MailIntakeAuthProvider
|
||||
|
||||
class MailIntakeGmailAdapter(MailIntakeAdapter):
|
||||
def __init__(self, auth_provider: MailIntakeAuthProvider, user_id: str = ...) -> None: ...
|
||||
@property
|
||||
def service(self) -> Any: ...
|
||||
def iter_message_refs(self, query: str) -> Iterator[Dict[str, str]]: ...
|
||||
def fetch_message(self, message_id: str) -> Dict[str, Any]: ...
|
||||
def fetch_thread(self, thread_id: str) -> Dict[str, Any]: ...
|
||||
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
Authentication provider implementations for Mail Intake.
|
||||
|
||||
This package defines the **authentication layer** used by mail adapters
|
||||
to obtain provider-specific credentials.
|
||||
|
||||
It exposes:
|
||||
- A stable, provider-agnostic authentication contract
|
||||
- Concrete authentication providers for supported platforms
|
||||
|
||||
Authentication providers:
|
||||
- Are responsible for credential acquisition and lifecycle management
|
||||
- Are intentionally decoupled from adapter logic
|
||||
- May be extended by users to support additional providers
|
||||
|
||||
Consumers should depend on the abstract interface and use concrete
|
||||
implementations only where explicitly required.
|
||||
"""
|
||||
|
||||
from .base import MailIntakeAuthProvider
|
||||
from .google import MailIntakeGoogleAuth
|
||||
|
||||
__all__ = [
|
||||
"MailIntakeAuthProvider",
|
||||
"MailIntakeGoogleAuth",
|
||||
]
|
||||
|
||||
4
mail_intake/auth/__init__.pyi
Normal file
4
mail_intake/auth/__init__.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from .base import MailIntakeAuthProvider
|
||||
from .google import MailIntakeGoogleAuth
|
||||
|
||||
__all__ = ["MailIntakeAuthProvider", "MailIntakeGoogleAuth"]
|
||||
@@ -1,20 +1,59 @@
|
||||
"""
|
||||
Authentication provider contracts for Mail Intake.
|
||||
|
||||
This module defines the **authentication abstraction layer** used by mail
|
||||
adapters to obtain provider-specific credentials.
|
||||
|
||||
Authentication concerns are intentionally decoupled from adapter logic.
|
||||
Adapters depend only on this interface and must not be aware of how
|
||||
credentials are acquired, refreshed, or persisted.
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class MailIntakeAuthProvider(ABC):
|
||||
class MailIntakeAuthProvider(ABC, Generic[T]):
|
||||
"""
|
||||
Abstract authentication provider.
|
||||
Abstract base class for authentication providers.
|
||||
|
||||
Mail adapters depend on this interface, not on concrete
|
||||
OAuth or credential implementations.
|
||||
This interface enforces a strict contract between authentication
|
||||
providers and mail adapters by requiring providers to explicitly
|
||||
declare the type of credentials they return.
|
||||
|
||||
Authentication providers encapsulate all logic required to:
|
||||
- Acquire credentials from an external provider
|
||||
- Refresh or revalidate credentials as needed
|
||||
- Handle authentication-specific failure modes
|
||||
- Coordinate with credential persistence layers where applicable
|
||||
|
||||
Mail adapters must treat returned credentials as opaque and
|
||||
provider-specific, relying only on the declared credential type
|
||||
expected by the adapter.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_credentials(self):
|
||||
def get_credentials(self) -> T:
|
||||
"""
|
||||
Return provider-specific credentials object.
|
||||
Retrieve valid, provider-specific credentials.
|
||||
|
||||
This method is synchronous by design and must either
|
||||
return valid credentials or raise MailIntakeAuthError.
|
||||
This method is synchronous by design and represents the sole
|
||||
entry point through which adapters obtain authentication
|
||||
material.
|
||||
|
||||
Implementations must either return credentials of the declared
|
||||
type ``T`` that are valid at the time of return or raise an
|
||||
authentication-specific exception.
|
||||
|
||||
Returns:
|
||||
Credentials of type ``T`` suitable for immediate use by the
|
||||
corresponding mail adapter.
|
||||
|
||||
Raises:
|
||||
Exception:
|
||||
An authentication-specific exception indicating that
|
||||
credentials could not be obtained or validated.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
8
mail_intake/auth/base.pyi
Normal file
8
mail_intake/auth/base.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class MailIntakeAuthProvider(ABC, Generic[T]):
|
||||
@abstractmethod
|
||||
def get_credentials(self) -> T: ...
|
||||
@@ -1,12 +1,28 @@
|
||||
"""
|
||||
Google authentication provider implementation for Mail Intake.
|
||||
|
||||
This module provides a **Google OAuth–based authentication provider**
|
||||
used primarily for Gmail access.
|
||||
|
||||
It encapsulates all Google-specific authentication concerns, including:
|
||||
- Credential loading and persistence
|
||||
- Token refresh handling
|
||||
- Interactive OAuth flow initiation
|
||||
- Coordination with a credential persistence layer
|
||||
|
||||
No Google authentication details should leak outside this module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import pickle
|
||||
from typing import Sequence
|
||||
|
||||
import google.auth.exceptions
|
||||
from google.auth.transport.requests import Request
|
||||
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||
from google.oauth2.credentials import Credentials
|
||||
|
||||
from mail_intake.auth.base import MailIntakeAuthProvider
|
||||
from mail_intake.credentials.store import CredentialStore
|
||||
from mail_intake.exceptions import MailIntakeAuthError
|
||||
|
||||
|
||||
@@ -14,34 +30,62 @@ class MailIntakeGoogleAuth(MailIntakeAuthProvider):
|
||||
"""
|
||||
Google OAuth provider for Gmail access.
|
||||
|
||||
Responsibilities:
|
||||
- Load cached credentials from disk
|
||||
- Refresh expired tokens when possible
|
||||
- Trigger interactive login only when strictly required
|
||||
This provider implements the `MailIntakeAuthProvider` interface using
|
||||
Google's OAuth 2.0 flow and credential management libraries.
|
||||
|
||||
This class is synchronous and intentionally state-light.
|
||||
Responsibilities:
|
||||
- Load cached credentials from a credential store when available
|
||||
- Refresh expired credentials when possible
|
||||
- Initiate an interactive OAuth flow only when required
|
||||
- Persist refreshed or newly obtained credentials via the store
|
||||
|
||||
This class is synchronous by design and maintains a minimal internal state.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
credentials_path: str,
|
||||
token_path: str,
|
||||
store: CredentialStore[Credentials],
|
||||
scopes: Sequence[str],
|
||||
):
|
||||
"""
|
||||
Initialize the Google authentication provider.
|
||||
|
||||
Args:
|
||||
credentials_path:
|
||||
Path to the Google OAuth client secrets file used to
|
||||
initiate the OAuth 2.0 flow.
|
||||
|
||||
store:
|
||||
Credential store responsible for persisting and
|
||||
retrieving Google OAuth credentials.
|
||||
|
||||
scopes:
|
||||
OAuth scopes required for Gmail access.
|
||||
"""
|
||||
self.credentials_path = credentials_path
|
||||
self.token_path = token_path
|
||||
self.store = store
|
||||
self.scopes = list(scopes)
|
||||
|
||||
def get_credentials(self):
|
||||
creds = None
|
||||
def get_credentials(self) -> Credentials:
|
||||
"""
|
||||
Retrieve valid Google OAuth credentials.
|
||||
|
||||
# Attempt to load cached credentials
|
||||
if os.path.exists(self.token_path):
|
||||
try:
|
||||
with open(self.token_path, "rb") as fh:
|
||||
creds = pickle.load(fh)
|
||||
except Exception:
|
||||
creds = None
|
||||
This method attempts to:
|
||||
1. Load cached credentials from the configured credential store
|
||||
2. Refresh expired credentials when possible
|
||||
3. Perform an interactive OAuth login as a fallback
|
||||
4. Persist valid credentials for future use
|
||||
|
||||
Returns:
|
||||
A ``google.oauth2.credentials.Credentials`` instance suitable
|
||||
for use with Google API clients.
|
||||
|
||||
Raises:
|
||||
MailIntakeAuthError: If credentials cannot be loaded, refreshed,
|
||||
or obtained via interactive authentication.
|
||||
"""
|
||||
creds = self.store.load()
|
||||
|
||||
# Validate / refresh credentials
|
||||
if not creds or not creds.valid:
|
||||
@@ -49,6 +93,7 @@ class MailIntakeGoogleAuth(MailIntakeAuthProvider):
|
||||
try:
|
||||
creds.refresh(Request())
|
||||
except google.auth.exceptions.RefreshError:
|
||||
self.store.clear()
|
||||
creds = None
|
||||
|
||||
# Interactive login if refresh failed or creds missing
|
||||
@@ -69,13 +114,12 @@ class MailIntakeGoogleAuth(MailIntakeAuthProvider):
|
||||
"Failed to complete Google OAuth flow"
|
||||
) from exc
|
||||
|
||||
# Persist refreshed / new credentials
|
||||
# Persist refreshed or newly obtained credentials
|
||||
try:
|
||||
with open(self.token_path, "wb") as fh:
|
||||
pickle.dump(creds, fh)
|
||||
self.store.save(creds)
|
||||
except Exception as exc:
|
||||
raise MailIntakeAuthError(
|
||||
f"Failed to write token file: {self.token_path}"
|
||||
"Failed to persist Google OAuth credentials"
|
||||
) from exc
|
||||
|
||||
return creds
|
||||
|
||||
7
mail_intake/auth/google.pyi
Normal file
7
mail_intake/auth/google.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Sequence, Any
|
||||
from mail_intake.auth.base import MailIntakeAuthProvider
|
||||
from mail_intake.credentials.store import CredentialStore
|
||||
|
||||
class MailIntakeGoogleAuth(MailIntakeAuthProvider[Any]):
|
||||
def __init__(self, credentials_path: str, store: CredentialStore[Any], scopes: Sequence[str]) -> None: ...
|
||||
def get_credentials(self) -> Any: ...
|
||||
@@ -1,3 +1,14 @@
|
||||
"""
|
||||
Global configuration models for Mail Intake.
|
||||
|
||||
This module defines the **top-level configuration object** used to control
|
||||
mail ingestion behavior across adapters, authentication providers, and
|
||||
ingestion workflows.
|
||||
|
||||
Configuration is intentionally explicit, immutable, and free of implicit
|
||||
environment reads to ensure predictability and testability.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
@@ -9,12 +20,26 @@ class MailIntakeConfig:
|
||||
|
||||
This configuration is intentionally explicit and immutable.
|
||||
No implicit environment reads or global state.
|
||||
|
||||
Design principles:
|
||||
- Immutable once constructed
|
||||
- Explicit configuration over implicit defaults
|
||||
- No direct environment or filesystem access
|
||||
|
||||
This model is safe to pass across layers and suitable for serialization.
|
||||
"""
|
||||
|
||||
provider: str = "gmail"
|
||||
user_id: str = "me"
|
||||
readonly: bool = True
|
||||
"""Identifier of the mail provider to use (e.g., ``"gmail"``)."""
|
||||
|
||||
user_id: str = "me"
|
||||
"""Provider-specific user identifier. Defaults to the authenticated user."""
|
||||
|
||||
readonly: bool = True
|
||||
"""Whether ingestion should operate in read-only mode."""
|
||||
|
||||
# Provider-specific paths (optional at this layer)
|
||||
credentials_path: Optional[str] = None
|
||||
"""Optional path to provider credentials configuration."""
|
||||
|
||||
token_path: Optional[str] = None
|
||||
"""Optional path to persisted authentication tokens."""
|
||||
|
||||
9
mail_intake/config.pyi
Normal file
9
mail_intake/config.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from typing import Optional
|
||||
|
||||
class MailIntakeConfig:
|
||||
provider: str
|
||||
user_id: str
|
||||
readonly: bool
|
||||
credentials_path: Optional[str]
|
||||
token_path: Optional[str]
|
||||
def __init__(self, provider: str = ..., user_id: str = ..., readonly: bool = ..., credentials_path: Optional[str] = ..., token_path: Optional[str] = ...) -> None: ...
|
||||
29
mail_intake/credentials/__init__.py
Normal file
29
mail_intake/credentials/__init__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Credential persistence interfaces and implementations for Mail Intake.
|
||||
|
||||
This package defines the abstractions and concrete implementations used
|
||||
to persist authentication credentials across Mail Intake components.
|
||||
|
||||
The credential persistence layer is intentionally decoupled from
|
||||
authentication logic. Authentication providers are responsible for
|
||||
credential acquisition, validation, and refresh, while implementations
|
||||
within this package are responsible solely for storage and retrieval.
|
||||
|
||||
The package provides:
|
||||
- A generic ``CredentialStore`` abstraction defining the persistence contract
|
||||
- Local filesystem–based storage for development and single-node use
|
||||
- Distributed, Redis-backed storage for production and scaled deployments
|
||||
|
||||
Credential lifecycle management, interpretation, and security policy
|
||||
decisions remain the responsibility of authentication providers.
|
||||
"""
|
||||
|
||||
from mail_intake.credentials.store import CredentialStore
|
||||
from mail_intake.credentials.pickle import PickleCredentialStore
|
||||
from mail_intake.credentials.redis import RedisCredentialStore
|
||||
|
||||
__all__ = [
|
||||
"CredentialStore",
|
||||
"PickleCredentialStore",
|
||||
"RedisCredentialStore",
|
||||
]
|
||||
5
mail_intake/credentials/__init__.pyi
Normal file
5
mail_intake/credentials/__init__.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from .store import CredentialStore
|
||||
from .pickle import PickleCredentialStore
|
||||
from .redis import RedisCredentialStore
|
||||
|
||||
__all__ = ["CredentialStore", "PickleCredentialStore", "RedisCredentialStore"]
|
||||
96
mail_intake/credentials/pickle.py
Normal file
96
mail_intake/credentials/pickle.py
Normal file
@@ -0,0 +1,96 @@
|
||||
"""
|
||||
Local filesystem–based credential persistence for Mail Intake.
|
||||
|
||||
This module provides a file-backed implementation of the
|
||||
``CredentialStore`` abstraction using Python's ``pickle`` module.
|
||||
|
||||
The pickle-based credential store is intended for local development,
|
||||
single-node deployments, and controlled environments where credentials
|
||||
do not need to be shared across processes or machines.
|
||||
|
||||
Due to the security and portability risks associated with pickle-based
|
||||
serialization, this implementation is not suitable for distributed or
|
||||
untrusted environments.
|
||||
"""
|
||||
|
||||
import pickle
|
||||
from typing import Optional, TypeVar
|
||||
|
||||
from mail_intake.credentials.store import CredentialStore
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class PickleCredentialStore(CredentialStore[T]):
|
||||
"""
|
||||
Filesystem-backed credential store using pickle serialization.
|
||||
|
||||
This store persists credentials as a pickled object on the local
|
||||
filesystem. It is a simple implementation intended primarily for
|
||||
development, testing, and single-process execution contexts.
|
||||
|
||||
This implementation:
|
||||
- Stores credentials on the local filesystem
|
||||
- Uses pickle for serialization and deserialization
|
||||
- Does not provide encryption, locking, or concurrency guarantees
|
||||
|
||||
Credential lifecycle management, validation, and refresh logic are
|
||||
explicitly out of scope for this class.
|
||||
"""
|
||||
|
||||
def __init__(self, path: str):
|
||||
"""
|
||||
Initialize a pickle-backed credential store.
|
||||
|
||||
Args:
|
||||
path:
|
||||
Filesystem path where credentials will be stored.
|
||||
The file will be created or overwritten as needed.
|
||||
"""
|
||||
self.path = path
|
||||
|
||||
def load(self) -> Optional[T]:
|
||||
"""
|
||||
Load credentials from the local filesystem.
|
||||
|
||||
If the credential file does not exist or cannot be successfully
|
||||
deserialized, this method returns ``None``.
|
||||
|
||||
The store does not attempt to validate or interpret the returned
|
||||
credentials.
|
||||
|
||||
Returns:
|
||||
An instance of type ``T`` if credentials are present and
|
||||
successfully deserialized; otherwise ``None``.
|
||||
"""
|
||||
try:
|
||||
with open(self.path, "rb") as fh:
|
||||
return pickle.load(fh)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def save(self, credentials: T) -> None:
|
||||
"""
|
||||
Persist credentials to the local filesystem.
|
||||
|
||||
Any previously stored credentials at the configured path are
|
||||
overwritten.
|
||||
|
||||
Args:
|
||||
credentials:
|
||||
The credential object to persist.
|
||||
"""
|
||||
with open(self.path, "wb") as fh:
|
||||
pickle.dump(credentials, fh)
|
||||
|
||||
def clear(self) -> None:
|
||||
"""
|
||||
Remove persisted credentials from the local filesystem.
|
||||
|
||||
This method deletes the credential file if it exists and should
|
||||
be treated as an idempotent operation.
|
||||
"""
|
||||
import os
|
||||
|
||||
if os.path.exists(self.path):
|
||||
os.remove(self.path)
|
||||
11
mail_intake/credentials/pickle.pyi
Normal file
11
mail_intake/credentials/pickle.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Optional, TypeVar
|
||||
from .store import CredentialStore
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class PickleCredentialStore(CredentialStore[T]):
|
||||
path: str
|
||||
def __init__(self, path: str) -> None: ...
|
||||
def load(self) -> Optional[T]: ...
|
||||
def save(self, credentials: T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
142
mail_intake/credentials/redis.py
Normal file
142
mail_intake/credentials/redis.py
Normal file
@@ -0,0 +1,142 @@
|
||||
"""
|
||||
Redis-backed credential persistence for Mail Intake.
|
||||
|
||||
This module provides a Redis-based implementation of the
|
||||
``CredentialStore`` abstraction, enabling credential persistence
|
||||
across distributed and horizontally scaled deployments.
|
||||
|
||||
The Redis credential store is designed for environments where
|
||||
authentication credentials must be shared safely across multiple
|
||||
processes, containers, or nodes, such as container orchestration
|
||||
platforms and microservice architectures.
|
||||
|
||||
Key characteristics:
|
||||
- Distributed-safe, shared storage using Redis
|
||||
- Explicit, caller-defined serialization and deserialization
|
||||
- No reliance on unsafe mechanisms such as pickle
|
||||
- Optional time-to-live (TTL) support for automatic credential expiry
|
||||
|
||||
This module is responsible solely for persistence concerns.
|
||||
Credential validation, refresh, rotation, and acquisition remain the
|
||||
responsibility of authentication provider implementations.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Optional, TypeVar, Callable
|
||||
|
||||
from mail_intake.credentials.store import CredentialStore
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class RedisCredentialStore(CredentialStore[T]):
|
||||
"""
|
||||
Redis-backed implementation of ``CredentialStore``.
|
||||
|
||||
This store persists credentials in Redis and is suitable for
|
||||
distributed and horizontally scaled deployments where credentials
|
||||
must be shared across multiple processes or nodes.
|
||||
|
||||
The store is intentionally generic and delegates all serialization
|
||||
concerns to caller-provided functions. This avoids unsafe mechanisms
|
||||
such as pickle and allows credential formats to be explicitly
|
||||
controlled and audited.
|
||||
|
||||
This class is responsible only for persistence and retrieval.
|
||||
It does not interpret, validate, refresh, or otherwise manage
|
||||
the lifecycle of the credentials being stored.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
redis_client,
|
||||
key: str,
|
||||
serialize: Callable[[T], bytes],
|
||||
deserialize: Callable[[bytes], T],
|
||||
ttl_seconds: Optional[int] = None,
|
||||
):
|
||||
"""
|
||||
Initialize a Redis-backed credential store.
|
||||
|
||||
Args:
|
||||
redis_client:
|
||||
An initialized Redis client instance (for example,
|
||||
``redis.Redis`` or a compatible interface) used to
|
||||
communicate with the Redis server.
|
||||
|
||||
key:
|
||||
The Redis key under which credentials are stored.
|
||||
Callers are responsible for applying appropriate
|
||||
namespacing to avoid collisions.
|
||||
|
||||
serialize:
|
||||
A callable that converts a credential object of type
|
||||
``T`` into a ``bytes`` representation suitable for
|
||||
storage in Redis.
|
||||
|
||||
deserialize:
|
||||
A callable that converts a ``bytes`` payload retrieved
|
||||
from Redis back into a credential object of type ``T``.
|
||||
|
||||
ttl_seconds:
|
||||
Optional time-to-live (TTL) for the stored credentials,
|
||||
expressed in seconds. When provided, Redis will
|
||||
automatically expire the stored credentials after the
|
||||
specified duration. If ``None``, credentials are stored
|
||||
without an expiration.
|
||||
"""
|
||||
self.redis = redis_client
|
||||
self.key = key
|
||||
self.serialize = serialize
|
||||
self.deserialize = deserialize
|
||||
self.ttl_seconds = ttl_seconds
|
||||
|
||||
def load(self) -> Optional[T]:
|
||||
"""
|
||||
Load credentials from Redis.
|
||||
|
||||
If no value exists for the configured key, or if the stored
|
||||
payload cannot be successfully deserialized, this method
|
||||
returns ``None``.
|
||||
|
||||
The store does not attempt to validate the returned credentials
|
||||
or determine whether they are expired or otherwise usable.
|
||||
|
||||
Returns:
|
||||
An instance of type ``T`` if credentials are present and
|
||||
successfully deserialized; otherwise ``None``.
|
||||
"""
|
||||
raw = self.redis.get(self.key)
|
||||
if not raw:
|
||||
return None
|
||||
try:
|
||||
return self.deserialize(raw)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def save(self, credentials: T) -> None:
|
||||
"""
|
||||
Persist credentials to Redis.
|
||||
|
||||
Any previously stored credentials under the same key are
|
||||
overwritten. If a TTL is configured, the credentials will
|
||||
expire automatically after the specified duration.
|
||||
|
||||
Args:
|
||||
credentials:
|
||||
The credential object to persist.
|
||||
"""
|
||||
payload = self.serialize(credentials)
|
||||
if self.ttl_seconds:
|
||||
self.redis.setex(self.key, self.ttl_seconds, payload)
|
||||
else:
|
||||
self.redis.set(self.key, payload)
|
||||
|
||||
def clear(self) -> None:
|
||||
"""
|
||||
Remove stored credentials from Redis.
|
||||
|
||||
This operation deletes the configured Redis key if it exists.
|
||||
Implementations should treat this method as idempotent.
|
||||
"""
|
||||
self.redis.delete(self.key)
|
||||
15
mail_intake/credentials/redis.pyi
Normal file
15
mail_intake/credentials/redis.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import Optional, TypeVar, Callable, Any
|
||||
from .store import CredentialStore
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class RedisCredentialStore(CredentialStore[T]):
|
||||
redis: Any
|
||||
key: str
|
||||
serialize: Callable[[T], bytes]
|
||||
deserialize: Callable[[bytes], T]
|
||||
ttl_seconds: Optional[int]
|
||||
def __init__(self, redis_client: Any, key: str, serialize: Callable[[T], bytes], deserialize: Callable[[bytes], T], ttl_seconds: Optional[int] = ...) -> None: ...
|
||||
def load(self) -> Optional[T]: ...
|
||||
def save(self, credentials: T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
90
mail_intake/credentials/store.py
Normal file
90
mail_intake/credentials/store.py
Normal file
@@ -0,0 +1,90 @@
|
||||
"""
|
||||
Credential persistence abstractions for Mail Intake.
|
||||
|
||||
This module defines the generic persistence contract used to store and
|
||||
retrieve authentication credentials across Mail Intake components.
|
||||
|
||||
The ``CredentialStore`` abstraction establishes a strict separation
|
||||
between credential *lifecycle management* and credential *storage*.
|
||||
Authentication providers are responsible for acquiring, validating,
|
||||
refreshing, and revoking credentials, while concrete store
|
||||
implementations are responsible solely for persistence concerns.
|
||||
|
||||
By remaining agnostic to credential structure, serialization format,
|
||||
and storage backend, this module enables multiple persistence
|
||||
strategies—such as local files, in-memory caches, distributed stores,
|
||||
or secrets managers—without coupling authentication logic to any
|
||||
specific storage mechanism.
|
||||
"""
|
||||
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class CredentialStore(ABC, Generic[T]):
|
||||
"""
|
||||
Abstract base class defining a generic persistence interface for
|
||||
authentication credentials.
|
||||
|
||||
This interface separates *credential lifecycle management* from
|
||||
*credential storage mechanics*. Implementations are responsible
|
||||
only for persistence concerns, while authentication providers
|
||||
retain full control over credential creation, validation, refresh,
|
||||
and revocation logic.
|
||||
|
||||
The store is intentionally agnostic to:
|
||||
- The concrete credential type being stored
|
||||
- The serialization format used to persist credentials
|
||||
- The underlying storage backend or durability guarantees
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def load(self) -> Optional[T]:
|
||||
"""
|
||||
Load previously persisted credentials.
|
||||
|
||||
Implementations should return ``None`` when no credentials are
|
||||
present or when stored credentials cannot be successfully
|
||||
decoded or deserialized.
|
||||
|
||||
The store must not attempt to validate, refresh, or otherwise
|
||||
interpret the returned credentials.
|
||||
|
||||
Returns:
|
||||
An instance of type ``T`` if credentials are available and
|
||||
loadable; otherwise ``None``.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def save(self, credentials: T) -> None:
|
||||
"""
|
||||
Persist credentials to the underlying storage backend.
|
||||
|
||||
This method is invoked when credentials are newly obtained or
|
||||
have been refreshed and are known to be valid at the time of
|
||||
persistence.
|
||||
|
||||
Implementations are responsible for:
|
||||
- Ensuring durability appropriate to the deployment context
|
||||
- Applying encryption or access controls where required
|
||||
- Overwriting any previously stored credentials
|
||||
|
||||
Args:
|
||||
credentials:
|
||||
The credential object to persist.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def clear(self) -> None:
|
||||
"""
|
||||
Remove any persisted credentials from the store.
|
||||
|
||||
This method is called when credentials are known to be invalid,
|
||||
revoked, corrupted, or otherwise unusable, and must ensure that
|
||||
no stale authentication material remains accessible.
|
||||
|
||||
Implementations should treat this operation as idempotent.
|
||||
"""
|
||||
12
mail_intake/credentials/store.pyi
Normal file
12
mail_intake/credentials/store.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Generic, Optional, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
class CredentialStore(ABC, Generic[T]):
|
||||
@abstractmethod
|
||||
def load(self) -> Optional[T]: ...
|
||||
@abstractmethod
|
||||
def save(self, credentials: T) -> None: ...
|
||||
@abstractmethod
|
||||
def clear(self) -> None: ...
|
||||
@@ -1,19 +1,49 @@
|
||||
"""
|
||||
Exception hierarchy for Mail Intake.
|
||||
|
||||
This module defines the **canonical exception types** used throughout the
|
||||
Mail Intake library.
|
||||
|
||||
All library-raised errors derive from `MailIntakeError`. Consumers are
|
||||
encouraged to catch this base type (or specific subclasses) rather than
|
||||
provider-specific or third-party exceptions.
|
||||
"""
|
||||
|
||||
|
||||
class MailIntakeError(Exception):
|
||||
"""
|
||||
Base exception for all mail-intake errors.
|
||||
Base exception for all Mail Intake errors.
|
||||
|
||||
Users of the library should catch this type (or subclasses)
|
||||
instead of provider-specific or third-party exceptions.
|
||||
This is the root of the Mail Intake exception hierarchy.
|
||||
All errors raised by the library must derive from this class.
|
||||
|
||||
Consumers should generally catch this type when handling
|
||||
library-level failures.
|
||||
"""
|
||||
|
||||
|
||||
class MailIntakeAuthError(MailIntakeError):
|
||||
"""Authentication and credential-related failures."""
|
||||
"""
|
||||
Authentication and credential-related failures.
|
||||
|
||||
Raised when authentication providers are unable to acquire,
|
||||
refresh, or persist valid credentials.
|
||||
"""
|
||||
|
||||
|
||||
class MailIntakeAdapterError(MailIntakeError):
|
||||
"""Errors raised by mail provider adapters."""
|
||||
"""
|
||||
Errors raised by mail provider adapters.
|
||||
|
||||
Raised when a provider adapter encounters API errors,
|
||||
transport failures, or invalid provider responses.
|
||||
"""
|
||||
|
||||
|
||||
class MailIntakeParsingError(MailIntakeError):
|
||||
"""Errors encountered while parsing message content."""
|
||||
"""
|
||||
Errors encountered while parsing message content.
|
||||
|
||||
Raised when raw provider payloads cannot be interpreted
|
||||
or normalized into internal domain models.
|
||||
"""
|
||||
|
||||
4
mail_intake/exceptions.pyi
Normal file
4
mail_intake/exceptions.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
class MailIntakeError(Exception): ...
|
||||
class MailIntakeAuthError(MailIntakeError): ...
|
||||
class MailIntakeAdapterError(MailIntakeError): ...
|
||||
class MailIntakeParsingError(MailIntakeError): ...
|
||||
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
Mail ingestion orchestration for Mail Intake.
|
||||
|
||||
This package contains **high-level ingestion components** responsible for
|
||||
coordinating mail retrieval, parsing, normalization, and model construction.
|
||||
|
||||
It represents the **top of the ingestion pipeline** and is intended to be the
|
||||
primary interaction surface for library consumers.
|
||||
|
||||
Components in this package:
|
||||
- Are provider-agnostic
|
||||
- Depend only on adapter and parser contracts
|
||||
- Contain no provider-specific API logic
|
||||
- Expose read-only ingestion workflows
|
||||
|
||||
Consumers are expected to construct a mail adapter and pass it to the
|
||||
ingestion layer to begin processing messages and threads.
|
||||
"""
|
||||
|
||||
from .reader import MailIntakeReader
|
||||
|
||||
__all__ = [
|
||||
"MailIntakeReader",
|
||||
]
|
||||
|
||||
3
mail_intake/ingestion/__init__.pyi
Normal file
3
mail_intake/ingestion/__init__.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from .reader import MailIntakeReader
|
||||
|
||||
__all__ = ["MailIntakeReader"]
|
||||
@@ -1,3 +1,18 @@
|
||||
"""
|
||||
High-level mail ingestion orchestration for Mail Intake.
|
||||
|
||||
This module provides the primary, provider-agnostic entry point for
|
||||
reading and processing mail data.
|
||||
|
||||
It coordinates:
|
||||
- Mail adapter access
|
||||
- Message and thread iteration
|
||||
- Header and body parsing
|
||||
- Normalization and model construction
|
||||
|
||||
No provider-specific logic or API semantics are permitted in this layer.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Iterator, Dict, Any
|
||||
|
||||
@@ -14,22 +29,43 @@ class MailIntakeReader:
|
||||
"""
|
||||
High-level read-only ingestion interface.
|
||||
|
||||
This is the primary entry point users should interact with.
|
||||
It orchestrates:
|
||||
- adapter calls
|
||||
- parsing
|
||||
- normalization
|
||||
- model construction
|
||||
This class is the **primary entry point** for consumers of the Mail
|
||||
Intake library.
|
||||
|
||||
No provider-specific logic exists here.
|
||||
It orchestrates the full ingestion pipeline:
|
||||
- Querying the adapter for message references
|
||||
- Fetching raw provider messages
|
||||
- Parsing and normalizing message data
|
||||
- Constructing domain models
|
||||
|
||||
This class is intentionally:
|
||||
- Provider-agnostic
|
||||
- Stateless beyond iteration scope
|
||||
- Read-only
|
||||
"""
|
||||
|
||||
def __init__(self, adapter: MailIntakeAdapter):
|
||||
"""
|
||||
Initialize the mail reader.
|
||||
|
||||
Args:
|
||||
adapter: Mail adapter implementation used to retrieve raw
|
||||
messages and threads from a mail provider.
|
||||
"""
|
||||
self._adapter = adapter
|
||||
|
||||
def iter_messages(self, query: str) -> Iterator[MailIntakeMessage]:
|
||||
"""
|
||||
Iterate over parsed messages matching a provider query.
|
||||
|
||||
Args:
|
||||
query: Provider-specific query string used to filter messages.
|
||||
|
||||
Yields:
|
||||
Fully parsed and normalized `MailIntakeMessage` instances.
|
||||
|
||||
Raises:
|
||||
MailIntakeParsingError: If a message cannot be parsed.
|
||||
"""
|
||||
for ref in self._adapter.iter_message_refs(query):
|
||||
raw = self._adapter.fetch_message(ref["message_id"])
|
||||
@@ -39,7 +75,17 @@ class MailIntakeReader:
|
||||
"""
|
||||
Iterate over threads constructed from messages matching a query.
|
||||
|
||||
Messages are grouped by thread_id and yielded as complete threads.
|
||||
Messages are grouped by `thread_id` and yielded as complete thread
|
||||
objects containing all associated messages.
|
||||
|
||||
Args:
|
||||
query: Provider-specific query string used to filter messages.
|
||||
|
||||
Returns:
|
||||
An iterator of `MailIntakeThread` instances.
|
||||
|
||||
Raises:
|
||||
MailIntakeParsingError: If a message cannot be parsed.
|
||||
"""
|
||||
threads: Dict[str, MailIntakeThread] = {}
|
||||
|
||||
@@ -61,7 +107,17 @@ class MailIntakeReader:
|
||||
|
||||
def _parse_message(self, raw_message: Dict[str, Any]) -> MailIntakeMessage:
|
||||
"""
|
||||
Parse a raw provider message into a MailIntakeMessage.
|
||||
Parse a raw provider message into a `MailIntakeMessage`.
|
||||
|
||||
Args:
|
||||
raw_message: Provider-native message payload.
|
||||
|
||||
Returns:
|
||||
A fully populated `MailIntakeMessage` instance.
|
||||
|
||||
Raises:
|
||||
MailIntakeParsingError: If the message payload is missing required
|
||||
fields or cannot be parsed.
|
||||
"""
|
||||
try:
|
||||
message_id = raw_message["id"]
|
||||
|
||||
10
mail_intake/ingestion/reader.pyi
Normal file
10
mail_intake/ingestion/reader.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import Iterator, Dict, Any
|
||||
from mail_intake.adapters.base import MailIntakeAdapter
|
||||
from mail_intake.models.message import MailIntakeMessage
|
||||
from mail_intake.models.thread import MailIntakeThread
|
||||
|
||||
class MailIntakeReader:
|
||||
def __init__(self, adapter: MailIntakeAdapter) -> None: ...
|
||||
def iter_messages(self, query: str) -> Iterator[MailIntakeMessage]: ...
|
||||
def iter_threads(self, query: str) -> Iterator[MailIntakeThread]: ...
|
||||
def _parse_message(self, raw_message: Dict[str, Any]) -> MailIntakeMessage: ...
|
||||
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Domain models for Mail Intake.
|
||||
|
||||
This package defines the **canonical, provider-agnostic data models**
|
||||
used throughout the Mail Intake ingestion pipeline.
|
||||
|
||||
Models in this package:
|
||||
- Represent fully parsed and normalized mail data
|
||||
- Are safe to persist, serialize, and index
|
||||
- Contain no provider-specific payloads or API semantics
|
||||
- Serve as stable inputs for downstream processing and analysis
|
||||
|
||||
These models form the core internal data contract of the library.
|
||||
"""
|
||||
|
||||
from .message import MailIntakeMessage
|
||||
from .thread import MailIntakeThread
|
||||
|
||||
__all__ = [
|
||||
"MailIntakeMessage",
|
||||
"MailIntakeThread",
|
||||
]
|
||||
|
||||
4
mail_intake/models/__init__.pyi
Normal file
4
mail_intake/models/__init__.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from .message import MailIntakeMessage
|
||||
from .thread import MailIntakeThread
|
||||
|
||||
__all__ = ["MailIntakeMessage", "MailIntakeThread"]
|
||||
@@ -1,3 +1,14 @@
|
||||
"""
|
||||
Message domain models for Mail Intake.
|
||||
|
||||
This module defines the **canonical, provider-agnostic representation**
|
||||
of an individual email message as used internally by the Mail Intake
|
||||
ingestion pipeline.
|
||||
|
||||
Models in this module are safe to persist and must not contain any
|
||||
provider-specific fields or semantics.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Optional, Dict
|
||||
@@ -8,19 +19,37 @@ class MailIntakeMessage:
|
||||
"""
|
||||
Canonical internal representation of a single email message.
|
||||
|
||||
This model is provider-agnostic and safe to persist.
|
||||
No Gmail-specific fields should appear here.
|
||||
This model represents a fully parsed and normalized email message.
|
||||
It is intentionally provider-agnostic and suitable for persistence,
|
||||
indexing, and downstream processing.
|
||||
|
||||
No provider-specific identifiers, payloads, or API semantics
|
||||
should appear in this model.
|
||||
"""
|
||||
|
||||
message_id: str
|
||||
"""Provider-specific message identifier."""
|
||||
|
||||
thread_id: str
|
||||
"""Provider-specific thread identifier to which this message belongs."""
|
||||
|
||||
timestamp: datetime
|
||||
"""Message timestamp as a timezone-naive UTC datetime."""
|
||||
|
||||
from_email: str
|
||||
"""Sender email address."""
|
||||
|
||||
from_name: Optional[str]
|
||||
"""Optional human-readable sender name."""
|
||||
|
||||
subject: str
|
||||
"""Raw subject line of the message."""
|
||||
|
||||
body_text: str
|
||||
"""Extracted plain-text body content of the message."""
|
||||
|
||||
snippet: str
|
||||
"""Short provider-supplied preview snippet of the message."""
|
||||
|
||||
raw_headers: Dict[str, str]
|
||||
"""Normalized mapping of message headers (header name → value)."""
|
||||
|
||||
14
mail_intake/models/message.pyi
Normal file
14
mail_intake/models/message.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional, Dict
|
||||
|
||||
class MailIntakeMessage:
|
||||
message_id: str
|
||||
thread_id: str
|
||||
timestamp: datetime
|
||||
from_email: str
|
||||
from_name: Optional[str]
|
||||
subject: str
|
||||
body_text: str
|
||||
snippet: str
|
||||
raw_headers: Dict[str, str]
|
||||
def __init__(self, message_id: str, thread_id: str, timestamp: datetime, from_email: str, from_name: Optional[str], subject: str, body_text: str, snippet: str, raw_headers: Dict[str, str]) -> None: ...
|
||||
@@ -1,3 +1,13 @@
|
||||
"""
|
||||
Thread domain models for Mail Intake.
|
||||
|
||||
This module defines the **canonical, provider-agnostic representation**
|
||||
of an email thread as used internally by the Mail Intake ingestion pipeline.
|
||||
|
||||
Threads group related messages and serve as the primary unit of reasoning
|
||||
for higher-level correspondence workflows.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from typing import List, Set
|
||||
@@ -10,21 +20,40 @@ class MailIntakeThread:
|
||||
"""
|
||||
Canonical internal representation of an email thread.
|
||||
|
||||
Threads are the primary unit of reasoning for correspondence
|
||||
workflows (job applications, interviews, follow-ups, etc.).
|
||||
A thread groups multiple related messages under a single subject
|
||||
and participant set. It is designed to support reasoning over
|
||||
conversational context such as job applications, interviews,
|
||||
follow-ups, and ongoing discussions.
|
||||
|
||||
This model is provider-agnostic and safe to persist.
|
||||
"""
|
||||
|
||||
thread_id: str
|
||||
"""Provider-specific thread identifier."""
|
||||
|
||||
normalized_subject: str
|
||||
"""Normalized subject line used to group related messages."""
|
||||
|
||||
participants: Set[str] = field(default_factory=set)
|
||||
"""Set of unique participant email addresses observed in the thread."""
|
||||
|
||||
messages: List[MailIntakeMessage] = field(default_factory=list)
|
||||
"""Ordered list of messages belonging to this thread."""
|
||||
|
||||
last_activity_at: datetime | None = None
|
||||
"""Timestamp of the most recent message in the thread."""
|
||||
|
||||
def add_message(self, message: MailIntakeMessage) -> None:
|
||||
"""
|
||||
Add a message to the thread and update derived fields.
|
||||
|
||||
This method:
|
||||
- Appends the message to the thread
|
||||
- Tracks unique participants
|
||||
- Updates the last activity timestamp
|
||||
|
||||
Args:
|
||||
message: Parsed mail message to add to the thread.
|
||||
"""
|
||||
self.messages.append(message)
|
||||
|
||||
|
||||
12
mail_intake/models/thread.pyi
Normal file
12
mail_intake/models/thread.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from datetime import datetime
|
||||
from typing import List, Set, Optional
|
||||
from .message import MailIntakeMessage
|
||||
|
||||
class MailIntakeThread:
|
||||
thread_id: str
|
||||
normalized_subject: str
|
||||
participants: Set[str]
|
||||
messages: List[MailIntakeMessage]
|
||||
last_activity_at: Optional[datetime]
|
||||
def __init__(self, thread_id: str, normalized_subject: str, participants: Set[str] = ..., messages: List[MailIntakeMessage] = ..., last_activity_at: Optional[datetime] = ...) -> None: ...
|
||||
def add_message(self, message: MailIntakeMessage) -> None: ...
|
||||
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Message parsing utilities for Mail Intake.
|
||||
|
||||
This package contains **provider-aware but adapter-agnostic parsing helpers**
|
||||
used to extract and normalize structured information from raw mail payloads.
|
||||
|
||||
Parsers in this package are responsible for:
|
||||
- Interpreting provider-native message structures
|
||||
- Extracting meaningful fields such as headers, body text, and subjects
|
||||
- Normalizing data into consistent internal representations
|
||||
|
||||
This package does not:
|
||||
- Perform network or IO operations
|
||||
- Contain provider API logic
|
||||
- Construct domain models directly
|
||||
|
||||
Parsing functions are designed to be composable and are orchestrated by the
|
||||
ingestion layer.
|
||||
"""
|
||||
|
||||
from .body import extract_body
|
||||
from .headers import parse_headers, extract_sender
|
||||
from .subject import normalize_subject
|
||||
|
||||
__all__ = [
|
||||
"extract_body",
|
||||
"parse_headers",
|
||||
"extract_sender",
|
||||
"normalize_subject",
|
||||
]
|
||||
|
||||
5
mail_intake/parsers/__init__.pyi
Normal file
5
mail_intake/parsers/__init__.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from .body import extract_body
|
||||
from .headers import parse_headers, extract_sender
|
||||
from .subject import normalize_subject
|
||||
|
||||
__all__ = ["extract_body", "parse_headers", "extract_sender", "normalize_subject"]
|
||||
@@ -1,3 +1,13 @@
|
||||
"""
|
||||
Message body extraction utilities for Mail Intake.
|
||||
|
||||
This module contains helper functions for extracting a best-effort
|
||||
plain-text body from provider-native message payloads.
|
||||
|
||||
The logic is intentionally tolerant of malformed or partial data and
|
||||
prefers human-readable text over fidelity to original formatting.
|
||||
"""
|
||||
|
||||
import base64
|
||||
from typing import Dict, Any, Optional
|
||||
|
||||
@@ -9,6 +19,18 @@ from mail_intake.exceptions import MailIntakeParsingError
|
||||
def _decode_base64(data: str) -> str:
|
||||
"""
|
||||
Decode Gmail URL-safe base64 payload into UTF-8 text.
|
||||
|
||||
Gmail message bodies are encoded using URL-safe base64, which may
|
||||
omit padding and use non-standard characters.
|
||||
|
||||
Args:
|
||||
data: URL-safe base64-encoded string.
|
||||
|
||||
Returns:
|
||||
Decoded UTF-8 text with replacement for invalid characters.
|
||||
|
||||
Raises:
|
||||
MailIntakeParsingError: If decoding fails.
|
||||
"""
|
||||
try:
|
||||
padded = data.replace("-", "+").replace("_", "/")
|
||||
@@ -21,6 +43,16 @@ def _decode_base64(data: str) -> str:
|
||||
def _extract_from_part(part: Dict[str, Any]) -> Optional[str]:
|
||||
"""
|
||||
Extract text content from a single MIME part.
|
||||
|
||||
Supports:
|
||||
- text/plain
|
||||
- text/html (converted to plain text)
|
||||
|
||||
Args:
|
||||
part: MIME part dictionary from a provider payload.
|
||||
|
||||
Returns:
|
||||
Extracted plain-text content, or None if unsupported or empty.
|
||||
"""
|
||||
mime_type = part.get("mimeType")
|
||||
body = part.get("body", {})
|
||||
@@ -49,7 +81,14 @@ def extract_body(payload: Dict[str, Any]) -> str:
|
||||
Priority:
|
||||
1. text/plain
|
||||
2. text/html (stripped to text)
|
||||
3. empty string (if nothing usable found)
|
||||
3. Single-part body
|
||||
4. empty string (if nothing usable found)
|
||||
|
||||
Args:
|
||||
payload: Provider-native message payload dictionary.
|
||||
|
||||
Returns:
|
||||
Extracted plain-text message body.
|
||||
"""
|
||||
if not payload:
|
||||
return ""
|
||||
|
||||
3
mail_intake/parsers/body.pyi
Normal file
3
mail_intake/parsers/body.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from typing import Dict, Any
|
||||
|
||||
def extract_body(payload: Dict[str, Any]) -> str: ...
|
||||
@@ -1,3 +1,13 @@
|
||||
"""
|
||||
Message header parsing utilities for Mail Intake.
|
||||
|
||||
This module provides helper functions for normalizing and extracting
|
||||
useful information from provider-native message headers.
|
||||
|
||||
The functions here are intentionally simple and tolerant of malformed
|
||||
or incomplete header data.
|
||||
"""
|
||||
|
||||
from typing import Dict, List, Tuple, Optional
|
||||
|
||||
|
||||
@@ -5,19 +15,29 @@ def parse_headers(raw_headers: List[Dict[str, str]]) -> Dict[str, str]:
|
||||
"""
|
||||
Convert a list of Gmail-style headers into a normalized dict.
|
||||
|
||||
Input:
|
||||
[
|
||||
{"name": "From", "value": "John Doe <john@example.com>"},
|
||||
{"name": "Subject", "value": "Re: Interview Update"},
|
||||
...
|
||||
]
|
||||
Provider payloads (such as Gmail) typically represent headers as a list
|
||||
of name/value mappings. This function normalizes them into a
|
||||
case-insensitive dictionary keyed by lowercase header names.
|
||||
|
||||
Output:
|
||||
{
|
||||
"from": "...",
|
||||
"subject": "...",
|
||||
...
|
||||
}
|
||||
Args:
|
||||
raw_headers: List of header dictionaries, each containing
|
||||
``name`` and ``value`` keys.
|
||||
|
||||
Returns:
|
||||
Dictionary mapping lowercase header names to stripped values.
|
||||
|
||||
Example:
|
||||
Input:
|
||||
[
|
||||
{"name": "From", "value": "John Doe <john@example.com>"},
|
||||
{"name": "Subject", "value": "Re: Interview Update"},
|
||||
]
|
||||
|
||||
Output:
|
||||
{
|
||||
"from": "John Doe <john@example.com>",
|
||||
"subject": "Re: Interview Update",
|
||||
}
|
||||
"""
|
||||
headers: Dict[str, str] = {}
|
||||
|
||||
@@ -37,18 +57,27 @@ def extract_sender(headers: Dict[str, str]) -> Tuple[str, Optional[str]]:
|
||||
"""
|
||||
Extract sender email and optional display name from headers.
|
||||
|
||||
Returns:
|
||||
(email, name)
|
||||
This function parses the ``From`` header and attempts to extract:
|
||||
- Sender email address
|
||||
- Optional human-readable display name
|
||||
|
||||
If name cannot be determined, name will be None.
|
||||
Args:
|
||||
headers: Normalized header dictionary as returned by
|
||||
:func:`parse_headers`.
|
||||
|
||||
Returns:
|
||||
A tuple ``(email, name)`` where:
|
||||
- ``email`` is the sender email address
|
||||
- ``name`` is the display name, or ``None`` if unavailable
|
||||
|
||||
Examples:
|
||||
``"John Doe <john@example.com>"`` → ``("john@example.com", "John Doe")``
|
||||
``"john@example.com"`` → ``("john@example.com", None)``
|
||||
"""
|
||||
from_header = headers.get("from")
|
||||
if not from_header:
|
||||
return "", None
|
||||
|
||||
# Common forms:
|
||||
# Name <email@domain>
|
||||
# email@domain
|
||||
if "<" in from_header and ">" in from_header:
|
||||
name_part, email_part = from_header.split("<", 1)
|
||||
email = email_part.rstrip(">").strip()
|
||||
|
||||
4
mail_intake/parsers/headers.pyi
Normal file
4
mail_intake/parsers/headers.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from typing import Dict, List, Tuple, Optional
|
||||
|
||||
def parse_headers(raw_headers: List[Dict[str, str]]) -> Dict[str, str]: ...
|
||||
def extract_sender(headers: Dict[str, str]) -> Tuple[str, Optional[str]]: ...
|
||||
@@ -1,7 +1,18 @@
|
||||
"""
|
||||
Subject line normalization utilities for Mail Intake.
|
||||
|
||||
This module provides helper functions for normalizing email subject lines
|
||||
to enable reliable thread-level comparison and grouping.
|
||||
|
||||
Normalization is intentionally conservative to avoid altering semantic
|
||||
meaning while removing common reply and forward prefixes.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
|
||||
_PREFIX_RE = re.compile(r"^(re|fw|fwd)\s*:\s*", re.IGNORECASE)
|
||||
"""Regular expression matching common reply/forward subject prefixes."""
|
||||
|
||||
|
||||
def normalize_subject(subject: str) -> str:
|
||||
@@ -9,11 +20,19 @@ def normalize_subject(subject: str) -> str:
|
||||
Normalize an email subject for thread-level comparison.
|
||||
|
||||
Operations:
|
||||
- Strip common prefixes (Re:, Fwd:, FW:)
|
||||
- Collapse whitespace
|
||||
- Preserve original casing (no lowercasing)
|
||||
- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``
|
||||
- Repeats prefix stripping to handle stacked prefixes
|
||||
- Collapses excessive whitespace
|
||||
- Preserves original casing (no lowercasing)
|
||||
|
||||
This function is intentionally conservative.
|
||||
This function is intentionally conservative and avoids aggressive
|
||||
transformations that could alter the semantic meaning of the subject.
|
||||
|
||||
Args:
|
||||
subject: Raw subject line from a message header.
|
||||
|
||||
Returns:
|
||||
Normalized subject string suitable for thread grouping.
|
||||
"""
|
||||
if not subject:
|
||||
return ""
|
||||
|
||||
1
mail_intake/parsers/subject.pyi
Normal file
1
mail_intake/parsers/subject.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def normalize_subject(subject: str) -> str: ...
|
||||
6
mcp_docs/index.json
Normal file
6
mcp_docs/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"project": "mail_intake",
|
||||
"type": "docforge-model",
|
||||
"modules_count": 22,
|
||||
"source": "docforge"
|
||||
}
|
||||
74
mcp_docs/modules/mail_intake.adapters.base.json
Normal file
74
mcp_docs/modules/mail_intake.adapters.base.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"module": "mail_intake.adapters.base",
|
||||
"content": {
|
||||
"path": "mail_intake.adapters.base",
|
||||
"docstring": "Mail provider adapter contracts for Mail Intake.\n\nThis module defines the **provider-agnostic adapter interface** used for\nread-only mail ingestion.\n\nAdapters encapsulate all provider-specific access logic and expose a\nminimal, normalized contract to the rest of the system. No provider-specific\ntypes or semantics should leak beyond implementations of this interface.",
|
||||
"objects": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAdapter', 16, 76)>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Function.signature of Function('iter_message_refs', 28, 49)>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Function.signature of Function('fetch_message', 51, 63)>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Function.signature of Function('fetch_thread', 65, 76)>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
134
mcp_docs/modules/mail_intake.adapters.gmail.json
Normal file
134
mcp_docs/modules/mail_intake.adapters.gmail.json
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"module": "mail_intake.adapters.gmail",
|
||||
"content": {
|
||||
"path": "mail_intake.adapters.gmail",
|
||||
"docstring": "Gmail adapter implementation for Mail Intake.\n\nThis module provides a **Gmail-specific implementation** of the\n`MailIntakeAdapter` contract.\n\nIt is the only place in the codebase where:\n- `googleapiclient` is imported\n- Gmail REST API semantics are known\n- Low-level `.execute()` calls are made\n\nAll Gmail-specific behavior must be strictly contained within this module.",
|
||||
"objects": {
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"build": {
|
||||
"name": "build",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.build",
|
||||
"signature": "<bound method Alias.signature of Alias('build', 'googleapiclient.discovery.build')>",
|
||||
"docstring": null
|
||||
},
|
||||
"HttpError": {
|
||||
"name": "HttpError",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.HttpError",
|
||||
"signature": "<bound method Alias.signature of Alias('HttpError', 'googleapiclient.errors.HttpError')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeAdapterError": {
|
||||
"name": "MailIntakeAdapterError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapterError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapterError', 'mail_intake.exceptions.MailIntakeAdapterError')>",
|
||||
"docstring": "Errors raised by mail provider adapters.\n\nRaised when a provider adapter encounters API errors,\ntransport failures, or invalid provider responses."
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeGmailAdapter": {
|
||||
"name": "MailIntakeGmailAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeGmailAdapter', 25, 172)>",
|
||||
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nThis class is the ONLY place where:\n- googleapiclient is imported\n- Gmail REST semantics are known\n- .execute() is called\n\nDesign constraints:\n- Must remain thin and imperative\n- Must not perform parsing or interpretation\n- Must not expose Gmail-specific types beyond this class",
|
||||
"members": {
|
||||
"service": {
|
||||
"name": "service",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.service",
|
||||
"signature": null,
|
||||
"docstring": "Lazily initialize and return the Gmail API service client.\n\nReturns:\n Initialized Gmail API service instance.\n\nRaises:\n MailIntakeAdapterError: If the Gmail service cannot be initialized."
|
||||
},
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.iter_message_refs",
|
||||
"signature": "<bound method Function.signature of Function('iter_message_refs', 82, 122)>",
|
||||
"docstring": "Iterate over message references matching the query.\n\nArgs:\n query: Gmail search query string.\n\nYields:\n Dictionaries containing:\n - ``message_id``: Gmail message ID\n - ``thread_id``: Gmail thread ID\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_message",
|
||||
"signature": "<bound method Function.signature of Function('fetch_message', 124, 147)>",
|
||||
"docstring": "Fetch a full Gmail message by message ID.\n\nArgs:\n message_id: Gmail message identifier.\n\nReturns:\n Provider-native Gmail message payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_thread",
|
||||
"signature": "<bound method Function.signature of Function('fetch_thread', 149, 172)>",
|
||||
"docstring": "Fetch a full Gmail thread by thread ID.\n\nArgs:\n thread_id: Gmail thread identifier.\n\nReturns:\n Provider-native Gmail thread payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
284
mcp_docs/modules/mail_intake.adapters.json
Normal file
284
mcp_docs/modules/mail_intake.adapters.json
Normal file
@@ -0,0 +1,284 @@
|
||||
{
|
||||
"module": "mail_intake.adapters",
|
||||
"content": {
|
||||
"path": "mail_intake.adapters",
|
||||
"docstring": "Mail provider adapter implementations for Mail Intake.\n\nThis package contains **adapter-layer implementations** responsible for\ninterfacing with external mail providers and exposing a normalized,\nprovider-agnostic contract to the rest of the system.\n\nAdapters in this package:\n- Implement the `MailIntakeAdapter` interface\n- Encapsulate all provider-specific APIs and semantics\n- Perform read-only access to mail data\n- Return provider-native payloads without interpretation\n\nProvider-specific logic **must not leak** outside of adapter implementations.\nAll parsings, normalizations, and transformations must be handled by downstream\ncomponents.\n\nPublic adapters exported from this package are considered the supported\nintegration surface for mail providers.",
|
||||
"objects": {
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.MailIntakeAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeGmailAdapter": {
|
||||
"name": "MailIntakeGmailAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.MailIntakeGmailAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeGmailAdapter', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter')>",
|
||||
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nThis class is the ONLY place where:\n- googleapiclient is imported\n- Gmail REST semantics are known\n- .execute() is called\n\nDesign constraints:\n- Must remain thin and imperative\n- Must not perform parsing or interpretation\n- Must not expose Gmail-specific types beyond this class",
|
||||
"members": {
|
||||
"service": {
|
||||
"name": "service",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.adapters.MailIntakeGmailAdapter.service",
|
||||
"signature": "<bound method Alias.signature of Alias('service', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter.service')>",
|
||||
"docstring": "Lazily initialize and return the Gmail API service client.\n\nReturns:\n Initialized Gmail API service instance.\n\nRaises:\n MailIntakeAdapterError: If the Gmail service cannot be initialized."
|
||||
},
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeGmailAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over message references matching the query.\n\nArgs:\n query: Gmail search query string.\n\nYields:\n Dictionaries containing:\n - ``message_id``: Gmail message ID\n - ``thread_id``: Gmail thread ID\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeGmailAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full Gmail message by message ID.\n\nArgs:\n message_id: Gmail message identifier.\n\nReturns:\n Provider-native Gmail message payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.MailIntakeGmailAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full Gmail thread by thread ID.\n\nArgs:\n thread_id: Gmail thread identifier.\n\nReturns:\n Provider-native Gmail thread payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
}
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"name": "base",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.adapters.base",
|
||||
"signature": null,
|
||||
"docstring": "Mail provider adapter contracts for Mail Intake.\n\nThis module defines the **provider-agnostic adapter interface** used for\nread-only mail ingestion.\n\nAdapters encapsulate all provider-specific access logic and expose a\nminimal, normalized contract to the rest of the system. No provider-specific\ntypes or semantics should leak beyond implementations of this interface.",
|
||||
"members": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.base.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAdapter', 16, 76)>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Function.signature of Function('iter_message_refs', 28, 49)>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Function.signature of Function('fetch_message', 51, 63)>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.base.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Function.signature of Function('fetch_thread', 65, 76)>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gmail": {
|
||||
"name": "gmail",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.adapters.gmail",
|
||||
"signature": null,
|
||||
"docstring": "Gmail adapter implementation for Mail Intake.\n\nThis module provides a **Gmail-specific implementation** of the\n`MailIntakeAdapter` contract.\n\nIt is the only place in the codebase where:\n- `googleapiclient` is imported\n- Gmail REST API semantics are known\n- Low-level `.execute()` calls are made\n\nAll Gmail-specific behavior must be strictly contained within this module.",
|
||||
"members": {
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"build": {
|
||||
"name": "build",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.build",
|
||||
"signature": "<bound method Alias.signature of Alias('build', 'googleapiclient.discovery.build')>",
|
||||
"docstring": null
|
||||
},
|
||||
"HttpError": {
|
||||
"name": "HttpError",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.adapters.gmail.HttpError",
|
||||
"signature": "<bound method Alias.signature of Alias('HttpError', 'googleapiclient.errors.HttpError')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeAdapterError": {
|
||||
"name": "MailIntakeAdapterError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAdapterError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapterError', 'mail_intake.exceptions.MailIntakeAdapterError')>",
|
||||
"docstring": "Errors raised by mail provider adapters.\n\nRaised when a provider adapter encounters API errors,\ntransport failures, or invalid provider responses."
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeGmailAdapter": {
|
||||
"name": "MailIntakeGmailAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeGmailAdapter', 25, 172)>",
|
||||
"docstring": "Gmail read-only adapter.\n\nThis adapter implements the `MailIntakeAdapter` interface using the\nGmail REST API. It translates the generic mail intake contract into\nGmail-specific API calls.\n\nThis class is the ONLY place where:\n- googleapiclient is imported\n- Gmail REST semantics are known\n- .execute() is called\n\nDesign constraints:\n- Must remain thin and imperative\n- Must not perform parsing or interpretation\n- Must not expose Gmail-specific types beyond this class",
|
||||
"members": {
|
||||
"service": {
|
||||
"name": "service",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.service",
|
||||
"signature": null,
|
||||
"docstring": "Lazily initialize and return the Gmail API service client.\n\nReturns:\n Initialized Gmail API service instance.\n\nRaises:\n MailIntakeAdapterError: If the Gmail service cannot be initialized."
|
||||
},
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.iter_message_refs",
|
||||
"signature": "<bound method Function.signature of Function('iter_message_refs', 82, 122)>",
|
||||
"docstring": "Iterate over message references matching the query.\n\nArgs:\n query: Gmail search query string.\n\nYields:\n Dictionaries containing:\n - ``message_id``: Gmail message ID\n - ``thread_id``: Gmail thread ID\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_message",
|
||||
"signature": "<bound method Function.signature of Function('fetch_message', 124, 147)>",
|
||||
"docstring": "Fetch a full Gmail message by message ID.\n\nArgs:\n message_id: Gmail message identifier.\n\nReturns:\n Provider-native Gmail message payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.adapters.gmail.MailIntakeGmailAdapter.fetch_thread",
|
||||
"signature": "<bound method Function.signature of Function('fetch_thread', 149, 172)>",
|
||||
"docstring": "Fetch a full Gmail thread by thread ID.\n\nArgs:\n thread_id: Gmail thread identifier.\n\nReturns:\n Provider-native Gmail thread payload.\n\nRaises:\n MailIntakeAdapterError: If the Gmail API returns an error."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
mcp_docs/modules/mail_intake.auth.base.json
Normal file
60
mcp_docs/modules/mail_intake.auth.base.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"module": "mail_intake.auth.base",
|
||||
"content": {
|
||||
"path": "mail_intake.auth.base",
|
||||
"docstring": "Authentication provider contracts for Mail Intake.\n\nThis module defines the **authentication abstraction layer** used by mail\nadapters to obtain provider-specific credentials.\n\nAuthentication concerns are intentionally decoupled from adapter logic.\nAdapters depend only on this interface and must not be aware of how\ncredentials are acquired, refreshed, or persisted.",
|
||||
"objects": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Generic": {
|
||||
"name": "Generic",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.Generic",
|
||||
"signature": "<bound method Alias.signature of Alias('Generic', 'typing.Generic')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.base.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.base.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAuthProvider', 18, 59)>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.base.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Function.signature of Function('get_credentials', 37, 59)>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
148
mcp_docs/modules/mail_intake.auth.google.json
Normal file
148
mcp_docs/modules/mail_intake.auth.google.json
Normal file
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"module": "mail_intake.auth.google",
|
||||
"content": {
|
||||
"path": "mail_intake.auth.google",
|
||||
"docstring": "Google authentication provider implementation for Mail Intake.\n\nThis module provides a **Google OAuth–based authentication provider**\nused primarily for Gmail access.\n\nIt encapsulates all Google-specific authentication concerns, including:\n- Credential loading and persistence\n- Token refresh handling\n- Interactive OAuth flow initiation\n- Coordination with a credential persistence layer\n\nNo Google authentication details should leak outside this module.",
|
||||
"objects": {
|
||||
"os": {
|
||||
"name": "os",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.os",
|
||||
"signature": "<bound method Alias.signature of Alias('os', 'os')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Sequence": {
|
||||
"name": "Sequence",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Sequence",
|
||||
"signature": "<bound method Alias.signature of Alias('Sequence', 'typing.Sequence')>",
|
||||
"docstring": null
|
||||
},
|
||||
"google": {
|
||||
"name": "google",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.google",
|
||||
"signature": "<bound method Alias.signature of Alias('google', 'google')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Request": {
|
||||
"name": "Request",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Request",
|
||||
"signature": "<bound method Alias.signature of Alias('Request', 'google.auth.transport.requests.Request')>",
|
||||
"docstring": null
|
||||
},
|
||||
"InstalledAppFlow": {
|
||||
"name": "InstalledAppFlow",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.InstalledAppFlow",
|
||||
"signature": "<bound method Alias.signature of Alias('InstalledAppFlow', 'google_auth_oauthlib.flow.InstalledAppFlow')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Credentials": {
|
||||
"name": "Credentials",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('Credentials', 'google.oauth2.credentials.Credentials')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeAuthError": {
|
||||
"name": "MailIntakeAuthError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthError', 'mail_intake.exceptions.MailIntakeAuthError')>",
|
||||
"docstring": "Authentication and credential-related failures.\n\nRaised when authentication providers are unable to acquire,\nrefresh, or persist valid credentials."
|
||||
},
|
||||
"MailIntakeGoogleAuth": {
|
||||
"name": "MailIntakeGoogleAuth",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeGoogleAuth', 29, 125)>",
|
||||
"docstring": "Google OAuth provider for Gmail access.\n\nThis provider implements the `MailIntakeAuthProvider` interface using\nGoogle's OAuth 2.0 flow and credential management libraries.\n\nResponsibilities:\n- Load cached credentials from a credential store when available\n- Refresh expired credentials when possible\n- Initiate an interactive OAuth flow only when required\n- Persist refreshed or newly obtained credentials via the store\n\nThis class is synchronous by design and maintains a minimal internal state.",
|
||||
"members": {
|
||||
"credentials_path": {
|
||||
"name": "credentials_path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.credentials_path",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"store": {
|
||||
"name": "store",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.store",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"scopes": {
|
||||
"name": "scopes",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.scopes",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.get_credentials",
|
||||
"signature": "<bound method Function.signature of Function('get_credentials', 70, 125)>",
|
||||
"docstring": "Retrieve valid Google OAuth credentials.\n\nThis method attempts to:\n1. Load cached credentials from the configured credential store\n2. Refresh expired credentials when possible\n3. Perform an interactive OAuth login as a fallback\n4. Persist valid credentials for future use\n\nReturns:\n A ``google.oauth2.credentials.Credentials`` instance suitable\n for use with Google API clients.\n\nRaises:\n MailIntakeAuthError: If credentials cannot be loaded, refreshed,\n or obtained via interactive authentication."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
270
mcp_docs/modules/mail_intake.auth.json
Normal file
270
mcp_docs/modules/mail_intake.auth.json
Normal file
@@ -0,0 +1,270 @@
|
||||
{
|
||||
"module": "mail_intake.auth",
|
||||
"content": {
|
||||
"path": "mail_intake.auth",
|
||||
"docstring": "Authentication provider implementations for Mail Intake.\n\nThis package defines the **authentication layer** used by mail adapters\nto obtain provider-specific credentials.\n\nIt exposes:\n- A stable, provider-agnostic authentication contract\n- Concrete authentication providers for supported platforms\n\nAuthentication providers:\n- Are responsible for credential acquisition and lifecycle management\n- Are intentionally decoupled from adapter logic\n- May be extended by users to support additional providers\n\nConsumers should depend on the abstract interface and use concrete\nimplementations only where explicitly required.",
|
||||
"objects": {
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeGoogleAuth": {
|
||||
"name": "MailIntakeGoogleAuth",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.MailIntakeGoogleAuth",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeGoogleAuth', 'mail_intake.auth.google.MailIntakeGoogleAuth')>",
|
||||
"docstring": "Google OAuth provider for Gmail access.\n\nThis provider implements the `MailIntakeAuthProvider` interface using\nGoogle's OAuth 2.0 flow and credential management libraries.\n\nResponsibilities:\n- Load cached credentials from a credential store when available\n- Refresh expired credentials when possible\n- Initiate an interactive OAuth flow only when required\n- Persist refreshed or newly obtained credentials via the store\n\nThis class is synchronous by design and maintains a minimal internal state.",
|
||||
"members": {
|
||||
"credentials_path": {
|
||||
"name": "credentials_path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.MailIntakeGoogleAuth.credentials_path",
|
||||
"signature": "<bound method Alias.signature of Alias('credentials_path', 'mail_intake.auth.google.MailIntakeGoogleAuth.credentials_path')>",
|
||||
"docstring": null
|
||||
},
|
||||
"store": {
|
||||
"name": "store",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.MailIntakeGoogleAuth.store",
|
||||
"signature": "<bound method Alias.signature of Alias('store', 'mail_intake.auth.google.MailIntakeGoogleAuth.store')>",
|
||||
"docstring": null
|
||||
},
|
||||
"scopes": {
|
||||
"name": "scopes",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.MailIntakeGoogleAuth.scopes",
|
||||
"signature": "<bound method Alias.signature of Alias('scopes', 'mail_intake.auth.google.MailIntakeGoogleAuth.scopes')>",
|
||||
"docstring": null
|
||||
},
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.MailIntakeGoogleAuth.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.google.MailIntakeGoogleAuth.get_credentials')>",
|
||||
"docstring": "Retrieve valid Google OAuth credentials.\n\nThis method attempts to:\n1. Load cached credentials from the configured credential store\n2. Refresh expired credentials when possible\n3. Perform an interactive OAuth login as a fallback\n4. Persist valid credentials for future use\n\nReturns:\n A ``google.oauth2.credentials.Credentials`` instance suitable\n for use with Google API clients.\n\nRaises:\n MailIntakeAuthError: If credentials cannot be loaded, refreshed,\n or obtained via interactive authentication."
|
||||
}
|
||||
}
|
||||
},
|
||||
"base": {
|
||||
"name": "base",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.auth.base",
|
||||
"signature": null,
|
||||
"docstring": "Authentication provider contracts for Mail Intake.\n\nThis module defines the **authentication abstraction layer** used by mail\nadapters to obtain provider-specific credentials.\n\nAuthentication concerns are intentionally decoupled from adapter logic.\nAdapters depend only on this interface and must not be aware of how\ncredentials are acquired, refreshed, or persisted.",
|
||||
"members": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Generic": {
|
||||
"name": "Generic",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.Generic",
|
||||
"signature": "<bound method Alias.signature of Alias('Generic', 'typing.Generic')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.base.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.base.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.base.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAuthProvider', 18, 59)>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.base.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Function.signature of Function('get_credentials', 37, 59)>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"google": {
|
||||
"name": "google",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.auth.google",
|
||||
"signature": null,
|
||||
"docstring": "Google authentication provider implementation for Mail Intake.\n\nThis module provides a **Google OAuth–based authentication provider**\nused primarily for Gmail access.\n\nIt encapsulates all Google-specific authentication concerns, including:\n- Credential loading and persistence\n- Token refresh handling\n- Interactive OAuth flow initiation\n- Coordination with a credential persistence layer\n\nNo Google authentication details should leak outside this module.",
|
||||
"members": {
|
||||
"os": {
|
||||
"name": "os",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.os",
|
||||
"signature": "<bound method Alias.signature of Alias('os', 'os')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Sequence": {
|
||||
"name": "Sequence",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Sequence",
|
||||
"signature": "<bound method Alias.signature of Alias('Sequence', 'typing.Sequence')>",
|
||||
"docstring": null
|
||||
},
|
||||
"google": {
|
||||
"name": "google",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.google",
|
||||
"signature": "<bound method Alias.signature of Alias('google', 'google')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Request": {
|
||||
"name": "Request",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Request",
|
||||
"signature": "<bound method Alias.signature of Alias('Request', 'google.auth.transport.requests.Request')>",
|
||||
"docstring": null
|
||||
},
|
||||
"InstalledAppFlow": {
|
||||
"name": "InstalledAppFlow",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.InstalledAppFlow",
|
||||
"signature": "<bound method Alias.signature of Alias('InstalledAppFlow', 'google_auth_oauthlib.flow.InstalledAppFlow')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Credentials": {
|
||||
"name": "Credentials",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('Credentials', 'google.oauth2.credentials.Credentials')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAuthProvider": {
|
||||
"name": "MailIntakeAuthProvider",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthProvider",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthProvider', 'mail_intake.auth.base.MailIntakeAuthProvider')>",
|
||||
"docstring": "Abstract base class for authentication providers.\n\nThis interface enforces a strict contract between authentication\nproviders and mail adapters by requiring providers to explicitly\ndeclare the type of credentials they return.\n\nAuthentication providers encapsulate all logic required to:\n- Acquire credentials from an external provider\n- Refresh or revalidate credentials as needed\n- Handle authentication-specific failure modes\n- Coordinate with credential persistence layers where applicable\n\nMail adapters must treat returned credentials as opaque and\nprovider-specific, relying only on the declared credential type\nexpected by the adapter.",
|
||||
"members": {
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthProvider.get_credentials",
|
||||
"signature": "<bound method Alias.signature of Alias('get_credentials', 'mail_intake.auth.base.MailIntakeAuthProvider.get_credentials')>",
|
||||
"docstring": "Retrieve valid, provider-specific credentials.\n\nThis method is synchronous by design and represents the sole\nentry point through which adapters obtain authentication\nmaterial.\n\nImplementations must either return credentials of the declared\ntype ``T`` that are valid at the time of return or raise an\nauthentication-specific exception.\n\nReturns:\n Credentials of type ``T`` suitable for immediate use by the\n corresponding mail adapter.\n\nRaises:\n Exception:\n An authentication-specific exception indicating that\n credentials could not be obtained or validated."
|
||||
}
|
||||
}
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeAuthError": {
|
||||
"name": "MailIntakeAuthError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeAuthError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAuthError', 'mail_intake.exceptions.MailIntakeAuthError')>",
|
||||
"docstring": "Authentication and credential-related failures.\n\nRaised when authentication providers are unable to acquire,\nrefresh, or persist valid credentials."
|
||||
},
|
||||
"MailIntakeGoogleAuth": {
|
||||
"name": "MailIntakeGoogleAuth",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeGoogleAuth', 29, 125)>",
|
||||
"docstring": "Google OAuth provider for Gmail access.\n\nThis provider implements the `MailIntakeAuthProvider` interface using\nGoogle's OAuth 2.0 flow and credential management libraries.\n\nResponsibilities:\n- Load cached credentials from a credential store when available\n- Refresh expired credentials when possible\n- Initiate an interactive OAuth flow only when required\n- Persist refreshed or newly obtained credentials via the store\n\nThis class is synchronous by design and maintains a minimal internal state.",
|
||||
"members": {
|
||||
"credentials_path": {
|
||||
"name": "credentials_path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.credentials_path",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"store": {
|
||||
"name": "store",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.store",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"scopes": {
|
||||
"name": "scopes",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.scopes",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"get_credentials": {
|
||||
"name": "get_credentials",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.auth.google.MailIntakeGoogleAuth.get_credentials",
|
||||
"signature": "<bound method Function.signature of Function('get_credentials', 70, 125)>",
|
||||
"docstring": "Retrieve valid Google OAuth credentials.\n\nThis method attempts to:\n1. Load cached credentials from the configured credential store\n2. Refresh expired credentials when possible\n3. Perform an interactive OAuth login as a fallback\n4. Persist valid credentials for future use\n\nReturns:\n A ``google.oauth2.credentials.Credentials`` instance suitable\n for use with Google API clients.\n\nRaises:\n MailIntakeAuthError: If credentials cannot be loaded, refreshed,\n or obtained via interactive authentication."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.auth.google.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
67
mcp_docs/modules/mail_intake.config.json
Normal file
67
mcp_docs/modules/mail_intake.config.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"module": "mail_intake.config",
|
||||
"content": {
|
||||
"path": "mail_intake.config",
|
||||
"docstring": "Global configuration models for Mail Intake.\n\nThis module defines the **top-level configuration object** used to control\nmail ingestion behavior across adapters, authentication providers, and\ningestion workflows.\n\nConfiguration is intentionally explicit, immutable, and free of implicit\nenvironment reads to ensure predictability and testability.",
|
||||
"objects": {
|
||||
"dataclass": {
|
||||
"name": "dataclass",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.config.dataclass",
|
||||
"signature": "<bound method Alias.signature of Alias('dataclass', 'dataclasses.dataclass')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.config.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeConfig": {
|
||||
"name": "MailIntakeConfig",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.config.MailIntakeConfig",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeConfig', 16, 45)>",
|
||||
"docstring": "Global configuration for mail-intake.\n\nThis configuration is intentionally explicit and immutable.\nNo implicit environment reads or global state.\n\nDesign principles:\n- Immutable once constructed\n- Explicit configuration over implicit defaults\n- No direct environment or filesystem access\n\nThis model is safe to pass across layers and suitable for serialization.",
|
||||
"members": {
|
||||
"provider": {
|
||||
"name": "provider",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.config.MailIntakeConfig.provider",
|
||||
"signature": null,
|
||||
"docstring": "Identifier of the mail provider to use (e.g., ``\"gmail\"``)."
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.config.MailIntakeConfig.user_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific user identifier. Defaults to the authenticated user."
|
||||
},
|
||||
"readonly": {
|
||||
"name": "readonly",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.config.MailIntakeConfig.readonly",
|
||||
"signature": null,
|
||||
"docstring": "Whether ingestion should operate in read-only mode."
|
||||
},
|
||||
"credentials_path": {
|
||||
"name": "credentials_path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.config.MailIntakeConfig.credentials_path",
|
||||
"signature": null,
|
||||
"docstring": "Optional path to provider credentials configuration."
|
||||
},
|
||||
"token_path": {
|
||||
"name": "token_path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.config.MailIntakeConfig.token_path",
|
||||
"signature": null,
|
||||
"docstring": "Optional path to persisted authentication tokens."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
465
mcp_docs/modules/mail_intake.credentials.json
Normal file
465
mcp_docs/modules/mail_intake.credentials.json
Normal file
@@ -0,0 +1,465 @@
|
||||
{
|
||||
"module": "mail_intake.credentials",
|
||||
"content": {
|
||||
"path": "mail_intake.credentials",
|
||||
"docstring": "Credential persistence interfaces and implementations for Mail Intake.\n\nThis package defines the abstractions and concrete implementations used\nto persist authentication credentials across Mail Intake components.\n\nThe credential persistence layer is intentionally decoupled from\nauthentication logic. Authentication providers are responsible for\ncredential acquisition, validation, and refresh, while implementations\nwithin this package are responsible solely for storage and retrieval.\n\nThe package provides:\n- A generic ``CredentialStore`` abstraction defining the persistence contract\n- Local filesystem–based storage for development and single-node use\n- Distributed, Redis-backed storage for production and scaled deployments\n\nCredential lifecycle management, interpretation, and security policy\ndecisions remain the responsibility of authentication providers.",
|
||||
"objects": {
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"PickleCredentialStore": {
|
||||
"name": "PickleCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.PickleCredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('PickleCredentialStore', 'mail_intake.credentials.pickle.PickleCredentialStore')>",
|
||||
"docstring": "Filesystem-backed credential store using pickle serialization.\n\nThis store persists credentials as a pickled object on the local\nfilesystem. It is a simple implementation intended primarily for\ndevelopment, testing, and single-process execution contexts.\n\nThis implementation:\n- Stores credentials on the local filesystem\n- Uses pickle for serialization and deserialization\n- Does not provide encryption, locking, or concurrency guarantees\n\nCredential lifecycle management, validation, and refresh logic are\nexplicitly out of scope for this class.",
|
||||
"members": {
|
||||
"path": {
|
||||
"name": "path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.PickleCredentialStore.path",
|
||||
"signature": "<bound method Alias.signature of Alias('path', 'mail_intake.credentials.pickle.PickleCredentialStore.path')>",
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.PickleCredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.pickle.PickleCredentialStore.load')>",
|
||||
"docstring": "Load credentials from the local filesystem.\n\nIf the credential file does not exist or cannot be successfully\ndeserialized, this method returns ``None``.\n\nThe store does not attempt to validate or interpret the returned\ncredentials.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.PickleCredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.pickle.PickleCredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the local filesystem.\n\nAny previously stored credentials at the configured path are\noverwritten.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.PickleCredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.pickle.PickleCredentialStore.clear')>",
|
||||
"docstring": "Remove persisted credentials from the local filesystem.\n\nThis method deletes the credential file if it exists and should\nbe treated as an idempotent operation."
|
||||
}
|
||||
}
|
||||
},
|
||||
"RedisCredentialStore": {
|
||||
"name": "RedisCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('RedisCredentialStore', 'mail_intake.credentials.redis.RedisCredentialStore')>",
|
||||
"docstring": "Redis-backed implementation of ``CredentialStore``.\n\nThis store persists credentials in Redis and is suitable for\ndistributed and horizontally scaled deployments where credentials\nmust be shared across multiple processes or nodes.\n\nThe store is intentionally generic and delegates all serialization\nconcerns to caller-provided functions. This avoids unsafe mechanisms\nsuch as pickle and allows credential formats to be explicitly\ncontrolled and audited.\n\nThis class is responsible only for persistence and retrieval.\nIt does not interpret, validate, refresh, or otherwise manage\nthe lifecycle of the credentials being stored.",
|
||||
"members": {
|
||||
"redis": {
|
||||
"name": "redis",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.redis",
|
||||
"signature": "<bound method Alias.signature of Alias('redis', 'mail_intake.credentials.redis.RedisCredentialStore.redis')>",
|
||||
"docstring": null
|
||||
},
|
||||
"key": {
|
||||
"name": "key",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.key",
|
||||
"signature": "<bound method Alias.signature of Alias('key', 'mail_intake.credentials.redis.RedisCredentialStore.key')>",
|
||||
"docstring": null
|
||||
},
|
||||
"serialize": {
|
||||
"name": "serialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.serialize",
|
||||
"signature": "<bound method Alias.signature of Alias('serialize', 'mail_intake.credentials.redis.RedisCredentialStore.serialize')>",
|
||||
"docstring": null
|
||||
},
|
||||
"deserialize": {
|
||||
"name": "deserialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.deserialize",
|
||||
"signature": "<bound method Alias.signature of Alias('deserialize', 'mail_intake.credentials.redis.RedisCredentialStore.deserialize')>",
|
||||
"docstring": null
|
||||
},
|
||||
"ttl_seconds": {
|
||||
"name": "ttl_seconds",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.ttl_seconds",
|
||||
"signature": "<bound method Alias.signature of Alias('ttl_seconds', 'mail_intake.credentials.redis.RedisCredentialStore.ttl_seconds')>",
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.redis.RedisCredentialStore.load')>",
|
||||
"docstring": "Load credentials from Redis.\n\nIf no value exists for the configured key, or if the stored\npayload cannot be successfully deserialized, this method\nreturns ``None``.\n\nThe store does not attempt to validate the returned credentials\nor determine whether they are expired or otherwise usable.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.redis.RedisCredentialStore.save')>",
|
||||
"docstring": "Persist credentials to Redis.\n\nAny previously stored credentials under the same key are\noverwritten. If a TTL is configured, the credentials will\nexpire automatically after the specified duration.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.RedisCredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.redis.RedisCredentialStore.clear')>",
|
||||
"docstring": "Remove stored credentials from Redis.\n\nThis operation deletes the configured Redis key if it exists.\nImplementations should treat this method as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"pickle": {
|
||||
"name": "pickle",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.credentials.pickle",
|
||||
"signature": null,
|
||||
"docstring": "Local filesystem–based credential persistence for Mail Intake.\n\nThis module provides a file-backed implementation of the\n``CredentialStore`` abstraction using Python's ``pickle`` module.\n\nThe pickle-based credential store is intended for local development,\nsingle-node deployments, and controlled environments where credentials\ndo not need to be shared across processes or machines.\n\nDue to the security and portability risks associated with pickle-based\nserialization, this implementation is not suitable for distributed or\nuntrusted environments.",
|
||||
"members": {
|
||||
"pickle": {
|
||||
"name": "pickle",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.pickle",
|
||||
"signature": "<bound method Alias.signature of Alias('pickle', 'pickle')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.pickle.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"PickleCredentialStore": {
|
||||
"name": "PickleCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('PickleCredentialStore', 24, 96)>",
|
||||
"docstring": "Filesystem-backed credential store using pickle serialization.\n\nThis store persists credentials as a pickled object on the local\nfilesystem. It is a simple implementation intended primarily for\ndevelopment, testing, and single-process execution contexts.\n\nThis implementation:\n- Stores credentials on the local filesystem\n- Uses pickle for serialization and deserialization\n- Does not provide encryption, locking, or concurrency guarantees\n\nCredential lifecycle management, validation, and refresh logic are\nexplicitly out of scope for this class.",
|
||||
"members": {
|
||||
"path": {
|
||||
"name": "path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.path",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 52, 70)>",
|
||||
"docstring": "Load credentials from the local filesystem.\n\nIf the credential file does not exist or cannot be successfully\ndeserialized, this method returns ``None``.\n\nThe store does not attempt to validate or interpret the returned\ncredentials.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 72, 84)>",
|
||||
"docstring": "Persist credentials to the local filesystem.\n\nAny previously stored credentials at the configured path are\noverwritten.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 86, 96)>",
|
||||
"docstring": "Remove persisted credentials from the local filesystem.\n\nThis method deletes the credential file if it exists and should\nbe treated as an idempotent operation."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"redis": {
|
||||
"name": "redis",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.credentials.redis",
|
||||
"signature": null,
|
||||
"docstring": "Redis-backed credential persistence for Mail Intake.\n\nThis module provides a Redis-based implementation of the\n``CredentialStore`` abstraction, enabling credential persistence\nacross distributed and horizontally scaled deployments.\n\nThe Redis credential store is designed for environments where\nauthentication credentials must be shared safely across multiple\nprocesses, containers, or nodes, such as container orchestration\nplatforms and microservice architectures.\n\nKey characteristics:\n- Distributed-safe, shared storage using Redis\n- Explicit, caller-defined serialization and deserialization\n- No reliance on unsafe mechanisms such as pickle\n- Optional time-to-live (TTL) support for automatic credential expiry\n\nThis module is responsible solely for persistence concerns.\nCredential validation, refresh, rotation, and acquisition remain the\nresponsibility of authentication provider implementations.",
|
||||
"members": {
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Callable": {
|
||||
"name": "Callable",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Callable",
|
||||
"signature": "<bound method Alias.signature of Alias('Callable', 'typing.Callable')>",
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"RedisCredentialStore": {
|
||||
"name": "RedisCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('RedisCredentialStore', 32, 142)>",
|
||||
"docstring": "Redis-backed implementation of ``CredentialStore``.\n\nThis store persists credentials in Redis and is suitable for\ndistributed and horizontally scaled deployments where credentials\nmust be shared across multiple processes or nodes.\n\nThe store is intentionally generic and delegates all serialization\nconcerns to caller-provided functions. This avoids unsafe mechanisms\nsuch as pickle and allows credential formats to be explicitly\ncontrolled and audited.\n\nThis class is responsible only for persistence and retrieval.\nIt does not interpret, validate, refresh, or otherwise manage\nthe lifecycle of the credentials being stored.",
|
||||
"members": {
|
||||
"redis": {
|
||||
"name": "redis",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.redis",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"key": {
|
||||
"name": "key",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.key",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"serialize": {
|
||||
"name": "serialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.serialize",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"deserialize": {
|
||||
"name": "deserialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.deserialize",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"ttl_seconds": {
|
||||
"name": "ttl_seconds",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.ttl_seconds",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 94, 115)>",
|
||||
"docstring": "Load credentials from Redis.\n\nIf no value exists for the configured key, or if the stored\npayload cannot be successfully deserialized, this method\nreturns ``None``.\n\nThe store does not attempt to validate the returned credentials\nor determine whether they are expired or otherwise usable.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 117, 133)>",
|
||||
"docstring": "Persist credentials to Redis.\n\nAny previously stored credentials under the same key are\noverwritten. If a TTL is configured, the credentials will\nexpire automatically after the specified duration.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 135, 142)>",
|
||||
"docstring": "Remove stored credentials from Redis.\n\nThis operation deletes the configured Redis key if it exists.\nImplementations should treat this method as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"store": {
|
||||
"name": "store",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.credentials.store",
|
||||
"signature": null,
|
||||
"docstring": "Credential persistence abstractions for Mail Intake.\n\nThis module defines the generic persistence contract used to store and\nretrieve authentication credentials across Mail Intake components.\n\nThe ``CredentialStore`` abstraction establishes a strict separation\nbetween credential *lifecycle management* and credential *storage*.\nAuthentication providers are responsible for acquiring, validating,\nrefreshing, and revoking credentials, while concrete store\nimplementations are responsible solely for persistence concerns.\n\nBy remaining agnostic to credential structure, serialization format,\nand storage backend, this module enables multiple persistence\nstrategies—such as local files, in-memory caches, distributed stores,\nor secrets managers—without coupling authentication logic to any\nspecific storage mechanism.",
|
||||
"members": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Generic": {
|
||||
"name": "Generic",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.Generic",
|
||||
"signature": "<bound method Alias.signature of Alias('Generic', 'typing.Generic')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.store.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.store.CredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('CredentialStore', 27, 90)>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 44, 59)>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 61, 78)>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 80, 90)>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
mcp_docs/modules/mail_intake.credentials.pickle.json
Normal file
104
mcp_docs/modules/mail_intake.credentials.pickle.json
Normal file
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"module": "mail_intake.credentials.pickle",
|
||||
"content": {
|
||||
"path": "mail_intake.credentials.pickle",
|
||||
"docstring": "Local filesystem–based credential persistence for Mail Intake.\n\nThis module provides a file-backed implementation of the\n``CredentialStore`` abstraction using Python's ``pickle`` module.\n\nThe pickle-based credential store is intended for local development,\nsingle-node deployments, and controlled environments where credentials\ndo not need to be shared across processes or machines.\n\nDue to the security and portability risks associated with pickle-based\nserialization, this implementation is not suitable for distributed or\nuntrusted environments.",
|
||||
"objects": {
|
||||
"pickle": {
|
||||
"name": "pickle",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.pickle",
|
||||
"signature": "<bound method Alias.signature of Alias('pickle', 'pickle')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.pickle.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.pickle.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"PickleCredentialStore": {
|
||||
"name": "PickleCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('PickleCredentialStore', 24, 96)>",
|
||||
"docstring": "Filesystem-backed credential store using pickle serialization.\n\nThis store persists credentials as a pickled object on the local\nfilesystem. It is a simple implementation intended primarily for\ndevelopment, testing, and single-process execution contexts.\n\nThis implementation:\n- Stores credentials on the local filesystem\n- Uses pickle for serialization and deserialization\n- Does not provide encryption, locking, or concurrency guarantees\n\nCredential lifecycle management, validation, and refresh logic are\nexplicitly out of scope for this class.",
|
||||
"members": {
|
||||
"path": {
|
||||
"name": "path",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.path",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 52, 70)>",
|
||||
"docstring": "Load credentials from the local filesystem.\n\nIf the credential file does not exist or cannot be successfully\ndeserialized, this method returns ``None``.\n\nThe store does not attempt to validate or interpret the returned\ncredentials.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 72, 84)>",
|
||||
"docstring": "Persist credentials to the local filesystem.\n\nAny previously stored credentials at the configured path are\noverwritten.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.pickle.PickleCredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 86, 96)>",
|
||||
"docstring": "Remove persisted credentials from the local filesystem.\n\nThis method deletes the credential file if it exists and should\nbe treated as an idempotent operation."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
139
mcp_docs/modules/mail_intake.credentials.redis.json
Normal file
139
mcp_docs/modules/mail_intake.credentials.redis.json
Normal file
@@ -0,0 +1,139 @@
|
||||
{
|
||||
"module": "mail_intake.credentials.redis",
|
||||
"content": {
|
||||
"path": "mail_intake.credentials.redis",
|
||||
"docstring": "Redis-backed credential persistence for Mail Intake.\n\nThis module provides a Redis-based implementation of the\n``CredentialStore`` abstraction, enabling credential persistence\nacross distributed and horizontally scaled deployments.\n\nThe Redis credential store is designed for environments where\nauthentication credentials must be shared safely across multiple\nprocesses, containers, or nodes, such as container orchestration\nplatforms and microservice architectures.\n\nKey characteristics:\n- Distributed-safe, shared storage using Redis\n- Explicit, caller-defined serialization and deserialization\n- No reliance on unsafe mechanisms such as pickle\n- Optional time-to-live (TTL) support for automatic credential expiry\n\nThis module is responsible solely for persistence concerns.\nCredential validation, refresh, rotation, and acquisition remain the\nresponsibility of authentication provider implementations.",
|
||||
"objects": {
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Callable": {
|
||||
"name": "Callable",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Callable",
|
||||
"signature": "<bound method Alias.signature of Alias('Callable', 'typing.Callable')>",
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore",
|
||||
"signature": "<bound method Alias.signature of Alias('CredentialStore', 'mail_intake.credentials.store.CredentialStore')>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.load",
|
||||
"signature": "<bound method Alias.signature of Alias('load', 'mail_intake.credentials.store.CredentialStore.load')>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.save",
|
||||
"signature": "<bound method Alias.signature of Alias('save', 'mail_intake.credentials.store.CredentialStore.save')>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.CredentialStore.clear",
|
||||
"signature": "<bound method Alias.signature of Alias('clear', 'mail_intake.credentials.store.CredentialStore.clear')>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"RedisCredentialStore": {
|
||||
"name": "RedisCredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('RedisCredentialStore', 32, 142)>",
|
||||
"docstring": "Redis-backed implementation of ``CredentialStore``.\n\nThis store persists credentials in Redis and is suitable for\ndistributed and horizontally scaled deployments where credentials\nmust be shared across multiple processes or nodes.\n\nThe store is intentionally generic and delegates all serialization\nconcerns to caller-provided functions. This avoids unsafe mechanisms\nsuch as pickle and allows credential formats to be explicitly\ncontrolled and audited.\n\nThis class is responsible only for persistence and retrieval.\nIt does not interpret, validate, refresh, or otherwise manage\nthe lifecycle of the credentials being stored.",
|
||||
"members": {
|
||||
"redis": {
|
||||
"name": "redis",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.redis",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"key": {
|
||||
"name": "key",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.key",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"serialize": {
|
||||
"name": "serialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.serialize",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"deserialize": {
|
||||
"name": "deserialize",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.deserialize",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"ttl_seconds": {
|
||||
"name": "ttl_seconds",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.ttl_seconds",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 94, 115)>",
|
||||
"docstring": "Load credentials from Redis.\n\nIf no value exists for the configured key, or if the stored\npayload cannot be successfully deserialized, this method\nreturns ``None``.\n\nThe store does not attempt to validate the returned credentials\nor determine whether they are expired or otherwise usable.\n\nReturns:\n An instance of type ``T`` if credentials are present and\n successfully deserialized; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 117, 133)>",
|
||||
"docstring": "Persist credentials to Redis.\n\nAny previously stored credentials under the same key are\noverwritten. If a TTL is configured, the credentials will\nexpire automatically after the specified duration.\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.redis.RedisCredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 135, 142)>",
|
||||
"docstring": "Remove stored credentials from Redis.\n\nThis operation deletes the configured Redis key if it exists.\nImplementations should treat this method as idempotent."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.redis.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
81
mcp_docs/modules/mail_intake.credentials.store.json
Normal file
81
mcp_docs/modules/mail_intake.credentials.store.json
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"module": "mail_intake.credentials.store",
|
||||
"content": {
|
||||
"path": "mail_intake.credentials.store",
|
||||
"docstring": "Credential persistence abstractions for Mail Intake.\n\nThis module defines the generic persistence contract used to store and\nretrieve authentication credentials across Mail Intake components.\n\nThe ``CredentialStore`` abstraction establishes a strict separation\nbetween credential *lifecycle management* and credential *storage*.\nAuthentication providers are responsible for acquiring, validating,\nrefreshing, and revoking credentials, while concrete store\nimplementations are responsible solely for persistence concerns.\n\nBy remaining agnostic to credential structure, serialization format,\nand storage backend, this module enables multiple persistence\nstrategies—such as local files, in-memory caches, distributed stores,\nor secrets managers—without coupling authentication logic to any\nspecific storage mechanism.",
|
||||
"objects": {
|
||||
"ABC": {
|
||||
"name": "ABC",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.ABC",
|
||||
"signature": "<bound method Alias.signature of Alias('ABC', 'abc.ABC')>",
|
||||
"docstring": null
|
||||
},
|
||||
"abstractmethod": {
|
||||
"name": "abstractmethod",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.abstractmethod",
|
||||
"signature": "<bound method Alias.signature of Alias('abstractmethod', 'abc.abstractmethod')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Generic": {
|
||||
"name": "Generic",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.Generic",
|
||||
"signature": "<bound method Alias.signature of Alias('Generic', 'typing.Generic')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"TypeVar": {
|
||||
"name": "TypeVar",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.credentials.store.TypeVar",
|
||||
"signature": "<bound method Alias.signature of Alias('TypeVar', 'typing.TypeVar')>",
|
||||
"docstring": null
|
||||
},
|
||||
"T": {
|
||||
"name": "T",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.credentials.store.T",
|
||||
"signature": null,
|
||||
"docstring": null
|
||||
},
|
||||
"CredentialStore": {
|
||||
"name": "CredentialStore",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.credentials.store.CredentialStore",
|
||||
"signature": "<bound method Class.signature of Class('CredentialStore', 27, 90)>",
|
||||
"docstring": "Abstract base class defining a generic persistence interface for\nauthentication credentials.\n\nThis interface separates *credential lifecycle management* from\n*credential storage mechanics*. Implementations are responsible\nonly for persistence concerns, while authentication providers\nretain full control over credential creation, validation, refresh,\nand revocation logic.\n\nThe store is intentionally agnostic to:\n- The concrete credential type being stored\n- The serialization format used to persist credentials\n- The underlying storage backend or durability guarantees",
|
||||
"members": {
|
||||
"load": {
|
||||
"name": "load",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.load",
|
||||
"signature": "<bound method Function.signature of Function('load', 44, 59)>",
|
||||
"docstring": "Load previously persisted credentials.\n\nImplementations should return ``None`` when no credentials are\npresent or when stored credentials cannot be successfully\ndecoded or deserialized.\n\nThe store must not attempt to validate, refresh, or otherwise\ninterpret the returned credentials.\n\nReturns:\n An instance of type ``T`` if credentials are available and\n loadable; otherwise ``None``."
|
||||
},
|
||||
"save": {
|
||||
"name": "save",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.save",
|
||||
"signature": "<bound method Function.signature of Function('save', 61, 78)>",
|
||||
"docstring": "Persist credentials to the underlying storage backend.\n\nThis method is invoked when credentials are newly obtained or\nhave been refreshed and are known to be valid at the time of\npersistence.\n\nImplementations are responsible for:\n- Ensuring durability appropriate to the deployment context\n- Applying encryption or access controls where required\n- Overwriting any previously stored credentials\n\nArgs:\n credentials:\n The credential object to persist."
|
||||
},
|
||||
"clear": {
|
||||
"name": "clear",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.credentials.store.CredentialStore.clear",
|
||||
"signature": "<bound method Function.signature of Function('clear', 80, 90)>",
|
||||
"docstring": "Remove any persisted credentials from the store.\n\nThis method is called when credentials are known to be invalid,\nrevoked, corrupted, or otherwise unusable, and must ensure that\nno stale authentication material remains accessible.\n\nImplementations should treat this operation as idempotent."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
mcp_docs/modules/mail_intake.exceptions.json
Normal file
37
mcp_docs/modules/mail_intake.exceptions.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"module": "mail_intake.exceptions",
|
||||
"content": {
|
||||
"path": "mail_intake.exceptions",
|
||||
"docstring": "Exception hierarchy for Mail Intake.\n\nThis module defines the **canonical exception types** used throughout the\nMail Intake library.\n\nAll library-raised errors derive from `MailIntakeError`. Consumers are\nencouraged to catch this base type (or specific subclasses) rather than\nprovider-specific or third-party exceptions.",
|
||||
"objects": {
|
||||
"MailIntakeError": {
|
||||
"name": "MailIntakeError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.exceptions.MailIntakeError",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeError', 13, 22)>",
|
||||
"docstring": "Base exception for all Mail Intake errors.\n\nThis is the root of the Mail Intake exception hierarchy.\nAll errors raised by the library must derive from this class.\n\nConsumers should generally catch this type when handling\nlibrary-level failures."
|
||||
},
|
||||
"MailIntakeAuthError": {
|
||||
"name": "MailIntakeAuthError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.exceptions.MailIntakeAuthError",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAuthError', 25, 31)>",
|
||||
"docstring": "Authentication and credential-related failures.\n\nRaised when authentication providers are unable to acquire,\nrefresh, or persist valid credentials."
|
||||
},
|
||||
"MailIntakeAdapterError": {
|
||||
"name": "MailIntakeAdapterError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.exceptions.MailIntakeAdapterError",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeAdapterError', 34, 40)>",
|
||||
"docstring": "Errors raised by mail provider adapters.\n\nRaised when a provider adapter encounters API errors,\ntransport failures, or invalid provider responses."
|
||||
},
|
||||
"MailIntakeParsingError": {
|
||||
"name": "MailIntakeParsingError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.exceptions.MailIntakeParsingError",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeParsingError', 43, 49)>",
|
||||
"docstring": "Errors encountered while parsing message content.\n\nRaised when raw provider payloads cannot be interpreted\nor normalized into internal domain models."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
280
mcp_docs/modules/mail_intake.ingestion.json
Normal file
280
mcp_docs/modules/mail_intake.ingestion.json
Normal file
@@ -0,0 +1,280 @@
|
||||
{
|
||||
"module": "mail_intake.ingestion",
|
||||
"content": {
|
||||
"path": "mail_intake.ingestion",
|
||||
"docstring": "Mail ingestion orchestration for Mail Intake.\n\nThis package contains **high-level ingestion components** responsible for\ncoordinating mail retrieval, parsing, normalization, and model construction.\n\nIt represents the **top of the ingestion pipeline** and is intended to be the\nprimary interaction surface for library consumers.\n\nComponents in this package:\n- Are provider-agnostic\n- Depend only on adapter and parser contracts\n- Contain no provider-specific API logic\n- Expose read-only ingestion workflows\n\nConsumers are expected to construct a mail adapter and pass it to the\ningestion layer to begin processing messages and threads.",
|
||||
"objects": {
|
||||
"MailIntakeReader": {
|
||||
"name": "MailIntakeReader",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.MailIntakeReader",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeReader', 'mail_intake.ingestion.reader.MailIntakeReader')>",
|
||||
"docstring": "High-level read-only ingestion interface.\n\nThis class is the **primary entry point** for consumers of the Mail\nIntake library.\n\nIt orchestrates the full ingestion pipeline:\n- Querying the adapter for message references\n- Fetching raw provider messages\n- Parsing and normalizing message data\n- Constructing domain models\n\nThis class is intentionally:\n- Provider-agnostic\n- Stateless beyond iteration scope\n- Read-only",
|
||||
"members": {
|
||||
"iter_messages": {
|
||||
"name": "iter_messages",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.MailIntakeReader.iter_messages",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_messages', 'mail_intake.ingestion.reader.MailIntakeReader.iter_messages')>",
|
||||
"docstring": "Iterate over parsed messages matching a provider query.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Fully parsed and normalized `MailIntakeMessage` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
},
|
||||
"iter_threads": {
|
||||
"name": "iter_threads",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.MailIntakeReader.iter_threads",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_threads', 'mail_intake.ingestion.reader.MailIntakeReader.iter_threads')>",
|
||||
"docstring": "Iterate over threads constructed from messages matching a query.\n\nMessages are grouped by `thread_id` and yielded as complete thread\nobjects containing all associated messages.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nReturns:\n An iterator of `MailIntakeThread` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
}
|
||||
}
|
||||
},
|
||||
"reader": {
|
||||
"name": "reader",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.ingestion.reader",
|
||||
"signature": null,
|
||||
"docstring": "High-level mail ingestion orchestration for Mail Intake.\n\nThis module provides the primary, provider-agnostic entry point for\nreading and processing mail data.\n\nIt coordinates:\n- Mail adapter access\n- Message and thread iteration\n- Header and body parsing\n- Normalization and model construction\n\nNo provider-specific logic or API semantics are permitted in this layer.",
|
||||
"members": {
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeMessage', 'mail_intake.models.message.MailIntakeMessage')>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.message_id",
|
||||
"signature": "<bound method Alias.signature of Alias('message_id', 'mail_intake.models.message.MailIntakeMessage.message_id')>",
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.message.MailIntakeMessage.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.timestamp",
|
||||
"signature": "<bound method Alias.signature of Alias('timestamp', 'mail_intake.models.message.MailIntakeMessage.timestamp')>",
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.from_email",
|
||||
"signature": "<bound method Alias.signature of Alias('from_email', 'mail_intake.models.message.MailIntakeMessage.from_email')>",
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.from_name",
|
||||
"signature": "<bound method Alias.signature of Alias('from_name', 'mail_intake.models.message.MailIntakeMessage.from_name')>",
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.subject",
|
||||
"signature": "<bound method Alias.signature of Alias('subject', 'mail_intake.models.message.MailIntakeMessage.subject')>",
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.body_text",
|
||||
"signature": "<bound method Alias.signature of Alias('body_text', 'mail_intake.models.message.MailIntakeMessage.body_text')>",
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.snippet",
|
||||
"signature": "<bound method Alias.signature of Alias('snippet', 'mail_intake.models.message.MailIntakeMessage.snippet')>",
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.raw_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('raw_headers', 'mail_intake.models.message.MailIntakeMessage.raw_headers')>",
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeThread": {
|
||||
"name": "MailIntakeThread",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeThread', 'mail_intake.models.thread.MailIntakeThread')>",
|
||||
"docstring": "Canonical internal representation of an email thread.\n\nA thread groups multiple related messages under a single subject\nand participant set. It is designed to support reasoning over\nconversational context such as job applications, interviews,\nfollow-ups, and ongoing discussions.\n\nThis model is provider-agnostic and safe to persist.",
|
||||
"members": {
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.thread.MailIntakeThread.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier."
|
||||
},
|
||||
"normalized_subject": {
|
||||
"name": "normalized_subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.normalized_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalized_subject', 'mail_intake.models.thread.MailIntakeThread.normalized_subject')>",
|
||||
"docstring": "Normalized subject line used to group related messages."
|
||||
},
|
||||
"participants": {
|
||||
"name": "participants",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.participants",
|
||||
"signature": "<bound method Alias.signature of Alias('participants', 'mail_intake.models.thread.MailIntakeThread.participants')>",
|
||||
"docstring": "Set of unique participant email addresses observed in the thread."
|
||||
},
|
||||
"messages": {
|
||||
"name": "messages",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.messages",
|
||||
"signature": "<bound method Alias.signature of Alias('messages', 'mail_intake.models.thread.MailIntakeThread.messages')>",
|
||||
"docstring": "Ordered list of messages belonging to this thread."
|
||||
},
|
||||
"last_activity_at": {
|
||||
"name": "last_activity_at",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.last_activity_at",
|
||||
"signature": "<bound method Alias.signature of Alias('last_activity_at', 'mail_intake.models.thread.MailIntakeThread.last_activity_at')>",
|
||||
"docstring": "Timestamp of the most recent message in the thread."
|
||||
},
|
||||
"add_message": {
|
||||
"name": "add_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.add_message",
|
||||
"signature": "<bound method Alias.signature of Alias('add_message', 'mail_intake.models.thread.MailIntakeThread.add_message')>",
|
||||
"docstring": "Add a message to the thread and update derived fields.\n\nThis method:\n- Appends the message to the thread\n- Tracks unique participants\n- Updates the last activity timestamp\n\nArgs:\n message: Parsed mail message to add to the thread."
|
||||
}
|
||||
}
|
||||
},
|
||||
"parse_headers": {
|
||||
"name": "parse_headers",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.parse_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('parse_headers', 'mail_intake.parsers.headers.parse_headers')>",
|
||||
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
|
||||
},
|
||||
"extract_sender": {
|
||||
"name": "extract_sender",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.extract_sender",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_sender', 'mail_intake.parsers.headers.extract_sender')>",
|
||||
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
|
||||
},
|
||||
"extract_body": {
|
||||
"name": "extract_body",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.extract_body",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_body', 'mail_intake.parsers.body.extract_body')>",
|
||||
"docstring": "Extract the best-effort message body from a Gmail payload.\n\nPriority:\n1. text/plain\n2. text/html (stripped to text)\n3. Single-part body\n4. empty string (if nothing usable found)\n\nArgs:\n payload: Provider-native message payload dictionary.\n\nReturns:\n Extracted plain-text message body."
|
||||
},
|
||||
"normalize_subject": {
|
||||
"name": "normalize_subject",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.normalize_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalize_subject', 'mail_intake.parsers.subject.normalize_subject')>",
|
||||
"docstring": "Normalize an email subject for thread-level comparison.\n\nOperations:\n- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``\n- Repeats prefix stripping to handle stacked prefixes\n- Collapses excessive whitespace\n- Preserves original casing (no lowercasing)\n\nThis function is intentionally conservative and avoids aggressive\ntransformations that could alter the semantic meaning of the subject.\n\nArgs:\n subject: Raw subject line from a message header.\n\nReturns:\n Normalized subject string suitable for thread grouping."
|
||||
},
|
||||
"MailIntakeParsingError": {
|
||||
"name": "MailIntakeParsingError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeParsingError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeParsingError', 'mail_intake.exceptions.MailIntakeParsingError')>",
|
||||
"docstring": "Errors encountered while parsing message content.\n\nRaised when raw provider payloads cannot be interpreted\nor normalized into internal domain models."
|
||||
},
|
||||
"MailIntakeReader": {
|
||||
"name": "MailIntakeReader",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeReader', 28, 155)>",
|
||||
"docstring": "High-level read-only ingestion interface.\n\nThis class is the **primary entry point** for consumers of the Mail\nIntake library.\n\nIt orchestrates the full ingestion pipeline:\n- Querying the adapter for message references\n- Fetching raw provider messages\n- Parsing and normalizing message data\n- Constructing domain models\n\nThis class is intentionally:\n- Provider-agnostic\n- Stateless beyond iteration scope\n- Read-only",
|
||||
"members": {
|
||||
"iter_messages": {
|
||||
"name": "iter_messages",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader.iter_messages",
|
||||
"signature": "<bound method Function.signature of Function('iter_messages', 57, 72)>",
|
||||
"docstring": "Iterate over parsed messages matching a provider query.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Fully parsed and normalized `MailIntakeMessage` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
},
|
||||
"iter_threads": {
|
||||
"name": "iter_threads",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader.iter_threads",
|
||||
"signature": "<bound method Function.signature of Function('iter_threads', 74, 106)>",
|
||||
"docstring": "Iterate over threads constructed from messages matching a query.\n\nMessages are grouped by `thread_id` and yielded as complete thread\nobjects containing all associated messages.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nReturns:\n An iterator of `MailIntakeThread` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
248
mcp_docs/modules/mail_intake.ingestion.reader.json
Normal file
248
mcp_docs/modules/mail_intake.ingestion.reader.json
Normal file
@@ -0,0 +1,248 @@
|
||||
{
|
||||
"module": "mail_intake.ingestion.reader",
|
||||
"content": {
|
||||
"path": "mail_intake.ingestion.reader",
|
||||
"docstring": "High-level mail ingestion orchestration for Mail Intake.\n\nThis module provides the primary, provider-agnostic entry point for\nreading and processing mail data.\n\nIt coordinates:\n- Mail adapter access\n- Message and thread iteration\n- Header and body parsing\n- Normalization and model construction\n\nNo provider-specific logic or API semantics are permitted in this layer.",
|
||||
"objects": {
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Iterator": {
|
||||
"name": "Iterator",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Iterator",
|
||||
"signature": "<bound method Alias.signature of Alias('Iterator', 'typing.Iterator')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.ingestion.reader.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeAdapter": {
|
||||
"name": "MailIntakeAdapter",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeAdapter', 'mail_intake.adapters.base.MailIntakeAdapter')>",
|
||||
"docstring": "Base adapter interface for mail providers.\n\nThis interface defines the minimal contract required to:\n- Discover messages matching a query\n- Retrieve full message payloads\n- Retrieve full thread payloads\n\nAdapters are intentionally read-only and must not mutate provider state.",
|
||||
"members": {
|
||||
"iter_message_refs": {
|
||||
"name": "iter_message_refs",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.iter_message_refs",
|
||||
"signature": "<bound method Alias.signature of Alias('iter_message_refs', 'mail_intake.adapters.base.MailIntakeAdapter.iter_message_refs')>",
|
||||
"docstring": "Iterate over lightweight message references matching a query.\n\nImplementations must yield dictionaries containing at least:\n- ``message_id``: Provider-specific message identifier\n- ``thread_id``: Provider-specific thread identifier\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Dictionaries containing message and thread identifiers.\n\nExample yield:\n {\n \"message_id\": \"...\",\n \"thread_id\": \"...\"\n }"
|
||||
},
|
||||
"fetch_message": {
|
||||
"name": "fetch_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.fetch_message",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_message', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_message')>",
|
||||
"docstring": "Fetch a full raw message by message identifier.\n\nArgs:\n message_id: Provider-specific message identifier.\n\nReturns:\n Provider-native message payload\n (e.g., Gmail message JSON structure)."
|
||||
},
|
||||
"fetch_thread": {
|
||||
"name": "fetch_thread",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeAdapter.fetch_thread",
|
||||
"signature": "<bound method Alias.signature of Alias('fetch_thread', 'mail_intake.adapters.base.MailIntakeAdapter.fetch_thread')>",
|
||||
"docstring": "Fetch a full raw thread by thread identifier.\n\nArgs:\n thread_id: Provider-specific thread identifier.\n\nReturns:\n Provider-native thread payload."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeMessage', 'mail_intake.models.message.MailIntakeMessage')>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.message_id",
|
||||
"signature": "<bound method Alias.signature of Alias('message_id', 'mail_intake.models.message.MailIntakeMessage.message_id')>",
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.message.MailIntakeMessage.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.timestamp",
|
||||
"signature": "<bound method Alias.signature of Alias('timestamp', 'mail_intake.models.message.MailIntakeMessage.timestamp')>",
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.from_email",
|
||||
"signature": "<bound method Alias.signature of Alias('from_email', 'mail_intake.models.message.MailIntakeMessage.from_email')>",
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.from_name",
|
||||
"signature": "<bound method Alias.signature of Alias('from_name', 'mail_intake.models.message.MailIntakeMessage.from_name')>",
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.subject",
|
||||
"signature": "<bound method Alias.signature of Alias('subject', 'mail_intake.models.message.MailIntakeMessage.subject')>",
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.body_text",
|
||||
"signature": "<bound method Alias.signature of Alias('body_text', 'mail_intake.models.message.MailIntakeMessage.body_text')>",
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.snippet",
|
||||
"signature": "<bound method Alias.signature of Alias('snippet', 'mail_intake.models.message.MailIntakeMessage.snippet')>",
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeMessage.raw_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('raw_headers', 'mail_intake.models.message.MailIntakeMessage.raw_headers')>",
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeThread": {
|
||||
"name": "MailIntakeThread",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeThread', 'mail_intake.models.thread.MailIntakeThread')>",
|
||||
"docstring": "Canonical internal representation of an email thread.\n\nA thread groups multiple related messages under a single subject\nand participant set. It is designed to support reasoning over\nconversational context such as job applications, interviews,\nfollow-ups, and ongoing discussions.\n\nThis model is provider-agnostic and safe to persist.",
|
||||
"members": {
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.thread.MailIntakeThread.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier."
|
||||
},
|
||||
"normalized_subject": {
|
||||
"name": "normalized_subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.normalized_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalized_subject', 'mail_intake.models.thread.MailIntakeThread.normalized_subject')>",
|
||||
"docstring": "Normalized subject line used to group related messages."
|
||||
},
|
||||
"participants": {
|
||||
"name": "participants",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.participants",
|
||||
"signature": "<bound method Alias.signature of Alias('participants', 'mail_intake.models.thread.MailIntakeThread.participants')>",
|
||||
"docstring": "Set of unique participant email addresses observed in the thread."
|
||||
},
|
||||
"messages": {
|
||||
"name": "messages",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.messages",
|
||||
"signature": "<bound method Alias.signature of Alias('messages', 'mail_intake.models.thread.MailIntakeThread.messages')>",
|
||||
"docstring": "Ordered list of messages belonging to this thread."
|
||||
},
|
||||
"last_activity_at": {
|
||||
"name": "last_activity_at",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.last_activity_at",
|
||||
"signature": "<bound method Alias.signature of Alias('last_activity_at', 'mail_intake.models.thread.MailIntakeThread.last_activity_at')>",
|
||||
"docstring": "Timestamp of the most recent message in the thread."
|
||||
},
|
||||
"add_message": {
|
||||
"name": "add_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeThread.add_message",
|
||||
"signature": "<bound method Alias.signature of Alias('add_message', 'mail_intake.models.thread.MailIntakeThread.add_message')>",
|
||||
"docstring": "Add a message to the thread and update derived fields.\n\nThis method:\n- Appends the message to the thread\n- Tracks unique participants\n- Updates the last activity timestamp\n\nArgs:\n message: Parsed mail message to add to the thread."
|
||||
}
|
||||
}
|
||||
},
|
||||
"parse_headers": {
|
||||
"name": "parse_headers",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.parse_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('parse_headers', 'mail_intake.parsers.headers.parse_headers')>",
|
||||
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
|
||||
},
|
||||
"extract_sender": {
|
||||
"name": "extract_sender",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.extract_sender",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_sender', 'mail_intake.parsers.headers.extract_sender')>",
|
||||
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
|
||||
},
|
||||
"extract_body": {
|
||||
"name": "extract_body",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.extract_body",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_body', 'mail_intake.parsers.body.extract_body')>",
|
||||
"docstring": "Extract the best-effort message body from a Gmail payload.\n\nPriority:\n1. text/plain\n2. text/html (stripped to text)\n3. Single-part body\n4. empty string (if nothing usable found)\n\nArgs:\n payload: Provider-native message payload dictionary.\n\nReturns:\n Extracted plain-text message body."
|
||||
},
|
||||
"normalize_subject": {
|
||||
"name": "normalize_subject",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.normalize_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalize_subject', 'mail_intake.parsers.subject.normalize_subject')>",
|
||||
"docstring": "Normalize an email subject for thread-level comparison.\n\nOperations:\n- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``\n- Repeats prefix stripping to handle stacked prefixes\n- Collapses excessive whitespace\n- Preserves original casing (no lowercasing)\n\nThis function is intentionally conservative and avoids aggressive\ntransformations that could alter the semantic meaning of the subject.\n\nArgs:\n subject: Raw subject line from a message header.\n\nReturns:\n Normalized subject string suitable for thread grouping."
|
||||
},
|
||||
"MailIntakeParsingError": {
|
||||
"name": "MailIntakeParsingError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeParsingError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeParsingError', 'mail_intake.exceptions.MailIntakeParsingError')>",
|
||||
"docstring": "Errors encountered while parsing message content.\n\nRaised when raw provider payloads cannot be interpreted\nor normalized into internal domain models."
|
||||
},
|
||||
"MailIntakeReader": {
|
||||
"name": "MailIntakeReader",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeReader', 28, 155)>",
|
||||
"docstring": "High-level read-only ingestion interface.\n\nThis class is the **primary entry point** for consumers of the Mail\nIntake library.\n\nIt orchestrates the full ingestion pipeline:\n- Querying the adapter for message references\n- Fetching raw provider messages\n- Parsing and normalizing message data\n- Constructing domain models\n\nThis class is intentionally:\n- Provider-agnostic\n- Stateless beyond iteration scope\n- Read-only",
|
||||
"members": {
|
||||
"iter_messages": {
|
||||
"name": "iter_messages",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader.iter_messages",
|
||||
"signature": "<bound method Function.signature of Function('iter_messages', 57, 72)>",
|
||||
"docstring": "Iterate over parsed messages matching a provider query.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nYields:\n Fully parsed and normalized `MailIntakeMessage` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
},
|
||||
"iter_threads": {
|
||||
"name": "iter_threads",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.ingestion.reader.MailIntakeReader.iter_threads",
|
||||
"signature": "<bound method Function.signature of Function('iter_threads', 74, 106)>",
|
||||
"docstring": "Iterate over threads constructed from messages matching a query.\n\nMessages are grouped by `thread_id` and yielded as complete thread\nobjects containing all associated messages.\n\nArgs:\n query: Provider-specific query string used to filter messages.\n\nReturns:\n An iterator of `MailIntakeThread` instances.\n\nRaises:\n MailIntakeParsingError: If a message cannot be parsed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1996
mcp_docs/modules/mail_intake.json
Normal file
1996
mcp_docs/modules/mail_intake.json
Normal file
File diff suppressed because one or more lines are too long
415
mcp_docs/modules/mail_intake.models.json
Normal file
415
mcp_docs/modules/mail_intake.models.json
Normal file
@@ -0,0 +1,415 @@
|
||||
{
|
||||
"module": "mail_intake.models",
|
||||
"content": {
|
||||
"path": "mail_intake.models",
|
||||
"docstring": "Domain models for Mail Intake.\n\nThis package defines the **canonical, provider-agnostic data models**\nused throughout the Mail Intake ingestion pipeline.\n\nModels in this package:\n- Represent fully parsed and normalized mail data\n- Are safe to persist, serialize, and index\n- Contain no provider-specific payloads or API semantics\n- Serve as stable inputs for downstream processing and analysis\n\nThese models form the core internal data contract of the library.",
|
||||
"objects": {
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.MailIntakeMessage",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeMessage', 'mail_intake.models.message.MailIntakeMessage')>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.message_id",
|
||||
"signature": "<bound method Alias.signature of Alias('message_id', 'mail_intake.models.message.MailIntakeMessage.message_id')>",
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.message.MailIntakeMessage.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.timestamp",
|
||||
"signature": "<bound method Alias.signature of Alias('timestamp', 'mail_intake.models.message.MailIntakeMessage.timestamp')>",
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.from_email",
|
||||
"signature": "<bound method Alias.signature of Alias('from_email', 'mail_intake.models.message.MailIntakeMessage.from_email')>",
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.from_name",
|
||||
"signature": "<bound method Alias.signature of Alias('from_name', 'mail_intake.models.message.MailIntakeMessage.from_name')>",
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.subject",
|
||||
"signature": "<bound method Alias.signature of Alias('subject', 'mail_intake.models.message.MailIntakeMessage.subject')>",
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.body_text",
|
||||
"signature": "<bound method Alias.signature of Alias('body_text', 'mail_intake.models.message.MailIntakeMessage.body_text')>",
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.snippet",
|
||||
"signature": "<bound method Alias.signature of Alias('snippet', 'mail_intake.models.message.MailIntakeMessage.snippet')>",
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeMessage.raw_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('raw_headers', 'mail_intake.models.message.MailIntakeMessage.raw_headers')>",
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeThread": {
|
||||
"name": "MailIntakeThread",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.MailIntakeThread",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeThread', 'mail_intake.models.thread.MailIntakeThread')>",
|
||||
"docstring": "Canonical internal representation of an email thread.\n\nA thread groups multiple related messages under a single subject\nand participant set. It is designed to support reasoning over\nconversational context such as job applications, interviews,\nfollow-ups, and ongoing discussions.\n\nThis model is provider-agnostic and safe to persist.",
|
||||
"members": {
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeThread.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.thread.MailIntakeThread.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier."
|
||||
},
|
||||
"normalized_subject": {
|
||||
"name": "normalized_subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeThread.normalized_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalized_subject', 'mail_intake.models.thread.MailIntakeThread.normalized_subject')>",
|
||||
"docstring": "Normalized subject line used to group related messages."
|
||||
},
|
||||
"participants": {
|
||||
"name": "participants",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeThread.participants",
|
||||
"signature": "<bound method Alias.signature of Alias('participants', 'mail_intake.models.thread.MailIntakeThread.participants')>",
|
||||
"docstring": "Set of unique participant email addresses observed in the thread."
|
||||
},
|
||||
"messages": {
|
||||
"name": "messages",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeThread.messages",
|
||||
"signature": "<bound method Alias.signature of Alias('messages', 'mail_intake.models.thread.MailIntakeThread.messages')>",
|
||||
"docstring": "Ordered list of messages belonging to this thread."
|
||||
},
|
||||
"last_activity_at": {
|
||||
"name": "last_activity_at",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.MailIntakeThread.last_activity_at",
|
||||
"signature": "<bound method Alias.signature of Alias('last_activity_at', 'mail_intake.models.thread.MailIntakeThread.last_activity_at')>",
|
||||
"docstring": "Timestamp of the most recent message in the thread."
|
||||
},
|
||||
"add_message": {
|
||||
"name": "add_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.models.MailIntakeThread.add_message",
|
||||
"signature": "<bound method Alias.signature of Alias('add_message', 'mail_intake.models.thread.MailIntakeThread.add_message')>",
|
||||
"docstring": "Add a message to the thread and update derived fields.\n\nThis method:\n- Appends the message to the thread\n- Tracks unique participants\n- Updates the last activity timestamp\n\nArgs:\n message: Parsed mail message to add to the thread."
|
||||
}
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"name": "message",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.models.message",
|
||||
"signature": null,
|
||||
"docstring": "Message domain models for Mail Intake.\n\nThis module defines the **canonical, provider-agnostic representation**\nof an individual email message as used internally by the Mail Intake\ningestion pipeline.\n\nModels in this module are safe to persist and must not contain any\nprovider-specific fields or semantics.",
|
||||
"members": {
|
||||
"dataclass": {
|
||||
"name": "dataclass",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.dataclass",
|
||||
"signature": "<bound method Alias.signature of Alias('dataclass', 'dataclasses.dataclass')>",
|
||||
"docstring": null
|
||||
},
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeMessage', 17, 55)>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.message_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.thread_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.timestamp",
|
||||
"signature": null,
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.from_email",
|
||||
"signature": null,
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.from_name",
|
||||
"signature": null,
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.subject",
|
||||
"signature": null,
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.body_text",
|
||||
"signature": null,
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.snippet",
|
||||
"signature": null,
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.raw_headers",
|
||||
"signature": null,
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"thread": {
|
||||
"name": "thread",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.models.thread",
|
||||
"signature": null,
|
||||
"docstring": "Thread domain models for Mail Intake.\n\nThis module defines the **canonical, provider-agnostic representation**\nof an email thread as used internally by the Mail Intake ingestion pipeline.\n\nThreads group related messages and serve as the primary unit of reasoning\nfor higher-level correspondence workflows.",
|
||||
"members": {
|
||||
"dataclass": {
|
||||
"name": "dataclass",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.dataclass",
|
||||
"signature": "<bound method Alias.signature of Alias('dataclass', 'dataclasses.dataclass')>",
|
||||
"docstring": null
|
||||
},
|
||||
"field": {
|
||||
"name": "field",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.field",
|
||||
"signature": "<bound method Alias.signature of Alias('field', 'dataclasses.field')>",
|
||||
"docstring": null
|
||||
},
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"List": {
|
||||
"name": "List",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.List",
|
||||
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Set": {
|
||||
"name": "Set",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.Set",
|
||||
"signature": "<bound method Alias.signature of Alias('Set', 'typing.Set')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeMessage', 'mail_intake.models.message.MailIntakeMessage')>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.message_id",
|
||||
"signature": "<bound method Alias.signature of Alias('message_id', 'mail_intake.models.message.MailIntakeMessage.message_id')>",
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.message.MailIntakeMessage.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.timestamp",
|
||||
"signature": "<bound method Alias.signature of Alias('timestamp', 'mail_intake.models.message.MailIntakeMessage.timestamp')>",
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.from_email",
|
||||
"signature": "<bound method Alias.signature of Alias('from_email', 'mail_intake.models.message.MailIntakeMessage.from_email')>",
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.from_name",
|
||||
"signature": "<bound method Alias.signature of Alias('from_name', 'mail_intake.models.message.MailIntakeMessage.from_name')>",
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.subject",
|
||||
"signature": "<bound method Alias.signature of Alias('subject', 'mail_intake.models.message.MailIntakeMessage.subject')>",
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.body_text",
|
||||
"signature": "<bound method Alias.signature of Alias('body_text', 'mail_intake.models.message.MailIntakeMessage.body_text')>",
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.snippet",
|
||||
"signature": "<bound method Alias.signature of Alias('snippet', 'mail_intake.models.message.MailIntakeMessage.snippet')>",
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.raw_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('raw_headers', 'mail_intake.models.message.MailIntakeMessage.raw_headers')>",
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeThread": {
|
||||
"name": "MailIntakeThread",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeThread', 18, 64)>",
|
||||
"docstring": "Canonical internal representation of an email thread.\n\nA thread groups multiple related messages under a single subject\nand participant set. It is designed to support reasoning over\nconversational context such as job applications, interviews,\nfollow-ups, and ongoing discussions.\n\nThis model is provider-agnostic and safe to persist.",
|
||||
"members": {
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.thread_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific thread identifier."
|
||||
},
|
||||
"normalized_subject": {
|
||||
"name": "normalized_subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.normalized_subject",
|
||||
"signature": null,
|
||||
"docstring": "Normalized subject line used to group related messages."
|
||||
},
|
||||
"participants": {
|
||||
"name": "participants",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.participants",
|
||||
"signature": null,
|
||||
"docstring": "Set of unique participant email addresses observed in the thread."
|
||||
},
|
||||
"messages": {
|
||||
"name": "messages",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.messages",
|
||||
"signature": null,
|
||||
"docstring": "Ordered list of messages belonging to this thread."
|
||||
},
|
||||
"last_activity_at": {
|
||||
"name": "last_activity_at",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.last_activity_at",
|
||||
"signature": null,
|
||||
"docstring": "Timestamp of the most recent message in the thread."
|
||||
},
|
||||
"add_message": {
|
||||
"name": "add_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.add_message",
|
||||
"signature": "<bound method Function.signature of Function('add_message', 46, 64)>",
|
||||
"docstring": "Add a message to the thread and update derived fields.\n\nThis method:\n- Appends the message to the thread\n- Tracks unique participants\n- Updates the last activity timestamp\n\nArgs:\n message: Parsed mail message to add to the thread."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
109
mcp_docs/modules/mail_intake.models.message.json
Normal file
109
mcp_docs/modules/mail_intake.models.message.json
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"module": "mail_intake.models.message",
|
||||
"content": {
|
||||
"path": "mail_intake.models.message",
|
||||
"docstring": "Message domain models for Mail Intake.\n\nThis module defines the **canonical, provider-agnostic representation**\nof an individual email message as used internally by the Mail Intake\ningestion pipeline.\n\nModels in this module are safe to persist and must not contain any\nprovider-specific fields or semantics.",
|
||||
"objects": {
|
||||
"dataclass": {
|
||||
"name": "dataclass",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.dataclass",
|
||||
"signature": "<bound method Alias.signature of Alias('dataclass', 'dataclasses.dataclass')>",
|
||||
"docstring": null
|
||||
},
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.message.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeMessage', 17, 55)>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.message_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.thread_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.timestamp",
|
||||
"signature": null,
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.from_email",
|
||||
"signature": null,
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.from_name",
|
||||
"signature": null,
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.subject",
|
||||
"signature": null,
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.body_text",
|
||||
"signature": null,
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.snippet",
|
||||
"signature": null,
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.message.MailIntakeMessage.raw_headers",
|
||||
"signature": null,
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
174
mcp_docs/modules/mail_intake.models.thread.json
Normal file
174
mcp_docs/modules/mail_intake.models.thread.json
Normal file
@@ -0,0 +1,174 @@
|
||||
{
|
||||
"module": "mail_intake.models.thread",
|
||||
"content": {
|
||||
"path": "mail_intake.models.thread",
|
||||
"docstring": "Thread domain models for Mail Intake.\n\nThis module defines the **canonical, provider-agnostic representation**\nof an email thread as used internally by the Mail Intake ingestion pipeline.\n\nThreads group related messages and serve as the primary unit of reasoning\nfor higher-level correspondence workflows.",
|
||||
"objects": {
|
||||
"dataclass": {
|
||||
"name": "dataclass",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.dataclass",
|
||||
"signature": "<bound method Alias.signature of Alias('dataclass', 'dataclasses.dataclass')>",
|
||||
"docstring": null
|
||||
},
|
||||
"field": {
|
||||
"name": "field",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.field",
|
||||
"signature": "<bound method Alias.signature of Alias('field', 'dataclasses.field')>",
|
||||
"docstring": null
|
||||
},
|
||||
"datetime": {
|
||||
"name": "datetime",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.datetime",
|
||||
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
||||
"docstring": null
|
||||
},
|
||||
"List": {
|
||||
"name": "List",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.List",
|
||||
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Set": {
|
||||
"name": "Set",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.Set",
|
||||
"signature": "<bound method Alias.signature of Alias('Set', 'typing.Set')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeMessage": {
|
||||
"name": "MailIntakeMessage",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeMessage', 'mail_intake.models.message.MailIntakeMessage')>",
|
||||
"docstring": "Canonical internal representation of a single email message.\n\nThis model represents a fully parsed and normalized email message.\nIt is intentionally provider-agnostic and suitable for persistence,\nindexing, and downstream processing.\n\nNo provider-specific identifiers, payloads, or API semantics\nshould appear in this model.",
|
||||
"members": {
|
||||
"message_id": {
|
||||
"name": "message_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.message_id",
|
||||
"signature": "<bound method Alias.signature of Alias('message_id', 'mail_intake.models.message.MailIntakeMessage.message_id')>",
|
||||
"docstring": "Provider-specific message identifier."
|
||||
},
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.thread_id",
|
||||
"signature": "<bound method Alias.signature of Alias('thread_id', 'mail_intake.models.message.MailIntakeMessage.thread_id')>",
|
||||
"docstring": "Provider-specific thread identifier to which this message belongs."
|
||||
},
|
||||
"timestamp": {
|
||||
"name": "timestamp",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.timestamp",
|
||||
"signature": "<bound method Alias.signature of Alias('timestamp', 'mail_intake.models.message.MailIntakeMessage.timestamp')>",
|
||||
"docstring": "Message timestamp as a timezone-naive UTC datetime."
|
||||
},
|
||||
"from_email": {
|
||||
"name": "from_email",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.from_email",
|
||||
"signature": "<bound method Alias.signature of Alias('from_email', 'mail_intake.models.message.MailIntakeMessage.from_email')>",
|
||||
"docstring": "Sender email address."
|
||||
},
|
||||
"from_name": {
|
||||
"name": "from_name",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.from_name",
|
||||
"signature": "<bound method Alias.signature of Alias('from_name', 'mail_intake.models.message.MailIntakeMessage.from_name')>",
|
||||
"docstring": "Optional human-readable sender name."
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.subject",
|
||||
"signature": "<bound method Alias.signature of Alias('subject', 'mail_intake.models.message.MailIntakeMessage.subject')>",
|
||||
"docstring": "Raw subject line of the message."
|
||||
},
|
||||
"body_text": {
|
||||
"name": "body_text",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.body_text",
|
||||
"signature": "<bound method Alias.signature of Alias('body_text', 'mail_intake.models.message.MailIntakeMessage.body_text')>",
|
||||
"docstring": "Extracted plain-text body content of the message."
|
||||
},
|
||||
"snippet": {
|
||||
"name": "snippet",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.snippet",
|
||||
"signature": "<bound method Alias.signature of Alias('snippet', 'mail_intake.models.message.MailIntakeMessage.snippet')>",
|
||||
"docstring": "Short provider-supplied preview snippet of the message."
|
||||
},
|
||||
"raw_headers": {
|
||||
"name": "raw_headers",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeMessage.raw_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('raw_headers', 'mail_intake.models.message.MailIntakeMessage.raw_headers')>",
|
||||
"docstring": "Normalized mapping of message headers (header name → value)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MailIntakeThread": {
|
||||
"name": "MailIntakeThread",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread",
|
||||
"signature": "<bound method Class.signature of Class('MailIntakeThread', 18, 64)>",
|
||||
"docstring": "Canonical internal representation of an email thread.\n\nA thread groups multiple related messages under a single subject\nand participant set. It is designed to support reasoning over\nconversational context such as job applications, interviews,\nfollow-ups, and ongoing discussions.\n\nThis model is provider-agnostic and safe to persist.",
|
||||
"members": {
|
||||
"thread_id": {
|
||||
"name": "thread_id",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.thread_id",
|
||||
"signature": null,
|
||||
"docstring": "Provider-specific thread identifier."
|
||||
},
|
||||
"normalized_subject": {
|
||||
"name": "normalized_subject",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.normalized_subject",
|
||||
"signature": null,
|
||||
"docstring": "Normalized subject line used to group related messages."
|
||||
},
|
||||
"participants": {
|
||||
"name": "participants",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.participants",
|
||||
"signature": null,
|
||||
"docstring": "Set of unique participant email addresses observed in the thread."
|
||||
},
|
||||
"messages": {
|
||||
"name": "messages",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.messages",
|
||||
"signature": null,
|
||||
"docstring": "Ordered list of messages belonging to this thread."
|
||||
},
|
||||
"last_activity_at": {
|
||||
"name": "last_activity_at",
|
||||
"kind": "attribute",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.last_activity_at",
|
||||
"signature": null,
|
||||
"docstring": "Timestamp of the most recent message in the thread."
|
||||
},
|
||||
"add_message": {
|
||||
"name": "add_message",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.models.thread.MailIntakeThread.add_message",
|
||||
"signature": "<bound method Function.signature of Function('add_message', 46, 64)>",
|
||||
"docstring": "Add a message to the thread and update derived fields.\n\nThis method:\n- Appends the message to the thread\n- Tracks unique participants\n- Updates the last activity timestamp\n\nArgs:\n message: Parsed mail message to add to the thread."
|
||||
}
|
||||
}
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.models.thread.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
mcp_docs/modules/mail_intake.parsers.body.json
Normal file
58
mcp_docs/modules/mail_intake.parsers.body.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"module": "mail_intake.parsers.body",
|
||||
"content": {
|
||||
"path": "mail_intake.parsers.body",
|
||||
"docstring": "Message body extraction utilities for Mail Intake.\n\nThis module contains helper functions for extracting a best-effort\nplain-text body from provider-native message payloads.\n\nThe logic is intentionally tolerant of malformed or partial data and\nprefers human-readable text over fidelity to original formatting.",
|
||||
"objects": {
|
||||
"base64": {
|
||||
"name": "base64",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.base64",
|
||||
"signature": "<bound method Alias.signature of Alias('base64', 'base64')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"BeautifulSoup": {
|
||||
"name": "BeautifulSoup",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.BeautifulSoup",
|
||||
"signature": "<bound method Alias.signature of Alias('BeautifulSoup', 'bs4.BeautifulSoup')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeParsingError": {
|
||||
"name": "MailIntakeParsingError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.parsers.body.MailIntakeParsingError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeParsingError', 'mail_intake.exceptions.MailIntakeParsingError')>",
|
||||
"docstring": "Errors encountered while parsing message content.\n\nRaised when raw provider payloads cannot be interpreted\nor normalized into internal domain models."
|
||||
},
|
||||
"extract_body": {
|
||||
"name": "extract_body",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.body.extract_body",
|
||||
"signature": "<bound method Function.signature of Function('extract_body', 77, 122)>",
|
||||
"docstring": "Extract the best-effort message body from a Gmail payload.\n\nPriority:\n1. text/plain\n2. text/html (stripped to text)\n3. Single-part body\n4. empty string (if nothing usable found)\n\nArgs:\n payload: Provider-native message payload dictionary.\n\nReturns:\n Extracted plain-text message body."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
mcp_docs/modules/mail_intake.parsers.headers.json
Normal file
51
mcp_docs/modules/mail_intake.parsers.headers.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"module": "mail_intake.parsers.headers",
|
||||
"content": {
|
||||
"path": "mail_intake.parsers.headers",
|
||||
"docstring": "Message header parsing utilities for Mail Intake.\n\nThis module provides helper functions for normalizing and extracting\nuseful information from provider-native message headers.\n\nThe functions here are intentionally simple and tolerant of malformed\nor incomplete header data.",
|
||||
"objects": {
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"List": {
|
||||
"name": "List",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.List",
|
||||
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Tuple": {
|
||||
"name": "Tuple",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Tuple",
|
||||
"signature": "<bound method Alias.signature of Alias('Tuple', 'typing.Tuple')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"parse_headers": {
|
||||
"name": "parse_headers",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.headers.parse_headers",
|
||||
"signature": "<bound method Function.signature of Function('parse_headers', 14, 53)>",
|
||||
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
|
||||
},
|
||||
"extract_sender": {
|
||||
"name": "extract_sender",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.headers.extract_sender",
|
||||
"signature": "<bound method Function.signature of Function('extract_sender', 56, 87)>",
|
||||
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
169
mcp_docs/modules/mail_intake.parsers.json
Normal file
169
mcp_docs/modules/mail_intake.parsers.json
Normal file
@@ -0,0 +1,169 @@
|
||||
{
|
||||
"module": "mail_intake.parsers",
|
||||
"content": {
|
||||
"path": "mail_intake.parsers",
|
||||
"docstring": "Message parsing utilities for Mail Intake.\n\nThis package contains **provider-aware but adapter-agnostic parsing helpers**\nused to extract and normalize structured information from raw mail payloads.\n\nParsers in this package are responsible for:\n- Interpreting provider-native message structures\n- Extracting meaningful fields such as headers, body text, and subjects\n- Normalizing data into consistent internal representations\n\nThis package does not:\n- Perform network or IO operations\n- Contain provider API logic\n- Construct domain models directly\n\nParsing functions are designed to be composable and are orchestrated by the\ningestion layer.",
|
||||
"objects": {
|
||||
"extract_body": {
|
||||
"name": "extract_body",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.extract_body",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_body', 'mail_intake.parsers.body.extract_body')>",
|
||||
"docstring": "Extract the best-effort message body from a Gmail payload.\n\nPriority:\n1. text/plain\n2. text/html (stripped to text)\n3. Single-part body\n4. empty string (if nothing usable found)\n\nArgs:\n payload: Provider-native message payload dictionary.\n\nReturns:\n Extracted plain-text message body."
|
||||
},
|
||||
"parse_headers": {
|
||||
"name": "parse_headers",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.parse_headers",
|
||||
"signature": "<bound method Alias.signature of Alias('parse_headers', 'mail_intake.parsers.headers.parse_headers')>",
|
||||
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
|
||||
},
|
||||
"extract_sender": {
|
||||
"name": "extract_sender",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.extract_sender",
|
||||
"signature": "<bound method Alias.signature of Alias('extract_sender', 'mail_intake.parsers.headers.extract_sender')>",
|
||||
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
|
||||
},
|
||||
"normalize_subject": {
|
||||
"name": "normalize_subject",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.normalize_subject",
|
||||
"signature": "<bound method Alias.signature of Alias('normalize_subject', 'mail_intake.parsers.subject.normalize_subject')>",
|
||||
"docstring": "Normalize an email subject for thread-level comparison.\n\nOperations:\n- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``\n- Repeats prefix stripping to handle stacked prefixes\n- Collapses excessive whitespace\n- Preserves original casing (no lowercasing)\n\nThis function is intentionally conservative and avoids aggressive\ntransformations that could alter the semantic meaning of the subject.\n\nArgs:\n subject: Raw subject line from a message header.\n\nReturns:\n Normalized subject string suitable for thread grouping."
|
||||
},
|
||||
"body": {
|
||||
"name": "body",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.parsers.body",
|
||||
"signature": null,
|
||||
"docstring": "Message body extraction utilities for Mail Intake.\n\nThis module contains helper functions for extracting a best-effort\nplain-text body from provider-native message payloads.\n\nThe logic is intentionally tolerant of malformed or partial data and\nprefers human-readable text over fidelity to original formatting.",
|
||||
"members": {
|
||||
"base64": {
|
||||
"name": "base64",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.base64",
|
||||
"signature": "<bound method Alias.signature of Alias('base64', 'base64')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Any": {
|
||||
"name": "Any",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Any",
|
||||
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"BeautifulSoup": {
|
||||
"name": "BeautifulSoup",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.body.BeautifulSoup",
|
||||
"signature": "<bound method Alias.signature of Alias('BeautifulSoup', 'bs4.BeautifulSoup')>",
|
||||
"docstring": null
|
||||
},
|
||||
"MailIntakeParsingError": {
|
||||
"name": "MailIntakeParsingError",
|
||||
"kind": "class",
|
||||
"path": "mail_intake.parsers.body.MailIntakeParsingError",
|
||||
"signature": "<bound method Alias.signature of Alias('MailIntakeParsingError', 'mail_intake.exceptions.MailIntakeParsingError')>",
|
||||
"docstring": "Errors encountered while parsing message content.\n\nRaised when raw provider payloads cannot be interpreted\nor normalized into internal domain models."
|
||||
},
|
||||
"extract_body": {
|
||||
"name": "extract_body",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.body.extract_body",
|
||||
"signature": "<bound method Function.signature of Function('extract_body', 77, 122)>",
|
||||
"docstring": "Extract the best-effort message body from a Gmail payload.\n\nPriority:\n1. text/plain\n2. text/html (stripped to text)\n3. Single-part body\n4. empty string (if nothing usable found)\n\nArgs:\n payload: Provider-native message payload dictionary.\n\nReturns:\n Extracted plain-text message body."
|
||||
}
|
||||
}
|
||||
},
|
||||
"headers": {
|
||||
"name": "headers",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.parsers.headers",
|
||||
"signature": null,
|
||||
"docstring": "Message header parsing utilities for Mail Intake.\n\nThis module provides helper functions for normalizing and extracting\nuseful information from provider-native message headers.\n\nThe functions here are intentionally simple and tolerant of malformed\nor incomplete header data.",
|
||||
"members": {
|
||||
"Dict": {
|
||||
"name": "Dict",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Dict",
|
||||
"signature": "<bound method Alias.signature of Alias('Dict', 'typing.Dict')>",
|
||||
"docstring": null
|
||||
},
|
||||
"List": {
|
||||
"name": "List",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.List",
|
||||
"signature": "<bound method Alias.signature of Alias('List', 'typing.List')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Tuple": {
|
||||
"name": "Tuple",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Tuple",
|
||||
"signature": "<bound method Alias.signature of Alias('Tuple', 'typing.Tuple')>",
|
||||
"docstring": null
|
||||
},
|
||||
"Optional": {
|
||||
"name": "Optional",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.headers.Optional",
|
||||
"signature": "<bound method Alias.signature of Alias('Optional', 'typing.Optional')>",
|
||||
"docstring": null
|
||||
},
|
||||
"parse_headers": {
|
||||
"name": "parse_headers",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.headers.parse_headers",
|
||||
"signature": "<bound method Function.signature of Function('parse_headers', 14, 53)>",
|
||||
"docstring": "Convert a list of Gmail-style headers into a normalized dict.\n\nProvider payloads (such as Gmail) typically represent headers as a list\nof name/value mappings. This function normalizes them into a\ncase-insensitive dictionary keyed by lowercase header names.\n\nArgs:\n raw_headers: List of header dictionaries, each containing\n ``name`` and ``value`` keys.\n\nReturns:\n Dictionary mapping lowercase header names to stripped values.\n\nExample:\n Input:\n [\n {\"name\": \"From\", \"value\": \"John Doe <john@example.com>\"},\n {\"name\": \"Subject\", \"value\": \"Re: Interview Update\"},\n ]\n\n Output:\n {\n \"from\": \"John Doe <john@example.com>\",\n \"subject\": \"Re: Interview Update\",\n }"
|
||||
},
|
||||
"extract_sender": {
|
||||
"name": "extract_sender",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.headers.extract_sender",
|
||||
"signature": "<bound method Function.signature of Function('extract_sender', 56, 87)>",
|
||||
"docstring": "Extract sender email and optional display name from headers.\n\nThis function parses the ``From`` header and attempts to extract:\n- Sender email address\n- Optional human-readable display name\n\nArgs:\n headers: Normalized header dictionary as returned by\n :func:`parse_headers`.\n\nReturns:\n A tuple ``(email, name)`` where:\n - ``email`` is the sender email address\n - ``name`` is the display name, or ``None`` if unavailable\n\nExamples:\n ``\"John Doe <john@example.com>\"`` → ``(\"john@example.com\", \"John Doe\")``\n ``\"john@example.com\"`` → ``(\"john@example.com\", None)``"
|
||||
}
|
||||
}
|
||||
},
|
||||
"subject": {
|
||||
"name": "subject",
|
||||
"kind": "module",
|
||||
"path": "mail_intake.parsers.subject",
|
||||
"signature": null,
|
||||
"docstring": "Subject line normalization utilities for Mail Intake.\n\nThis module provides helper functions for normalizing email subject lines\nto enable reliable thread-level comparison and grouping.\n\nNormalization is intentionally conservative to avoid altering semantic\nmeaning while removing common reply and forward prefixes.",
|
||||
"members": {
|
||||
"re": {
|
||||
"name": "re",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.subject.re",
|
||||
"signature": "<bound method Alias.signature of Alias('re', 're')>",
|
||||
"docstring": null
|
||||
},
|
||||
"normalize_subject": {
|
||||
"name": "normalize_subject",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.subject.normalize_subject",
|
||||
"signature": "<bound method Function.signature of Function('normalize_subject', 18, 52)>",
|
||||
"docstring": "Normalize an email subject for thread-level comparison.\n\nOperations:\n- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``\n- Repeats prefix stripping to handle stacked prefixes\n- Collapses excessive whitespace\n- Preserves original casing (no lowercasing)\n\nThis function is intentionally conservative and avoids aggressive\ntransformations that could alter the semantic meaning of the subject.\n\nArgs:\n subject: Raw subject line from a message header.\n\nReturns:\n Normalized subject string suitable for thread grouping."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
mcp_docs/modules/mail_intake.parsers.subject.json
Normal file
23
mcp_docs/modules/mail_intake.parsers.subject.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"module": "mail_intake.parsers.subject",
|
||||
"content": {
|
||||
"path": "mail_intake.parsers.subject",
|
||||
"docstring": "Subject line normalization utilities for Mail Intake.\n\nThis module provides helper functions for normalizing email subject lines\nto enable reliable thread-level comparison and grouping.\n\nNormalization is intentionally conservative to avoid altering semantic\nmeaning while removing common reply and forward prefixes.",
|
||||
"objects": {
|
||||
"re": {
|
||||
"name": "re",
|
||||
"kind": "alias",
|
||||
"path": "mail_intake.parsers.subject.re",
|
||||
"signature": "<bound method Alias.signature of Alias('re', 're')>",
|
||||
"docstring": null
|
||||
},
|
||||
"normalize_subject": {
|
||||
"name": "normalize_subject",
|
||||
"kind": "function",
|
||||
"path": "mail_intake.parsers.subject.normalize_subject",
|
||||
"signature": "<bound method Function.signature of Function('normalize_subject', 18, 52)>",
|
||||
"docstring": "Normalize an email subject for thread-level comparison.\n\nOperations:\n- Strips common prefixes such as ``Re:``, ``Fwd:``, and ``FW:``\n- Repeats prefix stripping to handle stacked prefixes\n- Collapses excessive whitespace\n- Preserves original casing (no lowercasing)\n\nThis function is intentionally conservative and avoids aggressive\ntransformations that could alter the semantic meaning of the subject.\n\nArgs:\n subject: Raw subject line from a message header.\n\nReturns:\n Normalized subject string suitable for thread grouping."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
90
mcp_docs/nav.json
Normal file
90
mcp_docs/nav.json
Normal file
@@ -0,0 +1,90 @@
|
||||
[
|
||||
{
|
||||
"module": "mail_intake",
|
||||
"resource": "doc://modules/mail_intake"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.adapters",
|
||||
"resource": "doc://modules/mail_intake.adapters"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.adapters.base",
|
||||
"resource": "doc://modules/mail_intake.adapters.base"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.adapters.gmail",
|
||||
"resource": "doc://modules/mail_intake.adapters.gmail"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.auth",
|
||||
"resource": "doc://modules/mail_intake.auth"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.auth.base",
|
||||
"resource": "doc://modules/mail_intake.auth.base"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.auth.google",
|
||||
"resource": "doc://modules/mail_intake.auth.google"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.config",
|
||||
"resource": "doc://modules/mail_intake.config"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.credentials",
|
||||
"resource": "doc://modules/mail_intake.credentials"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.credentials.pickle",
|
||||
"resource": "doc://modules/mail_intake.credentials.pickle"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.credentials.redis",
|
||||
"resource": "doc://modules/mail_intake.credentials.redis"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.credentials.store",
|
||||
"resource": "doc://modules/mail_intake.credentials.store"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.exceptions",
|
||||
"resource": "doc://modules/mail_intake.exceptions"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.ingestion",
|
||||
"resource": "doc://modules/mail_intake.ingestion"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.ingestion.reader",
|
||||
"resource": "doc://modules/mail_intake.ingestion.reader"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.models",
|
||||
"resource": "doc://modules/mail_intake.models"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.models.message",
|
||||
"resource": "doc://modules/mail_intake.models.message"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.models.thread",
|
||||
"resource": "doc://modules/mail_intake.models.thread"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.parsers",
|
||||
"resource": "doc://modules/mail_intake.parsers"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.parsers.body",
|
||||
"resource": "doc://modules/mail_intake.parsers.body"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.parsers.headers",
|
||||
"resource": "doc://modules/mail_intake.parsers.headers"
|
||||
},
|
||||
{
|
||||
"module": "mail_intake.parsers.subject",
|
||||
"resource": "doc://modules/mail_intake.parsers.subject"
|
||||
}
|
||||
]
|
||||
32
mcp_server.py
Normal file
32
mcp_server.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
MCP_ROOT = Path("mcp")
|
||||
|
||||
mcp = FastMCP("aetoskia-mail-intake-docs")
|
||||
|
||||
def read_json(path: Path):
|
||||
if not path.exists():
|
||||
return {"error": "not_found", "path": str(path)}
|
||||
return json.loads(path.read_text())
|
||||
|
||||
@mcp.resource("docs://index")
|
||||
def index():
|
||||
return read_json(MCP_ROOT / "index.json")
|
||||
|
||||
@mcp.resource("docs://nav")
|
||||
def nav():
|
||||
return read_json(MCP_ROOT / "nav.json")
|
||||
|
||||
@mcp.resource("docs://module/{module}")
|
||||
def module(module: str):
|
||||
return read_json(MCP_ROOT / "modules" / f"{module}.json")
|
||||
|
||||
@mcp.tool()
|
||||
def ping() -> str:
|
||||
return "Pong! (fake tool executed)"
|
||||
|
||||
if __name__ == "__main__":
|
||||
# FastMCP owns the HTTP server
|
||||
mcp.run(transport="streamable-http")
|
||||
67
mkdocs.yml
Normal file
67
mkdocs.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
site_name: Aetoskia Mail Intake
|
||||
site_description: Format-agnostic document reading, parsing, and scraping framework
|
||||
|
||||
theme:
|
||||
name: material
|
||||
palette:
|
||||
- scheme: slate
|
||||
primary: deep purple
|
||||
accent: cyan
|
||||
font:
|
||||
text: Inter
|
||||
code: JetBrains Mono
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.expand
|
||||
- navigation.top
|
||||
- navigation.instant
|
||||
- content.code.copy
|
||||
- content.code.annotate
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- mkdocstrings:
|
||||
handlers:
|
||||
python:
|
||||
paths:
|
||||
- .
|
||||
options:
|
||||
docstring_style: google
|
||||
show_source: false
|
||||
show_signature_annotations: true
|
||||
separate_signature: true
|
||||
merge_init_into_class: true
|
||||
inherited_members: true
|
||||
annotations_path: brief
|
||||
show_root_heading: true
|
||||
group_by_category: true
|
||||
|
||||
nav:
|
||||
- Home: mail_intake/index.md
|
||||
- Core API:
|
||||
- mail_intake/ingestion/index.md
|
||||
- mail_intake/ingestion/reader.md
|
||||
- Domain Models:
|
||||
- mail_intake/models/index.md
|
||||
- mail_intake/models/message.md
|
||||
- mail_intake/models/thread.md
|
||||
- Provider Adapters:
|
||||
- mail_intake/adapters/index.md
|
||||
- mail_intake/adapters/base.md
|
||||
- mail_intake/adapters/gmail.md
|
||||
- Authentication & Storage:
|
||||
- mail_intake/auth/index.md
|
||||
- mail_intake/auth/base.md
|
||||
- mail_intake/auth/google.md
|
||||
- mail_intake/credentials/index.md
|
||||
- mail_intake/credentials/store.md
|
||||
- mail_intake/credentials/pickle.md
|
||||
- mail_intake/credentials/redis.md
|
||||
- Normalization & Parsing:
|
||||
- mail_intake/parsers/index.md
|
||||
- mail_intake/parsers/body.md
|
||||
- mail_intake/parsers/headers.md
|
||||
- mail_intake/parsers/subject.md
|
||||
- Configuration & Errors:
|
||||
- mail_intake/config.md
|
||||
- mail_intake/exceptions.md
|
||||
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "mail-intake"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
description = "Structured mail ingestion and correspondence parsing with provider adapters (Gmail-first)."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
@@ -77,11 +77,7 @@ Versions = "https://git.aetoskia.com/aetos/mail-intake/tags"
|
||||
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = { "" = "src" }
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["src"]
|
||||
include = ["mail_intake*"]
|
||||
packages = { find = { include = ["mail_intake*"] } }
|
||||
|
||||
|
||||
[tool.ruff]
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
beautifulsoup4==4.12.0
|
||||
|
||||
pytest==7.4.0
|
||||
pytest-asyncio==0.21.0
|
||||
pytest-cov==4.1.0
|
||||
|
||||
types-beautifulsoup4
|
||||
|
||||
# Optional, useful locally
|
||||
ipython
|
||||
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from mail_intake.models.message import MailIntakeMessage
|
||||
from mail_intake.models.thread import MailIntakeThread
|
||||
from mail_intake.models import MailIntakeMessage
|
||||
from mail_intake.models import MailIntakeThread
|
||||
|
||||
|
||||
def test_message_is_immutable():
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import base64
|
||||
|
||||
from mail_intake.parsers.subject import normalize_subject
|
||||
from mail_intake.parsers.headers import parse_headers, extract_sender
|
||||
from mail_intake.parsers.body import extract_body
|
||||
from mail_intake.parsers import normalize_subject
|
||||
from mail_intake.parsers import parse_headers, extract_sender
|
||||
from mail_intake.parsers import extract_body
|
||||
|
||||
|
||||
def _b64(text: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user