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.

AK4: raea ask --brief none, for a caller that writes the whole state itself

shinyobjectz24b8bf33e430
diff --git a/apps/ask/src/prepare.rs b/apps/ask/src/prepare.rs
index 1c69c673..02c04b74 100644
--- a/apps/ask/src/prepare.rs
+++ b/apps/ask/src/prepare.rs
@@ -58,7 +58,12 @@ impl Piece {
/// The piece as raea finds it: the file probed, its brief (given or the nearest), its words.
pub fn read(file: &Path, brief: Option<&Path>, words: Option<&Path>, voice: Option<bool>, extra: Option<String>) -> Result<Piece, String> {
let probe = media::probe(file)?;
- let brief_file = brief.map(Path::to_path_buf).or_else(|| brief_near(file));
+ // "none": no brief, even with one near (a caller that writes the whole state itself, as the app's critique does)
+ let brief_file = match brief {
+ Some(p) if p.as_os_str() == "none" => None,
+ Some(p) => Some(p.to_path_buf()),
+ None => brief_near(file),
+ };
let (words, heard) = match words {
Some(w) => words_of(w).map(|(t, h)| (Some(t).filter(|t| !t.is_empty()), Some(h)))?,
None => (None, None),
@@ -90,10 +95,13 @@ impl Piece {
let b = &self.brief;
let modes = self.modes();
let what = if modes.is_empty() { "video".to_string() } else { modes.join(" and ") };
- let mut s = vec![match b["title"].as_str() {
- Some(t) => format!("A {what} piece: \"{t}\"."),
- None => format!("A {what} piece."),
- }];
+ // with no brief and the caller's own state, the caller says what the piece is
+ let briefless = b.as_object().is_none_or(|o| o.is_empty());
+ let mut s = match (b["title"].as_str(), briefless && self.extra.is_some()) {
+ (_, true) => vec![],
+ (Some(t), _) => vec![format!("A {what} piece: \"{t}\".")],
+ (None, _) => vec![format!("A {what} piece.")],
+ };
for (k, say) in [("audience", "It's for"), ("believe", "It should leave them believing"), ("logline", "Its storyboard"), ("voice", "Its voice")] {
if let Some(v) = b[k].as_str().filter(|v| !v.trim().is_empty()) {
s.push(format!("{say}: {}.", v.trim().trim_end_matches('.')));
diff --git a/apps/ask/src/tests.rs b/apps/ask/src/tests.rs
index 70fb8886..c3f33b8e 100644
--- a/apps/ask/src/tests.rs
+++ b/apps/ask/src/tests.rs
@@ -64,6 +64,9 @@ fn the_state_says_what_the_piece_is() {
assert!(s.contains(want), "{want}: {s}");
}
assert_eq!(p.facts().modes, ["pitch"]);
+ // no brief and the caller's own state: the caller says what the piece is
+ let own = Piece { extra: Some("A game: \"Rover\".".into()), ..(*piece("a.mp4", None)).clone() };
+ assert_eq!(own.state(), "It runs 10 s. A game: \"Rover\".");
}
#[test]
diff --git a/apps/ask/src/verbs.rs b/apps/ask/src/verbs.rs
index f094dd19..3113e026 100644
--- a/apps/ask/src/verbs.rs
+++ b/apps/ask/src/verbs.rs
@@ -14,7 +14,7 @@ use serde_json::{Value, json};
use crate::prepare::{self, Piece};
use crate::runner::{self, Entry, Event, Opts};
-pub const USAGE: &str = "raea ask FILE [QUESTION...] [--choose A,B,C] [--grade] [--rate N] [--flag ANSWERS] [--set NAME] [--std ID] [--from S] [--to S] [--at S] [--with FILE2] [--brief brief.ts] [--words words.json] [--voice yes|no] [--state TEXT] [--dry] [--json] [--gate [any]] [--jobs N] | ask --batch FILE [--dry] [--json] [--gate [any]] [--jobs N] | ask list [SET] [--json] (questions about a piece's picture and sound, answered by clef-omni and paid from your raea plan's pool when the app is signed in, else RAEA_AGENT_KEY's, else your own Cloudflare keys: your own words, or the standard sets (rubric, av, defects, platform, decide); every question about one clip goes in one call, --batch (a JSON list or JSON lines, - for stdin) asks many clips in parallel; --dry says what would be sent and spends nothing; answers are advice until a question is calibrated)";
+pub const USAGE: &str = "raea ask FILE [QUESTION...] [--choose A,B,C] [--grade] [--rate N] [--flag ANSWERS] [--set NAME] [--std ID] [--from S] [--to S] [--at S] [--with FILE2] [--brief brief.ts|none] [--words words.json] [--voice yes|no] [--state TEXT] [--dry] [--json] [--gate [any]] [--jobs N] | ask --batch FILE [--dry] [--json] [--gate [any]] [--jobs N] | ask list [SET] [--json] (questions about a piece's picture and sound, answered by clef-omni and paid from your raea plan's pool when the app is signed in, else RAEA_AGENT_KEY's, else your own Cloudflare keys: your own words, or the standard sets (rubric, av, defects, platform, decide); every question about one clip goes in one call, --batch (a JSON list or JSON lines, - for stdin) asks many clips in parallel; --dry says what would be sent and spends nothing; answers are advice until a question is calibrated)";
const VALUED: [&str; 15] = ["--choose", "--rate", "--flag", "--set", "--std", "--from", "--to", "--at", "--with", "--brief", "--words", "--voice", "--state", "--jobs", "--batch"];
const BARE: [&str; 4] = ["--grade", "--dry", "--json", "--gate"];
diff --git a/docs/ask.feature b/docs/ask.feature
index 686957a2..76622773 100644
--- a/docs/ask.feature
+++ b/docs/ask.feature
@@ -142,10 +142,15 @@ Feature: Ask: questions about a piece's picture and sound, answered by the decis
Scenario: AK4. The pool, through the app or an agent key
Then raea-api's `/v1/clef/ask` takes sounds (up to 4 MP3s) beside stills and videos, says the pool left with
each answer, and agent keys gain an `ask` scope that asks and can do nothing else
- And the app's host answers `/host/ask` by adding its device token and passing the call on, or 409 when the
- account has no pool, so the CLI goes on to the next route
+ And the app's host answers `/host/ask` by adding its device token and passing the call on, with the API's answer
+ back as it came: a plan with no pool (402 plan_required) or signed out (401) sends the CLI on to the next route
And the app's critique and game check ask through `raea ask --json`, and their own clef code is gone
And the app's agents get an `ask` tool (HOST) with `raea ask`'s inputs
+ Status 11-20: built, in review. raea-platform #16 (on #15): audio, the criteria clef takes, pool_left_usd and the
+ `ask` scope, with test/pool.sh reading what a fake clef was sent. raea-feed's feed-ask branch (on #98):
+ /host/ask, the `ask` tool, and the critique's judge on `raea ask --batch - --json` with `--brief none`, its
+ tests, typecheck and the protocol and hub tests passing. It's done when they merge and raea-api is deployed,
+ which waits on Shane's go.
Rule: AK5. Standing questions in `raea check`
diff --git a/docs/manual/reference/cli/ask.md b/docs/manual/reference/cli/ask.md
index 088c1df7..1cb0baf5 100644
--- a/docs/manual/reference/cli/ask.md
+++ b/docs/manual/reference/cli/ask.md
@@ -45,7 +45,7 @@ calibrated later.
## Usage
```sh
-raea ask FILE [QUESTION...] [--choose A,B,C] [--grade] [--rate N] [--flag ANSWERS] [--set NAME] [--std ID] [--from S] [--to S] [--at S] [--with FILE2] [--brief brief.ts] [--words words.json] [--voice yes|no] [--state TEXT] [--dry] [--json] [--gate [any]] [--jobs N] | ask --batch FILE [--dry] [--json] [--gate [any]] [--jobs N] | ask list [SET] [--json] (questions about a piece's picture and sound, answered by clef-omni and paid from your raea plan's pool when the app is signed in, else RAEA_AGENT_KEY's, else your own Cloudflare keys: your own words, or the standard sets (rubric, av, defects, platform, decide); every question about one clip goes in one call, --batch (a JSON list or JSON lines, - for stdin) asks many clips in parallel; --dry says what would be sent and spends nothing; answers are advice until a question is calibrated)
+raea ask FILE [QUESTION...] [--choose A,B,C] [--grade] [--rate N] [--flag ANSWERS] [--set NAME] [--std ID] [--from S] [--to S] [--at S] [--with FILE2] [--brief brief.ts|none] [--words words.json] [--voice yes|no] [--state TEXT] [--dry] [--json] [--gate [any]] [--jobs N] | ask --batch FILE [--dry] [--json] [--gate [any]] [--jobs N] | ask list [SET] [--json] (questions about a piece's picture and sound, answered by clef-omni and paid from your raea plan's pool when the app is signed in, else RAEA_AGENT_KEY's, else your own Cloudflare keys: your own words, or the standard sets (rubric, av, defects, platform, decide); every question about one clip goes in one call, --batch (a JSON list or JSON lines, - for stdin) asks many clips in parallel; --dry says what would be sent and spends nothing; answers are advice until a question is calibrated)
```
Headless: it needs nothing running and opens no window. Takes any number of arguments besides its flags.
@@ -56,13 +56,13 @@ Headless: it needs nothing running and opens no window. Takes any number of argu
| --- | --- | --- |
| `--at` | `S` | The three seconds around this moment: every question looks at that window. |
| `--batch` | `FILE` | A file of entries to ask, a JSON list or JSON lines (`-` reads stdin); each is a file with its questions. |
-| `--brief` | `brief.ts` | The project's brief, so clef knows who it's for and what it should do (else the nearest brief.ts above the file). |
+| `--brief` | `brief.ts\|none` | The project's brief, so clef knows who it's for and what it should do (else the nearest brief.ts above the file; `none` for no brief, when `--state` says what the piece is). |
| `--choose` | `A,B,C` | Your questions pick one of these options, rather than answering yes or no. |
| `--dry` | – | Cut the media and print each call that would be made (its state, questions, media sizes) with an estimated cost, and send nothing. |
| `--flag` | `ANSWERS` | The answers that mean a problem: `no` for a question where no is bad ("Is the logo readable?"), or a choice's options. |
| `--from` | `S` | Where the window starts, in seconds. |
| `--gate` | – | Exit 1 when a calibrated question flags, or questions wait for the pool; `--gate any` exits 1 when any question flags. |
-| `--grade` | – | Your questions answer on a graded scale (poor, weak, fair, good, excellent). |
+| `--grade` | – | Your questions answer on a graded scale (poor, weak, acceptable, strong, excellent). |
| `--jobs` | `N` | How many calls go at once (4). |
| `--json` | – | One JSON object a line: each answer, each call `--dry` would make, then the summary. |
| `--rate` | `N` | Your questions answer with a score from 1 to N. |
diff --git a/docs/manual/reference/sdk/ask.md b/docs/manual/reference/sdk/ask.md
index fa2fabe4..2f5133b2 100644
--- a/docs/manual/reference/sdk/ask.md
+++ b/docs/manual/reference/sdk/ask.md
@@ -99,7 +99,7 @@ One file and what to ask of it: a line of `raea ask --batch`.
| `std` | `string[]` | standard questions by id (`raea ask list` lists them) |
| `window` | `Window` | the seconds to look at, for every question here (else each question's own, else the whole file) |
| `with` | `string[]` | files set beside it: to pick between, or a before and after |
-| `brief` | `string` | the project's brief (else the nearest brief.ts above the file) |
+| `brief` | `string` | the project's brief (else the nearest brief.ts above the file; "none": no brief, the state saying what the piece is) |
| `words` | `string` | a words file (a JSON list of the words heard), so ask knows what's said and whether anyone speaks |
| `voice` | `boolean` | whether anyone speaks in it, when no words file says |
| `state` | `string` | more for clef to read before the media: what raea measured, the platform |
diff --git a/sdk/raea/src/ask.ts b/sdk/raea/src/ask.ts
index db651de8..03e57eed 100644
--- a/sdk/raea/src/ask.ts
+++ b/sdk/raea/src/ask.ts
@@ -31,7 +31,7 @@ export interface AskEntry {
window?: Window;
/** files set beside it: to pick between, or a before and after */
with?: string[];
- /** the project's brief (else the nearest brief.ts above the file) */
+ /** the project's brief (else the nearest brief.ts above the file; "none": no brief, the state saying what the piece is) */
brief?: string;
/** a words file (a JSON list of the words heard), so ask knows what's said and whether anyone speaks */
words?: string;