Files
phamnazage-jpg 71cbaf5fa6 test(project): achieve ≥70% package coverage across all internal packages
- store/sqlite: 75.4% (repos + db coverage)
- host/sub2api: 80.8% (httptest mock server, pure function tests)
- app: 74.2% (handler error paths, NewActionSet closures)
- pack: 72.4%
- provision: 75.2%
- access: 77.3%
- config: 94.7% (lookup mock tests)

All tests pass: build, vet, race, coverage gates.
2026-05-15 19:26:25 +08:00

46 lines
1.5 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.
# sub2api-cn-relay-manager PRDMVP
日期2026-05-13
## 目标
在**完全不修改 sub2api 官方系统代码**的前提下,交付一个可独立打包运行的外部伴生项目,使管理员能够通过一次导入动作,把国产模型 OpenAI 兼容中转能力安装到任意一套兼容的 sub2api 实例中。
## 硬约束
1. 不修改宿主源码
2. 不 fork 宿主并运行私有二进制
3. 不直接写宿主数据库
4. 不向宿主目录注入插件代码或补丁文件
5. 仅通过宿主现有 HTTP 管理 API 与标准 API 工作
## 首版验收
1. `model_pack` 可独立校验与装载
2. CLI 可直接读取 pack、选择 provider、导入多条 key
3. 导入流程能创建 group / channel / plansubscription 模式)/ accounts
4. 至少一个 account 完成 `/test``/models` 验证
5. 至少一种普通用户访问路径被真实探测:`GET /v1/models`
6. 失败时明确区分:`succeeded / partially_succeeded / failed`
## 首版边界
### 做
- pack runtime
- provider schema 校验
- 多 key 去重与批量导入
- subscription/self-service 两种访问模式建模
- CLI 一键导入
- 基于 stub 的端到端测试
### 暂不做
- Web 控制台
- 多宿主管理
- 自动代用户签发最终 API key
- 对账调度器完整实现
- 真实宿主删除/回滚链路
## 当前实现策略
首版先把“可独立打包 + 零侵入导入 + 用户访问验证”做成最小闭环状态库、HTTP 控制面、对账调度在此基础上继续扩展。