A Rust library for describing, hashing, validating, and patching sequential schedule assets intended for AI-driven debugging workflows. The crate models schedule assets (phases, nodes, breakpoints) and applies domain patches with validation and diagnostic reporting.
- Schedule asset model with phases, nodes, and breakpoints.
- Deterministic hashing of schedule assets using SHA-256.
- Validation diagnostics for duplicate IDs, invalid references, and multi-phase node placement.
- Patch application with optimistic concurrency via
base_schedule_hashand detailed diagnostics.
The primary types exported by the crate are:
ScheduleAsset,Phase,Node,Breakpointfor describing a sequential schedule.PatchEnvelopeandPatchOpfor applying changes.DiagnosticandSeverityfor validation feedback.
use ai_world::{
AssetMetadata, DebugOptions, Node, PatchEnvelope, PatchOp, Phase, ScheduleAsset,
};
use serde_json::json;
let mut schedule = ScheduleAsset {
schema_version: "1.0".to_string(),
catalog_hash: "sha256:catalog".to_string(),
mode: "sequential".to_string(),
debug_options: DebugOptions {
deterministic: true,
default_step_unit: "node".to_string(),
},
asset: AssetMetadata {
asset_id: "asset-1".to_string(),
name: "main".to_string(),
author: "ai".to_string(),
created_at_utc: "2024-01-01T00:00:00Z".to_string(),
},
phases: vec![Phase {
phase_id: "p.update".to_string(),
name: "update".to_string(),
nodes: vec!["n.tick".to_string()],
}],
nodes: vec![Node {
node_id: "n.tick".to_string(),
system_id: "com.example::tick".to_string(),
enabled: true,
params: json!({}),
tags: vec![],
}],
breakpoints: vec![],
};
let base_hash = schedule.schedule_hash().expect("hash schedule");
let patch = PatchEnvelope {
schema_version: "1.0".to_string(),
patch_id: "patch-1".to_string(),
world_id: "default".to_string(),
base_schedule_hash: base_hash,
policy_mode: "enforce".to_string(),
client_context: json!({}),
ops: vec![PatchOp::AddNode {
op_id: Some("op1".to_string()),
node: Node {
node_id: "n.move".to_string(),
system_id: "com.example::move".to_string(),
enabled: true,
params: json!({"speed": 1.0}),
tags: vec!["gameplay".to_string()],
},
}],
};
let result = patch.apply_to(&mut schedule);
assert!(result.ok, "patch failed: {result:?}");Run tests with:
cargo testtools/brpctl is a local JSON-RPC client for DevApi endpoints. It enables non-MCP,
command-based invocations for workflows that need local command execution instead of MCP calls.
tools/brpctl handshake
tools/brpctl get-skills --scope combined
tools/brpctl apply-patch ./patch.jsonSee docs/skills/brpctl_skill.md for the skill sheet and additional examples.
新增了一个前端原型 web/,包含:
- 2 个可自主移动小人(自动任务派发/执行)
- 1 种植物(浆果灌木,支持种植、生长、收获)
- 5 种基础地形(草地、土壤、沙地、水域、岩地)
- 山脉与 1 种矿物(矿脉,可开采)
- 房屋手动建造
- 徒手攻击、移动、建造、种植、收获、采矿等任务
- 接近 RimWorld 风格的完整 HUD(资源栏、殖民者面板、任务面板、检视器、日志、迷你地图、速度控制)
本地启动方式:
cd web
python3 -m http.server 4173
# 浏览器打开 http://localhost:4173
## RimWorld 风格单场景演示
仓库中新增了一个纯前端单场景原型:`game/index.html`。
功能包括:
- 丰富控制台 UI(资源、任务、殖民者状态、日志)
- 自动化任务派发(按优先级分配空闲小人)
- 小人自主移动并采集浆果
本地运行:
```bash
python3 -m http.server 4173
# 浏览器打开 http://localhost:4173/game/index.html
## Colony simulation demo (RimWorld-like single scene)
This repo now includes a console-playable single-scene colony simulation with:
- A rich HUD-like text UI panel.
- Automated task dispatch and prioritization.
- Autonomous pawn movement.
- Berry harvesting and stockpile delivery loops.
Run it with:
```bash
cargo run