Skip to content

armgit / raea

Public Imported from GitHub
0

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.

raea cloud ingest: docs/cloud-ingest.feature IG1-IG13 (a synced folder pictured, understood, embedded and organized; Shane 11-24), and raea-ingest on Modal (sdk/cloud/deploy/modal/ingest.py): POST /v1/frame makes a JPEG frame of a video at an address, for synced files with no picture in their tool (IG4). Deployed on profile raea; secret raea-ingest

shinyobjectz4e125419841c
diff --git a/docs/cloud-ingest.feature b/docs/cloud-ingest.feature
new file mode 100644
index 00000000..59d3d85f
--- /dev/null
+++ b/docs/cloud-ingest.feature
@@ -0,0 +1,92 @@
+@spec
+Feature: raea cloud: a synced folder is pictured, understood, embedded and organized for the person
+ Shane, 2026-11-24: "when i have a data sync, we should auto index/tag and relate them to the appropriate folders or
+ have an ai agent or our ask/decision model api if available otherwise use their subscription agent and tag or
+ auto-organize the assets or files or folders so we can help understand what purpose they are for and predict what
+ they mean/do. also make sure we embed all the assets based on embedding type. this will mean if we have a client
+ library, we want to relate a client based folder to that library, or if disorganized we go file by file."
+ Later that day: "we should be able to pick a folder from a sync location and have all content when syncing
+ auto-tagged and organized for the user", "make sure thumbnails are also generated correctly", and of the models:
+ "isn't it running the models in modal?"
+
+ Today (11-24) a sync lists its folder through Composio and adds each file as a link item, all in one flat folder,
+ named and typed from its name and mime type only. Search embeds words (Workers AI's bge-small) and nothing else; no
+ file is tagged; pictures came from drive.google.com in the viewer's browser, so a viewer signed out of Google saw
+ none. The first real client demo is StreetTalk's: workspace streettalk, its Main library's "raea test — StreetTalk
+ samples (Nov 2026)" Drive folder (54 files: 47 videos, 6 documents, 1 picture) and three client libraries (Dutch,
+ Elfster, The Body Shop), each with a Drive folder of its own.
+
+ Background:
+ Given a workspace with Google Drive (or Box, Dropbox, Frame.io, Slack) connected through Composio
+ And raea never moves, renames or deletes anything in the tool: organizing happens in raea's library only
+
+ Rule: a folder is picked, and its shape comes with it
+ Scenario: IG1. A sync is a folder picked from the tool's own list
+ When the person adds a sync and picks a folder from Drive's list (syncadd.js)
+ Then the sync keeps the folder's id and its name; a folder typed as its id or its Drive link works the same,
+ and is named for the folder on its first run (built 11-24: sync-run.ts driveId, NAME)
+ Scenario: IG2. Subfolders come in as folders
+ Given the picked folder holds subfolders ("Raw/Angle 1", "Finals")
+ Then each becomes a library folder under the sync's folder, with the same name and nesting, and each file lands
+ in its own; a file moved between subfolders in the tool moves in raea on the next run
+
+ Rule: every file has a picture anyone who can see the library sees
+ Scenario: IG3. A synced file's picture is kept by raea
+ When a run lists a file that has a picture in its tool (Drive's thumbnailLink; Box's and Dropbox's thumbnails)
+ Then raea fetches it once at 640 px and keeps it in the workspace's own store (items.thumb, the API's signed
+ thumb_src), 60 a run, a failed fetch tried again on the next run (built 11-24 for Drive)
+ And the library's card shows it, with a play mark on a video; a tool's page address is never put in a <video>
+ Scenario: IG4. A file with no picture in its tool gets one made
+ Given a video, PDF or document the tool has no picture of
+ Then a frame (a video's at 10% of its length), a first page or a typeset title card is made on Modal (IG8) and
+ kept the same way
+
+ Rule: every file is understood
+ Scenario: IG5. Each new file is read by its kind
+ When a run brings files in
+ Then each is read once per version (its tool's modified time or checksum): a picture by its picture; a video by
+ its picture, frames at 10/50/90% and its words (transcribed); a document by its text (Drive exports Docs as
+ text, PDFs are read); a sound by its words or, with none, what it sounds like
+ And what it says about the file is kept on the item: a one-line description, tags (its kind: raw footage, b-roll,
+ a final cut, a brief, a script, a logo, a voiceover, a reference; its subject; its client or brand; its format,
+ 9x16 or 16x9; its length), and for each tag who said it and why
+ Scenario: IG6. raea's model reads first; the workspace's agent when there's none
+ Given the workspace's plan has raea's ask model (raea ask, docs/ask.feature: clef-omni on the plan's pool)
+ Then the files are read by it, batched, the spend on the pool
+ Otherwise they are read by the workspace's own connected agent on raea cloud's box (Claude Code on its Claude, or
+ Antigravity on its Google AI plan), as a background job that never takes a project's turn
+ And with neither, files are tagged from their names, folders and types alone, and the library says how to get more
+ Scenario: IG7. A person's correction wins
+ When someone removes or changes a tag, or moves a file to another folder
+ Then raea never puts it back, and the next files like it are read with that correction in the prompt
+
+ Rule: every file is embedded by its kind, once
+ Scenario: IG8. Embeddings run on Modal, in raea's own models
+ Then pictures and video frames are embedded by SigLIP 2 (the model raea index uses on the Mac, so a desktop's and
+ the cloud's vectors compare), sounds by CLAP, and words (documents, transcripts, descriptions) by the text model
+ search already uses; on Modal (sdk/cloud/deploy/modal, beside the render farm), a GPU only while there's work
+ And a vector is kept per file version and model, never made twice, and dropped with its file
+ Scenario: IG9. Search finds a file by what's in it
+ When the person searches "girl laughing on a street corner, vertical"
+ Then the words are matched against pictures and frames (SigLIP's text tower), descriptions and transcripts, and
+ tags, fused into one ranking; a hit says where in a video it is
+
+ Rule: the files are organized for the person
+ Scenario: IG10. A folder about a client goes with that client's library
+ Given a synced folder whose name, or most of whose files, are about one of the workspace's clients
+ Then the sync is related to that client's library (or its files are, when the folder is the workspace's), shown
+ with the reason ("47 of 54 files show The Body Shop's products"), and undone in one click
+ Scenario: IG11. A disorganized folder is sorted file by file
+ Given a folder of files with no useful subfolders
+ Then raea proposes folders (by client, then by kind: Raw, B-roll, Finals, Briefs) with each file's place and
+ reason, as one review the person accepts whole, or file by file; nothing moves until they do
+ And once accepted, new files that fit are placed the same way on later runs
+
+ Rule: the person can see it working
+ Scenario: IG12. The left panel says what a sync is doing
+ Then a sync bringing files in turns in the left panel, on its row and its library's (built 11-24), then says
+ "Reading 12 of 54" while files are read, and its card shows the tags as they come
+ Scenario: IG13. Proven on StreetTalk's demo
+ When StreetTalk's four Drive syncs run from empty
+ Then every file has a picture, a description and tags; the three client folders are related to their client
+ libraries; a search for a shot finds it by what's in it; and the run says its time and what it cost
diff --git a/sdk/cloud/deploy/modal/ingest.py b/sdk/cloud/deploy/modal/ingest.py
new file mode 100644
index 00000000..cd41651f
--- /dev/null
+++ b/sdk/cloud/deploy/modal/ingest.py
@@ -0,0 +1,94 @@
+# raea cloud's ingest on Modal (docs/cloud-ingest.feature): what a synced file needs that a Worker can't do itself.
+# The Worker (sync-run.ts) calls it with the file at an address it can fetch (a Composio download's s3url) and keeps
+# what comes back. From sdk/cloud:
+#
+# MODAL_PROFILE=raea modal deploy deploy/modal/ingest.py
+#
+# POST /v1/frame {url, at?} a video's frame as a JPEG 640 px on its long side; at is where, as a fraction of its
+# length (0.1 when left out: past a fade from black, before the end card). IG4
+# GET /healthz
+#
+# Every call but /healthz carries Authorization: Bearer RAEA_INGEST_TOKEN (Modal secret raea-ingest; the Worker's
+# secret of the same name). CPU only: a frame is ffmpeg seeking in the file, a second or two.
+
+import os
+import subprocess
+import tempfile
+
+import modal
+
+app = modal.App("raea-ingest", image=modal.Image.debian_slim(python_version="3.12").apt_install("ffmpeg").pip_install("fastapi[standard]"))
+secret = modal.Secret.from_name("raea-ingest")
+
+# the largest file fetched for a frame: a phone's minute of 4K is about 400 MB
+MAX_BYTES = 2 << 30
+LONG_SIDE = 640
+
+
+def probe_seconds(path: str) -> float:
+ r = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", path], capture_output=True, text=True, timeout=60)
+ try:
+ return max(0.0, float(r.stdout.strip()))
+ except ValueError:
+ return 0.0
+
+
+def frame(path: str, at: float) -> bytes:
+ secs = probe_seconds(path)
+ t = secs * min(max(at, 0.0), 0.95) if secs else 0.0
+ scale = f"scale='if(gt(iw,ih),{LONG_SIDE},-2)':'if(gt(iw,ih),-2,{LONG_SIDE})'"
+ for seek in (t, 0.0):
+ r = subprocess.run(["ffmpeg", "-v", "error", "-ss", f"{seek:.3f}", "-i", path, "-frames:v", "1", "-vf", scale, "-q:v", "4", "-f", "image2", "-c:v", "mjpeg", "pipe:1"], capture_output=True, timeout=120)
+ if r.returncode == 0 and r.stdout:
+ return r.stdout
+ raise RuntimeError((r.stderr or b"no frame").decode(errors="replace")[-300:])
+
+
[email protected](cpu=2, memory=4096, secrets=[secret], timeout=900, scaledown_window=120)
[email protected](max_inputs=8)
+def api():
+ import urllib.request
+
+ from fastapi import FastAPI, HTTPException, Request
+ from fastapi.responses import PlainTextResponse, Response
+
+ web = FastAPI()
+ token = os.environ["RAEA_INGEST_TOKEN"]
+
+ def check(req: Request):
+ if req.headers.get("authorization", "").removeprefix("Bearer ") != token:
+ raise HTTPException(401, "a raea ingest token is needed (Authorization: Bearer)")
+
+ @web.get("/healthz")
+ def healthz():
+ return PlainTextResponse("ok")
+
+ @web.post("/v1/frame")
+ async def make_frame(req: Request):
+ check(req)
+ body = await req.json()
+ url, at = body.get("url"), float(body.get("at", 0.1))
+ if not isinstance(url, str) or not url.startswith("https://"):
+ raise HTTPException(400, "url is the file's https address")
+ with tempfile.NamedTemporaryFile(suffix=".media") as f:
+ got = 0
+ try:
+ with urllib.request.urlopen(urllib.request.Request(url, headers={"user-agent": "raea-ingest/1"}), timeout=120) as r:
+ while chunk := r.read(1 << 20):
+ got += len(chunk)
+ if got > MAX_BYTES:
+ raise HTTPException(413, "the file is over 2 GB")
+ f.write(chunk)
+ except HTTPException:
+ raise
+ except Exception as e:
+ raise HTTPException(502, f"couldn't fetch the file: {e}")
+ f.flush()
+ try:
+ jpg = frame(f.name, at)
+ except Exception as e:
+ raise HTTPException(422, f"no frame in it: {e}")
+ return Response(jpg, media_type="image/jpeg")
+
+ return web