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
raea c8b196fdb32690c0ab507b6ecb34463bd859abf8
shinyobjectz925bc03c09db
diff --git a/Cargo.lock b/Cargo.lockindex 1ca4c0c6..f0bcd261 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -8611,6 +8611,16 @@ dependencies = ["memchr",]+[[package]]+name = "junction"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8cfc352a66ba903c23239ef51e809508b6fc2b0f90e3476ac7a9ff47e863ae95"+dependencies = [+ "scopeguard",+ "windows-sys 0.61.2",+]+[[package]]name = "jzon"version = "0.12.5"@@ -13792,6 +13802,7 @@ dependencies = ["futures","hex","indexmap",+ "junction","libc","reqwest","serde",@@ -13837,6 +13848,7 @@ dependencies = ["log","raea-io-home","serde_json",+ "windows-sys 0.61.2",][[package]]@@ -13992,6 +14004,7 @@ dependencies = [name = "raea-runtime-bundle"version = "0.1.0"dependencies = [+ "dunce","libloading","raea-core-scene","raea-io-home",@@ -14336,6 +14349,7 @@ dependencies = ["raea-core-shape","raea-core-wire","raea-gpu-device",+ "raea-io-home","raea-io-media","raea-page","raea-sys-frame",diff --git a/LICENSES/dunce-1.0.5/LICENSE b/LICENSES/dunce-1.0.5/LICENSEdeleted file mode 100644index 0e259d42..00000000--- a/LICENSES/dunce-1.0.5/LICENSE+++ /dev/null@@ -1,121 +0,0 @@-Creative Commons Legal Code--CC0 1.0 Universal-- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE- LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN- ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS- INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES- REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS- PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM- THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED- HEREUNDER.--Statement of Purpose--The laws of most jurisdictions throughout the world automatically confer-exclusive Copyright and Related Rights (defined below) upon the creator-and subsequent owner(s) (each and all, an "owner") of an original work of-authorship and/or a database (each, a "Work").--Certain owners wish to permanently relinquish those rights to a Work for-the purpose of contributing to a commons of creative, cultural and-scientific works ("Commons") that the public can reliably and without fear-of later claims of infringement build upon, modify, incorporate in other-works, reuse and redistribute as freely as possible in any form whatsoever-and for any purposes, including without limitation commercial purposes.-These owners may contribute to the Commons to promote the ideal of a free-culture and the further production of creative, cultural and scientific-works, or to gain reputation or greater distribution for their Work in-part through the use and efforts of others.--For these and/or other purposes and motivations, and without any-expectation of additional consideration or compensation, the person-associating CC0 with a Work (the "Affirmer"), to the extent that he or she-is an owner of Copyright and Related Rights in the Work, voluntarily-elects to apply CC0 to the Work and publicly distribute the Work under its-terms, with knowledge of his or her Copyright and Related Rights in the-Work and the meaning and intended legal effect of CC0 on those rights.--1. Copyright and Related Rights. A Work made available under CC0 may be-protected by copyright and related or neighboring rights ("Copyright and-Related Rights"). Copyright and Related Rights include, but are not-limited to, the following:-- i. the right to reproduce, adapt, distribute, perform, display,- communicate, and translate a Work;- ii. moral rights retained by the original author(s) and/or performer(s);-iii. publicity and privacy rights pertaining to a person's image or- likeness depicted in a Work;- iv. rights protecting against unfair competition in regards to a Work,- subject to the limitations in paragraph 4(a), below;- v. rights protecting the extraction, dissemination, use and reuse of data- in a Work;- vi. database rights (such as those arising under Directive 96/9/EC of the- European Parliament and of the Council of 11 March 1996 on the legal- protection of databases, and under any national implementation- thereof, including any amended or successor version of such- directive); and-vii. other similar, equivalent or corresponding rights throughout the- world based on applicable law or treaty, and any national- implementations thereof.--2. Waiver. To the greatest extent permitted by, but not in contravention-of, applicable law, Affirmer hereby overtly, fully, permanently,-irrevocably and unconditionally waives, abandons, and surrenders all of-Affirmer's Copyright and Related Rights and associated claims and causes-of action, whether now known or unknown (including existing as well as-future claims and causes of action), in the Work (i) in all territories-worldwide, (ii) for the maximum duration provided by applicable law or-treaty (including future time extensions), (iii) in any current or future-medium and for any number of copies, and (iv) for any purpose whatsoever,-including without limitation commercial, advertising or promotional-purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each-member of the public at large and to the detriment of Affirmer's heirs and-successors, fully intending that such Waiver shall not be subject to-revocation, rescission, cancellation, termination, or any other legal or-equitable action to disrupt the quiet enjoyment of the Work by the public-as contemplated by Affirmer's express Statement of Purpose.--3. Public License Fallback. Should any part of the Waiver for any reason-be judged legally invalid or ineffective under applicable law, then the-Waiver shall be preserved to the maximum extent permitted taking into-account Affirmer's express Statement of Purpose. In addition, to the-extent the Waiver is so judged Affirmer hereby grants to each affected-person a royalty-free, non transferable, non sublicensable, non exclusive,-irrevocable and unconditional license to exercise Affirmer's Copyright and-Related Rights in the Work (i) in all territories worldwide, (ii) for the-maximum duration provided by applicable law or treaty (including future-time extensions), (iii) in any current or future medium and for any number-of copies, and (iv) for any purpose whatsoever, including without-limitation commercial, advertising or promotional purposes (the-"License"). The License shall be deemed effective as of the date CC0 was-applied by Affirmer to the Work. Should any part of the License for any-reason be judged legally invalid or ineffective under applicable law, such-partial invalidity or ineffectiveness shall not invalidate the remainder-of the License, and in such case Affirmer hereby affirms that he or she-will not (i) exercise any of his or her remaining Copyright and Related-Rights in the Work or (ii) assert any associated claims and causes of-action with respect to the Work, in either case contrary to Affirmer's-express Statement of Purpose.--4. Limitations and Disclaimers.-- a. No trademark or patent rights held by Affirmer are waived, abandoned,- surrendered, licensed or otherwise affected by this document.- b. Affirmer offers the Work as-is and makes no representations or- warranties of any kind concerning the Work, express, implied,- statutory or otherwise, including without limitation warranties of- title, merchantability, fitness for a particular purpose, non- infringement, or the absence of latent or other defects, accuracy, or- the present or absence of errors, whether or not discoverable, all to- the greatest extent permissible under applicable law.- c. Affirmer disclaims responsibility for clearing rights of other persons- that may apply to the Work or any use thereof, including without- limitation any person's Copyright and Related Rights in the Work.- Further, Affirmer disclaims responsibility for obtaining any necessary- consents, permissions or other rights required for any use of the- Work.- d. Affirmer understands and acknowledges that Creative Commons is not a- party to this document and has no duty or obligation with respect to- this CC0 or use of the Work.diff --git a/README.md b/README.mdindex d71d84be..af591caf 100644--- a/README.md+++ b/README.md@@ -27,12 +27,13 @@<img alt="status canary" src="https://img.shields.io/badge/status-canary-black"><img alt="macOS, Apple Silicon" src="https://img.shields.io/badge/macOS-Apple%20Silicon-black"><img alt="Linux x86_64" src="https://img.shields.io/badge/Linux-x86__64-black">+ <img alt="Windows x86_64" src="https://img.shields.io/badge/Windows-x86__64-black"></p>----> **Canary.** raea changes daily. Releases run on macOS (Apple Silicon) and Linux (x86_64). Expect breaking changes,-> rough edges and gaps in the docs.+> **Canary.** raea changes daily. Releases run on macOS (Apple Silicon), Linux (x86_64) and, new and least tested,+> Windows (x86_64). Expect breaking changes, rough edges and gaps in the docs.## Install@@ -45,6 +46,11 @@ The installer puts the `raea` command under `~/.raea`, links it into `~/.local/bwork. Run it again to update. The engine is free and needs no account. Tarballs and checksums are on the[releases page](https://github.com/shinyobjectz/raea/releases).+On Windows 10 or 11, download the zip from the+[latest release](https://github.com/shinyobjectz/raea/releases/tag/v0.1.0-canary.2); its notes give the PowerShell+steps that check, unpack and add it to your PATH. It needs the Microsoft Visual C++ Redistributable (x64), which most+machines already have, and a DirectX 12 or Vulkan GPU driver.+## HelloA composition is a React component that draws a frame for a given moment:diff --git a/apps/ci/src/process.rs b/apps/ci/src/process.rsindex 0701aea4..f43d237c 100644--- a/apps/ci/src/process.rs+++ b/apps/ci/src/process.rs@@ -19,7 +19,12 @@ pub(crate) fn time(args: &[String]) -> Result<i32, String> {let t0 = Instant::now();let st = Command::new(&cmd[0]).args(&cmd[1..]).status().map_err(|e| format!("{}: {e}", cmd[0]))?;let wall = t0.elapsed().as_secs_f64();- let code = st.code().unwrap_or(128 + std::os::unix::process::ExitStatusExt::signal(&st).unwrap_or(0));+ // a signal ends a process as a shell's 128+N counts it; Windows has no signals, so every exit there has a code+ #[cfg(unix)]+ let signal = std::os::unix::process::ExitStatusExt::signal(&st).unwrap_or(0);+ #[cfg(not(unix))]+ let signal = 0;+ let code = st.code().unwrap_or(128 + signal);std::fs::write(to, json!({"start_unix_ms": start, "wall_s": wall, "code": code}).to_string()).map_err(|e| format!("{to}: {e}"))?;Ok(code)}diff --git a/engine/cli/build.rs b/engine/cli/build.rsnew file mode 100644index 00000000..d1e50491--- /dev/null+++ b/engine/cli/build.rs@@ -0,0 +1,8 @@+// raea's main thread gets 8 MB of stack on Windows, as it has on macOS and Linux: Windows gives an executable 1 MB by+// default, while QuickJS is allowed 4 MB (runtime/jsengine) and Bevy's and Blitz's setup run there (PT20).+fn main() {+ println!("cargo:rerun-if-changed=build.rs");+ if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {+ println!("cargo:rustc-link-arg-bin=raea=/STACK:8388608");+ }+}diff --git a/engine/native/src/node.rs b/engine/native/src/node.rsindex 769422c4..400dc0fa 100644--- a/engine/native/src/node.rs+++ b/engine/native/src/node.rs@@ -9,6 +9,9 @@ use std::path::{Path, PathBuf};use base64::Engine as _;use serde_json::{json, Value};+mod os;+use os::{mode_ctime, signal};+/// The builtins node.js defines, by the names an import or require gives them (with or without `node:`)pub const BUILTINS: &[&str] = &[@@ -301,9 +304,9 @@ pub fn call(op: &str, a: &[Value]) -> Value {let m = if b(1) { std::fs::symlink_metadata(&p) } else { std::fs::metadata(&p) };match m {Ok(m) => {- use std::os::unix::fs::MetadataExt;- json!({"dir": m.is_dir(), "file": m.is_file(), "link": m.file_type().is_symlink(), "size": m.len(), "mode": m.mode(),- "mtimeMs": millis(m.modified()), "atimeMs": millis(m.accessed()), "birthtimeMs": millis(m.created()), "ctimeMs": m.ctime() as f64 * 1e3 + m.ctime_nsec() as f64 / 1e6})+ let (mode, ctime) = mode_ctime(&m);+ json!({"dir": m.is_dir(), "file": m.is_file(), "link": m.file_type().is_symlink(), "size": m.len(), "mode": mode,+ "mtimeMs": millis(m.modified()), "atimeMs": millis(m.accessed()), "birthtimeMs": millis(m.created()), "ctimeMs": ctime})}Err(e) => io_err(e, if b(1) { "lstat" } else { "stat" }, &p),}@@ -419,25 +422,11 @@ fn spawn(cmd: &str, args: Option<&Value>, o: &Value) -> Value {}}match child.wait_with_output() {- Ok(out) => {- use std::os::unix::process::ExitStatusExt;- json!({"status": out.status.code(), "signal": out.status.signal().map(signal_name), "stdout": b64(&out.stdout), "stderr": b64(&out.stderr)})- }+ Ok(out) => json!({"status": out.status.code(), "signal": signal(&out.status), "stdout": b64(&out.stdout), "stderr": b64(&out.stderr)}),Err(e) => json!({"error": {"code": "EIO", "message": e.to_string()}, "status": Value::Null}),}}-fn signal_name(n: i32) -> String {- match n {- libc::SIGTERM => "SIGTERM".into(),- libc::SIGKILL => "SIGKILL".into(),- libc::SIGINT => "SIGINT".into(),- libc::SIGSEGV => "SIGSEGV".into(),- libc::SIGABRT => "SIGABRT".into(),- n => format!("SIG{n}"),- }-}-/// `__raea_node(op, argsJson)`: node.js's one nativepub(crate) fn native(a: &[String]) -> Result<raea_runtime_jsengine::Ret, String> {let op = raea_runtime_jsengine::arg(a, 0);diff --git a/engine/native/src/node/os.rs b/engine/native/src/node/os.rsnew file mode 100644index 00000000..137cd6dc--- /dev/null+++ b/engine/native/src/node/os.rs@@ -0,0 +1,40 @@+// What node.js's fs and child_process report that Unix and Windows keep differently.++/// fs.stat's mode and ctimeMs (the inode change time).+#[cfg(unix)]+pub(super) fn mode_ctime(m: &std::fs::Metadata) -> (u32, f64) {+ use std::os::unix::fs::MetadataExt;+ (m.mode(), m.ctime() as f64 * 1e3 + m.ctime_nsec() as f64 / 1e6)+}++/// Windows has no mode bits or ctime: Node's own stat reports a directory as 0o40666 and a file as 0o100666 (0o444+/// read-only), and ctimeMs as the last write.+#[cfg(windows)]+pub(super) fn mode_ctime(m: &std::fs::Metadata) -> (u32, f64) {+ let perm = if m.permissions().readonly() { 0o444 } else { 0o666 };+ ((if m.is_dir() { 0o40000 } else { 0o100000 }) | perm,super::millis(m.modified()))+}++/// The signal that ended a child, as Node names it (null when it exited with a code).+#[cfg(unix)]+pub(super) fn signal(st: &std::process::ExitStatus) -> Option<String> {+ std::os::unix::process::ExitStatusExt::signal(st).map(signal_name)+}++/// Windows has no signals: a child always exits with a code.+#[cfg(windows)]+pub(super) fn signal(_: &std::process::ExitStatus) -> Option<String> {+ None+}++#[cfg(unix)]+fn signal_name(n: i32) -> String {+ match n {+ libc::SIGTERM => "SIGTERM".into(),+ libc::SIGKILL => "SIGKILL".into(),+ libc::SIGINT => "SIGINT".into(),+ libc::SIGSEGV => "SIGSEGV".into(),+ libc::SIGABRT => "SIGABRT".into(),+ n => format!("SIG{n}"),+ }+}diff --git a/gpu/device/src/lib.rs b/gpu/device/src/lib.rsindex 7fed6329..9cad9430 100644--- a/gpu/device/src/lib.rs+++ b/gpu/device/src/lib.rs@@ -36,7 +36,10 @@ fn make() -> Result<Handles, String> {// back): it checks each indirect draw's arguments in compute passes before drawing, and the indirect draws are// Bevy's own, written by its mesh preprocessing on this device. On arena3d it was ~7 extra passes and their blits a// frame, ~0.07 ms of GPU (lightspeed F2); pixels are the same.- let mut desc = wgpu::InstanceDescriptor::new_without_display_handle();+ // wgpu's own variables are read (WGPU_BACKEND, WGPU_DX12_COMPILER, WGPU_VALIDATION, ...; nothing changes when unset):+ // Windows' check renders on Mesa's lavapipe with WGPU_BACKEND=vulkan, because WARP crashes compiling one of Bevy's+ // compute shaders on GitHub's GPU-less runner (d3d10warp ComputeShaderTransformer, PT20)+ let mut desc = wgpu::InstanceDescriptor::new_without_display_handle_from_env();if !cfg!(debug_assertions) && std::env::var("RAEA_WGPU_INDIRECT_VALIDATION").as_deref() != Ok("1") {desc.flags.remove(wgpu::InstanceFlags::VALIDATION_INDIRECT_CALL);}diff --git a/io/home/src/lib.rs b/io/home/src/lib.rsindex d499eb50..180e46e0 100644--- a/io/home/src/lib.rs+++ b/io/home/src/lib.rs@@ -54,8 +54,31 @@ fn user_dir(apple: &str, xdg: &str, xdg_default: &str, windows: &str) -> Option<Some(base.join("raea"))}+/// A local file as a page's `src` (an <img>, a page's snapshot): its path on Unix; on Windows a file URL, since the+/// page reads `C:\...` as a URL whose scheme is `c` and loads nothing (PT20). A verbatim `\\?\C:\` path loses its+/// prefix first.+pub fn src(p: &std::path::Path) -> String {+ src_on(&p.display().to_string(), cfg!(windows))+}++fn src_on(s: &str, windows: bool) -> String {+ if !windows {+ return s.to_string();+ }+ let s = s.strip_prefix(r"\\?\").filter(|r| r.as_bytes().get(1) == Some(&b':')).unwrap_or(s);+ if s.as_bytes().get(1) == Some(&b':') { format!("file:///{}", s.replace('\\', "/")) } else { s.to_string() }+}+#[cfg(test)]mod tests {+ #[test]+ fn a_src_is_a_file_url_on_windows() {+ assert_eq!(super::src_on("/Users/a/assets/m.png", false), "/Users/a/assets/m.png");+ assert_eq!(super::src_on(r"C:\Users\a\assets/m.png", true), "file:///C:/Users/a/assets/m.png");+ assert_eq!(super::src_on(r"\\?\C:\a\m.png", true), "file:///C:/a/m.png");+ assert_eq!(super::src_on("assets/m.png", true), "assets/m.png");+ }+#[test]fn caches_and_logs_follow_the_platform() {// one test, so nothing else reads these variables while it sets themdiff --git a/io/npm/Cargo.toml b/io/npm/Cargo.tomlindex a91fed8b..d045e670 100644--- a/io/npm/Cargo.toml+++ b/io/npm/Cargo.toml@@ -24,3 +24,7 @@ base64 = "0.22"flate2 = "1"tar = "0.4"libc = "0.2"++# node_modules' links on Windows (layout.rs)+[target.'cfg(windows)'.dependencies]+junction = "1"diff --git a/io/npm/src/layout.rs b/io/npm/src/layout.rsindex 74ddecf7..72d79eb4 100644--- a/io/npm/src/layout.rs+++ b/io/npm/src/layout.rs@@ -78,7 +78,7 @@ pub(crate) fn lay_out(root: &Path, s: &SerializedNpmResolutionSnapshot, top: &[(for p in entries {let into_raea = std::fs::read_link(&p).map(|t| t.components().any(|c| c.as_os_str() == ".raea")).unwrap_or(false);if into_raea && !tops.contains(&p) {- let _ = std::fs::remove_file(&p);+ let _ = unlink(&p);// a scope (@assistant-ui) whose last package went: gone too (remove_dir fails while it holds anything)if let Some(scope) = p.parent().filter(|s| *s != nm && s.file_name().is_some_and(|n| n.to_string_lossy().starts_with('@'))) {let _ = std::fs::remove_dir(scope);@@ -88,20 +88,37 @@ pub(crate) fn lay_out(root: &Path, s: &SerializedNpmResolutionSnapshot, top: &[(Ok(())}-/// A symlink at `at` to `to`, relative (the project can move), replacing what was there.+/// A symlink at `at` to `to`, relative (the project can move), replacing what was there. On Windows it's a junction to+/// the absolute folder, as pnpm makes there: a symlink needs Developer Mode or an administrator, a junction neither.pub(crate) fn link(at: &Path, to: &Path) -> std::io::Result<()> {let parent = at.parent().unwrap();std::fs::create_dir_all(parent)?;let rel = relative(parent, to);- if std::fs::read_link(at).ok().as_deref() == Some(rel.as_path()) {+ let want = if cfg!(windows) { to.to_path_buf() } else { rel.clone() };+ if std::fs::read_link(at).ok().as_deref() == Some(want.as_path()) {return Ok(());}- if at.is_symlink() || at.is_file() {+ if at.is_symlink() {+ unlink(at)?;+ } else if at.is_file() {std::fs::remove_file(at)?;} else if at.is_dir() {std::fs::remove_dir_all(at)?;}- std::os::unix::fs::symlink(rel, at)+ #[cfg(unix)]+ return std::os::unix::fs::symlink(rel, at);+ #[cfg(windows)]+ return junction::create(to, at);+}++/// A link made by `link` removed, never what it points at: a junction is a folder to Windows, so it goes by remove_dir+/// (which leaves the target alone).+fn unlink(at: &Path) -> std::io::Result<()> {+ #[cfg(windows)]+ if std::fs::remove_dir(at).is_ok() {+ return Ok(());+ }+ std::fs::remove_file(at)}/// `to` as a path from the folder `from` (both absolute).diff --git a/io/npm/src/store.rs b/io/npm/src/store.rsindex 169d55e6..8e8260d5 100644--- a/io/npm/src/store.rs+++ b/io/npm/src/store.rs@@ -125,10 +125,13 @@ pub(crate) fn unpack(bytes: &[u8], dir: &Path) -> std::io::Result<()> {}let mut f = std::fs::File::create(&to)?;std::io::copy(&mut entry, &mut f)?;- // executable stays executable; npm's tarballs carry odd modes, so only that bit is kept- let exec = entry.header().mode().map(|m| m & 0o111 != 0).unwrap_or(false);- use std::os::unix::fs::PermissionsExt;- f.set_permissions(std::fs::Permissions::from_mode(if exec { 0o755 } else { 0o644 }))?;+ // executable stays executable; npm's tarballs carry odd modes, so only that bit is kept (Windows has none)+ #[cfg(unix)]+ {+ let exec = entry.header().mode().map(|m| m & 0o111 != 0).unwrap_or(false);+ use std::os::unix::fs::PermissionsExt;+ f.set_permissions(std::fs::Permissions::from_mode(if exec { 0o755 } else { 0o644 }))?;+ }}_ => {}}diff --git a/io/trace/Cargo.toml b/io/trace/Cargo.tomlindex 84cc9903..e347822e 100644--- a/io/trace/Cargo.toml+++ b/io/trace/Cargo.toml@@ -11,3 +11,7 @@ raea-io-home = { path = "../../io/home" }serde_json = "1"log = "0.4"libc = "0.2"++# whether an earlier session's process still runs, on Windows (crash.rs)+[target.'cfg(windows)'.dependencies]+windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_System_Threading"] }diff --git a/io/trace/src/crash.rs b/io/trace/src/crash.rsindex e627844b..58019c9a 100644--- a/io/trace/src/crash.rs+++ b/io/trace/src/crash.rs@@ -6,6 +6,8 @@ use super::*;// ---- stderr, teedpub(crate) fn tee_stderr(dir: &Path) {+ #[cfg(not(unix))]+ let _ = dir;#[cfg(unix)]unsafe {let mut fds = [0i32; 2];@@ -38,6 +40,7 @@ pub(crate) fn tee_stderr(dir: &Path) {// ---- the image, for symbolicating a stripped build's backtraces/// The crash file's image line, made at start (the signal handler only reads it).+#[cfg(unix)]pub(crate) static CRASH_IMAGE: std::sync::OnceLock<String> = std::sync::OnceLock::new();/// The main executable's Mach-O UUID, load address and ASLR slide: what atos needs to turn a stripped build's backtrace@@ -168,7 +171,7 @@ pub(crate) fn adopt_crash_reports(base: &Path) {continue;}let Some(pid) = d.file_name().and_then(|n| n.to_str()).and_then(|n| n.rsplit('-').next()).and_then(|p| p.parse::<i32>().ok()) else { continue };- if unsafe { libc::kill(pid, 0) } == 0 {+ if alive(pid) {continue; // still running (another instance)}let mut found = None;@@ -209,6 +212,27 @@ pub(crate) fn adopt_crash_reports(base: &Path) {}}+#[cfg(unix)]+fn alive(pid: i32) -> bool {+ unsafe { libc::kill(pid, 0) == 0 }+}++#[cfg(windows)]+fn alive(pid: i32) -> bool {+ use windows_sys::Win32::Foundation::{CloseHandle, STILL_ACTIVE};+ use windows_sys::Win32::System::Threading::{GetExitCodeProcess, OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION};+ unsafe {+ let h = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid as u32);+ if h.is_null() {+ return false;+ }+ let mut code = 0u32;+ let ok = GetExitCodeProcess(h, &mut code) != 0;+ CloseHandle(h);+ ok && code == STILL_ACTIVE as u32+ }+}+/// Only the last KEEP sessions stay.pub(crate) fn prune(base: &Path) {let Ok(entries) = std::fs::read_dir(base) else { return };diff --git a/io/trace/src/lib.rs b/io/trace/src/lib.rsindex 048c508f..55a5d2f2 100644--- a/io/trace/src/lib.rs+++ b/io/trace/src/lib.rs@@ -52,6 +52,7 @@ struct Session {static SESSION: Mutex<Option<Session>> = Mutex::new(None);/// the crash file's descriptor, opened at start, for the signal handler (which may only write)+#[cfg(unix)]static mut CRASH_FD: i32 = -1;const RING: usize = 400;const KEEP: usize = 60;@@ -133,6 +134,8 @@ pub fn start(app: &str) -> Option<PathBuf> {let _ = std::fs::write(dir.join("session.json"), serde_json::to_string_pretty(&session).unwrap_or_default());let open = |name: &str| OpenOptions::new().create(true).append(true).open(dir.join(name)).ok();let (events, perf) = (open("events.jsonl")?, open("perf.jsonl")?);+ // for the fatal-signal handler, which Windows doesn't have+ #[cfg(unix)]if let Some(f) = open("crash.txt") {use std::os::fd::IntoRawFd;unsafe { CRASH_FD = f.into_raw_fd() };diff --git a/runtime/bundle/Cargo.toml b/runtime/bundle/Cargo.tomlindex baa99b71..4991a524 100644--- a/runtime/bundle/Cargo.toml+++ b/runtime/bundle/Cargo.toml@@ -11,6 +11,8 @@ description = "A composition's TSX bundled into one script the engine runs, withmodules = ["raea-native/modules"][dependencies]+# canonical paths without Windows' verbatim prefix, for import specifiers (fresh.rs spec)+dunce = "1"# raea's home (the checkout's, or an install's share/raea): the SDK packages, the bundler's library, Tailwind's packageraea-io-home = { path = "../../io/home" }raea-core-scene = { path = "../../core/scene" }diff --git a/runtime/bundle/src/fresh.rs b/runtime/bundle/src/fresh.rsindex afb49138..ad12893d 100644--- a/runtime/bundle/src/fresh.rs+++ b/runtime/bundle/src/fresh.rs@@ -6,11 +6,18 @@ use super::*;pub fn bundle_script(ts: &Path, out: &Path) -> R<()> {let entry = format!("import * as M from {:?};\nconst call = (globalThis as any).__raea_call;\nPromise.resolve().then(() => (typeof (M as any).default === \"function\" ? (M as any).default() : undefined)).then(() => call(\"done\", JSON.stringify({{ code: 0 }})), (e: any) => {{ call(\"print\", JSON.stringify({{ text: \"error: \" + (e && e.stack ? e.stack : String(e)) }})); call(\"done\", JSON.stringify({{ code: 1 }})); }});\n",- ts.display().to_string()+ spec(ts));bundle_entry(&entry, out, &[])}+/// A path as an entry's import specifier. On Windows a canonical path is a verbatim one (\\?\C:\...), which Rolldown+/// can't resolve as an import (`raea run` on windows-latest, PT20); dunce drops the prefix where the plain path means the+/// same file, and changes nothing elsewhere.+fn spec(p: &Path) -> String {+ dunce::simplified(p).display().to_string()+}+/// A react-dom page's bundle (a surface): the module at `src` (its default/// export a React component) rendered by react-dom into #root with the page's width and height, again on each resize,/// bundled with its packages (the project's node_modules, raea-io-npm's) into `out`. The bundle's text. A legacy-app panel's@@ -27,7 +34,7 @@ const draw = () => root.render(createElement(Page as any, {{ width: innerWidth,addEventListener("resize", draw);draw();"#,- src = src.display().to_string()+ src = spec(src));bundle_entry(&entry, out, &[])?;std::fs::read_to_string(out).map_err(|e| format!("{}: {e}", out.display()))@@ -82,7 +89,7 @@ pub fn bundle_entry(entry: &str, out: &Path, extra: &[&str]) -> R<()> {pub fn bundle_tests(files: &[PathBuf], out: &Path, filter: Option<&str>, extra: &[&str]) -> R<()> {let mut entry = String::new();for f in files {- entry += &format!("import {:?};\n", f.display().to_string());+ entry += &format!("import {:?};\n", spec(f));}entry += &format!("import {{ run }} from \"bun:test\";\nconst call = (globalThis as any).__raea_call;\nconst print = (text: string) => call(\"print\", JSON.stringify({{ text }}));\nrun(print, {}).then((r) => call(\"done\", JSON.stringify({{ code: r.fail ? 1 : 0 }})), (e: any) => {{ print(\"error: \" + (e && e.stack ? e.stack : String(e))); call(\"done\", JSON.stringify({{ code: 1 }})); }});\n",diff --git a/runtime/page/src/elements.rs b/runtime/page/src/elements.rsindex 7fbf6dfd..85ba91ba 100644--- a/runtime/page/src/elements.rs+++ b/runtime/page/src/elements.rs@@ -235,7 +235,7 @@ pub(crate) fn page_props(kind: &str, props: Option<&Map<String, Value>>, dir: &Pif !p.exists() {REFUSED.with(|c| c.borrow_mut().push(format!("missing image: {}", p.display())));}- p.display().to_string()+ raea_io_home::src(&p)};out.insert(k.clone(), Value::String(path));continue;diff --git a/runtime/react/build.rs b/runtime/react/build.rsindex d78876c6..cee25015 100644--- a/runtime/react/build.rs+++ b/runtime/react/build.rs@@ -27,9 +27,15 @@ fn main() {// its own target folder inside the same target folder, so its build is kept between raea'slet target = bins.parent().expect("target").join("raea-bundle");let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());- let status = Command::new(cargo)- .args(["build", "--release", "--lib", "--manifest-path"])- .arg(manifest.join("../../engine/bundle/Cargo.toml"))+ // a cross build (Windows from Linux) builds the library for the same target, under target/raea-bundle/<triple>+ let (triple, host) = (std::env::var("TARGET").unwrap(), std::env::var("HOST").unwrap());+ let cross = (triple != host).then_some(triple);+ let mut cmd = Command::new(cargo);+ cmd.args(["build", "--release", "--lib", "--manifest-path"]).arg(manifest.join("../../engine/bundle/Cargo.toml"));+ if let Some(t) = &cross {+ cmd.args(["--target", t]);+ }+ let status = cmd.arg("--target-dir").arg(&target)// the outer build's target folder and profile settings aren't the library's@@ -38,7 +44,7 @@ fn main() {.status().expect("cargo, to build raea-bundle's library");assert!(status.success(), "raea-bundle's library didn't build (bundle/); RAEA_BUNDLE_SKIP=1 builds raea without it");- let lib = target.join("release").join(name);+ let lib = cross.map_or(target.clone(), |t| target.join(t)).join("release").join(name);// copied beside and renamed into place: a copy over the old file keeps its inode, whose code signature macOS has// cached, so the next process to load it was killed (SIGKILL, Code Signature Invalid; the legacy app's panel thread, 10-21)let tmp = bins.join(format!("{name}.new"));diff --git a/runtime/view/Cargo.toml b/runtime/view/Cargo.tomlindex 8408032f..d02d2aae 100644--- a/runtime/view/Cargo.toml+++ b/runtime/view/Cargo.toml@@ -7,6 +7,8 @@ publish = falsedescription = "The direct render's views (GPU and CPU) without the Bevy frame loop, the 2D rows drawn by Blitz, clips' masks, and the paint device as Bevy's renderer"[dependencies]+# a local file as a page src (raea_io_home::src: a file URL on Windows)+raea-io-home = { path = "../../io/home" }raea-core-program = { path = "../../core/program" }raea-core-shape = { path = "../../core/shape" }raea-core-wire = { path = "../../core/wire" }diff --git a/runtime/view/src/rows2d.rs b/runtime/view/src/rows2d.rsindex b69f43e9..6db22a22 100644--- a/runtime/view/src/rows2d.rs+++ b/runtime/view/src/rows2d.rs@@ -90,7 +90,7 @@ impl Rows {let mut p = Map::new();p.insert("style".into(), Value::Object(style_for(props)));if let Some(src) = &self.rows[*i].src {- p.insert("src".into(), Value::String(src.display().to_string()));+ p.insert("src".into(), Value::String(raea_io_home::src(src)));}want.push(Want { id, parent: ROOT, kind: "img".into(), props: p, text: None, path: format!("r{i}") });order.entry(ROOT).or_default().push(id);diff --git a/tools/release.sh b/tools/release.shindex b46537bd..e5ca516f 100755--- a/tools/release.sh+++ b/tools/release.sh@@ -1,124 +1,105 @@-#!/bin/zsh-# A release of the raea engine for macOS on Apple Silicon or for Linux on x86_64 (whichever machine runs it; Linux's-# is built on the probe box in an ubuntu:24.04 root, for glibc 2.39): raea and its bundler, with raea's own files beside-# them (share/raea: the raea SDK's TypeScript, the lite runtime and its packages, the shell's-# sources, the tools that install the local music and foley models, and the agent skills), laid out as-# tools/install.sh puts it under ~/.raea. Built from the committed tree at REF (never anyone's unfinished edit); the-# runtime's packages (sdk/react/js/node_modules, installed, not committed) come from this checkout.+#!/bin/bash+# A release of the raea engine for macOS on Apple Silicon, Linux on x86_64 or Windows on x86_64 (whichever machine runs+# it; Linux's is built on the probe box in an ubuntu:24.04 root, for glibc 2.39; Windows's on GitHub's windows-latest+# runner, .github/workflows/windows.yml's release mode, in Git's bash): raea and its bundler, with raea's own files+# beside them (share/raea: the raea SDK's TypeScript, the lite runtime and its packages, the shell's sources, the tools+# that install the local music and foley models, and the agent skills), laid out as the installer puts it under+# ~/.raea. Built from the committed tree at REF (never anyone's unfinished edit); the runtime's packages+# (sdk/react/js/node_modules, installed, not committed) come from this checkout.## tools/release.sh VERSION BIN_DIR [REF] BIN_DIR holds a release build's raea and its bundler-# (libraea_bundle.dylib or .so), and on macOS raea-perceive (`raea song`-# runs it; it isn't ported, so Linux's tarball has no `raea song`)+# (libraea_bundle.dylib, .so, or raea.exe and raea_bundle.dll), and on+# macOS raea-perceive (`raea song` runs it; it isn't ported, so Linux's+# and Windows's archives have no `raea song`)## The public engine is free and needs no raea account: its raea is built without raea's API (engine/cli's service# feature) and with the plugin catalog (raea/plugins' 56 Bevy plugins and raea/input's gamepad and picking):# cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features \# --features "$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)"-# The tarball's check opens avian and the virtual gamepad, so a raea without the catalog is refused. The check below refuses a build that names-# raea's API hosts or its token variables, and any file in the tarball that looks like a key. That build's raea-cli-# (thin LTO) prints nothing for over 25 minutes, so under antsy run it beside tools/cpu-heartbeat.sh (a line while-# rustc's CPU grows) and keep `--stall 25m`; a raised stall would only wait longer on a real hang.+# That build's raea-cli (thin LTO) prints nothing for over 25 minutes, so under antsy run it beside+# tools/cpu-heartbeat.sh (a line while rustc's CPU grows) and keep `--stall 25m`; a raised stall would only wait longer+# on a real hang.#-# Writes dist/raea-VERSION-macos-arm64.tar.gz (or -linux-x86_64) and its .sha256, and checks the tarball: unpacked into a fresh folder, its-# raea renders a frame with RAEA_NO_TREE=1 (so it can't be reading this checkout). Nothing is published.+# Writes dist/raea-VERSION-macos-arm64.tar.gz (-linux-x86_64.tar.gz, or -windows-x86_64.zip) and its .sha256, then+# checks the archive with tools/release-check.sh: unpacked into a fresh folder, its raea renders a frame with+# RAEA_NO_TREE=1 (so it can't be reading this checkout), has the plugin catalog, names none of raea's API and holds+# nothing key-shaped (on Windows, no Microsoft file). Nothing is published.set -euversion=${1:?usage: release.sh VERSION BIN_DIR [REF]}-bin=${2:?usage: release.sh VERSION BIN_DIR [REF]}+bin=$(cd "${2:?usage: release.sh VERSION BIN_DIR [REF]}" && pwd)ref=${3:-HEAD}-root=${0:A:h}/..-cd $root+root=$(cd "$(dirname "$0")/.." && pwd)+cd "$root"out=$root/dist-linux=; platform=macos-arm64-[ "$(uname -s)" = Linux ] && { linux=1; platform=linux-x86_64 }+case $(uname -s) in+ Linux) platform=linux-x86_64 ;;+ MINGW*|MSYS*|CYGWIN*) platform=windows-x86_64 ;;+ *) platform=macos-arm64 ;;+esacname=raea-$version-$platformstage=$(mktemp -d)/raea-mkdir -p $stage/bin $stage/share/raea $out-if [ -n "$linux" ]; then- cp $bin/raea $bin/libraea_bundle.so $stage/bin/- # what a Linux machine needs beside it: the bundled Noto Sans JP is a Latin subset, so kanji and kana come from the- # system, as on a Mac (raea warns once a character when no font has it)- print -r -- "raea $version for Linux x86_64 (glibc 2.39 or newer, Vulkan: a GPU driver or Mesa's llvmpipe).+mkdir -p "$stage/bin" "$stage/share/raea" "$out"+case $platform in+ linux-x86_64)+ cp "$bin/raea" "$bin/libraea_bundle.so" "$stage/bin/"+ # what a Linux machine needs beside it: the bundled Noto Sans JP is a Latin subset, so kanji and kana come from the+ # system, as on a Mac (raea warns once a character when no font has it)+ printf '%s\n' "raea $version for Linux x86_64 (glibc 2.39 or newer, Vulkan: a GPU driver or Mesa's llvmpipe).Install a CJK font for Japanese, Chinese and Korean text (Debian and Ubuntu: apt install fonts-noto-cjk).-Not in this build: raea song (its beat model's runner is macOS only so far)." > $stage/README-else- cp $bin/raea $bin/libraea_bundle.dylib $bin/raea-perceive $stage/bin/-fi+Not in this build: raea song (its beat model's runner is macOS only so far)." > "$stage/README" ;;+ windows-x86_64)+ cp "$bin/raea.exe" "$bin/raea_bundle.dll" "$stage/bin/"+ # the C runtime isn't in the zip (ort's ONNX Runtime needs its DLLs, and they're Microsoft's to ship): the VC+++ # redistributable, which most Windows machines already have, provides it+ printf '%s\r\n' "raea $version for Windows x86_64 (Windows 10 or 11, a DirectX 12 or Vulkan GPU driver; with no GPU, Mesa's lavapipe and WGPU_BACKEND=vulkan)." \+ "It needs the Microsoft Visual C++ Redistributable (x64), which most machines already have:" \+ "https://aka.ms/vs/17/release/vc_redist.x64.exe" \+ "Not in this build: raea song (its beat model's runner is macOS only so far)." > "$stage/README.txt" ;;+ *) cp "$bin/raea" "$bin/libraea_bundle.dylib" "$bin/raea-perceive" "$stage/bin/" ;;+esac# the packages sdk/tsconfig.base.json lists (@raea/<name>: its sources and package.json), which the bundlers resolve by itpkgs=()# and its bevy/ (a package's plugin handles, generated from the plugin build: its src/plugin.ts imports ../bevy/)-for p in $(git show ${ref}:sdk/tsconfig.base.json | jq -r '.compilerOptions.paths | to_entries[] | select(.key | test("^@raea/[a-z_]+$")) | .value[0] | ltrimstr("./") | split("/")[0]'); do- pkgs+=(sdk/$p/src sdk/$p/package.json)- git cat-file -e ${ref}:sdk/$p/bevy 2>/dev/null && pkgs+=(sdk/$p/bevy)+for p in $(git show "$ref:sdk/tsconfig.base.json" | jq -r '.compilerOptions.paths | to_entries[] | select(.key | test("^@raea/[a-z_]+$")) | .value[0] | ltrimstr("./") | split("/")[0]' | tr -d '\r'); do+ pkgs+=("sdk/$p/src" "sdk/$p/package.json")+ git cat-file -e "$ref:sdk/$p/bevy" 2>/dev/null && pkgs+=("sdk/$p/bevy")done-[ ${#pkgs} -gt 0 ] || { echo "release: no @raea packages in sdk/tsconfig.base.json at $ref" >&2; exit 1 }+[ ${#pkgs[@]} -gt 0 ] || { echo "release: no @raea packages in sdk/tsconfig.base.json at $ref" >&2; exit 1; }# the committed files raea reads at run time# (@raea/ui, the page's DOM every render goes through, isn't an @raea/<name> path, so it's named here)-git archive $ref sdk/tsconfig.base.json sdk/ui/src sdk/ui/package.json sdk/ui/bevy sdk/raea/src sdk/raea/library sdk/raea/package.json sdk/react/js/src sdk/react/js/lite sdk/react/js/shims sdk/react/js/package.json sdk/react/js/tsconfig.json sdk/shell/src \- $pkgs \+git archive "$ref" sdk/tsconfig.base.json sdk/ui/src sdk/ui/package.json sdk/ui/bevy sdk/raea/src sdk/raea/library sdk/raea/package.json sdk/react/js/src sdk/react/js/lite sdk/react/js/shims sdk/react/js/package.json sdk/react/js/tsconfig.json sdk/shell/src \+ "${pkgs[@]}" \tools/tokensynth tools/sao tools/goo tools/splat tools/matchmove sdk/guides/craft docs/sdk-coverage.md engine/cli/template/theme.css ':(glob)engine/cli/src/*.ts' \- | tar -x -C $stage/share/raea+ | tar -x -C "$stage/share/raea"+# a folder copied as it is here (links kept, as rsync -a; tar, since Git's bash on Windows has no rsync)+copy() { mkdir -p "$2" && tar -C "$(dirname "$1")" --exclude .cache -cf - "$(basename "$1")" | tar -C "$2" -xf -; }# styles.gen's Tailwind (raea compiles it on JavaScriptCore: runtime/bundle/src/styles.rs), as installed here-mkdir -p $stage/share/raea/sdk/react/tw/node_modules-rsync -a sdk/react/tw/node_modules/tailwindcss $stage/share/raea/sdk/react/tw/node_modules/+copy sdk/react/tw/node_modules/tailwindcss "$stage/share/raea/sdk/react/tw/node_modules"# `raea song`'s beat model (Beat This! small0, MIT), copied into ~/.local/share/raea-models on first use-if [ -z "$linux" ]; then- mkdir -p $stage/share/raea/models/beat-this- cp ~/.local/share/raea-models/beat-this/beat_this_small0.onnx $stage/share/raea/models/beat-this/+if [ $platform = macos-arm64 ]; then+ mkdir -p "$stage/share/raea/models/beat-this"+ cp ~/.local/share/raea-models/beat-this/beat_this_small0.onnx "$stage/share/raea/models/beat-this/"fi# the agent skills (sdk/skills: raea, raea-bevy), which the installer copies into ~/.claude/skills; raea-bevy's topic files# are links to the craft guides, so they go as the files they point toskills=$(mktemp -d)-git archive $ref sdk/skills sdk/guides | tar -x -C $skills+git archive "$ref" sdk/skills sdk/guides | tar -x -C "$skills"# raea-work is internal (work.raea.io's showcase pages), so it stays out, as the public export drops it-rm -rf $skills/sdk/skills/raea-work-cp -RL $skills/sdk/skills $stage/share/raea/skills+rm -rf "$skills/sdk/skills/raea-work"+cp -RL "$skills/sdk/skills" "$stage/share/raea/skills"# the runtime's packages, as installed here-mkdir -p $stage/share/raea/sdk/react/js && rsync -a --exclude .cache sdk/react/js/node_modules $stage/share/raea/sdk/react/js/-rm -rf $stage/share/raea/tools/tokensynth/__pycache__-print -r -- "$version" > $stage/share/raea/VERSION-tar -C ${stage:h} -czf $out/$name.tar.gz raea-(cd $out && if [ -n "$linux" ]; then sha256sum $name.tar.gz; else shasum -a 256 $name.tar.gz; fi > $name.tar.gz.sha256)-# the check: unpacked elsewhere, it renders a frame without the tree it was built from-check=$(mktemp -d)-tar -xzf $out/$name.tar.gz -C $check-# the edit in a folder of its own: raea reads every file under a project, and the install isn't the founder's project-mkdir -p $check/p-cat > $check/p/hello.tsx <<'TSX'-import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";-function Hello() {- const f = useCurrentFrame();- return <AbsoluteFill style={{ background: "#000", color: "#fff", fontSize: 120, justifyContent: "center", alignItems: "center" }}>raea {f}</AbsoluteFill>;-}-registerRoot(() => <Composition id="hello" component={Hello} width={640} height={360} fps={30} durationInFrames={30} />);-TSX-(cd $check/p && RAEA_NO_TREE=1 ../raea/bin/raea render hello.tsx --frame 12 -o hello.png >/dev/null 2>&1) || { echo "release: the unpacked raea didn't render (see $check)"; exit 1; }-[ -s $check/p/hello.png ] || { echo "release: no frame written (see $check)"; exit 1; }-# the plugin catalog is in it (track 3, raea/plugins): a headless App with avian and Bevy's input, raea/input's virtual-# gamepad pressed and read back. A raea built without --features "bevy-plugins,..." says "no plugin "avian" in this-# build" here-mkdir -p $check/plugins-cat > $check/plugins/check.ts <<'TS'-import { BevyApp } from "raea/bevy";-import { print } from "raea/native";-export default function main() {- const app = BevyApp.open({ plugins: ["avian", "bevy"], fps: 60 });- app.step(2);- app.call("raea/input", { gamepad: "South" });- app.step(2);- const held = app.call<{ buttons: string[] }>("raea/input.gamepad");- if (!held.buttons.includes("South")) throw new Error(`the virtual gamepad's South isn't held: ${JSON.stringify(held)}`);- print("plugins: avian and the virtual gamepad");-}-TS-(cd $check/plugins && RAEA_NO_TREE=1 ../raea/bin/raea run check.ts 2>&1 | grep -q "plugins: avian and the virtual gamepad") || { echo "release: the unpacked raea has no plugin catalog (build raea with --features \"\$(tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)\"; see $check/plugins)"; exit 1; }-# and its guides and styles.gen come from the release too-(cd $check/p && RAEA_NO_TREE=1 ../raea/bin/raea guide music | grep -q "music") || { echo "release: the unpacked raea has no craft guides (see $check)"; exit 1; }-mkdir -p $check/styled && { print -r -- 'import { css } from "./styles.gen";'; cat $check/p/hello.tsx; print -r -- 'void css;'; } > $check/styled/hello.tsx-(cd $check/styled && RAEA_NO_TREE=1 ../raea/bin/raea render hello.tsx --frame 1 -o hello.png >/dev/null 2>&1 && [ -s styles.gen.ts ]) || { echo "release: the unpacked raea didn't write styles.gen.ts (see $check/styled)"; exit 1; }-# engine only: no raea API in the binaries, nothing key-shaped anywhere-api=$(strings $check/raea/bin/* | grep -oE '(api|sign)\.raea\.io|RAEA_(SIGN|GEN)_TOKEN' | sort -u | tr '\n' ' ')-[ -z "$api" ] || { echo "release: the binaries name raea's API ($api): build raea-cli with --no-default-features"; exit 1; }-keys=$(grep -rlE 'sk-or-v1-[0-9a-f]{20}|sk-ant-[A-Za-z0-9_-]{20}|AKIA[0-9A-Z]{16}|BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY' $check/raea 2>/dev/null | head -5)-[ -z "$keys" ] || { echo "release: key-shaped text in: $keys"; exit 1; }-echo "release: $out/$name.tar.gz ($(du -h $out/$name.tar.gz | cut -f1)), checked: an unpacked copy rendered a frame with RAEA_NO_TREE=1"-rm -rf $check ${stage:h}+copy sdk/react/js/node_modules "$stage/share/raea/sdk/react/js"+rm -rf "$stage/share/raea/tools/tokensynth/__pycache__" "$skills"+printf '%s\n' "$version" > "$stage/share/raea/VERSION"+if [ $platform = windows-x86_64 ]; then+ archive=$name.zip+ rm -f "$out/$archive"+ (cd "$(dirname "$stage")" && 7z a -tzip -bso0 -bsp0 "$out/$archive" raea)+else+ archive=$name.tar.gz+ tar -C "$(dirname "$stage")" -czf "$out/$archive" raea+fi+(cd "$out" && if command -v sha256sum >/dev/null; then sha256sum "$archive"; else shasum -a 256 "$archive"; fi > "$archive.sha256")+rm -rf "$(dirname "$stage")"+bash "$root/tools/release-check.sh" "$out/$archive"+echo "release: $out/$archive ($(du -h "$out/$archive" | cut -f1))"