Phase1 skeleton: replace demo main.py with src.server contract

- Overlay ModelHub XC Phase1 (health/status, STRATEGY_ID gate, dry-run)
- Dockerfile CMD -> python -m src.server; FROM stays platform TCR base
- Remove demo main.py and requirements.txt (stdlib only)
- Add tests/, scripts/, docs/, Makefile, config/examples (no secrets)
This commit is contained in:
VC_noSugar
2026-10-16 15:47:10 +08:00
parent 26351cefee
commit 0d0f3b611a
31 changed files with 1436 additions and 106 deletions

39
docs/register-runbook.md Normal file
View File

@@ -0,0 +1,39 @@
# 注册智能体 Runbook(仅人工 · Victor)
> Agent / Bot **不代填、不代点、不代调写接口**。
## 流程
1. **本地绿**:`make test`(及有 Docker 时 `make build` + `make smoke-health`)
2. **Gitea 建仓**(Victor):`dev.modelhub.org.cn/<namespace>/<repo>`
- 命名空间/仓名 **未定**时:仅本地验收,不阻塞 Phase1
3. **推送代码**(Victor 本人):本 Makefile **无 push 目标**
4. **打 Git Tag**(可用本仓 `scripts/tag_release.py` **仅本地 tag**;push tag 由 Victor 执行)
5. **控制台新增**:个人主页 → 我的适配智能体 → 新增
- 名称
- 仓库地址(远程 Git URL)
- **Git Tag**(须先出现在远程;`GET .../tags` 下拉可选后再填)
6. **Kaniko 构建**:等待状态;证据同时记中文文案与枚举(`building` / `ready` / `failed` / `running` / `stopped`)
7. **部署后**:确认容器 `GET /health` → 200;积分应 **无变化**(发布 = 0 分)
## POST `/agent_platform/strategies`(文档说明 · 禁止代调)
| 字段 | 说明 |
|------|------|
| `name` | 策略显示名 |
| `repo_url` | Gitea 仓库 URL |
| `tag` | Git Tag(非分支) |
成功响应含 `.id`(等级 A:前端 bundle)。
**本仓与 Agent 禁止代调该写接口。**
相关写接口(同样禁止代调):`/{id}/deploy`、`/{id}/stop`、`DELETE /{id}`。
## 环境变量(平台注入 / 控制台)
| 变量 | 说明 |
|------|------|
| `STRATEGY_ID` | 策略 id;本仓启动必需 |
| `EXTERNAL_SERVICE_TOKEN` | 服务凭证;只检存在,不记值 |
| `ALLOW_LIVE_SUBMIT` | 默认 `0` |
| `LIVE_CONFIRM` | live 时须为 `I_CONFIRM_LIVE_SUBMIT` |