feat: add phase 3 readonly models

This commit is contained in:
Yoilun
2026-05-25 18:21:02 +08:00
parent 37e3d77110
commit d573bde194
18 changed files with 964 additions and 12 deletions

View File

@@ -6,13 +6,14 @@
## Target Architecture
计划架构为Go 后端提供 localhost HTTP APIVue 3 + Vite 前端提供中文工作台界面。当前后端已提供健康检查`.codex/agents/*.toml` 只读读取;目标后端将继续增加只读 SQLite 状态库、安全读取项目配置,并仅在用户确认后写回 `.codex/agents/*.toml`
计划架构为Go 后端提供 localhost HTTP APIVue 3 + Vite 前端提供中文工作台界面。当前后端已提供健康检查`.codex/agents/*.toml` 只读读取、项目配置只读读取、运行线程只读模型和动态工作流事件模型;目标后端后续仅在用户确认后写回 `.codex/agents/*.toml`
## Configuration
- `CODEX_HOME`: 默认 `/Users/yoilun/.codex`
- 后端监听地址:默认 `127.0.0.1:18083`
- 前端开发地址:默认 `127.0.0.1:13083`
- `WorkspaceRoot`: 默认当前进程工作目录,用于读取 `task_plan.md` 等计划文件证据。
## Runbook
@@ -34,14 +35,36 @@ curl http://127.0.0.1:18083/api/health
curl http://127.0.0.1:18083/api/agents
```
读取项目配置:
```bash
curl http://127.0.0.1:18083/api/projects
```
读取运行线程:
```bash
curl http://127.0.0.1:18083/api/runtime/threads
```
读取动态工作流事件:
```bash
curl http://127.0.0.1:18083/api/workflow/events
```
## Security Boundaries
- 不读取 `.codex/auth.json`
- 不写入 Codex SQLite。
- SQLite 通过纯 Go `modernc.org/sqlite``mode=ro&immutable=1` 打开;缺失 SQLite 返回空列表和低置信度来源说明。
- `.codex/agents/*.toml` 写回必须先备份。
- 当前 `/api/agents` 只读列出 `.codex/agents` 直属 `.toml` 文件,读取前通过 Codex home 边界和 agent TOML 专用 resolver坏 TOML 以单条 `invalid` 状态返回,不导致服务崩溃。
- 当前 `/api/projects` 只读解析 `.codex/config.toml` 中的 `[projects."..."]`,展示路径、显示名、信任等级和目录存在性。
- 当前 `/api/workflow/events` 从运行线程、spawn edges、goals 和计划文件证据生成事件流/交接边/阶段状态,不写死固定流程。
## Known Risks
- Codex 内部 SQLite schema 可能变化。
- 运行状态由多来源推断,必须显示置信度。
- Phase 3 真实 SQLite 读取已覆盖临时测试库;如果真实 Codex schema 与当前查询列名不同,需要新增兼容查询而不是降级写死流程。