aps-agent/aps/docs/endpoint-split.md

141 lines
4.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 端点分流清单(B1 第一步)
> 数据来自 `main` 分支的 FastAPI 路由装饰器,2026-09-30 实测 245 个端点。归属按 `docs/spec/platform-vs-business.md` 的判据判定:**业务事实 → APS;平台基础能力 → 平台;与第三方系统的对接 → 独立 Provider**。
## 0 提取方式(可复现)
```bash
# 在 main 分支上扫描所有 @app/@router 装饰器
git grep -n -E '^\s*@(app|router)\.(get|post|put|patch|delete)\(' main -- server | wc -l
```
## 1 总量
| 归属 | 端点数 | 占比 | 去向 |
| --- | --- | --- | --- |
| APS | 143 | 58.4% | 迁进 `aps/src/aps/api`(B1) |
| 平台 | 64 | 26.1% | 由平台 TS 侧重写(不搬代码) |
| 第三方 Provider | 13 | 5.3% | 拆成独立 Provider(A8 / B 线) |
| 丢弃 | 25 | 10.2% | 不迁移 |
| **合计** | **245** | 100% | — |
> 任务表 B1 里写的「210 个端点」指的是 `server/gateway/app.py` 这一个文件里的数量;全仓(含 `masterdata_api` / `governance_api` / `mps_api` / `plan_api` / `agent_api` 等子路由)是 245 个。
## 2 APS 侧清单(迁入 aps/)
共 143 个端点,分 42 组:
| 资源组 | 端点数 | 方法 |
| --- | --- | --- |
| `flex` | 16 | GET / POST |
| `gov` | 12 | GET / POST |
| `drawings` | 8 | DELETE / GET / POST |
| `rules` | 8 | DELETE / GET / POST / PUT |
| `plan` | 7 | GET |
| `params` | 7 | GET / POST |
| `mesh` | 7 | GET / POST |
| `*`(`/plans/{plan_id}/...` 挂载路由) | 6 | GET / POST |
| `dxf` | 5 | GET / POST |
| `saga` | 5 | GET / POST |
| `world` | 4 | GET |
| `schedule` | 4 | POST |
| `rebuild` | 4 | GET / POST |
| `orders` | 3 | GET / POST |
| `master` | 3 | GET / POST |
| `mrp` | 3 | GET / POST |
| `analytics` | 3 | GET |
| `sop` | 3 | GET / POST |
| `calendar` | 3 | GET / POST |
| `forecast` | 2 | GET / POST |
| `rush` | 2 | POST |
| `multimodal` | 2 | POST |
| `times` | 2 | GET / POST |
| `constraints` | 2 | GET / POST |
| `checkpoints` | 2 | GET |
| `reports` | 2 | GET |
| `resources` | 2 | GET |
| `trace` | 2 | GET / POST |
| `readiness` | 1 | GET |
| `attribution` | 1 | GET |
| `guidance` | 1 | GET |
| `scenario` | 1 | GET |
| `timeline` | 1 | GET |
| `versions` | 1 | GET |
| `stage` | 1 | POST |
| `confirm` | 1 | POST |
| `pending` | 1 | GET |
| `draft` | 1 | POST |
| `persist` | 1 | POST |
| `traces` | 1 | GET |
| `schedule-versions` | 1 | GET |
| `gap` | 1 | POST |
## 3 平台侧清单(平台重写,不搬代码)
共 64 个端点,分 17 组:
| 资源组 | 端点数 | 方法 |
| --- | --- | --- |
| `projects` | 12 | DELETE / GET / PATCH / POST |
| `sessions` | 12 | DELETE / GET / PATCH / POST / PUT |
| `auth` | 9 | GET / POST |
| `knowledge` | 6 | GET / POST |
| `jobs` | 4 | GET / POST |
| `templates` | 3 | GET / POST |
| `settings` | 3 | GET / POST |
| `intents` | 2 | GET |
| `health` | 2 | GET |
| `import` | 2 | POST |
| `workspace` | 2 | GET / PUT |
| `project-files` | 2 | DELETE / POST |
| `features` | 1 | GET |
| `chat` | 1 | POST |
| `packs` | 1 | GET |
| `rag` | 1 | POST |
| `system` | 1 | GET |
## 4 第三方 Provider(从 APS 里剥出来)
> 这一组按判据第 3 条单列:它们是与 SAP / MES / WMS 的对接,不是 APS 自己的业务。B 线拆分时搬成各自的 Provider(A8)。
共 13 个端点,分 3 组:
| 资源组 | 端点数 | 方法 |
| --- | --- | --- |
| `sap` | 5 | GET / POST |
| `mes` | 5 | GET / POST |
| `wms` | 3 | GET / POST |
## 5 丢弃
共 25 个端点,分 6 组:
| 资源组 | 端点数 | 方法 |
| --- | --- | --- |
| `skills` | 8 | GET / POST |
| `mcp` | 8 | GET / POST |
| `actions` | 4 | POST |
| `integrations` | 2 | GET / POST |
| `automation` | 2 | GET / POST |
| `invoke` | 1 | POST |
## 6 迁移顺序建议
| 批次 | 内容 | 理由 |
| --- | --- | --- |
| 1 | APS 侧的**只读**端点:`master` / `orders` / `calendar` / `params` / `analytics` / `reports` / `views` / `plan`(GET) | 对应契约草案里的 7 个只读能力,B5 与 A5 都要用 |
| 2 | APS 侧的求解与闭环:`schedule` / `flex` / `mrp` / `mps` / `saga` / `world` / `checkpoints` / `rebuild` | 需要 `engines` 与 `state` 一起搬 |
| 3 | APS 侧的图纸与导入:`drawings` / `dxf` / `multimodal` / `times` | 依赖解析类依赖,独立可搬 |
| 4 | APS 侧治理:`gov` / `rules` | 由 B4 重写,不搬旧实现 |
| 5 | 第三方 Provider:`sap` / `mes` / `wms` | 与 APS 解耦后再做(A8) |
## 7 交叉引用检查(B1 验收的另一半)
分流完成后要能证明「无交叉引用」:
| 检查 | 方式 |
| --- | --- |
| APS 不 import 平台 | `pytest` 里的 AST 守卫(B0 已加) |
| 平台不 import APS | 平台 `pnpm check:deps` + 跨库访问检查(A1.6 已实现) |
| 路由清单与代码一致 | 迁移后重新跑本文的提取脚本,比对数量与分组 |