"""中间件模块.

提供：
  - request_id: 请求 ID 注入与传播
  - error_handler: 全局错误处理（AIError → ActionState）
  - auth: 用户上下文提取（JWT claims 从 Gateway/BFF 透传）
  - permission: 权限校验守卫
"""

from .auth import UserContext, extract_user_context
from .error_handler import GlobalErrorHandler, register_error_handlers
from .permission import PermissionGuard, require_permission
from .request_id import RequestIdMiddleware

__all__ = [
    "UserContext",
    "extract_user_context",
    "GlobalErrorHandler",
    "register_error_handlers",
    "PermissionGuard",
    "require_permission",
    "RequestIdMiddleware",
]
