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.

Docs: sharing for review, libraries and the storage API. Two tutorials (share-for-review: a link anyone can watch and comment on, notes back to the agent, the next version on the same link, Review links, several files on one link, agents sharing; libraries: this Mac or the cloud, making one, search by what's in a shot, statuses, sharing from a cloud library, projects beside their code) and a guide to the API (who may call it: anyone on Pro or Team; agent keys and their scopes; libraries, search by meaning or by words, files, uploads, the trash, review links). storage-and-search says libraries stay on the Mac unless made in the cloud, and where indexing runs

shinyobjectz14870df0641b
diff --git a/docs/manual/guides/api.md b/docs/manual/guides/api.md
new file mode 100644
index 00000000..14331a90
--- /dev/null
+++ b/docs/manual/guides/api.md
@@ -0,0 +1,172 @@
+---
+title: "The storage, search and review API"
+summary: "Who can call raea's API (anyone on Pro or Team, on their own or in a team), how an agent key is made and scoped, and the calls for cloud libraries, search by meaning, files and review links."
+order: 5
+sources: ["docs/libraries.feature", "docs/review.feature", "apps/site/api/src/agent-keys.ts", "apps/site/api/src/library/routes.ts", "apps/site/api/src/library/search.ts", "apps/site/api/src/storage.ts", "apps/site/api/src/review.ts"]
+---
+
+Your cloud libraries, their search and your review links are reachable over HTTP at `https://api.raea.io`, so an
+agent, a script or your own tool can find a shot, fetch it, add files, and share them for review. The raea app uses
+the same calls.
+
+## Who can use it
+
+Anyone on **Pro** or **Team** can, a person on their own included: there's no separate developer plan and no
+per-call price. The API reaches what lives in raea's cloud, so it comes with the plans that have cloud storage.
+
+On **Free**, libraries stay on your Mac, and so does their search. Search them from the app, or from a terminal or an
+agent on the same Mac with [`raea library`](../reference/cli/library.md), which needs no key. Asking for an agent key
+on Free answers `402 agent_keys_paid`.
+
+## Make an agent key
+
+On [raea.io/account](https://raea.io/account), open Storage, then Agent access. Name the key after the agent that will
+use it, tick what it may do, and pick which libraries it reaches (all of them, or some). The key, `raea_ak_` and 64
+hex characters, is shown once with a ready-made example: copy it then. raea keeps only its hash.
+
+A key lasts 90 days unless you choose otherwise (365 at most), up to 50 at once. Revoking one stops it on its next
+request. Every change made with a key goes in your storage log, with the key's name.
+
+Send it as a bearer header on every call. Nothing else works with it: no cookie, no basic auth.
+
+```sh
+curl https://api.raea.io/v1/libraries -H "authorization: Bearer raea_ak_..."
+```
+
+## What a key may do
+
+| Scope | Reaches |
+| --- | --- |
+| `files:read` | your libraries and their files, search, a file's download URL, storage used |
+| `files:write` | uploads, naming files in a cloud library, tags, new libraries and cloud sources |
+| `files:delete` | moving stored files to the trash, the trash, restoring from it |
+| `share` | review links: making, changing and stopping them, their comments; a project's collaborators |
+
+A key reaches only those. Billing, connections, publishing, your computers, devices, Git LFS and the keys themselves
+answer `403 agent_scope`, whatever the key's scopes. A key limited to some libraries sees only their files (any other
+is `404`) and the files it uploaded itself; making a library, the trash and collaborators need a key for all of them.
+
+## Find your libraries
+
+```sh
+curl https://api.raea.io/v1/libraries -H "authorization: Bearer $RAEA_KEY"
+```
+
+Each library comes with its `id`, `name`, `workspace`, `sources` (each with its `kind`: a `folder` or `volume` on one of
+your computers, `cloud`, or `drive` for Google Drive), and how many `files` it holds and has `indexed`. A library on
+your Mac only isn't here: it never leaves the Mac.
+
+List a library's files, 200 at a time (up to 500), each with its `path`, `sha256`, `kind` and thumbnail:
+
+```sh
+curl "https://api.raea.io/v1/libraries/lib_.../files?limit=200" -H "authorization: Bearer $RAEA_KEY"
+```
+
+Pass the last `path` you got as `after=` for the next page.
+
+## Search
+
+```sh
+curl https://api.raea.io/v1/libraries/search \
+ -H "authorization: Bearer $RAEA_KEY" -H "content-type: application/json" \
+ -d '{"workspace": "<a library'\''s workspace>", "words": "a chip pulled apart, cheese stretching", "limit": 10}'
+```
+
+| Field | |
+| --- | --- |
+| `workspace` | required: the workspace the libraries are in, as the list names it |
+| `words` | what you're looking for, as you'd describe it |
+| `vector` | the words' embedding, to search by meaning (below) |
+| `libraries` | a list: only these library ids |
+| `kind` | a list of any of `video`, `image` and `audio` |
+| `tags` | a list: only files with any of these tags |
+| `path` | a glob over the files' paths, like `cuts/**` |
+| `limit` | how many hits |
+| `sound` | `true` to rank by how things sound, for a described sound effect |
+
+Each hit is a moment: the file's `sha256`, the segment's `t0` and `t1` in seconds, a `score`, what `matched` (its
+`picture`, `sound` or `words` by meaning, its `text` or `sound labels` by keyword), any `text` read or heard in it, its
+`labels`, a `thumb_url`, and the `file` with every place it's kept. The answer's `by` says how it searched.
+
+**By meaning, or by words.** With `vector`, raea compares it with every shot's picture, sound and words, and matches
+your words as keywords too: `"by": "meaning"`. Without one, it searches by keywords alone: `"by": "words"`. The vector
+is EmbeddingGemma 2's (`onnx-community/embeddinggemma-2-ONNX`, 768 numbers) for the text
+`task: search result | query: ` followed by your words. raea never runs a model in its cloud for you: the app embeds
+your words on your Mac, which is what `raea library search` and the app's Search do, and raea.io's Storage page
+borrows one of your computers that's online.
+
+## Get a file
+
+```sh
+curl https://api.raea.io/v1/storage/blobs/<sha256> -H "authorization: Bearer $RAEA_KEY"
+```
+
+The answer is a `url` good for an hour, and the file's `size`. Fetch the bytes from it directly. A file in a folder
+on one of your computers is in storage only once something has uploaded it (sharing it does); until then the hit's
+`file` says which computer has it.
+
+## Add a file
+
+Files go straight to storage, never through the API. Ask with the file's SHA-256 and size:
+
+```sh
+curl https://api.raea.io/v1/storage/uploads -H "authorization: Bearer $RAEA_KEY" \
+ -H "content-type: application/json" -d '{"sha256": "<sha256>", "size": 1048576}'
+```
+
+The answer is `{"exists": true}` when raea has the file already, a `url` to `PUT` it to, or for a big file an
+`upload_id` with a URL for each part. Then `POST /v1/storage/uploads/complete` with `{sha256, upload_id, parts}` (each
+part's `n` and `etag`). An upload past your plan's storage is refused before it starts.
+
+To put it in a cloud library, name it in one of the library's `cloud` sources:
+
+```sh
+curl https://api.raea.io/v1/libraries/sources/<source id>/files -H "authorization: Bearer $RAEA_KEY" \
+ -H "content-type: application/json" \
+ -d '{"upsert": [{"path": "cuts/teaser.mp4", "sha256": "<sha256>", "size": 1048576, "mtime": 1794400000000, "kind": "video"}]}'
+```
+
+raea indexes it in its own cloud, and it turns up in search once that's done. The same call takes `rename:
+[{from, to}]`, and `remove: [path]` with `files:delete`. Tags go on with `POST /v1/libraries/media/<sha256>/tags`
+`{"tags": [...]}`.
+
+## Delete, with a way back
+
+`DELETE /v1/storage/blobs/<sha256>` moves a file to the trash. It's refused (`409 in_use`, saying where) while a
+library still names it or a post is going out with it. `GET /v1/storage/trash` lists the trash, and
+`POST /v1/storage/trash/<sha256>/restore` brings a file back. raea deletes it for good after 30 days, and only you, on
+raea.io, can empty the trash sooner.
+
+## Share for review
+
+With the `share` scope, a key can send a stored file on a review link. Giving a key that scope is your say-so; Let
+agents share, in the app's Settings, is the same choice for agents working inside the app.
+
+```sh
+curl https://api.raea.io/v1/review-links -H "authorization: Bearer $RAEA_KEY" \
+ -H "content-type: application/json" \
+ -d '{"sha256": "<sha256>", "type": "video/mp4", "title": "Teaser, cut 3", "days": 30}'
+```
+
+The answer has the link's `id` and its `url` (raea.io/r/...) to hand on. `days` is 1 to 365 (30 if left out),
+`download` lets reviewers download the file, and `password` sets one. The file must be in your storage first:
+`409 not_stored` says to upload it.
+
+| Call | |
+| --- | --- |
+| `GET /v1/review-links` | every link, newest first |
+| `GET /v1/review-links/<id>` | one link with its versions, comments and viewers |
+| `POST /v1/review-links/<id>/versions` | `{sha256, type}`: the next version, on the same link |
+| `POST /v1/review-links/<id>/comments` | `{body, version?, parent?}`: your answer to a reviewer |
+| `PATCH /v1/review-links/<id>/comments/<comment id>` | `{"resolved": true}` |
+| `PATCH /v1/review-links/<id>` | `{title?, days?, download?, password?}` |
+| `DELETE /v1/review-links/<id>` | stop sharing: the link stops working for everyone at once |
+
+A link of several files is made in the app for now (the Library's Share for review bar); a key can't make one yet.
+
+## Errors
+
+A missing, unknown, revoked or expired key gets a plain-text `401`. Every other refusal is JSON with an `error` code
+and a `message` saying what to do: `402` for a plan without the feature, `403 agent_scope` for a call outside the key's scopes, `404` for
+anything that isn't yours (raea never says whether it exists), `409` for a conflict, and `413` when storage or the
+search index is full.
diff --git a/docs/manual/tutorials/index.md b/docs/manual/tutorials/index.md
index b4449fe2..698f1061 100644
--- a/docs/manual/tutorials/index.md
+++ b/docs/manual/tutorials/index.md
@@ -1,6 +1,6 @@
---
title: "Tutorials"
-summary: "Ten short narrated tutorials that walk through raea from the first download to publishing, controllers, the SDK, teams, storage and search."
+summary: "Short narrated tutorials that walk through raea from the first download to reviewing, sharing for review, publishing, controllers, the SDK, teams, libraries, storage and search."
order: 0
sources: ["docs/manual/tutorials", "apps/site/src/tutorials", "apps/site/real/tutorial"]
---
@@ -18,6 +18,7 @@ to your agent. Take them in order the first time: each one builds on the one bef
## Make and review
- [Review work and leave notes](review-and-notes.md): open what your agents made, pin a note to a moment and a place, and get the next version.
+- [Share work for review](share-for-review.md): send a cut on a link anyone can watch and comment on, and get their notes back to the agent.
- [Inspect compositions and components](inspect.md): see what a piece is made of, pick any part of the picture, and change it.
- [Controllers](controllers.md): a project's settings, which every agent works to, made by describing them in plain words.
- [Publish](publish.md): connect your accounts and post the approved cut to all of them at once.
@@ -26,4 +27,5 @@ to your agent. Take them in order the first time: each one builds on the one bef
- [Extend raea with the SDK](extend.md): compositions and controllers as TypeScript, the feed's tools, and asking your agent for new work.
- [Work as a team](teams.md): invite your teammates, review together, and share one pool of storage.
+- [Libraries: keep, find and share your media](libraries.md): libraries on this Mac or in the cloud, search by what's in a shot, statuses, and projects beside their code.
- [How storage and search work](storage-and-search.md): projects as Git with media in storage the Git LFS way, and searching media by what's in it.
diff --git a/docs/manual/tutorials/libraries.md b/docs/manual/tutorials/libraries.md
new file mode 100644
index 00000000..f6d85f84
--- /dev/null
+++ b/docs/manual/tutorials/libraries.md
@@ -0,0 +1,50 @@
+---
+title: "Libraries: keep, find and share your media"
+summary: "Make a library on this Mac or in raea's cloud, find any shot or sound by what's in it, mark where each file stands, share from it, and keep a project's media beside its code."
+order: 9.5
+sources: ["docs/libraries.feature", "docs/review.feature", "apps/app/src/library", "apps/app/host/library"]
+---
+
+A library is a set of folders raea reads, so you can find footage, stills and sounds by what's in them. This tutorial
+makes one, searches it, marks where its files stand, and shares from it.
+
+## On this Mac, or in the cloud
+
+Every library lives in one of two places. On this Mac, its files and their index stay on your computer, and nothing
+leaves it. In raea's cloud, on Pro and Team, it's searchable from any device, and only a cloud library's files can be
+shared.
+
+## Make a library
+
+Open Library in the sidebar and press the plus beside Libraries. Name it, choose This Mac or raea cloud, then add a
+folder, a drive, or files from Google Drive. raea reads each file once, in the background. A folder an agent adds
+waits for your yes.
+
+## Search by what's in it
+
+Search looks through every library at once. Describe what's in the shot, like a chip pulled apart with cheese
+stretching between the halves, and raea finds that moment, even when no file is named that. Turn on Sounds only to
+find a sound by how it sounds.
+
+## Mark where a file stands
+
+Open a file to see it large. At the top of its panel, mark it Needs review, In progress, or Approved. The row under the
+library's sources filters by status, so what's still waiting is one click away.
+
+## Share from a library
+
+In a cloud library, a file's panel has Share for review: the link is made right there, with Copy beside it. Pick
+several files to send them on one link. A library on this Mac says that its files can't be shared, since they never
+leave.
+
+## Your projects, with their code
+
+Projects you've saved to raea are listed under Projects, each one a cloud library over the project's folder. Its page
+shows the project's GitHub repository and whether the code is pushed, so a project's media and its code sit together.
+
+## From the terminal, and your agents
+
+Agents search the same libraries, with raea library search, while the app is open. And on Pro and Team, an agent key
+lets any agent reach your cloud libraries through raea's API, from anywhere.
+
+Next: [How storage and search work](storage-and-search.md). The [API guide](../guides/api.md) has the calls.
diff --git a/docs/manual/tutorials/review-and-notes.md b/docs/manual/tutorials/review-and-notes.md
index be2b78ef..48fe0d9e 100644
--- a/docs/manual/tutorials/review-and-notes.md
+++ b/docs/manual/tutorials/review-and-notes.md
@@ -41,4 +41,4 @@ Every item moves through the same five steps: planned, making, posted, seen, and
and its status shows beside its title. The number beside the Inbox counts what's posted and not seen yet, so you always
know what's waiting for you.
-Next: [Inspect compositions and components](inspect.md).
+Next: [Share work for review](share-for-review.md), for people who don't use raea.
diff --git a/docs/manual/tutorials/share-for-review.md b/docs/manual/tutorials/share-for-review.md
new file mode 100644
index 00000000..a53a44b4
--- /dev/null
+++ b/docs/manual/tutorials/share-for-review.md
@@ -0,0 +1,52 @@
+---
+title: "Share work for review"
+summary: "Send a cut, a still or a sound on a review link: anyone with it watches and comments on the picture without an account, their notes come back to the agent, and the next version goes out on the same link."
+order: 4.5
+sources: ["docs/review.feature", "apps/app/src/share", "apps/app/src/library/ShareBar.tsx", "apps/site/api/src/review.ts", "apps/site/api/src/review-sets.ts", "apps/site/src/review"]
+---
+
+Not everyone who needs to see your work uses raea. This tutorial shares a cut on a link, follows a reviewer's notes
+back to the agent who made it, and puts the next version on the same link.
+
+## Share a cut
+
+Open the cut and press Share, at the top right. Name the link, choose how long it works, and press Create link. raea
+sends the file to your storage, and Copy gives you the link. Reviewers need no account, and take no seat on your plan.
+
+## What your reviewer sees
+
+The link opens a player on raea.io. The reviewer gives their name, clicks the picture where something should change,
+and writes the note right there, at that frame. They can step through frame by frame, and Approve marks the version
+approved.
+
+## Their notes come back
+
+Every note they leave comes back to the item in raea, pinned where they put it, with their name on it. Send it to the
+agent like one of your own. Reply, or mark it done, and the reviewer sees that on the page.
+
+## The next version, on the same link
+
+When the agent's next version lands, open it, and the Share panel says the link still shows the earlier one. Press
+Make it v2. The same link now plays v2, with a picker for every version, and Compare plays two side by side.
+
+## Every link in one place
+
+Library, in the sidebar, has Review links: every link you've sent, as a card saying where it stands. Approved, notes to
+address, waiting, or ended, with its views and comments. Stop sharing ends a link for everyone, at once.
+
+## Several files on one link
+
+In a cloud library, pick the files to send with the box at a tile's corner, or Command-click. Press Share for review in
+the bar, and give the link a name. Your reviewer gets every file as a poster, and each opens its own page.
+
+## Let your agent share
+
+An agent can share for you too, once you turn on Let agents share in Settings, under Sharing. Ask it to send the cut to
+your client: it hands you the link, and it reads the notes as they come in.
+
+## Who can share
+
+Review links come with Pro and Team, because the file is sent from your cloud storage. Downloads stay off unless you
+allow them, a password is up to you, and a link is never listed or found by search.
+
+Next: [Inspect compositions and components](inspect.md).
diff --git a/docs/manual/tutorials/storage-and-search.md b/docs/manual/tutorials/storage-and-search.md
index 2c6c2fc7..330d6747 100644
--- a/docs/manual/tutorials/storage-and-search.md
+++ b/docs/manual/tutorials/storage-and-search.md
@@ -43,12 +43,13 @@ Then an embedding model turns each shot's picture, sound and words into vectors,
When you search, your words become a vector in that same space. raea compares it with every shot's picture, sound and
words, matches your words as keywords too, and ranks the results together. So a chip pulled apart, with cheese stretching between the halves, finds that
shot, even if no file is named that. The vectors are kept in turbopuffer, a vector database, one namespace for each
-workspace, while the indexing runs on your own computers.
+workspace, while the indexing runs on your own computers, or on raea's own for files only its storage holds.
## Free, Pro and Team
-On Free, your libraries and their index stay on your computer. On Pro and Team, they're kept in raea's storage, so you
-can search them on raea.io too, and on Team every teammate searches the same media.
+On Free, your libraries and their index stay on your computer. On Pro and Team, each library can stay there too, or
+live in raea's cloud, where you can search it on raea.io and from any device, and share its files for review.
That's the last tutorial. The rest of the docs go deeper: [How an agent should use raea](../start/agents.md) for the
-loop, and the [CLI](../reference/cli/index.md) and [SDK](../reference/sdk/index.md) references.
+loop, the [storage and search API](../guides/api.md), and the [CLI](../reference/cli/index.md) and
+[SDK](../reference/sdk/index.md) references.