Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
MK0-MK2: raea make, the review loop the agent can't skip (AnyScene/AnyKit/AnyShot, docs/make.feature)
shinyobjectzcedf2607c6d2
diff --git a/Cargo.lock b/Cargo.lockindex af6c14fc..08945bc7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -13669,6 +13669,7 @@ dependencies = ["raea-app-check-cause","raea-app-check-flash","raea-app-check-inbox",+ "raea-app-check-make","raea-app-check-read","raea-app-check-text","raea-core-brief",@@ -13701,6 +13702,16 @@ dependencies = ["serde_json",]+[[package]]+name = "raea-app-check-make"+version = "0.1.0"+dependencies = [+ "dunce",+ "raea-core-facts",+ "raea-io-home",+ "serde_json",+]+[[package]]name = "raea-app-check-read"version = "0.1.0"@@ -13860,6 +13871,17 @@ dependencies = ["serde_json",]+[[package]]+name = "raea-app-make"+version = "0.1.0"+dependencies = [+ "dunce",+ "raea-app-judge",+ "raea-core-brief",+ "raea-core-facts",+ "serde_json",+]+[[package]]name = "raea-app-media"version = "0.1.0"@@ -13947,6 +13969,7 @@ dependencies = ["dunce","raea-app-ask","raea-app-judge",+ "raea-app-make","raea-core-facts","raea-core-meshcheck","raea-core-shape",@@ -14229,6 +14252,7 @@ dependencies = ["raea-app-game","raea-app-judge","raea-app-layers",+ "raea-app-make","raea-app-media","raea-app-notes","raea-app-play",diff --git a/Cargo.toml b/Cargo.tomlindex 70f73eed..eac36958 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -202,6 +202,7 @@ members = ["apps/check/cause","apps/check/flash","apps/check/inbox",+ "apps/check/make","apps/check/read","apps/check/text","apps/direction",@@ -216,6 +217,7 @@ members = ["apps/engines","apps/interchange","apps/judge",+ "apps/make","apps/solid","apps/scene","apps/media",diff --git a/apps/check/Cargo.toml b/apps/check/Cargo.tomlindex 45c00524..98fe5096 100644--- a/apps/check/Cargo.toml+++ b/apps/check/Cargo.toml@@ -28,4 +28,6 @@ raea-app-check-text = { path = "text" }raea-app-check-flash = { path = "flash" }# what the person sent from the raea app, handed to the agent (split out to keep this crate small)raea-app-check-inbox = { path = "inbox" }+# the Stop gate for a `make` job (docs/make.feature MK2; split out to keep this crate small)+raea-app-check-make = { path = "make" }serde_json = "1"diff --git a/apps/check/make/Cargo.toml b/apps/check/make/Cargo.tomlnew file mode 100644index 00000000..527c0bb9--- /dev/null+++ b/apps/check/make/Cargo.toml@@ -0,0 +1,16 @@+[package]+name = "raea-app-check-make"+version = "0.1.0"+edition = "2024"+license = "FSL-1.1-ALv2"+publish = false+description = "`raea hook`'s Stop gate for a `make` job (docs/make.feature MK2): an agent can't end its turn until `raea make status` says the job is done"++[dependencies]+serde_json = "1"+# brief.ts found as raea finds a project (plain paths on Windows)+dunce = "1"+# the project's folder (record.rs `up`)+raea-core-facts = { path = "../../../core/facts" }+# the guard's counts, under the home folder+raea-io-home = { path = "../../../io/home" }diff --git a/apps/check/make/src/lib.rs b/apps/check/make/src/lib.rsnew file mode 100644index 00000000..6e671405--- /dev/null+++ b/apps/check/make/src/lib.rs@@ -0,0 +1,118 @@+//! raea-app-check-make: the Stop hook's half of `raea make` (docs/make.feature MK2): an agent working in a project whose brief.ts has a+//! `make` job can't end its turn until `raea make status` says the job is done. Cheap when there's no job: the brief's+//! words are read, and only a brief with `make:` is evaluated (by `raea make status`, a child process, so this crate+//! doesn't carry the judge). A session blocked three times with the same open items goes through: it's going in+//! circles, and the person is better told than the agent looped (PL7's keeper stops the same way).++use std::hash::{DefaultHasher, Hash, Hasher};+use std::path::{Path, PathBuf};++use serde_json::Value;++/// How many times the same open items may block one session before the stop goes through.+pub const SAME_BLOCKS: u32 = 3;++/// The brief.ts with a job, at or above `cwd` inside its raea project.+pub fn brief_with_job(cwd: &Path) -> Option<PathBuf> {+ let project = raea_core_facts::record::up(cwd, ".raea/project");+ for d in dunce::canonicalize(cwd).ok()?.ancestors() {+ let p = d.join("brief.ts");+ if p.is_file() {+ return std::fs::read_to_string(&p).is_ok_and(|t| t.contains("make:") || t.contains("make :")).then_some(p);+ }+ if project.as_deref() == Some(d) {+ return None;+ }+ }+ None+}++fn hash(parts: &[&str]) -> u64 {+ let mut h = DefaultHasher::new();+ parts.hash(&mut h);+ h.finish()+}++/// Counts this session's blocks on the same open items in `guard` ("<items hash> <count>"); true while it may block.+pub fn may_block(guard: &Path, items: &str) -> bool {+ let key = hash(&[items]).to_string();+ let count = std::fs::read_to_string(guard).ok().and_then(|t| {+ let (k, n) = t.trim().split_once(' ')?;+ (k == key).then(|| n.parse::<u32>().ok()).flatten()+ });+ let next = count.unwrap_or(0) + 1;+ let _ = std::fs::create_dir_all(guard.parent().unwrap_or(Path::new(".")));+ let _ = std::fs::write(guard, format!("{key} {next}"));+ next <= SAME_BLOCKS+}++/// What the agent is told when its turn may not end, or None to let it end: no job here, the job is done, the job+/// didn't load (never block on raea's own failure), or the same items have blocked it three times already.+pub fn stop(v: &Value) -> Option<String> {+ let cwd = PathBuf::from(v["cwd"].as_str()?);+ let brief = brief_with_job(&cwd)?;+ let exe = std::env::current_exe().ok()?;+ let out = std::process::Command::new(exe).args(["make", "status"]).arg(brief.parent()?).arg("--json").env("RAEA_RECORD", "off").output().ok()?;+ let s: Value = serde_json::from_slice(&out.stdout).ok()?;+ let home = raea_io_home::user_home()?;+ let session = v["session_id"].as_str().unwrap_or("");+ let guard = home.join(".raea/hooks/make").join(format!("{:x}", hash(&[session, &brief.display().to_string()])));+ if s["done"] == true {+ let _ = std::fs::remove_file(&guard);+ return None;+ }+ let items = open_items(&s);+ if !may_block(&guard, &items) {+ return None;+ }+ Some(format!(+ "Not done ({} job, {}): {items}. Keep going: `raea make status` lists what's open; a defect you judge wrong is answered in NOTES.md by its name.",+ s["kind"].as_str().unwrap_or("make"),+ brief.display()+ ))+}++/// The open items, one line each: what's missing, then each gate that isn't clear.+pub fn open_items(s: &Value) -> String {+ let mut items: Vec<String> = s["missing"].as_array().into_iter().flatten().filter_map(|m| m.as_str().map(String::from)).collect();+ items.extend(s["gates"].as_array().into_iter().flatten().filter(|g| g["clear"] != true).map(|g| format!("{}{}: {}", g["gate"].as_str().unwrap_or(""), g["of"].as_str().map(|o| format!(" {o}")).unwrap_or_default(), g["says"].as_str().unwrap_or(""))));+ items.join("; ")+}++#[cfg(test)]+mod tests {+ use super::*;+ use serde_json::json;++ fn tmp(name: &str) -> PathBuf {+ let d = std::env::temp_dir().join(format!("raea-make-gate-{name}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&d);+ std::fs::create_dir_all(d.join("compositions")).unwrap();+ d+ }++ #[test]+ fn only_a_brief_with_a_job_is_held() {+ let d = tmp("job");+ std::fs::write(d.join("brief.ts"), "export default brief({ title: \"x\" })").unwrap();+ assert_eq!(brief_with_job(&d.join("compositions")), None, "a brief without make is never held");+ std::fs::write(d.join("brief.ts"), "export default brief({ title: \"x\", make: kit({ objects: [] }) })").unwrap();+ assert_eq!(brief_with_job(&d.join("compositions")).map(|p| p.file_name().unwrap().to_owned()), Some("brief.ts".into()));+ }++ #[test]+ fn the_same_open_items_block_three_times_then_go_through() {+ let g = tmp("guard").join("g");+ assert!(may_block(&g, "a") && may_block(&g, "a") && may_block(&g, "a"));+ assert!(!may_block(&g, "a"), "a fourth stop on the same items goes through");+ assert!(may_block(&g, "a; b"), "new items start the count again");+ }++ #[test]+ fn open_items_list_what_is_missing_then_the_gates_that_are_not_clear() {+ let s = json!({"missing": ["out/kit/lineup.png"], "gates": [+ {"gate": "checks", "of": "scene.tsx", "clear": false, "says": "never rendered"},+ {"gate": "critic", "clear": true, "says": "ok"}]});+ assert_eq!(open_items(&s), "out/kit/lineup.png; checks scene.tsx: never rendered");+ }+}diff --git a/apps/check/src/hook.rs b/apps/check/src/hook.rsindex 06ead16f..a049abb8 100644--- a/apps/check/src/hook.rs+++ b/apps/check/src/hook.rs@@ -150,7 +150,9 @@ pub fn hook(args: &[String]) -> R<String> {// to end goes on to take it uplet sent = if matches!(event, "PostToolUse" | "AfterTool" | "Stop") { crate::inbox::told(agent, &v) } else { None };if event == "Stop" {- return Ok(sent.map(|s| json!({"decision": "block", "reason": s}).to_string()).unwrap_or_default());+ // what the person sent, and a `make` job that isn't done (docs/make.feature MK2): either keeps the turn going+ let reasons: Vec<String> = [sent, raea_app_check_make::stop(&v)].into_iter().flatten().collect();+ return Ok(if reasons.is_empty() { String::new() } else { json!({"decision": "block", "reason": reasons.join("\n\n")}).to_string() });}let after_tool = matches!(event, "PostToolUse" | "AfterTool");if let Some(cmd) = shell_command(&v).filter(|_| !after_tool) {diff --git a/apps/make/Cargo.toml b/apps/make/Cargo.tomlnew file mode 100644index 00000000..2cf265f4--- /dev/null+++ b/apps/make/Cargo.toml@@ -0,0 +1,18 @@+[package]+name = "raea-app-make"+version = "0.1.0"+edition = "2024"+license = "FSL-1.1-ALv2"+publish = false+description = "raea make: a scene, kit or shot held to its frozen plan; what's missing and whether it's done, decided in code (docs/make.feature)"++[dependencies]+# the plan: `make` on brief.ts+raea-core-brief = { path = "../../core/brief" }+# the project's record of renders and checks, and the folder it lives in+raea-core-facts = { path = "../../core/facts" }+# the judge's rounds, passes and blocking defects, read as it keeps them+raea-app-judge = { path = "../judge" }+dunce = "1"+serde_json = "1"+diff --git a/apps/make/src/lib.rs b/apps/make/src/lib.rsnew file mode 100644index 00000000..f82f00ac--- /dev/null+++ b/apps/make/src/lib.rs@@ -0,0 +1,97 @@+//! `raea make`: a scene, kit or shot made to its frozen plan (`make` on brief.ts, core/brief make.rs) and held to the+//! review loop (docs/make.feature). `status` decides, in code, what's missing and whether the agent may stop; the Stop+//! hook (apps/check hook.rs) asks it at the end of every turn.+//!+//! raea make status [DIR] [--json]++pub mod status;++use std::path::{Path, PathBuf};++use raea_core_brief::make::Make;+use serde_json::Value;++pub const USAGE: &str = "raea make status [DIR] [--json] (a scene, kit or shot held to its plan, `make` on brief.ts: what's missing, each gate, the judge's rounds, and whether it's done, decided in code; the agent's Stop hook holds it there)";++/// The brief.ts the job is read from: DIR's own, else the nearest above it inside its raea project.+pub fn brief_path(dir: &Path) -> Option<PathBuf> {+ let dir = dunce::canonicalize(dir).ok()?;+ let project = raea_core_facts::record::up(&dir, ".raea/project");+ for d in dir.ancestors() {+ let p = d.join("brief.ts");+ if p.is_file() {+ return Some(p);+ }+ if project.as_deref() == Some(d) {+ break;+ }+ }+ None+}++/// Whether a brief.ts has a job at all, read from its words: cheap enough for a hook at every turn's end, so the+/// module is only evaluated when it can matter.+pub fn has_make(brief: &Path) -> bool {+ std::fs::read_to_string(brief).is_ok_and(|t| t.contains("make:") || t.contains("make :"))+}++/// The plan from brief.ts, evaluated by `raea spec FILE --as brief` (the module runs; Rust checks it against core/brief).+pub fn read_make(brief: &Path) -> Result<Option<Make>, String> {+ let exe = std::env::current_exe().map_err(|e| e.to_string())?;+ let out = std::process::Command::new(exe).arg("spec").arg(brief).args(["--as", "brief"]).env("RAEA_RECORD", "off").output().map_err(|e| e.to_string())?;+ let text = String::from_utf8_lossy(&out.stdout);+ let start = text.find('{').ok_or_else(|| format!("{} didn't read as a brief: {}", brief.display(), String::from_utf8_lossy(&out.stderr).lines().last().unwrap_or("")))?;+ let v: Value = serde_json::from_str(&text[start..]).map_err(|e| format!("{}: {e}", brief.display()))?;+ let b = v.get("brief").cloned().unwrap_or(v);+ match b.get("make") {+ None | Some(Value::Null) => Ok(None),+ Some(m) => serde_json::from_value(m.clone()).map(Some).map_err(|e| format!("{}: make: {e}", brief.display())),+ }+}++/// The judge's rounds beside the brief (review/judge.log.jsonl, as `raea judge` keeps them), the newest round's+/// judge.json, and when the log was last written.+fn judged(dir: &Path) -> (Vec<Value>, Option<Value>, Option<std::time::SystemTime>) {+ let log = dir.join("review").join("judge.log.jsonl");+ let rounds: Vec<Value> = std::fs::read_to_string(&log).unwrap_or_default().lines().filter_map(|l| serde_json::from_str(l).ok()).collect();+ let verdict = rounds.last().and_then(|r| r["dir"].as_str()).and_then(|d| std::fs::read_to_string(Path::new(d).join("judge.json")).ok()).and_then(|t| serde_json::from_str(&t).ok());+ let at = std::fs::metadata(&log).and_then(|m| m.modified()).ok();+ (rounds, verdict, at)+}++/// The status of the job whose brief is at `brief`, with its plan already read.+pub fn status_of(brief: &Path, make: &Make) -> Value {+ let dir = brief.parent().unwrap_or(Path::new("."));+ let project = raea_core_facts::record::up(dir, ".raea/project");+ let record = project.as_deref().map(raea_core_facts::record::read).unwrap_or_default();+ let (rounds, verdict, judged_at) = judged(dir);+ let job = status::Job { make, dir, project: project.as_deref(), record: &record, rounds: &rounds, verdict: verdict.as_ref(), judged_at };+ let mut s = status::status(&job);+ s["brief"] = Value::String(brief.display().to_string());+ s+}++/// For the hook: the job's status from a folder, None when there's no job there (no brief.ts, or no `make` on it).+pub fn status_in(dir: &Path) -> Result<Option<Value>, String> {+ let Some(brief) = brief_path(dir).filter(|b| has_make(b)) else { return Ok(None) };+ let Some(make) = read_make(&brief)? else { return Ok(None) };+ Ok(Some(status_of(&brief, &make)))+}++pub fn cli(args: &[String]) -> Result<String, String> {+ match args.get(1).map(String::as_str) {+ Some("status") => {}+ _ => return Err(USAGE.into()),+ }+ let dir = args.iter().skip(2).find(|a| !a.starts_with("--")).map(PathBuf::from).unwrap_or_else(|| PathBuf::from("."));+ let brief = brief_path(&dir).ok_or_else(|| format!("raea make: no brief.ts at or above {} in its project", dir.display()))?;+ let make = read_make(&brief)?.ok_or_else(|| format!("raea make: {} has no `make` (scene(), kit() or shot() from raea/brief)", brief.display()))?;+ let s = status_of(&brief, &make);+ if args.iter().any(|a| a == "--json") {+ return Ok(serde_json::to_string_pretty(&s).unwrap_or_default());+ }+ Ok(status::text(&s))+}++#[cfg(test)]+mod tests;diff --git a/apps/make/src/status.rs b/apps/make/src/status.rsnew file mode 100644index 00000000..aa848776--- /dev/null+++ b/apps/make/src/status.rs@@ -0,0 +1,182 @@+//! Whether a job is done (docs/make.feature MK1), from what's on disk and nothing the agent says: the deliverables, the+//! notes, the record of renders and checks, and the judge's rounds. Pure over a `Job` so it is tested on fixtures.++use std::path::{Path, PathBuf};+use std::time::SystemTime;++use raea_core_brief::make::{self, Make};+use raea_core_facts::{Level, record::Entry};+use serde_json::{Value, json};++/// The heading the notes end with, so the next job (and the skill) learns from this one.+pub const SKILL_HEADING: &str = "What the skill got wrong";++/// Everything status reads, gathered by `lib.rs` (or a test).+pub struct Job<'a> {+ pub make: &'a Make,+ /// the brief's folder: deliverables, NOTES.md and review/ are relative to it+ pub dir: &'a Path,+ /// the project's folder (record paths are relative to it), when it is a raea project+ pub project: Option<&'a Path>,+ pub record: &'a [Entry],+ /// review/judge.log.jsonl's rounds, oldest first+ pub rounds: &'a [Value],+ /// the latest round's judge.json, when there is one+ pub verdict: Option<&'a Value>,+ /// when the judge last wrote its log+ pub judged_at: Option<SystemTime>,+}++fn mtime(p: &Path) -> Option<SystemTime> {+ std::fs::metadata(p).and_then(|m| m.modified()).ok()+}++fn is_picture(p: &Path) -> bool {+ matches!(p.extension().and_then(|e| e.to_str()).map(str::to_ascii_lowercase).as_deref(), Some("png" | "jpg" | "jpeg" | "exr"))+}++/// One deliverable: a file, `a|b` (either), or `dir/` (three or more pictures in it). Returns the files that answer it.+fn answered(dir: &Path, want: &str) -> Result<Vec<PathBuf>, String> {+ if let Some(folder) = want.strip_suffix('/') {+ let pics: Vec<PathBuf> = std::fs::read_dir(dir.join(folder)).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| is_picture(p)).collect();+ return if pics.len() >= 3 { Ok(pics) } else { Err(format!("{want} holds {} picture{}; three or more", pics.len(), if pics.len() == 1 { "" } else { "s" })) };+ }+ let found: Vec<PathBuf> = want.split('|').map(|w| dir.join(w)).filter(|p| p.is_file()).collect();+ if found.is_empty() { Err(want.replace('|', " or ")) } else { Ok(found) }+}++fn notes_text(dir: &Path) -> Option<String> {+ std::fs::read_to_string(dir.join("NOTES.md")).ok()+}++/// AnyKit's stall: three rounds in a row without beating the best mean before them. Not the judge's own `stall`+/// (the same defect twice: change the approach), which is advice to the agent, not a reason to let it stop.+pub fn stalled(rounds: &[Value]) -> bool {+ let means: Vec<f64> = rounds.iter().filter_map(|r| r["mean"].as_f64()).collect();+ means.len() >= 4 && {+ let (before, last) = means.split_at(means.len() - 3);+ last.iter().cloned().fold(f64::MIN, f64::max) <= before.iter().cloned().fold(f64::MIN, f64::max)+ }+}++fn gate(name: &str, of: Option<&str>, clear: bool, says: String) -> Value {+ let mut g = json!({"gate": name, "clear": clear, "says": says});+ if let Some(of) = of {+ g["of"] = json!(of);+ }+ g+}++/// Tier 1: each composition the plan names has a render or check newer than it that found no error.+fn checks(job: &Job) -> Vec<Value> {+ job.make+ .compositions+ .iter()+ .map(|c| {+ let file = job.dir.join(c);+ let rel = job.project.map(|p| raea_core_facts::record::rel(p, &file)).unwrap_or_else(|| c.clone());+ let Some(last) = job.record.iter().rev().find(|e| e.of == rel) else {+ return gate("checks", Some(c), false, format!("never rendered or checked: raea render {c} (or raea scene lint {c})"));+ };+ let changed = mtime(&file).and_then(|m| m.duration_since(SystemTime::UNIX_EPOCH).ok()).map(|d| d.as_secs());+ if changed.is_some_and(|t| t > last.at) {+ return gate("checks", Some(c), false, format!("changed since its last {} ({}): run it again", last.by, last.id));+ }+ let errors: Vec<&str> = last.findings.iter().filter(|f| f.level == Level::Error).map(|f| f.says.as_str()).collect();+ match errors.as_slice() {+ [] => gate("checks", Some(c), true, format!("clean at {} ({})", last.id, last.by)),+ [one] => gate("checks", Some(c), false, format!("{} found: {one}", last.id)),+ many => gate("checks", Some(c), false, format!("{} found {} errors, first: {}", last.id, many.len(), many[0])),+ }+ })+ .collect()+}++/// Tier 3: a fresh critic has judged a round newer than the newest deliverable, and each blocking defect it named is+/// fixed (the round passed) or answered in NOTES.md by its name. Its score gates once the judge is calibrated.+fn critic(job: &Job, newest: Option<SystemTime>, notes: &str) -> Vec<Value> {+ let Some(last) = job.rounds.last() else {+ return vec![gate("critic", None, false, "no round yet: raea render EDIT.tsx --review review/r1, then raea judge review/r1 --by claude".into())];+ };+ let mut out = Vec::new();+ let fresh = match (job.judged_at, newest) {+ (Some(j), Some(n)) => j >= n,+ (Some(_), None) => true,+ _ => false,+ };+ out.push(gate("critic", None, fresh, if fresh { format!("round {} judged after the newest deliverable", job.rounds.len()) } else { "the newest deliverable came after the last round: review and judge it again".into() }));+ let blocking: Vec<&str> = raea_app_judge::rubric::blocking(last["defects"].as_array().map(Vec::as_slice).unwrap_or_default());+ let open: Vec<&str> = if last["pass"] == true { Vec::new() } else { blocking.into_iter().filter(|d| !notes.contains(d)).collect() };+ out.push(gate("defects", None, open.is_empty(), if open.is_empty() { "no blocking defect left unanswered".into() } else { format!("blocking, neither fixed nor answered in NOTES.md: {}", open.join(", ")) }));+ if job.verdict.is_some_and(|v| v["gating"] == true) {+ let p = raea_app_judge::progress(job.rounds);+ let done = p["done"] == true;+ out.push(gate("score", None, done, format!("the calibrated judge: {} passes in a row, two needed", p["passesInARow"])));+ }+ out+}++/// The job's status: what's missing, each gate, the judge's rounds, and whether the agent may stop.+pub fn status(job: &Job) -> Value {+ let mut missing = Vec::new();+ let mut newest: Option<SystemTime> = None;+ for want in make::deliverables(job.make) {+ match answered(job.dir, &want) {+ Ok(files) => newest = files.iter().filter_map(|f| mtime(f)).chain(newest).max(),+ Err(why) => missing.push(why),+ }+ }+ let notes = notes_text(job.dir).unwrap_or_default();+ if !notes.to_lowercase().contains(&SKILL_HEADING.to_lowercase()) {+ missing.push(format!("NOTES.md with a \"{SKILL_HEADING}\" section (one line per thing that cost time; what the guide got wrong for this job)"));+ }+ let mut gates = checks(job);+ gates.extend(critic(job, newest, ¬es));+ let cap = job.make.rounds.unwrap_or(make::ROUNDS) as usize;+ let capped = job.rounds.len() >= cap;+ let stalled = stalled(job.rounds);+ let clear = missing.is_empty() && gates.iter().all(|g| g["clear"] == true);+ let mut why = Vec::new();+ if capped && !clear {+ why.push(format!("capped: {} critic rounds, the most this job gets; delivered with what's still missing", job.rounds.len()));+ }+ if stalled && !clear {+ why.push("stalled: three rounds without beating the best before them; delivered with what's still missing".into());+ }+ let advice = raea_app_judge::progress(job.rounds);+ json!({+ "kind": job.make.kind,+ "done": clear || capped || stalled,+ "short": !clear && (capped || stalled),+ "missing": missing,+ "gates": gates,+ "judge": {"rounds": job.rounds.len(), "cap": cap, "passesInARow": advice["passesInARow"], "changeApproach": advice["stall"], "again": advice["again"]},+ "plan": make::doctor(job.make),+ "why": why,+ })+}++/// The status for a person or an agent to read.+pub fn text(s: &Value) -> String {+ let mut t = vec![format!("make: {} {}", s["kind"].as_str().unwrap_or("?"), if s["done"] == true { if s["short"] == true { "delivered short" } else { "done" } } else { "not done" })];+ for w in s["why"].as_array().into_iter().flatten() {+ t.push(format!(" {}", w.as_str().unwrap_or("")));+ }+ let list = |k: &str| s[k].as_array().cloned().unwrap_or_default();+ if !list("plan").is_empty() {+ t.push("plan:".into());+ t.extend(list("plan").iter().map(|p| format!(" {}", p.as_str().unwrap_or(""))));+ }+ if !list("missing").is_empty() {+ t.push("missing:".into());+ t.extend(list("missing").iter().map(|m| format!(" {}", m.as_str().unwrap_or(""))));+ }+ t.push("gates:".into());+ for g in list("gates") {+ let of = g["of"].as_str().map(|o| format!(" {o}")).unwrap_or_default();+ t.push(format!(" {} {}{of}: {}", if g["clear"] == true { "ok " } else { "open" }, g["gate"].as_str().unwrap_or(""), g["says"].as_str().unwrap_or("")));+ }+ let j = &s["judge"];+ t.push(format!("judge: {} of {} rounds, {} passes in a row{}", j["rounds"], j["cap"], j["passesInARow"], if j["changeApproach"] == true { "; the same defect keeps coming back: change the approach for that part, not the dose" } else { "" }));+ t.join("\n")+}diff --git a/apps/make/src/tests.rs b/apps/make/src/tests.rsnew file mode 100644index 00000000..9c39c209--- /dev/null+++ b/apps/make/src/tests.rs@@ -0,0 +1,134 @@+use std::path::PathBuf;+use std::time::{Duration, SystemTime};++use raea_core_brief::{make::Make, read};+use raea_core_facts::record::Entry;+use serde_json::{Value, json};++use crate::status::{Job, status, stalled};++fn dir(name: &str) -> PathBuf {+ let d = std::env::temp_dir().join(format!("raea-make-{name}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&d);+ std::fs::create_dir_all(&d).unwrap();+ d+}++fn put(d: &PathBuf, rel: &str, text: &str) {+ let p = d.join(rel);+ std::fs::create_dir_all(p.parent().unwrap()).unwrap();+ std::fs::write(p, text).unwrap();+}++fn kit() -> Make {+ read("make", r#"{"kind": "kit", "style": "1970s desk, maker Aurora", "objects": [{"id": "phone", "label": "Phone", "h": 0.12, "prompt": "a rotary phone"}]}"#).unwrap()+}++fn delivered(d: &PathBuf) {+ for f in ["out/kit/phone/phone.glb", "out/kit/phone/phone_lod1.glb", "out/kit/thumbs/phone.png", "out/kit/lineup.png", "out/kit/kit.json"] {+ put(d, f, "x");+ }+ put(d, "NOTES.md", "# Notes\n\n## What the skill got wrong\n- nothing yet\n");+}++fn round(pass: bool, mean: f64, defects: Value) -> Value {+ json!({"dir": "review/r1", "pass": pass, "mean": mean, "defects": defects})+}++fn run(make: &Make, d: &PathBuf, record: &[Entry], rounds: &[Value], judged_at: Option<SystemTime>) -> Value {+ status(&Job { make, dir: d, project: None, record, rounds, verdict: None, judged_at })+}++fn later() -> Option<SystemTime> {+ Some(SystemTime::now() + Duration::from_secs(5))+}++#[test]+fn nothing_made_is_not_done_and_says_what_is_missing() {+ let d = dir("empty");+ let s = run(&kit(), &d, &[], &[], None);+ assert_eq!(s["done"], false);+ let missing = s["missing"].to_string();+ assert!(missing.contains("out/kit/phone/phone_lod1.glb") && missing.contains("NOTES.md"), "{missing}");+ assert!(s["gates"].as_array().unwrap().iter().any(|g| g["gate"] == "critic" && g["clear"] == false));+}++#[test]+fn delivered_and_judged_after_is_done() {+ let d = dir("done");+ delivered(&d);+ let s = run(&kit(), &d, &[], &[round(true, 7.5, json!([]))], later());+ assert_eq!(s["done"], true, "{s:#}");+ assert_eq!(s["short"], false);+}++#[test]+fn a_round_older_than_the_newest_deliverable_is_stale() {+ let d = dir("stale");+ delivered(&d);+ let s = run(&kit(), &d, &[], &[round(true, 7.5, json!([]))], Some(SystemTime::UNIX_EPOCH));+ assert_eq!(s["done"], false);+ assert!(s["gates"].to_string().contains("came after the last round"), "{s:#}");+}++#[test]+fn a_blocking_defect_must_be_fixed_or_answered_in_the_notes() {+ let d = dir("defect");+ delivered(&d);+ let defects = json!([{"defect": "floating", "present": true, "level": "blocking"}]);+ let s = run(&kit(), &d, &[], &[round(false, 6.0, defects.clone())], later());+ assert_eq!(s["done"], false);+ assert!(s["gates"].to_string().contains("floating"));+ put(&d, "NOTES.md", "## What the skill got wrong\n- floating: the handset rests in its cradle; the judge read its shadow as a gap\n");+ let s = run(&kit(), &d, &[], &[round(false, 6.0, defects)], later());+ assert_eq!(s["done"], true, "{s:#}");+}++#[test]+fn at_the_cap_it_is_delivered_short() {+ let d = dir("cap");+ let rounds: Vec<Value> = (0..8).map(|i| round(false, 5.0 + i as f64 * 0.5, json!([]))).collect();+ let s = run(&kit(), &d, &[], &rounds, later());+ assert_eq!((s["done"].clone(), s["short"].clone()), (json!(true), json!(true)), "{s:#}");+ assert!(s["why"].to_string().contains("capped"));+}++#[test]+fn three_rounds_without_beating_the_best_is_a_stall() {+ let r = |m: f64| json!({"mean": m});+ assert!(stalled(&[r(5.0), r(6.5), r(6.0), r(6.4), r(6.5)]));+ assert!(!stalled(&[r(5.0), r(6.0), r(6.2), r(6.4), r(6.6)]));+ assert!(!stalled(&[r(5.0), r(5.0), r(5.0)]), "too few rounds to call it");+}++#[test]+fn a_composition_needs_a_clean_check_newer_than_it() {+ let d = dir("checks");+ delivered(&d);+ put(&d, "scene.tsx", "x");+ let mut make = kit();+ make.compositions = vec!["scene.tsx".into()];+ let rounds = [round(true, 7.5, json!([]))];+ let s = run(&make, &d, &[], &rounds, later());+ assert!(s["gates"].to_string().contains("never rendered"), "{s:#}");+ let entry = |at: u64, level: &str| -> Entry {+ serde_json::from_value(json!({"id": "20261123-x", "at": at, "by": "raea render", "of": "scene.tsx",+ "findings": [{"check": "float", "level": level, "says": "the mug floats 2 cm", "by": "raea scene lint"}]})).unwrap()+ };+ let future = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs() + 60;+ let s = run(&make, &d, &[entry(future, "error")], &rounds, later());+ assert!(s["gates"].to_string().contains("the mug floats"), "{s:#}");+ let s = run(&make, &d, &[entry(future, "warn")], &rounds, later());+ assert_eq!(s["done"], true, "a warn doesn't block: {s:#}");+ let s = run(&make, &d, &[entry(1, "warn")], &rounds, later());+ assert!(s["gates"].to_string().contains("changed since"), "{s:#}");+}++#[test]+fn a_scene_wants_three_stills() {+ let d = dir("scene");+ let make: Make = read("make", r#"{"kind": "scene", "objects": [{"id": "stool", "label": "Stool", "h": 0.45, "route": "gen", "prompt": "a red stool"}]}"#).unwrap();+ put(&d, "out/stills/a.png", "x");+ let s = run(&make, &d, &[], &[], None);+ assert!(s["missing"].to_string().contains("holds 1 picture"), "{s:#}");+}diff --git a/apps/solid/Cargo.toml b/apps/solid/Cargo.tomlindex af643c8d..1dceeec7 100644--- a/apps/solid/Cargo.toml+++ b/apps/solid/Cargo.toml@@ -17,6 +17,8 @@ raea-runtime-bundle = { path = "../../runtime/bundle" }# `raea judge`, dispatched with `raea solid` (verb())raea-app-judge = { path = "../judge" }raea-app-ask = { path = "../ask" }+# a scene, kit or shot held to its plan (docs/make.feature)+raea-app-make = { path = "../make" }# `raea solid export`: the solid built, written as .glb and read back (core/shape), named and coloured (core/meshcheck)raea-core-shape = { path = "../../core/shape" }raea-core-meshcheck = { path = "../../core/meshcheck" }diff --git a/apps/solid/src/lib.rs b/apps/solid/src/lib.rsindex 60a4a001..e6242331 100644--- a/apps/solid/src/lib.rs+++ b/apps/solid/src/lib.rs@@ -91,13 +91,14 @@ fn parse_set(s: &str) -> Result<Map<String, Value>, String> {Ok(m)}-/// `raea solid ...`, `raea judge ...` and `raea ask ...` (docs/ask.feature AK3, which prints as it goes and exits with+/// `raea solid ...`, `raea judge ...`, `raea make ...` (docs/make.feature) and `raea ask ...` (docs/ask.feature AK3, which prints as it goes and exits with/// its own code), the verbs that build and judge a piece (engine/cli hands them over), or None for another verb.pub fn verb(args: &[String]) -> Option<Result<String, String>> {match args.first().map(String::as_str) {Some("solid") => Some(cli(args)),Some("judge") => Some(raea_app_judge::cli(args)),Some("ask") => std::process::exit(raea_app_ask::cli(&args[1..])),+ Some("make") => Some(raea_app_make::cli(args)),_ => None,}}diff --git a/apps/tools/src/agent_hooks.rs b/apps/tools/src/agent_hooks.rsindex 4d4ba09f..394d5120 100644--- a/apps/tools/src/agent_hooks.rs+++ b/apps/tools/src/agent_hooks.rs@@ -21,7 +21,7 @@ struct Hook {fn hooks(agent: &str) -> R<Vec<Hook>> {let h = |event, matcher, secs| Hook { event, matcher, secs };Ok(match agent {- "claude" => vec![h("PreToolUse", "Bash", 30), h("PostToolUse", "*", 60), h("Stop", "", 10)],+ "claude" => vec![h("PreToolUse", "Bash", 30), h("PostToolUse", "*", 60), h("Stop", "", 30)],"codex" => vec![h("PreToolUse", "^(Bash|shell|shell_command|exec_command)$", 30), h("PostToolUse", "^(apply_patch|Edit|Write)$", 60)],"gemini" => vec![h("BeforeTool", "run_shell_command", 30), h("AfterTool", "write_file|replace", 60)],"kimi" => vec![h("PreToolUse", "Bash|Shell", 30), h("PostToolUse", "Write|Edit|WriteFile|StrReplaceFile", 60)],diff --git a/core/brief/src/brief.rs b/core/brief/src/brief.rsindex b081f864..ace115ea 100644--- a/core/brief/src/brief.rs+++ b/core/brief/src/brief.rs@@ -61,6 +61,11 @@ pub struct Brief {#[serde(default, skip_serializing_if = "Option::is_none")]#[ts(type = "unknown", optional)]pub story: Option<serde_json::Value>,+ /// a scene, kit or shot made to a frozen plan and held to the review loop (docs/make.feature): `scene()`, `kit()`+ /// or `shot()` from "raea/brief"; `raea make status` decides when it's done+ #[serde(default, skip_serializing_if = "Option::is_none")]+ #[ts(optional)]+ pub make: Option<crate::make::Make>,}#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]@@ -124,5 +129,8 @@ pub fn doctor(b: &Brief) -> Vec<String> {for a in &b.assumed {out.push(format!("`{a}` is assumed: confirm it with the person"));}+ if let Some(m) = &b.make {+ out.extend(crate::make::doctor(m).into_iter().map(|d| format!("make: {d}")));+ }out}diff --git a/core/brief/src/lib.rs b/core/brief/src/lib.rsindex af30957d..38849104 100644--- a/core/brief/src/lib.rs+++ b/core/brief/src/lib.rs@@ -4,11 +4,13 @@//! types (`declarations`), so what tsc checks is exactly what this crate reads.pub mod brief;+pub mod make;pub mod parts;pub mod script;pub mod taste;pub use brief::Brief;+pub use make::Make;pub use parts::Parts;pub use script::Script;pub use taste::Taste;@@ -36,6 +38,7 @@ pub fn declarations() -> String {script::Script, script::Scene, script::Beat, script::Line,taste::Taste, taste::TasteSection, taste::Rule, taste::RuleCheck, taste::RuleLevel, taste::Check,parts::Parts, parts::Concept, parts::Level, parts::Count, parts::Part,+ make::Make, make::Kind, make::Source, make::DialValue, make::Dial, make::Route, make::Origin, make::Pick, make::Object, make::Shot,));out.join("\n\n") + "\n"}diff --git a/core/brief/src/make.rs b/core/brief/src/make.rsnew file mode 100644index 00000000..eac46fd3--- /dev/null+++ b/core/brief/src/make.rs@@ -0,0 +1,257 @@+//! A job made to a frozen plan (docs/make.feature MK0): `make` on a project's brief.ts, written with `scene()`, `kit()`+//! or `shot()` from "raea/brief" before anything is built, and read here. One loop, three kinds: a scene (a dressed,+//! lit place), a kit (props that belong together) and a shot (stills or camera moves of a built scene). Every object+//! carries its real size and whether it came from the reference or was invented; every dial its value, where the value+//! came from, and what it meant here. `raea make status` (apps/make) holds the job to it.++use std::collections::BTreeMap;++use serde::{Deserialize, Serialize};+use ts_rs::TS;++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]+#[serde(rename_all = "lowercase")]+#[ts(rename = "MakeKind")]+pub enum Kind {+ /// a dressed, lit place from references or a brief+ Scene,+ /// a set of props in one style, at real size, to drop into any scene+ Kit,+ /// stills or camera moves of a built scene, from words+ Shot,+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(rename_all = "camelCase", deny_unknown_fields)]+#[ts(optional_fields)]+pub struct Make {+ pub kind: Kind,+ /// the pictures the job answers to (paths beside the brief): what is in it and where for a scene, the style for a kit+ #[serde(default)]+ #[ts(as = "Option<Vec<String>>", optional)]+ pub references: Vec<String>,+ /// one paragraph every reference prompt carries: era, palette, materials, wear, and one fictional maker+ pub style: Option<String>,+ /// by name, from the kind's set (DIALS); one left out is read from the references+ #[serde(default)]+ #[ts(as = "Option<BTreeMap<String, Dial>>", optional)]+ pub dials: BTreeMap<String, Dial>,+ #[serde(default)]+ #[ts(as = "Option<Vec<Object>>", optional)]+ pub objects: Vec<Object>,+ #[serde(default)]+ #[ts(as = "Option<Vec<Shot>>", optional)]+ pub shots: Vec<Shot>,+ /// the compositions the job's checks hold (relative to the brief): each needs a clean render or check newer than it+ #[serde(default)]+ #[ts(as = "Option<Vec<String>>", optional)]+ pub compositions: Vec<String>,+ /// what must exist when it's done, relative to the brief; replaces the kind's own list (`deliverables`)+ #[serde(default)]+ #[ts(as = "Option<Vec<String>>", optional)]+ pub deliverables: Vec<String>,+ /// the most critic rounds the job gets; at the cap it is delivered with what's still missing (8 by default)+ pub rounds: Option<u32>,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]+#[serde(rename_all = "lowercase")]+#[ts(rename = "MakeSource")]+pub enum Source {+ /// set by the person who asked: an instruction, even when the reference says otherwise+ Customer,+ /// read from the references, because nobody set it+ Reference,+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(untagged)]+#[ts(rename = "MakeDialValue")]+pub enum DialValue {+ Number(f64),+ Text(String),+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(untagged)]+#[ts(rename = "MakeDial")]+pub enum Dial {+ /// `wear: 0.4`: the value alone, set by the person+ Bare(DialValue),+ /// `wear: { value: 0.4, source: "reference", means: "scuffed bakelite, worn paint on the edges" }`+ Full {+ value: DialValue,+ #[ts(optional)]+ source: Option<Source>,+ /// what the value meant for this job, in one line+ #[ts(optional)]+ means: Option<String>,+ },+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]+#[serde(rename_all = "lowercase")]+#[ts(rename = "MakeRoute")]+pub enum Route {+ /// defined by numbers: Manifold solids, raea/room+ Solid,+ /// defined by a rule: fields, growth, instances+ Rule,+ /// defined by its looks: generated (raea gen)+ Gen,+ /// an exact asset that already exists+ Library,+ /// far background: a picture on a plane+ Picture,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TS)]+#[serde(rename_all = "lowercase")]+#[ts(rename = "MakeOrigin")]+pub enum Origin {+ /// seen in a reference+ Reference,+ /// added to complete the place or the set, in the same world+ Invented,+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(deny_unknown_fields)]+#[ts(optional_fields)]+#[ts(rename = "MakePick")]+pub struct Pick {+ /// "tripo-h31", "meshy", ...+ pub generator: String,+ /// one line: why this one ("sharper dial numerals; Tripo fused the handset to the cradle")+ pub why: String,+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(rename_all = "camelCase", deny_unknown_fields)]+#[ts(optional_fields)]+#[ts(rename = "MakeObject")]+pub struct Object {+ /// snake_case, unique in the job+ pub id: String,+ pub label: String,+ /// real height in metres+ pub h: Option<f64>,+ /// [width, depth, height] in metres, for boxy things (generators invent depth)+ pub dims: Option<[f64; 3]>,+ /// largest extent in metres, for things that lie flat (tools, papers)+ pub max: Option<f64>,+ pub route: Option<Route>,+ /// one object, its condition and its materials; never a real brand+ pub prompt: Option<String>,+ pub source: Option<Origin>,+ /// where it is in reference 0: [x0, y0, x1, y1] in 0..1+ pub crop: Option<[f64; 4]>,+ /// where it stands in a scene: metres, the floor's front-left corner at the origin, rot 0 = facing the entrance+ pub at: Option<[f64; 3]>,+ pub rot: Option<f64>,+ pub hero: Option<bool>,+ pub pick: Option<Pick>,+ /// what was fixed by script ("glass made transmissive, label kept opaque")+ #[serde(default)]+ #[ts(as = "Option<Vec<String>>", optional)]+ pub fixes: Vec<String>,+}++#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]+#[serde(rename_all = "camelCase", deny_unknown_fields)]+#[ts(optional_fields)]+#[ts(rename = "MakeShot")]+pub struct Shot {+ /// [a-z0-9_]: the file it lands as (out/shots/<name>.png or .mp4)+ pub name: String,+ /// in a crew's words: "slow push along the counter, rack focus to the register"+ pub description: Option<String>,+ /// static, dolly, truck, pedestal, crane, pan, tilt, orbit, dollyZoom, path+ #[serde(rename = "move")]+ #[ts(rename = "move")]+ pub move_: Option<String>,+ pub seconds: Option<f64>,+ pub lens: Option<f64>,+ /// none, subtle, walk+ pub handheld: Option<String>,+ /// a still rather than a move+ pub still: Option<bool>,+}++/// Each kind's dials: what may be set, and what an unset one is read from the references as.+pub fn dials(kind: Kind) -> &'static [&'static str] {+ match kind {+ Kind::Scene => &["density", "tidiness", "wear", "wetness", "time_of_day", "weather", "atmosphere", "power", "warmth", "look"],+ Kind::Kit => &["count", "variety", "detail", "wear", "wetness", "warmth", "look"],+ Kind::Shot => &["res", "seconds", "lens", "handheld", "look"],+ }+}++/// The round cap when the plan names none: AnyKit's and raea judge's 8.+pub const ROUNDS: u32 = 8;++/// What must exist when the job is done, relative to the brief's folder: the plan's own list, else the kind's.+pub fn deliverables(m: &Make) -> Vec<String> {+ if !m.deliverables.is_empty() {+ return m.deliverables.clone();+ }+ match m.kind {+ // the stills are counted (three or more), not named: apps/make checks the folder+ Kind::Scene => vec!["out/stills/".into()],+ Kind::Kit => {+ let mut v: Vec<String> = m+ .objects+ .iter()+ .flat_map(|o| [format!("out/kit/{0}/{0}.glb", o.id), format!("out/kit/{0}/{0}_lod1.glb", o.id), format!("out/kit/thumbs/{}.png", o.id)])+ .collect();+ v.extend(["out/kit/lineup.png".into(), "out/kit/kit.json".into()]);+ v+ }+ // a shot is a still or a move, so either file answers; apps/make reads `a|b`+ Kind::Shot => m.shots.iter().map(|s| format!("out/shots/{0}.png|out/shots/{0}.mp4", s.name)).collect(),+ }+}++/// What the plan still lacks before it can be built against, each with what to do. Empty when it's ready.+pub fn doctor(m: &Make) -> Vec<String> {+ let mut out = Vec::new();+ let allowed = dials(m.kind);+ for name in m.dials.keys().filter(|k| !allowed.contains(&k.as_str())) {+ out.push(format!("dial `{name}` isn't one of a {:?}'s ({}): drop it or say it in `style`", m.kind, allowed.join(", ")));+ }+ match m.kind {+ Kind::Shot if m.shots.is_empty() => out.push("no shots: list each with a name and a description".into()),+ Kind::Scene | Kind::Kit if m.objects.is_empty() => out.push("no objects: list every object with its real size and route".into()),+ _ => {}+ }+ if m.kind == Kind::Kit && m.style.is_none() {+ out.push("no `style`: one paragraph (era, palette, materials, wear, one fictional maker) every reference carries".into());+ }+ let mut seen = std::collections::BTreeSet::new();+ for o in &m.objects {+ if !seen.insert(o.id.as_str()) {+ out.push(format!("object `{}` is listed twice", o.id));+ }+ if o.h.is_none() && o.dims.is_none() && o.max.is_none() {+ out.push(format!("object `{}` has no size: give `h` (metres), `dims` for boxy things or `max` for flat ones", o.id));+ }+ if o.route.is_none() && m.kind == Kind::Scene {+ out.push(format!("object `{}` has no route: solid, rule, gen, library or picture", o.id));+ }+ if matches!(o.route, Some(Route::Gen)) || m.kind == Kind::Kit {+ if o.prompt.is_none() {+ out.push(format!("object `{}` is generated but has no prompt: one object, its condition and materials", o.id));+ }+ }+ }+ let mut names = std::collections::BTreeSet::new();+ for s in &m.shots {+ if !names.insert(s.name.as_str()) {+ out.push(format!("shot `{}` is listed twice", s.name));+ }+ if !s.name.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_') {+ out.push(format!("shot `{}`: names are [a-z0-9_], the file it lands as", s.name));+ }+ }+ out+}diff --git a/core/brief/src/tests.rs b/core/brief/src/tests.rsindex 14d289a6..90116414 100644--- a/core/brief/src/tests.rs+++ b/core/brief/src/tests.rs@@ -97,3 +97,29 @@ fn an_older_brief_with_stages_still_reads_and_never_writes_them() {assert!(!serde_json::to_string(&b).unwrap().contains("stages"));assert!(!declarations().contains("stages"), "the schema an agent writes has no stages (docs/plan.feature PL8a)");}++#[test]+fn a_make_plan_reads_and_its_doctor_names_what_it_lacks() {+ let b: Brief = read("brief.ts", r#"{"title": "Flight desk kit", "make": {"kind": "kit",+ "dials": {"count": 2, "wear": {"value": 0.4, "source": "customer", "means": "scuffed bakelite"}, "time_of_day": "night"},+ "objects": [{"id": "phone", "label": "Rotary phone", "h": 0.12, "prompt": "a rotary desk phone", "source": "invented"},+ {"id": "ashtray", "label": "Glass ashtray"}]}}"#).unwrap();+ let m = b.make.as_ref().unwrap();+ assert_eq!(m.kind, make::Kind::Kit);+ let d = make::doctor(m);+ assert!(d.iter().any(|x| x.contains("`time_of_day`")), "a scene's dial on a kit: {d:?}");+ assert!(d.iter().any(|x| x.contains("no `style`")), "{d:?}");+ assert!(d.iter().any(|x| x.contains("`ashtray` has no size")), "{d:?}");+ assert!(d.iter().any(|x| x.contains("`ashtray` is generated but has no prompt")), "{d:?}");+ assert!(!d.iter().any(|x| x.contains("`phone`")), "{d:?}");+ assert!(brief::doctor(&b).iter().any(|x| x.starts_with("make: ")));+ let want = make::deliverables(m);+ assert!(want.contains(&"out/kit/phone/phone_lod1.glb".to_string()) && want.contains(&"out/kit/kit.json".to_string()), "{want:?}");+}++#[test]+fn a_shot_plan_wants_a_still_or_a_move_per_shot() {+ let m: make::Make = read("make", r#"{"kind": "shot", "shots": [{"name": "counter_push", "move": "push_in"}, {"name": "Bad Name"}]}"#).unwrap();+ assert_eq!(make::deliverables(&m)[0], "out/shots/counter_push.png|out/shots/counter_push.mp4");+ assert!(make::doctor(&m).iter().any(|x| x.contains("`Bad Name`")));+}diff --git a/docs/make.feature b/docs/make.featurenew file mode 100644index 00000000..9d10a5f8--- /dev/null+++ b/docs/make.feature@@ -0,0 +1,197 @@+@spec+Feature: Make: scenes, kits and shots built to a frozen plan and held to a review loop the agent can't skip+ Shane, 2026-11-23, after a deep dive into apekshik's AnyScene, AnyKit and AnyShot (github.com/apekshik, MIT): "lets+ take all three learn form them and adopt that review loop internally wholesale. i think this is ley for us. all 11+ points seem relevant to adopt or itnegrate intoexisting systems, or converting into a typescript planning and review+ sdk as part of it". Decided the same day: the contract goes on brief.ts; the gate uses `raea ask`; internal and cloud+ are built together. Plan: ~/.claude/plans/dreamy-floating-dijkstra-of-771a18a0-2207-4b03-80e7-ddbec117bc80.md.++ What the three repos showed (their builder/CRAFT.md and agent/KIT.md say it outright): the quality came from a loop,+ not a model or a setting. Render it and look; name the problem precisely; fix it in a script so a rebuild keeps it;+ check the fix from a view that shows it (a camera 30 cm off the floor shows a floating chair a wide shot hides); get+ an independent critic, because the builder stops seeing its own flaws. And a Stop hook that won't let the agent end+ until every deliverable exists and the critic passes, with a cap and a stall rule so it can't loop forever.++ The model this file sets:+ 1. One loop, three kinds of job: a scene (a dressed, lit place from references or a brief), a kit (a set of props+ that belong together, from style references) and a shot (stills or camera moves of a built scene, from words).+ 2. The plan is the contract: `make` on the project's brief.ts (core/brief make.rs), typed from Rust, written by the+ agent before it builds, and read by Rust. Every object carries its real size and whether it came from the+ reference or was invented; every dial its value, where the value came from, and what it meant here.+ 3. Done is decided in code (`raea make status`), never by the agent saying so, and enforced where the agent stops:+ the Stop hook of every agent raea installs hooks for, locally and on raea cloud.+ 4. Three tiers of gate, each gating once it has earned it: measured checks always; `raea ask` questions one by one,+ once each is calibrated on the person's labels; a fresh critic's fixes always (fixed or answered), its score+ once `raea judge calibrate` agrees with the person's eye.+ 5. Every job ends with its notes, including what the skill got wrong for it, so the next job starts from them.++ Background:+ Given raea's scene loop as advice (sdk/guides/craft/bevy/scenes.md, from the 11-06 research): brief, routing,+ build big to small, `raea render --review` (hero, front, right, top, iso and low cameras in colour and clay;+ core/review), `raea judge` (frozen rubric; clef, kimi or claude; pass, done, stall in code; apps/judge),+ `raea scene lint` (raea-sys-contact) and `raea gen check`+ And `raea ask` (docs/ask.feature): typed clef questions with a ledger that calibrates each question on labels+ And the raea plugin's hooks (skills/skills/hooks/hooks.json -> `raea hook claude`, apps/check hook.rs), whose Stop+ branch already blocks a turn's end to hand over what the person sent from the app+ And the project's record (.raea/record/, core/facts record.rs): what each render and check found, and when++ Rule: the plan and done (MK0-MK3)+++ Scenario: MK0. The contract: `make` on brief.ts+ Given a brief.ts whose default export has `make: kit({...})`, `scene({...})` or `shot({...})` (raea/brief)+ Then core/brief reads it as `Make`: its kind, references, style (one paragraph: era, palette, materials, wear and+ one fictional maker), dials, objects, shots, deliverables and a round cap (8 by default)+ And each object has an id, a label, one size (`h`, `dims` [w, d, h] or `max` for things that lie flat), a route+ (solid, rule, gen, library, picture), a prompt, `source` (reference or invented), a `crop` in reference 0, a+ place (x, y, z, rot) for a scene, the generator it was picked from and why, and the fixes made by script+ And each dial is `{ value, source: customer | reference, means }`, from its kind's set (scene: density, tidiness,+ wear, wetness, time_of_day, weather, atmosphere, power, warmth, look; kit: count, variety, detail, wear,+ wetness, warmth, look; shot: res, seconds, lens, handheld, look)+ And the TypeScript is generated from those types (sdk/raea/src/brief.gen.ts), so tsc checks what Rust reads+ And `doctor` names what the plan still lacks: no objects, an object with no size or no route, a dial outside its+ kind's set, a generated object with no prompt++ @needs:MK0+ Scenario: MK1. `raea make status`: what's missing, decided in code+ Given a project whose brief has `make`+ When `raea make status [DIR] [--json]` runs+ Then it lists what's missing for the kind:+ | kind | deliverables (under out/, overridable with `deliverables`) |+ | scene | stills/ with 3 or more pictures |+ | kit | kit/<id>/<id>.glb, kit/<id>/<id>_lod1.glb and kit/thumbs/<id>.png per object, kit/lineup.png, kit/kit.json |+ | shot | shots/<name>.png or shots/<name>.mp4 per shot |+ And NOTES.md beside the brief, with a "What the skill got wrong" section+ And each gate's state: the record's last render or check of every composition the plan names is newer than the+ file and found no error; the critic has judged a round newer than the newest deliverable; each blocking defect+ of that round is fixed (the round passed) or answered in NOTES.md by its id+ And the judge's rounds, passes in a row and stall, read from review/judge.log.jsonl as `raea judge` keeps them+ And `done` is true when nothing is missing and every gate is clear, and also when the job is capped (its rounds+ reached the cap) or stalled; a capped or stalled job is delivered short, with what's missing listed++ @needs:MK1+ Scenario: MK2. The Stop hook: the agent can't end a job that isn't done+ Given an agent session (Claude Code, codex, gemini, kimi) with raea's hooks, in a project whose brief has `make`+ When its turn is about to end and `raea make status` isn't done+ Then the hook blocks the stop with "Not done:" and what's missing, and the agent keeps going+ And a session blocked three times with the same list goes through (the agent is going in circles; the status+ says so), as PL7's keeper stops after asks that change nothing+ And a project without `make` is never blocked, and a brief that doesn't load blocks nothing (the hook says why)++ @needs:MK2+ Scenario: MK3. Gates in plan.org+ Given the project's plan.org (docs/plan.feature)+ Then `raea make status --plan` writes each gate as a check line under the job's task (sdk/task `setCheck`), so+ the person, the app and the cloud see the same list the hook holds the agent to++ Rule: the three tiers of gate (MK4-MK6)++ @needs:MK1+ Scenario: MK4. Defects as calibrated ask questions+ Given the judge's yes/no defects (apps/judge rubric.rs: floating, intersecting, blobby, stand_in, clones,+ flat_colour, plastic, ...) and the loop's own (a cohesion outlier on a reference sheet, a real brand, garbled+ hero text, a disconnected assembly, opaque glass, a camera through a wall)+ Then each is an ask question with versioned words (core/ask), answered on the gate's sheet and kept in the ledger+ And it gates once `raea ask calibrate` passes it on the person's labels (16 problem, 16 clean, held-out AUC 0.8);+ until then its answer shows in the status as advice++ @needs:MK1+ Scenario: MK5. A rubric per kind for the fresh critic+ Then `raea judge --kind scene|kit|shot` asks the kind's categories (scene: layout, props, screens and signage,+ materials, light, atmosphere, plausibility, composition; kit: cohesion, reference fidelity, brief, mesh,+ texture, assembly, scale, labels; shot: framing, move, focus, clearance, continuity, grade)+ And the critic is told the bar is a production base an artist then refines, judged at normal viewing distance,+ no points off for choices that differ from the reference, at most five fixes, most damaging first++ @needs:MK5+ Scenario: MK6. The critic's score gates once it is calibrated+ Given `raea judge calibrate` reporting agreement with the person's eye for a kind+ Then that kind's jobs also need two fresh passes in a row to be done; before that, fixed-or-answered is enough++ Rule: measured placement (MK7-MK9)++ Scenario: MK7. Grounding at contact points+ Given a part whose box bottom isn't where it touches down (splayed feet, a handle, an origin offset)+ Then `raea scene lint` casts rays down from its lowest vertices, ignoring itself, volumes and decals, and reports+ `floating_contact` with the gap and its `{dy}` fix; hanging kinds (signs, pendants, lamps on cords) only with+ --all; a fix only ever settles a part down++ Scenario: MK8. The clip check, for every level+ Then the triangle check FLOOR3 used (projects/floor3 tools/clips.ts) is `raea scene lint --clips`: intersections+ with depth, z-fighting faces, flicker inside one model, and nothing within 3 mm (floating)++ Scenario: MK9. Re-drop after every move+ Then a part moved sideways by a fix is settled onto what's under its new place in the same pass, and stools drop+ from below the table top, so nothing hovers at table height++ Rule: kits (MK10-MK13)++ @needs:MK1+ Scenario: MK10. References made in one style, checked on one sheet+ Then each object's reference is `raea gen image --edit` with the style images as input, the plan's style+ paragraph and the scan template, and `raea make sheet refs` puts them all on one sheet before any 3D+ And outliers (another style, a real brand, cropped, two objects) are regenerated first: the cheapest place to fix+ cohesion++ @needs:MK10+ Scenario: MK11. Both generators, picked on clay+ Then every reference goes to Tripo H3.1 (face limit 150k heroes, 60k small) and Meshy, and `raea gen pick ID...`+ renders reference | Tripo beauty | Tripo clay | Meshy beauty | Meshy clay under one light, and records the+ pick and a one-line why (the earlier ~150 props: Meshy ~70%, small items and printed labels; Tripo the big+ hard-surface heroes)++ @needs:MK11+ Scenario: MK12. Prep and LOD+ Then `raea gen check -o` fits each pick (front -Y, real metres, bottom-centre, textures at 2K or less) and+ `--lod1` writes a quarter-triangle copy, each with its .glb.json saying how it was made++ @needs:MK12+ Scenario: MK13. A kit is a component set+ Then a finished kit is shared/components/<kit>/ (one component per object with its fixture), with a `<Lineup>`+ composition (scale bar, labels), thumbnails and kit.json, so `raea component add` puts it in any scene++ Rule: shots (MK14-MK17)++ Scenario: MK14. Camera moves, focus and the handheld walk+ Then raea/camera has static, dolly, truck, pedestal, crane, pan, tilt, orbit, dollyZoom (the lens solved per+ frame to hold the subject) and path (Catmull-Rom), focus track, point and rack with holds, and+ `handheld({ profile: "walk" })`: steps at 1.8 Hz, an aim on a spring, small reframes, nothing above 1.9 Hz++ @needs:MK14+ Scenario: MK15. Blocking: framing sheets and a lens chart+ Then `raea render --framing` stamps each shot at t = 0, 0.5 and 1 on one sheet, and `--lenschart SHOT` its first+ frame at 18, 24, 35, 50, 85 and 135 mm++ @needs:MK14+ Scenario: MK16. Clearance on every frame+ Then `raea scene stage --clearance 0.45` finds every frame where the camera is nearer a solid than that, leaving+ out volumes, particles, decals, glass panes meant to be passed and anything under 5 cm++ @needs:MK14+ Scenario: MK17. Shots from words and from a floor plan+ Then the shot-language guide maps a crew's words to moves (push in, truck, reveal, rack focus, walkthrough at+ 0.4-0.6 m/s and 1.5-1.7 m), and a floor plan with a drawn path is registered to an ortho top render and its+ path becomes `path` keys; grade looks (clean, cinematic, gritty, vintage) are raea/post presets++ Rule: the plan, drawn (MK18)++ @needs:MK0+ Scenario: MK18. `raea make plan`: a floor plan, a grey box and a comparison+ Then it draws floor-plan.png (labelled footprints, invented ones dashed, lights, the reference camera's cone),+ renders a grey box of the plan from the reference camera (raea/room and boxes, `raea render --review`) and+ puts the reference beside it, for the person to approve before anything is generated++ Rule: raea cloud (MK19-MK20)++ @needs:MK2+ Scenario: MK19. Three skills on raea cloud+ Then raea cloud has "Scene from references" (stops: plan, spend, picks, finals), "Kit from style" (plan,+ reference sheet, spend, lineup) and "Shots of a scene" (shot list, framing, finals), each stop's checks calling+ `raea make status --json` on the box++ @needs:MK19+ Scenario: MK20. Retry-safe jobs and a live view+ Then a project is keyed by a hash of its inputs: the same ask returns the finished project, attaches to the+ running one or resumes it without paying again for what's already generated+ And every picture the agent opens goes to the live watch with a preview, and a heartbeat every 20 s repeats the+ milestones so far for anyone who joins latediff --git a/docs/manual/reference/cli/make.md b/docs/manual/reference/cli/make.mdnew file mode 100644index 00000000..064bbc38--- /dev/null+++ b/docs/manual/reference/cli/make.md@@ -0,0 +1,45 @@+---+title: "raea make"+summary: "Whether a scene, kit or shot made to its plan is done: what's missing, each gate, the judge's rounds, decided in code; the agent's Stop hook holds it there."+order: 44+sources: ["apps/make/src/lib.rs", "apps/make/src/status.rs", "core/brief/src/make.rs", "apps/check/src/make_gate.rs"]+---++`raea make status` reads the job on a project's brief.ts (`make: scene({...})`, `kit({...})` or `shot({...})` from+`raea/brief`) and says what's still missing, from what's on disk and never from what the agent says:++- the kind's deliverables (a scene's three or more stills; a kit's GLB, LOD1 and thumbnail per object, its lineup+ and kit.json; a shot's still or move per shot), or the plan's own `deliverables`;+- NOTES.md, ending with a "What the skill got wrong" section;+- each composition the plan names has a render or check newer than it that found no error (the project's record);+- a fresh critic (`raea judge`) has judged a round newer than the newest deliverable, and each blocking defect it+ named is fixed or answered in NOTES.md by its name; once the judge is calibrated against your eye, two passes in a+ row as well.++A job is done when all of that holds, and also at its round cap (8 by default) or when three rounds in a row haven't+beaten the best before them: then it's delivered short, with what's missing listed. raea's Stop hook (`raea hook`)+asks it at the end of every turn in a project whose brief has `make`, and keeps an agent working until it's done; the+same open items block a session three times at most. The loop it holds is in docs/make.feature.++```sh+raea make status+raea make status ~/Documents/raea/acme/projects/flight-desk-kit --json+```++<!-- generated:begin by tools/manual-ref/cli.ts from `raea help --json`; edit only the flag descriptions -->++## Usage++```sh+raea make status [DIR] [--json] (a scene, kit or shot held to its plan, `make` on brief.ts: what's missing, each gate, the judge's rounds, and whether it's done, decided in code; the agent's Stop hook holds it there)+```++Headless: it needs nothing running and opens no window. Takes any number of arguments besides its flags.++## Flags++| Flag | Takes | What it does |+| --- | --- | --- |+| `--json` | – | Print the status as JSON: missing, gates, judge, done, short and why. |++<!-- generated:end -->diff --git a/engine/cli/Cargo.toml b/engine/cli/Cargo.tomlindex 378f183e..4ac2f200 100644--- a/engine/cli/Cargo.toml+++ b/engine/cli/Cargo.toml@@ -75,6 +75,7 @@ raea-app-judge = { path = "../../apps/judge" }# raea scene lint|explain|light|stage (docs/stage-guards.feature)raea-app-scene = { path = "../../apps/scene" }raea-app-ask = { path = "../../apps/ask" }+raea-app-make = { path = "../../apps/make" }raea-app-media = { path = "../../apps/media" }# `raea app run|check|bundle` and `raea rune` on either target (docs/targets.feature T0b)raea-app-targets = { path = "../../apps/targets" }diff --git a/engine/cli/src/cli.rs b/engine/cli/src/cli.rsindex d779cf5b..43dfdd16 100644--- a/engine/cli/src/cli.rs+++ b/engine/cli/src/cli.rs@@ -146,7 +146,7 @@ pub fn run(args: &[String]) -> R<String> {// a workspace's files and specs (docs/projects.feature), listed under render's usage like librarylet usage = format!("{usage}\n raea spec FILE.ts [--as brief|script|taste|parts] (a spec's default export as JSON, checked against its schema: brief.ts, script.ts, taste.ts, NAME.parts.ts)\n raea workspace init [NAME] [--layout LAYOUT] | raea workspace adopt DIR [--name NAME] | raea workspace [--json] (a workspace: a git repo of projects under raea.root, ~/Documents/raea unless git config says)\n raea project new NAME [--storage inline|submodule] | raea project split NAME [--remote URL] | raea project join NAME | raea project [--json] (a project in the workspace: its folder, brief.ts, media/, out/; split and join keep its history)\n raea check EDIT.tsx --quick [--shape S] [--platform P] [--taste T] [-o check.json] (three stills of a composition checked for text: clipped, cramped, safe areas, sizes; about a second)\n raea hook [claude|codex|gemini|kimi] (every agent's tool hooks, which raea skills install adds: before a shell command, media opened in the Mac's viewer while the raea app is installed is stopped once for raea show (the same command again goes through); after a save, the quick check on a composition)\n raea next [DIR] (the two or three useful next steps for the project, from its brief, compositions, renders and checks)\n raea doctor [--fix] [DIR] (what doesn't match this raea: old brief files, an older workspace format, an agent's skill from another version)\n raea app run|check|bundle APP.tsx [--target web|native] [--size WxH] [--script steps.json] [--png DIR] [-o App.app] (a TSX app on @raea/ui: its window, the headless check, a Mac app; web is Blitz on Bevy, native is Rune; the app's `export const app` sets the target, web when it doesn't; raea rune ... is --target native)\n {}\n {}\n {} ({})\n {}\n {}\n {}", skill::USAGE, tools::blender::USAGE, tools::motion::SETUP_USAGE, tools::motion::SETUP_ABOUT, raea_app_engines::godot::USAGE, raea_app_engines::shot::USAGE, raea_app_engines::round::USAGE);let (export_game, capcut, layers, xml, scene, physics, splat, wear) = (raea_app_game::USAGE, raea_app_capcut::USAGE, raea_app_layers::USAGE, raea_app_layers::USAGE_XML, raea_app_scene::USAGE, motion::physics::USAGE, tools::splat::USAGE, raea_runtime_wear::USAGE);- let apps = format!(" {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n", raea_app_direction::check::USAGE, raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_ask::USAGE, raea_app_direction::USAGE, raea_app_direction::findings::USAGE, raea_app_notes::USAGE, raea_app_fingerprint::USAGE, raea_sys_index::cli::USAGE);+ let apps = format!(" {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n", raea_app_direction::check::USAGE, raea_app_check::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_ask::USAGE, raea_app_make::USAGE, raea_app_direction::USAGE, raea_app_direction::findings::USAGE, raea_app_notes::USAGE, raea_app_fingerprint::USAGE, raea_sys_index::cli::USAGE);return Ok(format!("raea: renders, plays and checks raea compositions (React and TypeScript) on the GPU.\n\nusage: {usage}\n raea init (a project's files where they're missing: edit.tsx, cuts.ts, components/, AGENTS.md)\n raea cut TAKE \"line\" ... | --at A-B ... [--append] (cuts.ts and words.json: a take under media/ cut in the pauses around each line it says, transcribed first if it has no TAKE.words.json; or at those seconds)\n raea frame TAKE [--at S] (how a take fits the edit: a talking take for <FaceFrame>, a screen for <ScreenFit>, from where its face is)\n raea component list | raea component add NAME ... [--shared] [--force] | raea part list | raea part add NAME ... [--shared] [--force] (a ready component or set copied into components/, or the workspace's shared/components/ with --shared, yours to change; raea part is its old name)\n raea brand DOMAIN|URL (the brand kit read from its website on this machine: brand/brand.css, brand/brand.json, BRAND.md, logos in media/brand; says when a plain fetch saw too little)\n raea guide [NAME] (craft, the floor read before any edit; the modes: pitch, explain, story, play, tool; motion, music, layout and the rest; bevy and bevy/NAME for 3D)\n raea context PROJECT (what to read before working on a project: taste, brief, look, the floor and its modes' guides)\n{apps} raea play EDIT.tsx [--input | --input-script KEYS.json] [--size WxH] [--seconds N|end] (a game, live; also: --input-log FILE --offscreen --snapshot T FILE --json FILE --seek F FILE --pick X,Y --view YAW,PITCH,DISTANCE --scrub N --baked --autoplay --no-vsync --master --3d)\n {export_game} (a game as a program of its own: a Mac app or a command)\n {capcut}\n {layers}\n {xml}\n {scene} (what each 3D part rests on: floating, sunk and clipping parts; light: the scene's lighting)\n {physics} (the bakes <Physics> and <Goo> make)\n {wear} (a .glb's weathering causes for raea/wear: the model with a second UV set and its cause maps, made once in the asset store)\n {splat} (footage trained into a Gaussian splat for <Splat>; setup installs its tools)\n raea run SCRIPT.ts (a TypeScript program on the engine, headless: its default export is called, what it prints is the answer; a check like a room's checkLayout; also: --timeout S)\n raea gen image|video|music|sfx|speech|mesh|text \"PROMPT\" | gen plan|run FLOW.ts|FLOW.json | gen comfy import|export|run|schema FILE | gen models | gen balance (generated media through made.app, fal, Replicate, OpenRouter, Modal or ComfyUI; ComfyUI workflows both ways: raea gen alone lists its flags)\n {neural_usage} (DLSS 5 neural rendering on a `render --aov` folder, with its motion and depth: your own MLX-DLSS build and weights, RAEA_MLXDLSS and RAEA_DLSS_MODEL)\n {light_usage} (each scene on each light path against its path-traced reference: distance in stops, the worst tile, a moving shot's flicker, a frame's cost; DIR/report.json)\n raea mezz [--check] PATH... (an intra-only ProRes copy of each long-GOP source over 1080p, for smooth scrubbing; --check says which would get one)\n raea traces [show [N|last|DIR]] (the sessions raea left, newest first: how each ended, its glitches; show tells one in full)"));}// `--version`: the release's version, which a skill's front matter names (docs/skills.feature SK6)diff --git a/engine/cli/src/tests.rs b/engine/cli/src/tests.rsindex ea52522a..634f43f8 100644--- a/engine/cli/src/tests.rs+++ b/engine/cli/src/tests.rs@@ -32,7 +32,7 @@ fn help_lists_every_verb() {let listed = |v: &str| [format!("raea {v} "), format!("raea {v}\n"), format!("| {v} ")].iter().any(|l| help.contains(l.as_str()));let missing: Vec<_> = verbs.iter().filter(|v| !listed(v) && !unlisted.contains(&v.as_str())).collect();assert!(missing.is_empty(), "not in raea help: {missing:?}");- for usage in [raea_app_check::USAGE, raea_app_ask::USAGE, raea_app_direction::check::USAGE, raea_app_direction::USAGE, raea_app_notes::USAGE, raea_app_game::USAGE, raea_app_scene::USAGE, motion::physics::USAGE, raea_runtime_wear::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, tools::blender::USAGE] {+ for usage in [raea_app_check::USAGE, raea_app_ask::USAGE, raea_app_direction::check::USAGE, raea_app_direction::USAGE, raea_app_notes::USAGE, raea_app_game::USAGE, raea_app_scene::USAGE, motion::physics::USAGE, raea_runtime_wear::USAGE, tools::splat::USAGE, tools::sound::SAO_USAGE, tools::sound::TOKENSYNTH_USAGE, tools::song::USAGE, motion::track::USAGE, raea_app_solid::USAGE, raea_app_judge::USAGE, raea_app_make::USAGE, tools::blender::USAGE] {assert!(help.contains(usage), "{usage}");}}diff --git a/sdk/raea/src/brief.gen.ts b/sdk/raea/src/brief.gen.tsindex c321c893..72b48644 100644--- a/sdk/raea/src/brief.gen.ts+++ b/sdk/raea/src/brief.gen.ts@@ -45,7 +45,12 @@ sections?: Array<Section>, deliver?: Array<Deliverable>, references?: Array<Refe* the project's stories, imported explicitly (raea/story, docs/story.md): one, or several by name. Kept as written:* raea reads nothing in it, the story SDK and the checks that import it do*/-story?: unknown, };+story?: unknown,+/**+ * a scene, kit or shot made to a frozen plan and held to the review loop (docs/make.feature): `scene()`, `kit()`+ * or `shot()` from "raea/brief"; `raea make status` decides when it's done+ */+make?: Make, };export type Section = { heading: string, text: string, };@@ -193,3 +198,111 @@ material?: string, style?: string,* what a near crop of it must show*/near?: string, };++export type Make = { kind: MakeKind,+/**+ * the pictures the job answers to (paths beside the brief): what is in it and where for a scene, the style for a kit+ */+references?: Array<string>,+/**+ * one paragraph every reference prompt carries: era, palette, materials, wear, and one fictional maker+ */+style?: string,+/**+ * by name, from the kind's set (DIALS); one left out is read from the references+ */+dials?: { [key in string]: MakeDial }, objects?: Array<MakeObject>, shots?: Array<MakeShot>,+/**+ * the compositions the job's checks hold (relative to the brief): each needs a clean render or check newer than it+ */+compositions?: Array<string>,+/**+ * what must exist when it's done, relative to the brief; replaces the kind's own list (`deliverables`)+ */+deliverables?: Array<string>,+/**+ * the most critic rounds the job gets; at the cap it is delivered with what's still missing (8 by default)+ */+rounds?: number, };++export type MakeKind = "scene" | "kit" | "shot";++export type MakeSource = "customer" | "reference";++export type MakeDialValue = number | string;++export type MakeDial = MakeDialValue | { value: MakeDialValue, source?: MakeSource,+/**+ * what the value meant for this job, in one line+ */+means?: string, };++export type MakeRoute = "solid" | "rule" | "gen" | "library" | "picture";++export type MakeOrigin = "reference" | "invented";++export type MakePick = {+/**+ * "tripo-h31", "meshy", ...+ */+generator: string,+/**+ * one line: why this one ("sharper dial numerals; Tripo fused the handset to the cradle")+ */+why: string, };++export type MakeObject = {+/**+ * snake_case, unique in the job+ */+id: string, label: string,+/**+ * real height in metres+ */+h?: number,+/**+ * [width, depth, height] in metres, for boxy things (generators invent depth)+ */+dims?: [number, number, number],+/**+ * largest extent in metres, for things that lie flat (tools, papers)+ */+max?: number, route?: MakeRoute,+/**+ * one object, its condition and its materials; never a real brand+ */+prompt?: string, source?: MakeOrigin,+/**+ * where it is in reference 0: [x0, y0, x1, y1] in 0..1+ */+crop?: [number, number, number, number],+/**+ * where it stands in a scene: metres, the floor's front-left corner at the origin, rot 0 = facing the entrance+ */+at?: [number, number, number], rot?: number, hero?: boolean, pick?: MakePick,+/**+ * what was fixed by script ("glass made transmissive, label kept opaque")+ */+fixes?: Array<string>, };++export type MakeShot = {+/**+ * [a-z0-9_]: the file it lands as (out/shots/<name>.png or .mp4)+ */+name: string,+/**+ * in a crew's words: "slow push along the counter, rack focus to the register"+ */+description?: string,+/**+ * static, dolly, truck, pedestal, crane, pan, tilt, orbit, dollyZoom, path+ */+move?: string, seconds?: number, lens?: number,+/**+ * none, subtle, walk+ */+handheld?: string,+/**+ * a still rather than a move+ */+still?: boolean, };diff --git a/sdk/raea/src/brief.ts b/sdk/raea/src/brief.tsindex 3b08a790..3fdcf45d 100644--- a/sdk/raea/src/brief.ts+++ b/sdk/raea/src/brief.ts@@ -7,7 +7,7 @@//// The types are generated from the Rust schemas (core/brief, raea-core-brief) into brief.gen.ts, so what tsc checks is// what raea reads: `raea context` evaluates the module and Rust validates its default export again.-import type { Brief, Parts, Script, Taste } from "./brief.gen";+import type { Brief, Make, Parts, Script, Taste } from "./brief.gen";export type * from "./brief.gen";export { fingerprint } from "./fingerprint";@@ -25,3 +25,13 @@ export const script = (s: Script): Script => s;export const taste = (t: Taste): Taste => t;/** An object's parts (NAME.parts.ts), written before any geometry: each by name, its level, count and material. */export const parts = (p: Parts): Parts => p;++/** A job made to a frozen plan and held to the review loop (docs/make.feature): `make: scene({...})` on brief.ts. Every+ * object has its real size and whether it came from the reference or was invented; `raea make status` decides when+ * it's done, and the agent's Stop hook holds it there. */+export const scene = (m: Omit<Make, "kind">): Make => ({ kind: "scene", ...m });+/** A kit: props in one style at real size (`style` is the paragraph every reference carries: era, palette, materials,+ * wear and one fictional maker). Done is a GLB, a LOD1 and a thumbnail per object, a lineup and kit.json. */+export const kit = (m: Omit<Make, "kind">): Make => ({ kind: "kit", ...m });+/** Shots of a built scene, each named for the file it lands as and described in a crew's words. */+export const shot = (m: Omit<Make, "kind">): Make => ({ kind: "shot", ...m });diff --git a/tools/manual-ref/cli.ts b/tools/manual-ref/cli.tsindex 853df2d0..194d60b8 100644--- a/tools/manual-ref/cli.ts+++ b/tools/manual-ref/cli.ts@@ -27,7 +27,7 @@ const verbs: Verb[] = JSON.parse(run(["help", "--json"])).verbsconst GROUPS: [string, string, string[]][] = [["Make", "Render, play and package what you wrote.", ["render", "play", "export-game", "export", "bundle", "app", "run"]],["Projects", "The workspace, its projects and what a project holds.", ["init", "workspace", "project", "spec", "component", "part", "add", "brand", "library", "index"]],- ["Check", "What's wrong before anyone watches it.", ["check", "judge", "fingerprint", "findings", "scene", "light", "world", "solid", "next", "doctor", "hook", "traces"]],+ ["Check", "What's wrong before anyone watches it.", ["check", "judge", "make", "fingerprint", "findings", "scene", "light", "world", "solid", "next", "doctor", "hook", "traces"]],["Footage", "Takes, cuts and the camera, from your own media.", ["media", "cut", "frame", "track", "splat", "mezz", "neural"]],["Sound", "Music read, foley and instruments made on this machine.", ["song", "sounds", "sao", "tokensynth", "setup-audio"]],["Generate and 3D tools", "Generated media, physics and weathering bakes, clothes and motion for SOMA's body, Blender and Godot.", ["gen", "physics", "wear", "clothes", "motion", "blender", "godot"]],