feat: buildable list, building interaction API (toggle/set_recipe/empty/cancel)

New endpoints:
- GET /api/state/buildable: buildings filtered by completed research (unlocked/locked)
- POST /api/action/toggle: toggle building on/off (save power, control workflow)
- POST /api/action/set_recipe: set building recipe (e.g. Rock Crusher mode)
- POST /api/action/empty: empty building storage (drop all contents)
- POST /api/action/cancel_errand: cancel all errands at a building

Improved research: proper prerequisite validation, tech queueing, research station check

CLI: buildable [filter], toggle, set_recipe, empty, cancel_errand
Updated SKILL.md with new endpoint docs
This commit is contained in:
root
2026-05-22 09:32:49 +08:00
parent 80485d2a5a
commit 7a946aa555
3 changed files with 244 additions and 15 deletions

View File

@ -104,11 +104,7 @@ ONI 使用二维方格(tile)系统。AI 必须理解坐标系才能正确操
| 端点 | 说明 | 用途 |
|------|------|------|
| `/health` | Mod 存活检测 | 连接检查 |
| `/api/state/game` | 全局状态(周期/人数/世界尺寸) | 总览 |
| `/api/state/resources` | 资源列表(含分类/物态) | 物资盘点 |
| `/api/state/duplicants` | 复制人详情(位置/压力/食物/当前任务) | 人员管理 |
| `/api/state/buildings` | 建筑列表(位置/是否运行/功耗/分类) | 基建评估 |
| `/api/state/buildable` | 当前科技解锁的建筑 | 查看 AI 现在能造什么 |
| `/api/state/research` | 科技树(进度/解锁的建筑) | 科研规划 |
| `/api/state/geysers` | 喷泉(位置/状态/排放率) | 资源规划 |
| `/api/state/alert` | 警报列表 | 紧急处理 |
@ -137,6 +133,10 @@ ONI 使用二维方格(tile)系统。AI 必须理解坐标系才能正确操
| 端点 | 请求体 | 用途 |
|------|--------|------|
| `/api/action/toggle` | `{x, y}` | 开关建筑(省电/控制流程) |
| `/api/action/set_recipe` | `{x, y, recipeId}` | 设置建筑配方 |
| `/api/action/empty` | `{x, y}` | 清空建筑储物 |
| `/api/action/cancel_errand` | `{x, y}` | 取消建筑处的任务 |
| `/api/action/dig` | `{x, y, width, height}` | 挖掘区域 |
| `/api/action/build` | `{buildingId, x, y}` | 建造建筑 |
| `/api/action/deconstruct` | `{buildingId, x, y}` | 拆除建筑 |