Files
xc_agent_platform_demo/docs/api-probe-design.md
Victor Cao bed3bc11ca Phase2 dry-run: pending A, probe, build-config client, gated task/add
Still default dry-run; ALLOW_LIVE_SUBMIT=0. Live gates closed.
2026-10-16 19:00:15 +08:00

44 lines
2.2 KiB
Markdown
Raw 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.

# API 探针设计(只读意图 · 禁止代调写接口)
- 日期:2026-10-16 Asia/Shanghai
- Phase2:客户端已实现但默认不调用;本轮禁止真实 task/add
## 管理 API `/agent_platform/strategies*`
| 方法 | 路径 | 本仓态度 |
|------|------|----------|
| POST | `/agent_platform/strategies` | **禁止代调**(注册) |
| POST | `.../{id}/deploy` | **禁止代调** |
| POST | `.../{id}/stop` | **禁止代调** |
| DELETE | `.../{id}` | **禁止代调** |
| GET | `.../{id}` | 未来只读探针可选(Phase3+,需 Victor 授权) |
| GET | `.../{id}/logs` | 未来只读探针可选 |
鉴权(浏览器):`Authorization: Bearer <login token>`(等级 A)。
## 适配任务 API
| 方法 | 路径 | 本仓态度 |
|------|------|----------|
| GET | `/api/adapt/task/page` | 未来只读鉴权探针(对齐 huni-probe,`ALLOW_SUBMIT=0`) |
| POST | `/api/adapt/task/build-config` | 设计可引用;Phase1 不实现 |
| POST | `/api/adapt/task/add` | 显式注入客户端 + 双闸门;本轮只做 mock 测试 |
| GET | `/api/adapt/task/calculate-credit` | 只读索引;勿写死 KPI |
容器内社区鉴权(C):`Xc-Token` + body `strategyId` — **待 Victor 账号核实**;60014 仍为 **D(unverified)**。
## Phase2 落地边界
- `src/gate.py`:闸门逻辑 + `attempt_live_submit(..., client=Fake)` ;真实客户端只能显式注入,测试必须 mock HTTP
- `src/task_add_client.py` 使用 urllib;import 和 dry-run 无网络调用,无自动重试
- token 优先级:XC_TOKEN_FILE → XC_TOKEN → MODELHUB_XC_TOKEN → EXTERNAL_SERVICE_TOKEN;禁止输出 token
- build_payload 中 GPU/framework/strategyId/configParams 占位须人工替换;真实调用要求 STRATEGY_ID 与 payload 一致
- 队列 ≥95 阻断;无效队列提示也阻断;每进程一次调用预算在调用前保留,异常也不重试(防止响应丢失造成重复创建)
- 名称/族硬门不能证明元数据 PASS;未跳过的 pending 行均标 needs_human
- 仍禁止所有 agent_platform 写接口
- Makefile **无** register / submit / deploy / push
## 冲突裁决提醒
适配 W1:队列 ≥95 → 禁 live;智能体不抢验证空位。