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
LR1: room for the layout reads in crates at their 2000-line limit. Matchmove (raea track, matchmove.solve) moves out of raea-runtime-react into raea-runtime-track, which react re-exports as scene::track; the frame pages' asset writer (store_page, store_clear, the writer pool) moves out of raea-runtime-export into raea-runtime-pagestore. page-layout installs itself on import, so the entry adds one line. A pass with no page answers NOTHING_DRAWN, and wait_flush takes the runtime's ask. page-layout and dom-reads are installed by the entry, so the manual's and the skill's references skip them as they skip canvas2d
shinyobjectzee171c4f852d
diff --git a/Cargo.lock b/Cargo.lockindex 3efb88e3..741c22ae 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -14932,6 +14932,7 @@ dependencies = ["raea-runtime-bake","raea-runtime-encode","raea-runtime-page",+ "raea-runtime-pagestore","raea-runtime-react","raea-runtime-scene","raea-runtime-scene3d",@@ -14944,7 +14945,6 @@ dependencies = ["raea-sys-mix","raea-sys-page","serde_json",- "twox-hash","wgpu",]@@ -15071,6 +15071,14 @@ dependencies = ["wgpu",]+[[package]]+name = "raea-runtime-pagestore"+version = "0.1.0"+dependencies = [+ "image",+ "twox-hash",+]+[[package]]name = "raea-runtime-plugins"version = "0.1.0"@@ -15111,6 +15119,7 @@ dependencies = ["raea-runtime-scene","raea-runtime-shared","raea-runtime-shots",+ "raea-runtime-track","raea-runtime-twins","raea-runtime-view","raea-sys-animate",@@ -15202,6 +15211,18 @@ dependencies = ["serde_json",]+[[package]]+name = "raea-runtime-track"+version = "0.1.0"+dependencies = [+ "raea-io-assets",+ "raea-native",+ "raea-runtime-bundle",+ "raea-runtime-calls",+ "raea-sys-bake",+ "serde_json",+]+[[package]]name = "raea-runtime-twins"version = "0.1.0"diff --git a/Cargo.toml b/Cargo.tomlindex 132a50ab..43366583 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -136,6 +136,8 @@ members = ["engine/seedling","engine/web","runtime/react",+ "runtime/track",+ "runtime/pagestore","bench/bridge","bench/bevy-parity","bench/bridge/swatch",diff --git a/engine/cli/src/tests.rs b/engine/cli/src/tests.rsindex febfd4dc..d03f0df3 100644--- a/engine/cli/src/tests.rs+++ b/engine/cli/src/tests.rs@@ -126,7 +126,7 @@ fn every_flag_a_verb_reads_is_in_the_help() {("apps/game export.rs", include_str!("../../../apps/game/src/export.rs")),("apps/game player.rs", include_str!("../../../apps/game/src/player.rs")),("apps/tools song.rs", include_str!("../../../apps/tools/src/song.rs")),- ("motion/track.rs", include_str!("../../../runtime/react/src/scene/track.rs")),+ ("motion/track.rs", include_str!("../../../runtime/track/src/lib.rs")),("apps/tools splat.rs", include_str!("../../../apps/tools/src/splat.rs")),("apps/tools sound.rs", include_str!("../../../apps/tools/src/sound.rs")),("runtime/export scene.rs", include_str!("../../../runtime/export/src/scene.rs")),diff --git a/runtime/bake/src/lib.rs b/runtime/bake/src/lib.rsindex 1a98251f..8b96a827 100644--- a/runtime/bake/src/lib.rs+++ b/runtime/bake/src/lib.rs@@ -215,7 +215,7 @@ pub fn step_frames(app: &mut App, a: i64, b: i64, mut each: impl FnMut(&mut App,app.world().resource::<ReactOutbox>().send(json!({"t": "event", "name": "raea-frames", "value": {"from": a, "to": b}}));for g in a..b {// a layout read gets no boxes: the frames stepped here draw no page (the 3D rows' pre-pass; docs/layout-reads.feature LR2)- raea_runtime_react::scene::settle_with(app, Some(g), 20.0, &mut raea_runtime_react::layout::nothing_drawn)?;+ raea_runtime_react::scene::settle_with(app, Some(g), 20.0, &mut |_| Ok(raea_runtime_react::layout::NOTHING_DRAWN.into()))?;let te = std::time::Instant::now();each(app, g)?;t_each += te.elapsed();diff --git a/runtime/bundle/src/entry.rs b/runtime/bundle/src/entry.rsindex 363b0073..b6b30f1e 100644--- a/runtime/bundle/src/entry.rs+++ b/runtime/bundle/src/entry.rs@@ -14,11 +14,8 @@ pub fn entry(file: &str, o: &CompOpts) -> String {r#"import {{ frameCallbacks, pureAgain, pureFrame, pureSession, seedOf }} from "./motion/pure";import {{ canvas2d }} from "./motion/canvas2d";import {{ mount, addEventListener, BevyCanvasElement }} from "bevy-react";-import {{ layoutReads, stale as layoutStale }} from "./motion/page-layout";canvas2d(BevyCanvasElement); // a <canvas> ref's getContext("2d") is the web's (motion canvas2d.ts, #55)-// a composition reads its layout from the page that draws the frame (page.layout, docs/layout-reads.feature LR1),-// the answer kept until its next commit or frame-layoutReads();+import "./motion/page-layout"; // a composition reads its layout from its frame's page (page.layout, docs/layout-reads.feature LR1)import {{ Component, useEffect, useMemo, useState }} from "react";import * as M from "./src/{file}";import {{ Clock, getCompositions, tickClocks }} from "./motion";@@ -100,7 +97,6 @@ function Root() {{const [size, setSize] = useState<{{ w: number; h: number }} | null>(null);useEffect(() => addEventListener("raea-size", (v: any) => setSize(v)), []);useEffect(() => addEventListener("raea-frame", (v: any) => {{- layoutStale(); // the page is at another time: its CSS animations have movedif (typeof v === "number") return setF(v);live = true;// a live session's own seed and start (live.rs), which its input log keeps for a replaydiff --git a/runtime/export/Cargo.toml b/runtime/export/Cargo.tomlindex c26a49a3..2ece327c 100644--- a/runtime/export/Cargo.toml+++ b/runtime/export/Cargo.toml@@ -41,6 +41,6 @@ raea-sys-mix = { path = "../../systems/mix" }bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app"] }image = { version = "0.25", default-features = false, features = ["png", "hdr"] }serde_json = "1"-# a page's identity in a render (pages.rs store_page): xxHash3, many GB/s-twox-hash = { version = "2", default-features = false, features = ["xxhash3_64"] }+# the frames' pages written as assets, on workers+raea-runtime-pagestore = { path = "../../runtime/pagestore" }wgpu = "=30.0.1"diff --git a/runtime/export/src/pages.rs b/runtime/export/src/pages.rsindex f4867816..d9823b89 100644--- a/runtime/export/src/pages.rs+++ b/runtime/export/src/pages.rs@@ -1,30 +1,7 @@-//! A frame's page written once as an asset, on workers, and the frames' pages settled before raea-render reads them.+//! The frames' pages settled before raea-render reads them; each is written once as an asset by raea-runtime-pagestore.use super::*;--/// A frame's page written once as an asset (assets/HASH.png, straight alpha), its hash; None when nothing is painted.-/// Pages being written on workers, and the paths already started (a repeated page is written once).-pub(crate) static WRITERS: std::sync::Mutex<Vec<std::thread::JoinHandle<R<()>>>> = std::sync::Mutex::new(Vec::new());-pub(crate) static PENDING: std::sync::LazyLock<std::sync::Mutex<std::collections::HashSet<PathBuf>>> = std::sync::LazyLock::new(Default::default);--/// Every page written: before raea-render reads them.-pub(crate) fn pages_written() -> R<()> {- let jobs: Vec<_> = std::mem::take(&mut *WRITERS.lock().unwrap());- for j in jobs {- j.join().map_err(|_| "a page writer panicked".to_string())??;- }- Ok(())-}--/// A PNG written for the engine to read straight back (video stills, pages): no filtering, the fastest deflate. The-/// default level spent 12 ms a page and as long again on every video still, for files that live a few seconds.-pub(crate) fn fast_png(path: &Path, rgba: &[u8], w: u32, h: u32) -> R<()> {- use image::ImageEncoder;- let f = std::io::BufWriter::new(std::fs::File::create(path).map_err(|e| format!("{}: {e}", path.display()))?);- image::codecs::png::PngEncoder::new_with_quality(f, image::codecs::png::CompressionType::Fast, image::codecs::png::FilterType::NoFilter)- .write_image(rgba, w, h, image::ExtendedColorType::Rgba8)- .map_err(|e| e.to_string())-}+pub(crate) use raea_runtime_pagestore::{pages_written, store_clear, store_page};/// A frame's page collected from its paint and written as an asset (once per distinct page).pub(crate) fn settle_page(frames: &mut [(i64, Frame)], k: usize, w: u32, h: u32, work: &Path) -> R<()> {@@ -43,56 +20,3 @@ pub(crate) fn settle_page(frames: &mut [(i64, Frame)], k: usize, w: u32, h: u32,let _ = (w, h);Ok(())}--pub(crate) fn store_page(page: &[u8], w: u32, h: u32, work: &Path) -> R<Option<String>> {- if page.iter().skip(3).step_by(4).all(|a| *a == 0) {- return Ok(None);- }- // xxHash3 (a page is 8 MB: SipHash spent milliseconds on each one)- let hash = format!("motion{:016x}", twox_hash::XxHash3_64::oneshot(page));- // RAEA_KEEP: each frame's page in order, in pages.txt, to compare renders page by page- if std::env::var_os("RAEA_KEEP").is_some() {- use std::io::Write as _;- if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(work.join("pages.txt")) {- let _ = writeln!(f, "{hash}");- }- }- std::fs::create_dir_all(work.join("assets")).map_err(|e| e.to_string())?;- let p = work.join("assets").join(format!("{hash}.png"));- if !p.exists() && PENDING.lock().unwrap().insert(p.clone()) {- // premultiplied to straight, as a PNG holds it; written on a worker so the next frame can start (WRITERS,- // joined before raea-render reads the pages)- let mut straight = page.to_vec();- let path = p.clone();- let job = std::thread::spawn(move || {- for px in straight.chunks_exact_mut(4) {- let a = px[3] as u32;- if a > 0 && a < 255 {- for c in &mut px[..3] {- *c = ((*c as u32 * 255 + a / 2) / a).min(255) as u8;- }- }- }- fast_png(&path, &straight, w, h)- });- let mut ws = WRITERS.lock().unwrap();- ws.push(job);- if ws.len() > 8 {- let first = ws.remove(0);- drop(ws);- first.join().map_err(|_| "a page writer panicked".to_string())??;- }- }- Ok(Some(hash))-}--/// A fully clear picture `w` x `h` as an asset (store_page leaves a clear page out; a screen shows it).-pub(crate) fn store_clear(w: u32, h: u32, work: &Path) -> R<String> {- let hash = format!("clear{w}x{h}");- std::fs::create_dir_all(work.join("assets")).map_err(|e| e.to_string())?;- let p = work.join("assets").join(format!("{hash}.png"));- if !p.exists() {- fast_png(&p, &vec![0u8; (w * h * 4) as usize], w, h)?;- }- Ok(hash)-}diff --git a/runtime/export/src/sound.rs b/runtime/export/src/sound.rsindex 5fe3339d..3d002536 100644--- a/runtime/export/src/sound.rs+++ b/runtime/export/src/sound.rs@@ -88,7 +88,7 @@ pub(crate) fn core_cues(js: &Path, dir: &Path, need_mix: bool) -> R<Option<(Vec<for f in 0..total {app.world().resource::<ReactOutbox>().send(json!({"t": "event", "name": "raea-frame", "value": f}));// (a layout read here gets no boxes: the sound pass draws no page, docs/layout-reads.feature LR2)- settle_with(&mut app, Some(f), 20.0, &mut raea_runtime_react::layout::nothing_drawn)?;+ settle_with(&mut app, Some(f), 20.0, &mut |_| Ok(raea_runtime_react::layout::NOTHING_DRAWN.into()))?;cx.now = f;cx.sounds.clear();cx.mix = None;diff --git a/runtime/pagestore/Cargo.toml b/runtime/pagestore/Cargo.tomlnew file mode 100644index 00000000..de430fb2--- /dev/null+++ b/runtime/pagestore/Cargo.toml@@ -0,0 +1,11 @@+[package]+name = "raea-runtime-pagestore"+version = "0.1.0"+edition = "2024"+description = "A render's frame pages written once each as assets (assets/HASH.png), on workers, joined before raea-render reads them"+license = "FSL-1.1-ALv2"++[dependencies]+image = { version = "0.25", default-features = false, features = ["png"] }+# a page's identity in a render (store_page): xxHash3, many GB/s+twox-hash = { version = "2", default-features = false, features = ["xxhash3_64"] }diff --git a/runtime/pagestore/src/lib.rs b/runtime/pagestore/src/lib.rsnew file mode 100644index 00000000..14de5b8a--- /dev/null+++ b/runtime/pagestore/src/lib.rs@@ -0,0 +1,83 @@+//! A render's frame pages written once each as assets (assets/HASH.png, straight alpha), on workers: the next frame+//! starts while one is written, and every page is written before raea-render reads them (raea-runtime-export).++use std::path::{Path, PathBuf};++type R<T> = Result<T, String>;++/// Pages being written on workers, and the paths already started (a repeated page is written once).+static WRITERS: std::sync::Mutex<Vec<std::thread::JoinHandle<R<()>>>> = std::sync::Mutex::new(Vec::new());+static PENDING: std::sync::LazyLock<std::sync::Mutex<std::collections::HashSet<PathBuf>>> = std::sync::LazyLock::new(Default::default);++/// Every page written: before raea-render reads them.+pub fn pages_written() -> R<()> {+ let jobs: Vec<_> = std::mem::take(&mut *WRITERS.lock().unwrap());+ for j in jobs {+ j.join().map_err(|_| "a page writer panicked".to_string())??;+ }+ Ok(())+}++/// A PNG written for the engine to read straight back (video stills, pages): no filtering, the fastest deflate. The+/// default level spent 12 ms a page and as long again on every video still, for files that live a few seconds.+pub fn fast_png(path: &Path, rgba: &[u8], w: u32, h: u32) -> R<()> {+ use image::ImageEncoder;+ let f = std::io::BufWriter::new(std::fs::File::create(path).map_err(|e| format!("{}: {e}", path.display()))?);+ image::codecs::png::PngEncoder::new_with_quality(f, image::codecs::png::CompressionType::Fast, image::codecs::png::FilterType::NoFilter)+ .write_image(rgba, w, h, image::ExtendedColorType::Rgba8)+ .map_err(|e| e.to_string())+}++/// A frame's page written once as an asset (assets/HASH.png, straight alpha), its hash; None when nothing is painted.+pub fn store_page(page: &[u8], w: u32, h: u32, work: &Path) -> R<Option<String>> {+ if page.iter().skip(3).step_by(4).all(|a| *a == 0) {+ return Ok(None);+ }+ // xxHash3 (a page is 8 MB: SipHash spent milliseconds on each one)+ let hash = format!("motion{:016x}", twox_hash::XxHash3_64::oneshot(page));+ // RAEA_KEEP: each frame's page in order, in pages.txt, to compare renders page by page+ if std::env::var_os("RAEA_KEEP").is_some() {+ use std::io::Write as _;+ if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(work.join("pages.txt")) {+ let _ = writeln!(f, "{hash}");+ }+ }+ std::fs::create_dir_all(work.join("assets")).map_err(|e| e.to_string())?;+ let p = work.join("assets").join(format!("{hash}.png"));+ if !p.exists() && PENDING.lock().unwrap().insert(p.clone()) {+ // premultiplied to straight, as a PNG holds it; written on a worker so the next frame can start (WRITERS,+ // joined before raea-render reads the pages)+ let mut straight = page.to_vec();+ let path = p.clone();+ let job = std::thread::spawn(move || {+ for px in straight.chunks_exact_mut(4) {+ let a = px[3] as u32;+ if a > 0 && a < 255 {+ for c in &mut px[..3] {+ *c = ((*c as u32 * 255 + a / 2) / a).min(255) as u8;+ }+ }+ }+ fast_png(&path, &straight, w, h)+ });+ let mut ws = WRITERS.lock().unwrap();+ ws.push(job);+ if ws.len() > 8 {+ let first = ws.remove(0);+ drop(ws);+ first.join().map_err(|_| "a page writer panicked".to_string())??;+ }+ }+ Ok(Some(hash))+}++/// A fully clear picture `w` x `h` as an asset (store_page leaves a clear page out; a screen shows it).+pub fn store_clear(w: u32, h: u32, work: &Path) -> R<String> {+ let hash = format!("clear{w}x{h}");+ std::fs::create_dir_all(work.join("assets")).map_err(|e| e.to_string())?;+ let p = work.join("assets").join(format!("{hash}.png"));+ if !p.exists() {+ fast_png(&p, &vec![0u8; (w * h * 4) as usize], w, h)?;+ }+ Ok(hash)+}diff --git a/runtime/react/Cargo.toml b/runtime/react/Cargo.tomlindex 44ad1fa6..ea64c474 100644--- a/runtime/react/Cargo.toml+++ b/runtime/react/Cargo.toml@@ -72,6 +72,8 @@ raea-sys-animate = { path = "../../systems/animate" }# Bevy plugins compiled into the engine, each behind a feature (sdk/raea/docs/bevy-plugins.md); none by defaultraea-bevy-plugins = { path = "../../engine/bevy-plugins", optional = true }raea-sys-bake = { path = "../../systems/bake" }+# matchmove (`raea track`, matchmove.solve), its own crate+raea-runtime-track = { path = "../../runtime/track" }# <BlenderShot> and <GodotShot>'s native calls (blender.shot, godot.shot)raea-runtime-shots = { path = "../shots" }diff --git a/runtime/react/src/layout.rs b/runtime/react/src/layout.rsindex 5d59fbb4..d5326da1 100644--- a/runtime/react/src/layout.rs+++ b/runtime/react/src/layout.rs@@ -93,9 +93,7 @@ pub(crate) fn register() {/// The answer of a pass that runs the composition but draws nothing (the sound pass, the 3D rows' pre-pass): no element/// has a box, so every read is 0, and the composition goes on as it would before it's laid out.-pub fn nothing_drawn(_: &mut World) -> Result<String, String> {- Ok("{\"vw\":0,\"vh\":0,\"dpr\":1,\"n\":[],\"o\":[]}".into())-}+pub const NOTHING_DRAWN: &str = "{\"vw\":0,\"vh\":0,\"dpr\":1,\"n\":[],\"o\":[]}";/// A host's answer when it has no page to lay out.pub fn no_page(host: &'static str) -> impl FnMut(&mut World) -> Result<String, String> {diff --git a/runtime/react/src/lib.rs b/runtime/react/src/lib.rsindex 6bd31267..5658f39f 100644--- a/runtime/react/src/lib.rs+++ b/runtime/react/src/lib.rs@@ -318,13 +318,9 @@ pub fn flushed() -> u64 {*FLUSHED.0.lock().unwrap()}-/// Block until React flushes a commit after the `seen`-th, or `timeout` passes; the count now.-pub fn wait_flush(seen: u64, timeout: Duration) -> u64 {- wait_flush_or(seen, timeout, None)-}--/// [`wait_flush`], woken also by `ask`'s layout read (settle answers it: layout.rs).-pub fn wait_flush_or(seen: u64, timeout: Duration, ask: Option<&layout::Ask>) -> u64 {+/// Block until React flushes a commit after the `seen`-th, `ask` has a layout read waiting (settle answers it:+/// layout.rs), or `timeout` passes; the count now.+pub fn wait_flush(seen: u64, timeout: Duration, ask: Option<&layout::Ask>) -> u64 {let (n, cv) = &FLUSHED;let t0 = Instant::now();let g = n.lock().unwrap();diff --git a/runtime/react/src/scene.rs b/runtime/react/src/scene.rsindex 8fd9a725..113cd614 100644--- a/runtime/react/src/scene.rs+++ b/runtime/react/src/scene.rs@@ -34,8 +34,8 @@ pub use plugin::*;pub(crate) use contact::register as register_scene;// physics for compositions: rigid bodies (Rapier), parts cut from a glTF, goo (tools/goo): systems/bake, as native calls in scene/physics.rspub mod physics;-// matchmove: `track` and the matchmove.solve native call (scene/track.rs)-pub mod track;+// matchmove: `track` and the matchmove.solve native call (raea-runtime-track)+pub use raea_runtime_track as track;thread_local! {/// each part's data-props as last parsed: its text and the props, and the scene it was last read indiff --git a/runtime/react/src/scene/settle.rs b/runtime/react/src/scene/settle.rsindex a612d1ed..2e88646a 100644--- a/runtime/react/src/scene/settle.rs+++ b/runtime/react/src/scene/settle.rs@@ -143,7 +143,7 @@ pub fn settle_with(app: &mut App, want: Option<i64>, secs: f64, answer: &mut craif app.world().get_resource::<crate::OneBatch>().is_some_and(|q| !q.0.is_empty()) {continue;}- seen = crate::wait_flush_or(seen, std::time::Duration::from_secs_f64(left.min(0.5)), ask.as_deref());+ seen = crate::wait_flush(seen, std::time::Duration::from_secs_f64(left.min(0.5)), ask.as_deref());}// a call past HANG_SECS is a hang, named: which runtime's call, and how long it has runif let Some(d) = crate::js_call_for().filter(|d| d.as_secs_f64() >= HANG_SECS) {diff --git a/runtime/track/Cargo.toml b/runtime/track/Cargo.tomlnew file mode 100644index 00000000..f396d2e3--- /dev/null+++ b/runtime/track/Cargo.toml@@ -0,0 +1,14 @@+[package]+name = "raea-runtime-track"+version = "0.1.0"+edition = "2024"+description = "Matchmove: a clip's camera solved for <Matchmove>, as `raea track` and the matchmove.solve native call"+license = "FSL-1.1-ALv2"++[dependencies]+raea-io-assets = { path = "../../io/assets" }+raea-native = { path = "../../engine/native", default-features = false }+raea-runtime-bundle = { path = "../../runtime/bundle" }+raea-runtime-calls = { path = "../../runtime/calls" }+raea-sys-bake = { path = "../../systems/bake" }+serde_json = "1"diff --git a/runtime/react/src/scene/track.rs b/runtime/track/src/lib.rssimilarity index 97%rename from runtime/react/src/scene/track.rsrename to runtime/track/src/lib.rsindex b2f91433..0f0f73b8 100644--- a/runtime/react/src/scene/track.rs+++ b/runtime/track/src/lib.rs@@ -120,10 +120,10 @@ pub fn track(args: &[String]) -> R<String> {/// Seconds spent in solves and bakes made during this process (and the one running now): a render's wait for a frame's/// commit (scene.rs settle) doesn't count them, so a first-use solve inside a render isn't taken for a hung composition.-pub(crate) use raea_sys_bake::{making, making_secs};+pub use raea_sys_bake::{making, making_secs};/// `matchmove.solve`: the solve a <Matchmove> draws from, made on first use (the composition's folder's store).-pub(crate) fn register() {+pub fn register() {raea_native::register("matchmove.solve","{ src: string; from?: number; seconds?: number; subject?: [number, number, number, number] | null; height?: number; fov?: number; smooth?: number }",@@ -131,8 +131,8 @@ pub(crate) fn register() {"a clip's camera solved (COLMAP; made once per clip content and params, in the composition's asset store)",|v| {let src = v.get("src").and_then(Value::as_str).ok_or("matchmove.solve: src, the clip (staticFile(\"x.mp4\"))")?;- let dir = crate::native::composition_dir().unwrap_or_else(|| PathBuf::from("."));- let clip = super::media_path(&dir, src);+ let dir = raea_runtime_calls::composition_dir().unwrap_or_else(|| PathBuf::from("."));+ let clip = raea_runtime_bundle::media_path(&dir, src);let mut p = v.as_object().cloned().unwrap_or_default();p.remove("src");let store = raea_io_assets::Store::beside(&dir.join("edit.tsx"));diff --git a/sdk/raea/src/page-layout.ts b/sdk/raea/src/page-layout.tsindex 4d4f3b72..19dd266f 100644--- a/sdk/raea/src/page-layout.ts+++ b/sdk/raea/src/page-layout.ts@@ -79,7 +79,8 @@ export function viewportSize(): [number, number] {return viewport;}-/** From the entry, once: any commit makes the layout stale (each batch passes the host's op_flush). */+/** Once, on import from the entry: any commit makes the layout stale (each batch passes the host's op_flush; a new+ * frame commits its marker, so a frame's CSS animations moving makes it stale too). */export function layoutReads(): void {if (!HOST || typeof HOST.op_flush !== "function" || HOST.__layoutReads) return;HOST.__layoutReads = true;@@ -89,3 +90,5 @@ export function layoutReads(): void {return flush(json, devtools);};}++layoutReads();diff --git a/tools/manual-ref/sdk.ts b/tools/manual-ref/sdk.tsindex 9aaeacae..85c32f37 100644--- a/tools/manual-ref/sdk.ts+++ b/tools/manual-ref/sdk.ts@@ -14,7 +14,7 @@ const ROOT = path.resolve(import.meta.dir, "../..")const ts = createRequire(path.join(ROOT, "sdk/shell/package.json"))("typescript") as typeof import("typescript")const SRC = path.join(ROOT, "sdk/raea/src")const REPO = "https://github.com/shinyobjectz/raea/blob/main"-const SKIP = /(\.gen\.ts|^test\.tsx|^native-calls\.ts|^prelude\.ts|^pure\.ts|^frame-globals\.ts|^canvas2d\.ts)$/+const SKIP = /(\.gen\.ts|^test\.tsx|^native-calls\.ts|^prelude\.ts|^pure\.ts|^frame-globals\.ts|^canvas2d\.ts|^page-layout\.ts|^dom-reads\.ts)$/const [mode = "check", dirArg] = process.argv.slice(2)if (mode !== "gen" && mode !== "check") throw new Error("usage: sdk.ts gen|check [DIR]")const out = path.resolve(dirArg ?? path.join(ROOT, "docs/manual/reference/sdk"))diff --git a/tools/skills.sh b/tools/skills.shindex 3825073b..9d4e7209 100755--- a/tools/skills.sh+++ b/tools/skills.sh@@ -225,7 +225,7 @@ gen_sdk() {bun -e 'const root = process.argv[1], dir = root + "/sdk/raea/src"const t = new Bun.Transpiler({ loader: "tsx" })- const skip = /(\.gen\.ts|^test\.tsx|^native-calls\.ts|^prelude\.ts|^pure\.ts|^frame-globals\.ts|^canvas2d\.ts)$/+ const skip = /(\.gen\.ts|^test\.tsx|^native-calls\.ts|^prelude\.ts|^pure\.ts|^frame-globals\.ts|^canvas2d\.ts|^page-layout\.ts|^dom-reads\.ts)$/const files = [...new Bun.Glob("*.{ts,tsx}").scanSync(dir)].filter((f) => !skip.test(f)).sort()const rows = files.map((f) => ({ entry: f.startsWith("index.") ? "raea" : "raea/" + f.replace(/\.tsx?$/, ""), file: "sdk/raea/src/" + f, names: t.scan(require("fs").readFileSync(dir + "/" + f, "utf8")).exports.filter((n) => n !== "default").sort() }))console.log(JSON.stringify(rows.sort((a, b) => (a.entry === "raea" ? -1 : b.entry === "raea" ? 1 : a.entry.localeCompare(b.entry)))))@@ -263,7 +263,9 @@ help_stale() {COVERAGE_SKIP="verb:hook (raea skills install sets it up; an agent never runs it)verb:traces (raea's own session logs, for whoever debugs raea)module:dev_tools (raea's own debugging overlays)-module:test (raea's test harness, for raea's own tests)"+module:test (raea's test harness, for raea's own tests)+module:page-layout (installed by the entry: a composition reads its layout through the DOM on its refs, docs/layout-reads.feature)+module:dom-reads (installed by the entry on every ref; what it adds is the web's own API)"coverage() {local corpus v m t f; corpus=$(mktemp "${TMPDIR:-/tmp}/skills-cov.XXXXXX")texts | while read -r f; do cat "$f"; echo; done > "$corpus"