# api/sealai/ — SealAI 传输层 ## 职责边界 - **薄层封装**:只做 HTTP 请求发送和 Pydantic 响应解析,不做业务判断。 - **不被上层直接调用**:仅供 `services/sealai/` 调用,commands 和 server 不得直接引用本层业务函数。 ## 模块说明 | 模块 | 封装的 API | |---|---| | `client.py` | `SealAiClient`:Bearer JWT 认证的 httpx 客户端 | | `schemas.py` | 所有 Pydantic 模型(响应模型 + Server 请求模型) | | `auth_api.py` | `GET /api/v1/auth/me` → `get_me()` | | `billing_api.py` | `GET /api/v1/billing/status` → `get_billing_status()` | | `rules_api.py` | `/api/v1/rules` 系列(草稿 CRUD + 版本发布) | | `preference_api.py` | `GET/POST /api/v1/agent/ai-approval/config` | | `knowledge_api.py` | `/api/v1/knowledge/articles` 系列 | ## SealAiClient ```python class SealAiClient: base_url: str # https://{corp_id.lower()}.sealai.cc bearer_token: str ``` 所有 API 函数签名:`fn(client: SealAiClient, ...) -> ResponseModel` ## schemas.py 结构 ``` schemas.py ├── 通用包装:SealAiResponse[T] ├── 认证:SealAiUser / SealAiTenant / MeData ├── 计费:Subscription / Feature / BillingStatusData ├── 审核规则草稿:DraftRule / DraftRulesData ├── 已发布版本:RuleSetVersion / PublishVersionData ├── 风格偏好:DecisionPreferences / AiApprovalConfig / AiApprovalSaveResult ├── 知识文档:KnowledgeArticle / KnowledgeArticleListData └── Server 请求模型:RuleCreateRequest / RuleUpdateRequest / PublishVersionRequest / DecisionPreferencesUpdateRequest / ArticleCreateRequest / ArticleUpdateRequest ``` ## 已知 API 路径 详见 `services/sealai/README.sealai.md` 及各 `*_api.py` 文件顶部 docstring。