feat: 支持 provider profile config.toml 管理

This commit is contained in:
Codex
2026-06-05 22:35:40 +08:00
parent 17e9cd3995
commit dd58cf9a8e
5 changed files with 163 additions and 3 deletions
@@ -40,12 +40,14 @@ Provider profile 管理 API 属于 `agentrun-mgr` 公共 REST API 的服务端
```http
GET /api/v1/provider-profiles
GET /api/v1/provider-profiles/:profile
GET /api/v1/provider-profiles/:profile/config
PUT /api/v1/provider-profiles/:profile/config
PUT /api/v1/provider-profiles/:profile/credential
POST /api/v1/provider-profiles/:profile/validate
GET /api/v1/provider-profiles/:profile/validations/:validationId
```
所有成功和失败响应都必须是 JSON。失败响应至少包含 `failureKind``message``requestId`所有响应不得包含 API Key 原文、Codex `auth.json` 明文、Codex `config.toml` 明文、base64 Secret data、Authorization header、Kubernetes token 或 provider request header。
所有成功和失败响应都必须是 JSON。失败响应至少包含 `failureKind``message``requestId`除显式 `GET /api/v1/provider-profiles/:profile/config` 返回 `config.toml` 明文供 HWLAB admin 管理页查看外,其他响应不得包含 API Key 原文、Codex `auth.json` 明文、Codex `config.toml` 明文、base64 Secret data、Authorization header、Kubernetes token 或 provider request header。
### `GET /api/v1/provider-profiles`
@@ -63,6 +65,10 @@ GET /api/v1/provider-profiles/:profile/validations/:validationId
Secret 缺失时仍要返回 profile capability,并把状态标为 `configured=false``failureKind=secret-unavailable`;不得因为 Secret 未配置而隐藏 profile。
### `GET/PUT /api/v1/provider-profiles/:profile/config`
`GET` 返回当前 profile 的 `configToml`、SecretRef、resourceVersion 和 hash 后缀,供 HWLAB admin 管理页查看。`PUT` 接收 `configToml`,保存时只替换同一 Secret 的 `config.toml`,保留现有 `auth.json`,并返回 resourceVersion 和 `configHashSuffix`
### `PUT /api/v1/provider-profiles/:profile/credential`
请求体由 HWLAB 后端或受控 CLI 发送,最小形态:
@@ -143,7 +149,9 @@ AgentRun CLI 提供 operator 和综合联调入口:
```bash
./scripts/agentrun provider-profiles list
./scripts/agentrun provider-profiles show deepseek
./scripts/agentrun provider-profiles config deepseek
./scripts/agentrun provider-profiles set-key deepseek --key-stdin
./scripts/agentrun provider-profiles set-config deepseek --config-stdin
./scripts/agentrun provider-profiles validate deepseek --wait --timeout-ms 120000
```