"""Middleware base class — before/after hooks around graph execution.""" from __future__ import annotations from abc import ABC, abstractmethod from app.graph.state import ReportState class Middleware(ABC): """Base middleware. Subclasses override before() and/or after().""" name: str = "base" enabled: bool = True async def before(self, state: ReportState) -> ReportState: """Called before graph execution. Modify state as needed.""" return state async def after(self, state: ReportState) -> ReportState: """Called after graph execution. Modify state as needed.""" return state