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
The Google sign-in's screen is handed out once Chrome's window is up (a fresh profile takes about 20 s on the box's CPU, and the viewer showed black till then), and a display left by an X server that's gone (a service restart leaves their sockets) is reclaimed. setup.sh adds xdotool for the window check
shinyobjectz4cc8f58e0a95
diff --git a/sdk/cloud/deploy/sprites/setup.sh b/sdk/cloud/deploy/sprites/setup.shindex e8dd561f..abbeb38d 100644--- a/sdk/cloud/deploy/sprites/setup.sh+++ b/sdk/cloud/deploy/sprites/setup.sh@@ -35,7 +35,7 @@ if [ "$(/opt/raea/bin/raea --version 2> /dev/null)" != "$VERSION" ]; thenfi# the Google sign-in's own browser (server/google-screen.ts): Chrome on a virtual display, shown over VNC-sudo -E apt-get install -y -qq --no-install-recommends xvfb x11vnc fonts-noto-color-emoji > /dev/null+sudo -E apt-get install -y -qq --no-install-recommends xvfb x11vnc xdotool fonts-noto-color-emoji > /dev/nullcommand -v google-chrome > /dev/null || {say "google chrome"curl -fsSLo /tmp/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debdiff --git a/sdk/cloud/server/google-screen.ts b/sdk/cloud/server/google-screen.tsindex bc4ff906..813e5d69 100644--- a/sdk/cloud/server/google-screen.ts+++ b/sdk/cloud/server/google-screen.ts@@ -9,7 +9,7 @@// with it) and VNC port; all three stop when the sign-in ends. With no Chrome installed there's no screen, and the// sign-in falls back to the pasted address.import { type ChildProcess, spawn, spawnSync } from "node:child_process"-import { existsSync } from "node:fs"+import { existsSync, readFileSync, rmSync } from "node:fs"import { connect } from "node:net"import path from "node:path"@@ -41,12 +41,41 @@ const listening = (port: number) =>s.once("error", () => ok(false))})-/** the first display number from 100 with no X socket, and its VNC port */+const alive = (pid: number) => {+ try {+ process.kill(pid, 0)+ return true+ } catch {+ return false+ }+}+/** the first display number from 100 that's free: no X server holds it (a socket and lock left by one that's gone,+ * as a restart of the service leaves them, are cleared) */function freeDisplay(): number {- for (let n = 100; n < 400; n++) if (!existsSync(`/tmp/.X11-unix/X${n}`) && !existsSync(`/tmp/.X${n}-lock`)) return n+ for (let n = 100; n < 400; n++) {+ const sock = `/tmp/.X11-unix/X${n}`, lock = `/tmp/.X${n}-lock`+ const pid = existsSync(lock) ? Number(readFileSync(lock, "utf8").trim()) : 0+ if (pid && alive(pid)) continue+ if (existsSync(sock) || existsSync(lock)) {+ try {+ rmSync(sock, { force: true })+ rmSync(lock, { force: true })+ } catch {+ continue+ }+ }+ return n+ }throw new Error("no free display for the sign-in's browser")}+/** whether Chrome has a window up on display n (xdotool; without it, assumed so) */+const windowUp = (n: number) => {+ if (!which("xdotool")) return true+ const r = spawnSync("xdotool", ["search", "--onlyvisible", "--class", "chrome"], { env: { ...process.env, DISPLAY: `:${n}` }, encoding: "utf8" })+ return r.status === 0 && r.stdout.trim() !== ""+}+/** a Chrome on a display of its own at url, served over VNC on 127.0.0.1; its profile is under dir */export async function openScreen(dir: string, url: string): Promise<Screen> {const bin = chrome()@@ -91,6 +120,8 @@ export async function openScreen(dir: string, url: string): Promise<Screen> {if (!ok) await new Promise((r) => setTimeout(r, 200))}if (!ok) throw new Error("the sign-in's screen didn't start")+ // the page, not a black screen: a fresh Chrome profile takes a while on the box's CPU (about 20 s seen 11-24)+ for (let t = 0; t < 45_000 && !windowUp(n); t += 300) await new Promise((r) => setTimeout(r, 300))} catch (e) {stop()throw e