forked from luopingyi/xc_agent_platform_demo
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:
62
docs/platform-contract-agent.md
Normal file
62
docs/platform-contract-agent.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# 平台契约 — 适配智能体(Phase1)
|
||||
|
||||
- 日期:2026-10-16 Asia/Shanghai
|
||||
- 依据:产品规划 `agent-product-plan-2026-10-16.md` §1 + PRD `02-agent-contribution-prd.md`
|
||||
- **冲突裁决:适配 W1 优先**(队列 ≥95 禁 live;本骨架默认 dry-run)
|
||||
|
||||
## 核实等级
|
||||
|
||||
| 等级 | 含义 |
|
||||
|------|------|
|
||||
| **A** | 官方演示仓 / 主站前端明文 |
|
||||
| **B** | PRD 已核实(docs/6 + 控制台,基线 2026-10-12) |
|
||||
| **C** | 社区样例,非平台承诺 |
|
||||
| **D** | 待核实 |
|
||||
|
||||
## 运行契约
|
||||
|
||||
| 项 | 内容 | 等级 |
|
||||
|----|------|------|
|
||||
| 代码托管 | `dev.modelhub.org.cn` 用户仓 | B |
|
||||
| 注册 UI | 名称、仓库地址、**Git Tag**(不可用分支名) | B |
|
||||
| 构建 | 平台 Kaniko,`refs/tags/<tag>` | B |
|
||||
| Dockerfile | **仓库根目录**;base `modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim` | A |
|
||||
| 端口 | **8080**,`EXPOSE 8080` | A |
|
||||
| 健康检查 | `GET /health` → 200 `{"status":"ok"}` | A |
|
||||
| 可选状态 | `GET /status` → 布尔 `strategy_id_present` / `external_service_token_present`(**不回传值**) | 本仓 Phase1 |
|
||||
| 优雅退出 | `SIGTERM`,约 **≤30s** 平台窗口;本实现目标 ~1s 退出主循环 | B |
|
||||
| 平台注入 | `STRATEGY_ID`;`EXTERNAL_SERVICE_TOKEN`(及社区别名) | A/B |
|
||||
| **STRATEGY_ID 缺失** | **Phase1:进程启动失败(exit ≠0)** | 产品规划 Phase1 + PRD |
|
||||
| 资源 | 约 100m–1 CPU / 256–512Mi | B |
|
||||
| **发布智能体得分** | **0 分**(发布 ≠ 得分) | B |
|
||||
| Live 默认 | **关**;双重闸门 `ALLOW_LIVE_SUBMIT=1` + `LIVE_CONFIRM=I_CONFIRM_LIVE_SUBMIT` | 本仓 |
|
||||
| 积分 | 来自**成功适配**;智能体代提成功计同一成功分;公式/周报 **待平台核实** | B / D |
|
||||
|
||||
## 鉴权双轨(文档索引,Phase1 不代调)
|
||||
|
||||
| 场景 | 头 | 等级 |
|
||||
|------|----|------|
|
||||
| 浏览器 / `agent_platform` | `Authorization: Bearer <login token>` | A |
|
||||
| 容器内社区实践 | `Xc-Token: <token>`;body 带 `strategyId` | C |
|
||||
|
||||
## 禁止
|
||||
|
||||
- 代注册、代 live 提交、Makefile 含 register/submit/deploy/push
|
||||
- 日志/响应/镜像层写入 token 或 STRATEGY_ID **值**
|
||||
- 把「智能体已发布」写入千分进度
|
||||
|
||||
## 冲突裁决(强制)
|
||||
|
||||
| 资源 | 裁决 |
|
||||
|------|------|
|
||||
| 异步验证队列 | 适配 W1 优先;≥95 全体停交(含智能体 live) |
|
||||
| Codex | hold 期扩池/归因 > 智能体脚手架 |
|
||||
| 本骨架 | 默认 dry-run;本轮无真实 `task/add` HTTP 客户端 |
|
||||
|
||||
## 闸门配置以实现为准
|
||||
|
||||
`src/gate.py` 只接受 `ALLOW_LIVE_SUBMIT=1` 与
|
||||
`LIVE_CONFIRM=I_CONFIRM_LIVE_SUBMIT`(去除首尾空白后精确匹配)。
|
||||
PRD 的 `ALLOW_LIVE_SUBMIT=true` / `CONFIRM_LIVE=YES` 仅为需求示例,
|
||||
本仓不支持这些值/别名,也不读取确认文件。开闸无客户端仍 blocked。
|
||||
这只是本地逻辑闸门,不代表已获 live 授权或已校验队列与候选硬门。
|
||||
Reference in New Issue
Block a user