docs: 固化 AgentRun Queue 吸收 Code Queue 规格

This commit is contained in:
Codex
2026-06-01 21:41:21 +08:00
parent 7a152d3061
commit 1a92951324
10 changed files with 234 additions and 20 deletions
+20
View File
@@ -5,6 +5,8 @@ AgentRun CLI 是 `v0.1` 的受控人工操作和验收入口。它必须遵循 U
## 在系统中的职责划分
- 创建 run、查询 run、提交 command、查询 command、分页读取 events。
- 创建和查询 Queue task,查看 Queue stats/read/commander,并从 Queue task 获取 Session 引用。
- 查询 Session 输出、trace 和会话控制;Queue 命令不得代理输出或 trace。
- 手动启动 runner,本地 process 或 Kubernetes Job 均必须快速返回 job/process identity 和 logPath。
- 查询 backend capability 和 manager health。
- 为综合联调提供 CLI 交互面;不得替代 RESTful API 合同测试。
@@ -49,6 +51,17 @@ CLI 官方 TypeScript 入口固定为 `scripts/agentrun-cli.ts`。在 G14 非交
./scripts/agentrun secrets codex render --dry-run [--profile codex|deepseek] [--codex-home <dir>]
./scripts/agentrun backends list
./scripts/agentrun server start|status
./scripts/agentrun queue submit --json-file <task.json>
./scripts/agentrun queue list [--queue <queue>] [--state <state>] [--cursor <cursor>] [--limit <limit>]
./scripts/agentrun queue show <taskId>
./scripts/agentrun queue stats [--queue <queue>]
./scripts/agentrun queue commander [--queue <queue>]
./scripts/agentrun queue read <taskId>
./scripts/agentrun queue cancel <taskId> [--reason <text>]
./scripts/agentrun sessions show <sessionId|sessionPath>
./scripts/agentrun sessions output <sessionId|sessionPath> [--cursor <cursor>] [--limit <limit>]
./scripts/agentrun sessions trace <sessionId|sessionPath> [--cursor <cursor>] [--limit <limit>]
./scripts/agentrun sessions control <sessionId|sessionPath> --json-file <control.json>
```
具体参数可以在实现时按代码结构微调,但行为必须保持:
@@ -61,6 +74,8 @@ CLI 官方 TypeScript 入口固定为 `scripts/agentrun-cli.ts`。在 G14 非交
- `server logs` 返回有界日志摘要,并指向完整日志文件或 Kubernetes pod identity。
- `secrets codex render --dry-run` 返回 Codex stdio profile Secret 创建计划、输入文件 bytes/hash、SecretRef、manifest 摘要和 apply 命令形状;`--profile codex` 默认 Secret name 为 `agentrun-v01-provider-codex``--profile deepseek` 默认 Secret name 为 `agentrun-v01-provider-deepseek`;它不得输出 Secret value 或执行 Kubernetes 写操作。
- `backends list` 必须显示 `codex``deepseek` profile 的 backendKind、protocol、transport、command、requiredSecretKeys 和状态;不得因为 `deepseek` 尚未配置 Secret 就隐藏 capability。
- `queue show` 必须返回 task/attempt summary、state、read cursor、stats 相关字段和 `sessionPath`;不得返回或代理完整 output/trace。
- `sessions output``sessions trace` 是输出和 trace 的唯一 CLI 查询入口;不得新增 `queue output``queue trace` 兼容命令。
## 配置与 Secret 边界
@@ -91,6 +106,10 @@ CLI 官方 TypeScript 入口固定为 `scripts/agentrun-cli.ts`。在 G14 非交
阅读本文、[spec-v01-backend-codex.md](spec-v01-backend-codex.md) 和 [spec-v01-validation.md](spec-v01-validation.md),然后用正式 CLI 分别创建 `backendProfile=codex``backendProfile=deepseek` 的 run,按 `codex -> deepseek -> codex` 顺序执行真实 runner。确认 CLI 输出非空 JSONbackend_status 显示正确 profile/backendKind/protocol,缺失 `deepseek` SecretRef 时返回 `secret-unavailable`,不会 fallback 到 `codex`
### T6 Queue 与 Session CLI 分层
阅读本文和 [spec-v01-queue.md](spec-v01-queue.md),然后用正式 CLI 创建一个 Queue task,轮询 `queue list/show/stats/commander/read`,再使用 `queue show` 返回的 `sessionPath` 调用 `sessions output/trace`。确认 Queue 命令只返回 summary/stats/read/sessionPath,不代理 output/traceSession 命令能查询输出和 trace。最终交互验收必须使用真实 runtime,不使用 mock,不写自动交互脚本。
## 规格的实现情况
| 规格项 | 状态 | 说明 |
@@ -101,5 +120,6 @@ CLI 官方 TypeScript 入口固定为 `scripts/agentrun-cli.ts`。在 G14 非交
| runner start/job | 已实现 | `runner start` 可执行 host process runner`runner job --dry-run` 可渲染 Kubernetes Job JSON`runner job` 正式路径通过 manager REST 创建 Kubernetes Job,支持 `--idempotency-key` 并快速返回 job identity、SecretRef、retention 和轮询命令。 |
| runner jobs/job-status | 已实现 | CLI 通过 manager REST 查询 runner Job 持久记录和最小状态摘要,不直连 Kubernetes、不读取 Secret 值。 |
| result/cancel CLI | 已实现 | `runs result``commands result``runs cancel``commands cancel` 均调用 manager REST,不维护独立状态。 |
| Queue/Session CLI | 待实现 | 规格见 [spec-v01-queue.md](spec-v01-queue.md)Queue 命令只返回 sessionPath,输出和 trace 进入 Session 命令。 |
| CLI 测试规格 | 已定义/已验证主闭环 | 综合联调见 [spec-v01-validation.md](spec-v01-validation.md);每次发布仍按手动交互验收复跑。 |
| `deepseek` profile CLI | 已实现/已通过主闭环 | `secrets codex render --profile deepseek``backends list``runner start --backend``runner job` 和 JSON 错误可见性已实现;真实 CLI/RESTful 联调已通过 `codex -> deepseek -> codex` 切换主闭环。 |