fix: 收口 v0.1 规格缺口

This commit is contained in:
Codex
2026-05-29 17:38:47 +08:00
parent 7d88bcdd24
commit 860da3c387
17 changed files with 127 additions and 70 deletions
+25 -17
View File
@@ -19,22 +19,30 @@ scripts/agentrun-cli.ts
scripts/src/*.ts
```
CLI 官方运行方式固定为 Bun + TypeScript`bun scripts/agentrun-cli.ts ...``node``tsx` 或 shell wrapper 只能作为本地开发辅助,不能成为 `v0.1` 用户文档、CI/CD 或综合联调的权威入口。入口文件只负责参数解析和路由,具体实现拆到 `scripts/src/`。CLI 命令默认输出 JSON;任何命令无 stdout 都是失败。单次 CLI 调用必须在 60 秒内返回,长时间模型 turn 通过 status/events 后续命令观察。
CLI 官方 TypeScript 入口固定为 `scripts/agentrun-cli.ts`。在 G14 非交互 SSH route、CI task 和人工验收命令中,推荐使用仓库内 launcher:
```bash
./scripts/agentrun ...
```
该 launcher 只负责定位 `bun`(优先 `BUN_BIN`、其次 PATH、`$HOME/.bun/bin/bun` 和 G14 默认 `/root/.bun/bin/bun`),然后转入同一个 `scripts/agentrun-cli.ts`。它不实现第二套路由、不读取额外配置、不绕过 TypeScript CLI。`bun scripts/agentrun-cli.ts ...` 仍可在 PATH 已包含 Bun 的交互 shell 中使用;`node``tsx` 或其他 wrapper 只能作为本地开发辅助,不能成为 `v0.1` 综合联调的权威入口。
入口文件只负责参数解析和路由,具体实现拆到 `scripts/src/`。CLI 命令默认输出 JSON;任何命令无 stdout 都是失败。单次 CLI 调用必须在 60 秒内返回,长时间模型 turn 通过 status/events 后续命令观察。
## 初始命令族
```bash
bun scripts/agentrun-cli.ts runs create --json-file <run.json>
bun scripts/agentrun-cli.ts runs show <runId>
bun scripts/agentrun-cli.ts runs events <runId> --after-seq <n> --limit <n>
bun scripts/agentrun-cli.ts commands create <runId> --type turn --json-file <payload.json>
bun scripts/agentrun-cli.ts commands show <commandId>
bun scripts/agentrun-cli.ts runner start --run-id <runId> --backend <backendProfile>
bun scripts/agentrun-cli.ts runner job --run-id <runId> --command-id <commandId>
bun scripts/agentrun-cli.ts runner job --dry-run --run-id <runId> --command-id <commandId> --image <image>
bun scripts/agentrun-cli.ts secrets codex render --dry-run [--codex-home <dir>]
bun scripts/agentrun-cli.ts backends list
bun scripts/agentrun-cli.ts server start|status|stop|logs
./scripts/agentrun runs create --json-file <run.json>
./scripts/agentrun runs show <runId>
./scripts/agentrun runs events <runId> --after-seq <n> --limit <n>
./scripts/agentrun commands create <runId> --type turn --json-file <payload.json>
./scripts/agentrun commands show <commandId> --run-id <runId>
./scripts/agentrun runner start --run-id <runId> --backend <backendProfile>
./scripts/agentrun runner job --run-id <runId> --command-id <commandId>
./scripts/agentrun runner job --dry-run --run-id <runId> --command-id <commandId> --image <image>
./scripts/agentrun secrets codex render --dry-run [--codex-home <dir>]
./scripts/agentrun backends list
./scripts/agentrun server start|status
```
具体参数可以在实现时按代码结构微调,但行为必须保持:
@@ -57,7 +65,7 @@ bun scripts/agentrun-cli.ts server start|status|stop|logs
### T1 CLI run 生命周期
阅读 `AGENTS.md`、本文和 [spec-v01-validation.md](spec-v01-validation.md),然后用正式 AgentRun CLI 创建 run、提交 `turn` command、启动 runner、轮询 command 和 events 直到 terminal_status。确认每个命令输出非空 JSON,60 秒内返回,并给出下一步可执行命令或 logPath。
阅读 `AGENTS.md`、本文和 [spec-v01-validation.md](spec-v01-validation.md),然后用 `./scripts/agentrun` 创建 run、提交 `turn` command、启动 runner、轮询 command 和 events 直到 terminal_status。确认每个命令输出非空 JSON,60 秒内返回,并给出下一步可执行命令或 logPath。若直接执行 `bun scripts/agentrun-cli.ts`,必须先证明当前 shell 的 PATH 能找到 BunG14 route 默认以 `./scripts/agentrun` 为准。
### T2 CLI 错误可见性
@@ -76,7 +84,7 @@ bun scripts/agentrun-cli.ts server start|status|stop|logs
| 规格项 | 状态 | 说明 |
| --- | --- | --- |
| AgentRun CLI 规格 | 已定义 | 本文为 v0.1 CLI 权威。 |
| `scripts/agentrun-cli.ts` | 部分实现 | 已提供 run/command/event/backend/server 基础命令和 JSON envelope。 |
| CLI 调 manager REST | 部分实现 | CLI 通过 `ManagerClient` 调 manager REST当前自测试使用内存 manager。 |
| runner start/job | 部分实现 | `runner start` 可执行 host process runner`runner job --dry-run` 可渲染 Kubernetes Job JSON`runner job` 正式路径通过 manager REST 创建 Kubernetes Job 并快速返回 job identity、SecretRef 和轮询命令。 |
| CLI 测试规格 | 已定义 | 综合联调见 [spec-v01-validation.md](spec-v01-validation.md)。 |
| `scripts/agentrun-cli.ts` | 实现 | 已提供 run/command/event/backend/server 基础命令和 JSON envelope`scripts/agentrun` 是同一入口的 Bun 定位 launcher。 |
| CLI 调 manager REST | 实现 | CLI 通过 `ManagerClient` 调 manager REST;自测试用内存 manager,综合联调必须指向真实 `agentrun-v01` manager。 |
| runner start/job | 实现 | `runner start` 可执行 host process runner`runner job --dry-run` 可渲染 Kubernetes Job JSON`runner job` 正式路径通过 manager REST 创建 Kubernetes Job 并快速返回 job identity、SecretRef、retention 和轮询命令。 |
| CLI 测试规格 | 已定义/已验证主闭环 | 综合联调见 [spec-v01-validation.md](spec-v01-validation.md);每次发布仍按手动交互验收复跑。 |