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 boxes keep an agent's socket from going idle, and stop what a stopped agent left running. Between raea cloud and a box a socket is closed after about two minutes without traffic, and an agent waiting on a long render sends nothing: five of StreetTalk's seven "socket closed" ends on 11-25 came 114-125 s into a silence. The box sends a _raea/keepalive notification every 20 s (raea cloud skips notifications it doesn't know; the agent never sees it). An agent now runs in its own process group, stopped whole when its socket closes or it exits: a killed agent's background renders went on as orphans, 4 GB of them on raea-2.
shinyobjectz79cda1dc8c6d
diff --git a/sdk/cloud/server/main.ts b/sdk/cloud/server/main.tsindex bd964598..7176e6c3 100644--- a/sdk/cloud/server/main.ts+++ b/sdk/cloud/server/main.ts@@ -349,10 +349,28 @@ server.on("upgrade", (req, socket, head) => {}const env = own ? { ...withoutKeys(childEnv()), ...agent.env, ...RUN_DEFAULTS, ...own } : { ...childEnv(), ...agent.env }wss.handleUpgrade(req, socket, head, (ws) => {- const child = spawn(agent.command, agent.args, { cwd: WORK, env, stdio: ["pipe", "pipe", "pipe"] })+ // its own process group, so what it started (a render left running in the background) stops with it: a killed+ // agent's renders went on as orphans, 4 GB of them on raea-2 (11-25)+ const child = spawn(agent.command, agent.args, { cwd: WORK, env, stdio: ["pipe", "pipe", "pipe"], detached: true })+ const stopAll = () => {+ if (!child.pid) return+ try {+ process.kill(-child.pid, "SIGTERM")+ } catch {}+ setTimeout(() => {+ try {+ process.kill(-child.pid!, "SIGKILL")+ } catch {}+ }, 5000).unref()+ }running.add(child)agentSockets.add(ws)- ws.on("close", () => agentSockets.delete(ws))+ // a message every 20 s, so the socket is never idle: between raea cloud and the box it's closed after about two+ // minutes without traffic, and an agent waiting on a long render sends nothing (11-25: five of StreetTalk's seven+ // "socket closed" ends came 114-125 s into a silence). raea cloud skips notifications it doesn't know; the agent+ // never sees it+ const beat = setInterval(() => ws.readyState === ws.OPEN && ws.send('{"jsonrpc":"2.0","method":"_raea/keepalive"}'), 20_000)+ ws.on("close", () => (agentSockets.delete(ws), clearInterval(beat)))child.on("exit", () => running.delete(child))// its stderr to the box's log as before, and along the socket as _raea/stderr notifications, so raea cloud keeps// it with the run's trace (runtrace.ts) instead of only on this box's disk (11-25: raea-1's logs died with it)@@ -367,9 +385,9 @@ server.on("upgrade", (req, socket, head) => {for (let i; (i = buf.indexOf("\n")) >= 0; buf = buf.slice(i + 1)) if (i > 0) ws.send(buf.slice(0, i))})ws.on("message", (m) => child.stdin.write(m.toString() + "\n"))- ws.on("close", () => child.exitCode === null && child.kill("SIGTERM"))+ ws.on("close", stopAll)child.on("error", (e) => ws.close(1011, `couldn't start ${agent.id}: ${e.message}`.slice(0, 120)))- child.on("exit", (code) => ws.close(1011, `${agent.id} exited ${code}`))+ child.on("exit", (code) => (ws.close(1011, `${agent.id} exited ${code}`), stopAll()))})})