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 cloud: a render's hash list follows the tar's excludes, and raea-repo finds its helper through a link (CR22, CR23)
shinyobjectz1d4779f0c296
diff --git a/sdk/cloud/deploy/git/repo.sh b/sdk/cloud/deploy/git/repo.shindex d3054f70..f50ac7b7 100755--- a/sdk/cloud/deploy/git/repo.sh+++ b/sdk/cloud/deploy/git/repo.sh@@ -9,7 +9,10 @@# repo.sh clone OWNER PROJECT DIR the project's Git, then its media (git lfs pull)# repo.sh sign DIR OWNER PROJECT a clone made another way signed in like the aboveset -euo pipefail-here=$(cd "$(dirname "$0")" && pwd)+# beside this script itself, run through a link or not (the box runs it as /usr/local/bin/raea-repo)+self=$0+[ -L "$self" ] && self=$(readlink -f "$self" 2>/dev/null || readlink "$self")+here=$(cd "$(dirname "$self")" && pwd)api=${RAEA_API_ORIGIN:-https://raea.io}# git runs a helper named by its absolute path directly, so a clone keeps working after this script is donehelper=$here/git-credential-raeadiff --git a/sdk/cloud/server/media.ts b/sdk/cloud/server/media.tsindex 74e5a498..9ed0b6f8 100644--- a/sdk/cloud/server/media.ts+++ b/sdk/cloud/server/media.ts@@ -72,13 +72,26 @@ const isPointer = (file: string) => {}}-/** The project's media that can go by hash: each with its signed download URL. */-export async function inputs(root: string, lfs: Lfs): Promise<Media[]> {+/** tar --exclude patterns (./out/*, ./.git) as a test of a path in the project, the way tar applies them: its+ * wildcards cross /, and a folder left out takes its files with it */+export function excluded(patterns: string[]): (p: string) => boolean {+ const res = patterns.map((e) => new RegExp("^" + e.replace(/^\.\//, "").replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".") + "$"))+ return (p) => {+ const parts = p.split("/")+ for (let i = 1; i <= parts.length; i++) if (res.some((r) => r.test(parts.slice(0, i).join("/")))) return true+ return false+ }+}++/** The project's media that can go by hash, each with its signed download URL: all but what `skip` leaves out (the+ * tar's excludes, so an old render in out/ isn't fetched for a new one). */+export async function inputs(root: string, lfs: Lfs, skip: (p: string) => boolean = () => false): Promise<Media[]> {const ls = spawnSync("git", ["-C", root, "lfs", "ls-files", "--json"], { encoding: "utf8", maxBuffer: 64 << 20 })if (ls.status !== 0) return []const files = ((JSON.parse(ls.stdout || "{}") as { files?: { name: string; oid: string; size: number }[] }).files ?? [])const same: { path: string; oid: string; size: number }[] = []for (const f of files) {+ if (skip(f.name)) continueconst p = path.join(root, f.name)if (!existsSync(p)) continueif (isPointer(p) || (await sha256(p)) === f.oid) same.push({ path: f.name, oid: f.oid, size: f.size })diff --git a/sdk/cloud/server/offload.ts b/sdk/cloud/server/offload.tsindex 97cbf8c5..83800060 100644--- a/sdk/cloud/server/offload.ts+++ b/sdk/cloud/server/offload.ts@@ -21,7 +21,7 @@ import os from "node:os"import path from "node:path"import { pathToFileURL } from "node:url"import { RaeaCloud } from "../src/index.ts"-import { excludes as mediaExcludes, inputs, lfsOf, outputs } from "./media.ts"+import { excluded, excludes as mediaExcludes, inputs, lfsOf, outputs } from "./media.ts"const REAL = process.env.RAEA_REAL ?? "/opt/raea/bin/raea"// flags whose value is a path raea writes; the rest of a render's path arguments are read@@ -99,7 +99,7 @@ async function main() {const sent = path.join(tmp, "in.tar")// the media that goes by hash: out of the tar, named in its manifestconst lfs = lfsOf(p.root)- const byHash = typeof lfs === "string" ? [] : await inputs(p.root, lfs)+ const byHash = typeof lfs === "string" ? [] : await inputs(p.root, lfs, excluded(excludes))const extra: string[] = []if (byHash.length) {writeFileSync(path.join(tmp, "media-excludes"), mediaExcludes(byHash))diff --git a/sdk/cloud/test/media.ts b/sdk/cloud/test/media.tsindex f008b755..c0c31780 100644--- a/sdk/cloud/test/media.ts+++ b/sdk/cloud/test/media.ts@@ -11,7 +11,7 @@ import { createHash, randomBytes } from "node:crypto"import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs"import { tmpdir } from "node:os"import path from "node:path"-import { inputs, lfsOf, outputs } from "../server/media.ts"+import { excluded, inputs, lfsOf, outputs } from "../server/media.ts"const clone = process.argv[2]if (!clone) throw new Error("node test/media.ts CLONE")@@ -29,6 +29,10 @@ const farm = (fn: string, ...args: unknown[]) => {}const sha = (f: string) => createHash("sha256").update(readFileSync(f)).digest("hex")+// the tar's excludes leave the same media out of the hash list+const skip = excluded(["./.git", "./out/*", "./.raea-cloud-out"])+if (!skip("out/a.mp4") || !skip("out/x/b.png") || !skip(".git/lfs/x") || skip("media/plate.png") || skip("outro.mp4")) fail("excluded() doesn't match tar's excludes")+const lfs = lfsOf(clone)if (typeof lfs === "string") fail(`the clone's media would go in the tar: ${lfs}`)const lfsOk = lfs as Exclude<typeof lfs, string>