Compare commits

..
Author SHA1 Message Date
shinyobjectz 20249b43e9 One opener for a video (raea_io_media::open_video) and one step of React to a frame (step_react), where the render-cost work had copied each 2026-11-30 19:06:26 -08:00
shinyobjectz 88223b9388 Merge remote-tracking branch 'origin/main' into engine-render-cost 2026-11-30 19:02:01 -08:00
shinyobjectz f605e309e4 The face track and render --review's sheets are crates of their own (raea-sys-facetrack, raea-runtime-review): raea-runtime-page and raea-runtime-export are under 2000 lines again 2026-11-30 19:02:00 -08:00
shinyobjectz e75a0f626d RAEA_NV=1: NVENC and NVDEC in the ffmpeg backend, each after a one-frame try on the machine
The render farm sets it on a GPU's runs of a piece with 3D in it. h264_nvenc at libx264's CRF number as constant QP
(SSIM 0.9925 to libx264's 0.9924 on the ad) and clips through CUDA; where a try fails, libx264 and ffmpeg's own,
said once. The answer is kept for the machine's later runs (CR34).
2026-11-30 18:14:16 -08:00
shinyobjectz db4cbb5814 render --keys: each frame's key with nothing drawn, and the largest each clip is drawn
raea render EDIT --keys keys.json steps React through every frame and makes the page match it without reading a clip
or drawing: each frame's key (its elements' place, kind, props and text, each video's file and time, its 3D rows;
paths named from the composition's folder), has3d, the piece's sounds, and the largest each clip is drawn (box as
drawn, transforms and punch-in applied). A render farm keeps runs by these keys and reads clips from copies no larger
than they're drawn. On the ad: 6.7 s for 894 frames; a caption word changed 70 frames' keys, a sound 3 dB louder none
(CR32, CR36).
2026-11-30 18:14:16 -08:00
shinyobjectz 9008056959 A page reads a clip on from where it stopped: up to 4 readers a file, so a clip shown twice at once isn't sought every frame
Where two elements showed one 4K clip, they shared one decoder and ffmpeg restarted every frame (31 starts in 30
frames). Each file now keeps up to 4 readers, each reading on from its last frame (the one behind within 60 frames,
else a new one, else the least used), and the frame it read last for a second ask. Those frames: 909 to 53 ms on the
Mac, SSIM 1.000000; a 30 s ad of 4K street-interview clips on the farm's GPUs 277 s and $0.106 to 153 s and $0.033.
2026-11-30 18:14:16 -08:00
12 changed files with 36 additions and 195 deletions

No files matched your search

+1 -1
View File
@@ -318,7 +318,7 @@ Feature: Goal: the loop every piece of work runs, one goal or a workflow of them
Given a goal job
Then `raea goal check` runs every `run` rule at every status, the Stop hook's included, and holds the job on one
that fails or outlives its timeout, with its exit code and last line ("run")
And a `says` rule is clear only when review/judge/NAME.json, written by `raea goal judge [DIR] [--by claude|kimi|clef]`
And a `says` rule is clear only when review/judge/NAME.json, written by `raea goal judge [DIR] [--by claude|kimi]`
(a fresh session that may only read: Read, Grep and Glob), found it true at a time no earlier than the work's
newest file, the job's own review/, .raea/, NOTES.md, .git and node_modules left out, compared at whole seconds
("says")
+3 -6
View File
@@ -54,11 +54,8 @@ findings are then warnings.
A rules goal (`rules({...})`, what raea.app's `/goal` writes) is any other work: the aim in your words and the rules
that must hold before the agent stops. A `run` rule is a command that must exit 0 in the brief's folder (300 seconds
unless its `timeout` says otherwise); a `file` rule is a deliverable; a `says` rule is words that must be true of the
work, judged by a fresh critic that may only read: `raea goal judge` asks one (`--by claude`, `kimi` or `clef`) and
keeps its verdict in review/judge/NAME.json, and the rule clears only while that verdict is no older than the work's
newest file. `clef` is clef-omni, as `raea ask` reaches it: it watches and hears the files a rule names (in the rule's
"from A s to B s" window if it has one), else every video under out/, and reads no folder, so a rule about text it
can't see stays open. It is the critic where `RAEA_AGENT_KEY` is set, as on raea cloud; elsewhere the critic is `claude`.
work, judged by a fresh critic that may only read: `raea goal judge` asks one (`--by claude` or `kimi`) and keeps its
verdict in review/judge/NAME.json, and the rule clears only while that verdict is no older than the work's newest file.
```ts
import { brief, rules } from "raea/brief"
@@ -98,7 +95,7 @@ goal's rules are never copied into the plan: the plan is the work, the goal is w
raea goal check [FILE...] [--at edit|render|publish|done] [--goal NAME] [--only ID,...] [--manifest render.json] [--json] (every rule each goal of brief.ts is held to at that moment: its kind's packs, its rules and its own checks; with no goal, the floor; every project is also held to `registered`, every raea file reached from brief.ts; review/goal.json; exit 1 on an error. The hook runs it at every save (edit) and stop (done), a render at its end, raea cloud at publish)
raea goal tasks [DIR] [--json] | raea goal tasks [DIR] --apply EDITS.json|- | raea goal tasks [DIR] --put PUT.json|- (the brief's plan as the brief's run gives it: open tasks by id, or all as JSON; --apply writes edits by task id back where each task is written, refusing one made by code; a project with no plan gets plan.ts, imported by brief.ts; --put {plan, base} writes the whole plan back only while the brief's is still base)
raea goal seen FILE ["what you see and would change"] [--surprise "SECONDS s: what it is"] (FILE's contact sheet beside it, to look at every frame; with words, what was seen of FILE as it is now)
raea goal judge [--goal NAME] [--by claude|kimi|clef] (a goal's `says` rules judged by a fresh critic that only reads; review/judge/NAME.json. clef watches and hears the files a rule names, else the videos under out/, paid as `raea ask` is: the critic where RAEA_AGENT_KEY is set, as on raea cloud, else claude)
raea goal judge [--goal NAME] [--by claude|kimi] (a goal's `says` rules judged by a fresh critic that only reads; review/judge/NAME.json)
raea goal next [DIR] (the two or three useful next steps for the project, from its brief, its goals, compositions, renders and checks)
raea goal gates [DIR] [--goal NAME] --json (a scene, kit or shot goal's record and critic gates, as raea/goal's packs read them)
```
+1 -1
View File
@@ -15,7 +15,7 @@ pub const GOAL_TS: &[&str] = &["check", "tasks", "seen", "judge"];
pub const GOAL_USAGE: &str = "raea goal check [FILE...] [--at edit|render|publish|done] [--goal NAME] [--only ID,...] [--manifest render.json] [--json] (every rule each goal of brief.ts is held to at that moment: its kind's packs, its rules and its own checks; with no goal, the floor; every project is also held to `registered`, every raea file reached from brief.ts; review/goal.json; exit 1 on an error. The hook runs it at every save (edit) and stop (done), a render at its end, raea cloud at publish)
raea goal tasks [DIR] [--json] | raea goal tasks [DIR] --apply EDITS.json|- | raea goal tasks [DIR] --put PUT.json|- (the brief's plan as the brief's run gives it: open tasks by id, or all as JSON; --apply writes edits by task id back where each task is written, refusing one made by code; a project with no plan gets plan.ts, imported by brief.ts; --put {plan, base} writes the whole plan back only while the brief's is still base)
raea goal seen FILE [\"what you see and would change\"] [--surprise \"SECONDS s: what it is\"] (FILE's contact sheet beside it, to look at every frame; with words, what was seen of FILE as it is now)
raea goal judge [--goal NAME] [--by claude|kimi|clef] (a goal's `says` rules judged by a fresh critic that only reads; review/judge/NAME.json. clef watches and hears the files a rule names, else the videos under out/, paid as `raea ask` is: the critic where RAEA_AGENT_KEY is set, as on raea cloud, else claude)
raea goal judge [--goal NAME] [--by claude|kimi] (a goal's `says` rules judged by a fresh critic that only reads; review/judge/NAME.json)
raea goal next [DIR] (the two or three useful next steps for the project, from its brief, its goals, compositions, renders and checks)";
/// One of GOAL_TS's verbs (or `make place`): printed as it says, and the process exits with its code (1 on an
-5
View File
@@ -53,11 +53,6 @@ pub fn resolve_file(spec: &str, dir: &Path, esm: bool) -> Result<PathBuf, String
return Ok(f);
}
}
// raea's own file (sdk/app, under `raea goal check`) importing a package raea ships: a release has those in the React runtime's node_modules alone (#278)
let (home, own) = (raea_io_home::home(), raea_io_home::home().join("sdk/react/js/node_modules").join(&name));
if dir.starts_with(&home) && own.is_dir() {
return package_entry(&own, &sub, esm).ok_or_else(|| format!("Cannot find module '{spec}': {} has no {sub}", own.display()));
}
Err(format!("Cannot find package '{name}' imported from {}", dir.display()))
}
-22
View File
@@ -1,22 +0,0 @@
//! A file of raea's own importing a package raea ships finds it in the React runtime's node_modules (#278): a release has
//! no node_modules above sdk/app, so `raea goal check` ended every render "Cannot find package 'react'". Its own test
//! binary: raea's home is read once a process.
#![cfg(feature = "modules")]
use std::fs;
#[test]
fn raeas_own_file_finds_the_react_raea_ships() {
let home = std::env::temp_dir().join(format!("raea-native-shipped-{}", std::process::id()));
let (pkg, own, theirs) = (home.join("sdk/react/js/node_modules/react"), home.join("sdk/app/src"), std::env::temp_dir().join("raea-native-elsewhere"));
for d in [&pkg, &own] {
fs::create_dir_all(d).unwrap();
}
fs::write(pkg.join("package.json"), r#"{"name":"react","main":"index.js"}"#).unwrap();
fs::write(pkg.join("index.js"), "module.exports = {}").unwrap();
// SAFETY: the one test here, before anything reads the environment
unsafe { std::env::set_var("RAEA_HOME", &home) };
assert_eq!(raea_native::node::resolve_file("react", &own, true).unwrap(), pkg.join("index.js"));
// a project's own file never reaches into raea's packages
assert!(raea_native::node::resolve_file("react", &theirs, true).unwrap_err().contains("Cannot find package 'react'"));
fs::remove_dir_all(&home).ok();
}
+21 -33
View File
@@ -50,40 +50,14 @@ fn says(option: &str) -> String {
/// phone): libx264 where ffmpeg was built with it (Homebrew's, Linux distributions'), else the system's own (Windows'
/// Media Foundation, h264_mf, in the LGPL build raea ships there; macOS's VideoToolbox) at 8 Mb/s; None without one.
pub fn h264() -> Option<Vec<&'static str>> {
let enc = listed()?;
static ENCODERS: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let have = ENCODERS.get_or_init(|| says("-encoders"));
let has = |c: &str| have.split_whitespace().any(|w| w == c);
let enc = ["libx264", "h264_mf", "h264_videotoolbox"].into_iter().find(|c| has(c))?;
let rate: &[&'static str] = if enc == "libx264" { &[] } else { &["-b:v", "8M"] };
Some([&["-c:v", enc][..], rate, &["-pix_fmt", "yuv420p"]].concat())
}
/// The first of libx264, Media Foundation's and VideoToolbox's H.264 encoders this machine's ffmpeg lists
fn listed() -> Option<&'static str> {
["libx264", "h264_mf", "h264_videotoolbox"].into_iter().find(|c| lists("-encoders", c))
}
/// `codec` is among what this machine's ffmpeg prints for `option` (-encoders, -decoders), each asked once
fn lists(option: &'static str, codec: &str) -> bool {
static PRINTED: std::sync::OnceLock<std::sync::Mutex<std::collections::HashMap<&'static str, String>>> = std::sync::OnceLock::new();
let mut printed = PRINTED.get_or_init(Default::default).lock().unwrap_or_else(|e| e.into_inner());
printed.entry(option).or_insert_with(|| says(option)).split_whitespace().any(|w| w == codec)
}
/// A render's encoder and its rate, as ffmpeg's arguments: NVENC and libx264 at a constant quality when one is asked
/// (0.85 -> 13, 0.95 -> 11, 0.6 -> 18), else the average bitrate. The system's own encoders (h264_mf, h264_videotoolbox)
/// have no CRF, so they take the bitrate either way: the LGPL ffmpeg raea ships on Windows has no libx264, and
/// RAEA_MEDIA=ffmpeg failed there on `-c:v libx264` (#279)
fn video_args(enc: &str, o: &EncodeOpts) -> Vec<String> {
let rate = || vec!["-b:v".to_string(), format!("{}k", o.kbps), "-maxrate".to_string(), format!("{}k", o.kbps * 3 / 2), "-bufsize".to_string(), format!("{}k", o.kbps * 2)];
let q = |q: f32| format!("{:.0}", 30.0 - 20.0 * q.clamp(0.0, 1.0));
let (nvenc, x264) = (NVENC.map(String::from).to_vec(), ["-c:v", "libx264", "-preset", "medium"].map(String::from).to_vec());
match (enc, o.quality) {
("h264_nvenc", Some(v)) => [nvenc, vec!["-rc".into(), "constqp".into(), "-qp".into(), q(v)]].concat(),
("h264_nvenc", None) => [nvenc, rate()].concat(),
("libx264", Some(v)) => [x264, vec!["-crf".into(), q(v)]].concat(),
("libx264", None) => [x264, rate()].concat(),
_ => [vec!["-c:v".into(), enc.to_string()], rate()].concat(),
}
}
/// RAEA_NV=1 (the render farm sets it on a GPU's runs of a piece with 3D in it, docs/cloud-render.feature CR34): NVIDIA's
/// encoder (`enc`, NVENC) or decoder (NVDEC, through CUDA) in place of libx264 and ffmpeg's own, each only once a
/// one-frame try of it worked on this machine (a GPU without the driver's video libraries keeps libx264, said once).
@@ -180,7 +154,9 @@ fn probe(path: &Path) -> R<(Info, Vec<f64>, bool, Option<&'static str>)> {
_ => None,
};
// an ffmpeg built without libvpx decodes the picture alone, as before
let alpha = alpha.filter(|c| lists("-decoders", c));
static DECODERS: std::sync::OnceLock<String> = std::sync::OnceLock::new();
let have = DECODERS.get_or_init(|| says("-decoders"));
let alpha = alpha.filter(|c| have.split_whitespace().any(|w| w == *c));
Ok((
Info {
codec: s["codec_name"].as_str().unwrap_or("?").into(),
@@ -424,7 +400,6 @@ impl Backend for Ffmpeg {
}
fn encoder(&self, out: &Path, o: &EncodeOpts) -> R<Box<dyn VideoEncoder>> {
let video = out.with_extension("video.mp4");
let enc = if nv(true) { "h264_nvenc" } else { listed().ok_or("this machine's ffmpeg has no H.264 encoder (libx264, h264_mf or h264_videotoolbox)")? };
let child = cli("ffmpeg", false)?
.args([
"-v",
@@ -441,7 +416,20 @@ impl Backend for Ffmpeg {
"-i",
"-",
])
.args(video_args(enc, o))
.args(if nv(true) { &NVENC[..] } else { &["-c:v", "libx264", "-preset", "medium"][..] })
// constant quality as CRF (0.85 -> 13, 0.95 -> 11, 0.6 -> 18), else the average bitrate
.args(match o.quality {
Some(q) if nv(true) => vec!["-rc".to_string(), "constqp".to_string(), "-qp".to_string(), format!("{:.0}", 30.0 - 20.0 * q.clamp(0.0, 1.0))],
Some(q) => vec!["-crf".to_string(), format!("{:.0}", 30.0 - 20.0 * q.clamp(0.0, 1.0))],
None => vec![
"-b:v".to_string(),
format!("{}k", o.kbps),
"-maxrate".to_string(),
format!("{}k", o.kbps * 3 / 2),
"-bufsize".to_string(),
format!("{}k", o.kbps * 2),
],
})
.args([
"-pix_fmt",
"yuv420p",
-18
View File
@@ -47,21 +47,3 @@ fn nv_falls_back_where_nvidia_isnt() {
assert!(!nv(true) && !nv(false), "off without RAEA_NV=1");
}
}
/// libx264's arguments are what they were, and the system's encoder (macOS's here, Windows' Media Foundation the same
/// way) takes a bitrate even when a quality is asked, and encodes with them (#279)
#[test]
fn a_system_encoder_takes_the_bitrate() {
let o = |quality| EncodeOpts { width: 256, height: 256, fps: 30.0, kbps: 900, quality, nv12: false, realtime: false };
assert_eq!(video_args("libx264", &o(Some(0.85))), ["-c:v", "libx264", "-preset", "medium", "-crf", "13"]);
assert_eq!(video_args("libx264", &o(None)), ["-c:v", "libx264", "-preset", "medium", "-b:v", "900k", "-maxrate", "1350k", "-bufsize", "1800k"]);
let args = video_args("h264_videotoolbox", &o(Some(0.85)));
assert_eq!(args, ["-c:v", "h264_videotoolbox", "-b:v", "900k", "-maxrate", "1350k", "-bufsize", "1800k"]);
if !lists("-encoders", "h264_videotoolbox") {
return eprintln!("skipped the encode: no h264_videotoolbox in this ffmpeg");
}
let out = std::env::temp_dir().join(format!("raea-ffmpeg-system-{}.mp4", std::process::id()));
let ok = Command::new("ffmpeg").args(["-v", "error", "-y", "-f", "lavfi", "-i", "color=c=red:s=256x256:d=0.3"]).args(&args).args(["-pix_fmt", "yuv420p"]).arg(&out).status().is_ok_and(|s| s.success());
assert!(ok && std::fs::metadata(&out).is_ok_and(|m| m.len() > 500), "ffmpeg encodes with the system encoder's arguments");
let _ = std::fs::remove_file(&out);
}
+3 -69
View File
@@ -9,9 +9,8 @@ import { spawnSync } from "node:child_process"
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"
import path from "node:path"
import { check, found } from "raea/check"
import { type Contract, nameOf, type Said, saysOf } from "../contract.ts"
import { type Contract, nameOf, saysOf } from "../contract.ts"
import type { Job } from "../facts.ts"
import { RAEA } from "../media.ts"
/** where a goal's critic verdict is kept, relative to the brief */
export const verdictPath = (g: Contract) => `review/judge/${nameOf(g)}.json`
@@ -119,69 +118,7 @@ export function lastVerdict(text: string): Verdict | null {
return null
}
export const BY = ["claude", "kimi", "clef"] as const
/** the critic when none is named: clef where an agent key is set (a raea cloud box, whose shell has no Claude
* sign-in: 12-01, every judging there answered "Not logged in"), else Claude Code */
export const critic = () => (process.env.RAEA_AGENT_KEY && process.env.RAEA_API ? "clef" : "claude")
const PIECE = /[\w@./-]+\.(?:mp4|mov|webm|m4v|png|jpe?g|webp|wav|mp3|m4a)\b/gi
const VIDEO = /\.(?:mp4|mov|webm|m4v)$/i
/** the videos under out/, newest first */
function made(dir: string): string[] {
const out: { f: string; at: number }[] = []
const walk = (d: string) => {
for (const e of existsSync(d) ? readdirSync(d, { withFileTypes: true }) : []) {
const f = path.join(d, e.name)
if (e.isDirectory()) walk(f)
else if (VIDEO.test(e.name)) out.push({ f, at: statSync(f).mtimeMs })
}
}
walk(path.join(dir, "out"))
return out.sort((x, y) => y.at - x.at).map((x) => path.relative(dir, x.f))
}
/** clef-omni as the critic (`raea ask`, paid as ask is): it watches and hears a piece, and reads no folder. A rule is
* asked of the files it names, in its "from A s to B s" window if it has one, else of every video under out/ (the
* newest CLEF_PIECES), and passes when it's true of each; the rules about one piece go in one call */
const CLEF_PIECES = 12
export function clefVerdict(g: Contract, dir: string, ask = askClef): Verdict["rules"] {
const all = made(dir)
const groups = new Map<string, { file: string; from?: string; to?: string; rules: Said[] }>()
const pieces = new Map<string, string[]>()
for (const r of saysOf(g)) {
const named = [...new Set(r.says.match(PIECE) ?? [])].filter((f) => existsSync(path.join(dir, f)))
const files = named.length ? named : all.slice(0, CLEF_PIECES)
const w = /from (\d+(?:\.\d+)?) s to (?:(\d+(?:\.\d+)?) s|its end)/.exec(r.says)
pieces.set(r.id, files)
for (const file of files) {
const key = [file, w?.[1], w?.[2]].join("\u001f")
const at = groups.get(key) ?? { file, from: w?.[1], to: w?.[2], rules: [] }
at.rules.push(r)
groups.set(key, at)
}
}
const got = new Map<string, { pass: boolean; why: string }[]>()
for (const k of groups.values()) {
const answers = ask(dir, k.file, k.rules.map((r) => r.says), k.from, k.to)
k.rules.forEach((r, i) => got.set(r.id, [...(got.get(r.id) ?? []), { pass: answers[i]?.choice === "true" && !answers[i]?.problem, why: `${k.file}: ${answers[i]?.problem ?? answers[i]?.says ?? "no answer"}` }]))
}
const rules: Verdict["rules"] = {}
for (const r of saysOf(g)) {
const a = got.get(r.id) ?? []
const open = a.filter((x) => !x.pass)
rules[r.id] = !pieces.get(r.id)?.length
? { pass: false, why: "clef watches and hears a piece, and this rule names no file on disk while out/ holds no video: name the file in the rule, or judge it --by claude where Claude Code is signed in" }
: { pass: !open.length, why: (open.length ? open : a).map((x) => x.why).join("; ") }
}
return rules
}
type Answer = { choice?: string; says?: string; problem?: string | null }
function askClef(dir: string, file: string, says: string[], from?: string, to?: string): Answer[] {
const r = spawnSync(RAEA, ["ask", file, ...says, "--choose", "true,false", "--json", ...(from ? ["--from", from] : []), ...(to ? ["--to", to] : [])], { cwd: dir, encoding: "utf8", maxBuffer: 1 << 26 })
if (r.error) throw new Error(`couldn't run raea ask: ${r.error.message}`)
const rows = String(r.stdout ?? "").split("\n").flatMap((l) => { try { const o = JSON.parse(l); return o.answer ? [o as Answer] : [] } catch { return [] } })
if (rows.length !== says.length) throw new Error(`raea ask answered ${rows.length} of ${says.length} about ${file}: ${String(r.stderr ?? "").trim().slice(-300) || String(r.stdout ?? "").trim().slice(-300)}`)
return rows
}
export const BY = ["claude", "kimi"] as const
/** one fresh critic over a goal's `says` rules (`raea goal judge`): its verdict kept at review/judge/NAME.json,
* stamped with when it was asked (so work changed while it judged counts as changed after) */
@@ -189,7 +126,6 @@ export function judge(g: Contract, dir: string, by: string): Verdict {
if (!saysOf(g).length) throw new Error(`goal ${nameOf(g)} has no \`says\` rules; its \`run\` and \`file\` rules are held by raea goal check`)
if (!(BY as readonly string[]).includes(by)) throw new Error(`--by ${by}: the critics are ${BY.join(", ")}`)
const asked = Math.floor(Date.now() / 1000)
if (by === "clef") return keep(g, dir, { at: asked, by, goal: g.aim ?? nameOf(g), rules: clefVerdict(g, dir) })
const p = prompt(g, dir)
const r = by === "claude" ? spawnSync("claude", ["-p", p, "--allowedTools", "Read Grep Glob", "--output-format", "json"], { cwd: dir, encoding: "utf8", maxBuffer: 1 << 26 }) : spawnSync("kimi", ["-p", p], { cwd: dir, encoding: "utf8", maxBuffer: 1 << 26 })
if (r.error) throw new Error(`couldn't run ${by}: ${r.error.message} (is its CLI installed and signed in?)`)
@@ -200,9 +136,7 @@ export function judge(g: Contract, dir: string, by: string): Verdict {
} catch {}
const v = lastVerdict(words)
if (!v) throw new Error(`${by} answered no verdict: ${words.slice(-300).trim()}`)
return keep(g, dir, { ...v, at: asked, by, goal: g.aim ?? nameOf(g) })
}
function keep(g: Contract, dir: string, out: Verdict): Verdict {
const out: Verdict = { ...v, at: asked, by, goal: g.aim ?? nameOf(g) }
const file = path.join(dir, verdictPath(g))
mkdirSync(path.dirname(file), { recursive: true })
writeFileSync(file, `${JSON.stringify(out, null, 2)}\n`)
+4 -4
View File
@@ -13,7 +13,7 @@
// says what for; it holds nothing.
// raea goal tasks [DIR] [--json] | --apply EDITS.json|- the brief's plan as tasks, and edits written back (tasks.ts)
// raea goal seen FILE "WHAT" [--surprise "S s: WHAT"] what was seen of FILE as it is now, and its surprise
// raea goal judge [--goal NAME] [--by claude|kimi|clef] a fresh critic over a goal's `says` rules (review/judge/)
// raea goal judge [--goal NAME] [--by claude|kimi] a fresh critic over a goal's `says` rules (review/judge/)
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"
import path from "node:path"
import { pathToFileURL } from "node:url"
@@ -24,7 +24,7 @@ import * as media from "./media.ts"
import { registeredPack } from "./packs/job.ts"
import { tastePack } from "./packs/taste.ts"
import { loadProject, type Project } from "./project.ts"
import { critic, judge } from "./packs/goal.ts"
import { judge } from "./packs/goal.ts"
import { PACK_CHECKS } from "./packs/index.ts"
import { deliverablesOf } from "./packs/job.ts"
import { bookkeeping } from "./packs/naming.ts"
@@ -229,7 +229,7 @@ const USAGE = `raea goal check [FILE...] [--at edit|render|publish|done] [--goal
raea goal tasks [DIR] [--json] | raea goal tasks [DIR] --apply EDITS.json|-
raea goal seen FILE (its contact sheet, to look at every frame)
raea goal seen FILE "what you see and would change" [--surprise "SECONDS s: what it is"]
raea goal judge [--goal NAME] [--by claude|kimi|clef]
raea goal judge [--goal NAME] [--by claude|kimi]
raea make place FILE [--at S[,S...]] [--box WxH]`
export async function main(argv: string[]): Promise<number> {
@@ -304,7 +304,7 @@ export async function main(argv: string[]): Promise<number> {
console.error(`raea goal judge: ${!root ? "no brief.ts here or above" : !said.length ? `no goal${name ? ` named ${name}` : ""} here has \`says\` rules` : `several goals have \`says\` rules (${said.map(nameOf).join(", ")}): name one with --goal`}`)
return 2
}
const v = judge(said[0], root, flag(a, "--by") ?? critic())
const v = judge(said[0], root, flag(a, "--by") ?? "claude")
for (const [id, r] of Object.entries(v.rules)) console.log(`${r?.pass ? "ok " : "open"} ${id}: ${r?.why ?? ""}`)
return 0
}
+2 -21
View File
@@ -1,10 +1,9 @@
// The rule packs (MK29, ported from Rust's goal gate tests): run rules pass or say why, says rules need a fresh critic;
// any goal carries rules.
import { expect, test } from "bun:test"
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs"
import { tmpdir } from "node:os"
import { mkdirSync, writeFileSync } from "node:fs"
import path from "node:path"
import { clefVerdict, lastVerdict, newest } from "../src/packs/goal.ts"
import { lastVerdict, newest } from "../src/packs/goal.ts"
import { goalCheck } from "../src/run.ts"
import { project, put } from "./project.ts"
@@ -62,21 +61,3 @@ test("a check runs only at its moments", async () => {
expect((await goalCheck({ cwd: d, at: "edit" })).checks).not.toContain("run")
expect((await goalCheck({ cwd: d, at: "done" })).checks).toContain("run")
})
test("clef judges a rule on the file it names, else on every video made, and says when there's nothing to watch", () => {
const d = mkdtempSync(path.join(tmpdir(), "raea-goal-clef-"))
mkdirSync(path.join(d, "out/cuts"), { recursive: true })
for (const f of ["out/cuts/a_9x16.mp4", "out/cuts/b_9x16.mp4"]) writeFileSync(path.join(d, f), "x")
const g = { name: "rules", rules: [{ id: "named", says: "In out/cuts/a_9x16.mp4, from 0 s to 3 s, the host is speaking" }, { id: "all", says: "No caption covers a face" }] } as never
const asked: string[] = []
const rules = clefVerdict(g, d, (_dir, file, says, from, to) => {
asked.push(`${file} ${from ?? ""}-${to ?? ""} ${says.length}`)
return says.map((q) => ({ choice: q.includes("caption") && file.includes("b_") ? "false" : "true", says: "said" }))
})
expect(asked.sort()).toEqual(["out/cuts/a_9x16.mp4 - 1", "out/cuts/a_9x16.mp4 0-3 1", "out/cuts/b_9x16.mp4 - 1"])
expect(rules.named?.pass).toBe(true)
expect(rules.all?.pass).toBe(false)
expect(rules.all?.why).toBe("out/cuts/b_9x16.mp4: said")
const empty = mkdtempSync(path.join(tmpdir(), "raea-goal-clef-"))
expect(clefVerdict(g, empty, () => []).all?.why).toContain("names no file on disk")
})
-14
View File
@@ -40,20 +40,6 @@
loudness, a join into dead silence gets the room's tone, and the whole mix comes to -14 LUFS integrated with true
peaks under -1 dBTP, which is what the floor's loudness defect asks for. Don't level lines with `gainDb` or master
the voice outside raea. One `<Mix lufs={…} ceiling={…} />` per composition sets another target.
- A music file under talking is ducked for you. With no Tone graph of your own, raea's default mix puts footage and
voice files (a video file, or vo, voice, narration, dialogue, speech, interview in the name) on a talk bus, effects
(sfx, foley, whoosh, sting, riser, impact in the name) on the master, and any other audio file on a music bed ducked
6 dB under the talking that comes back up where nobody talks, so a wordless end card keeps its music. It is slight
on purpose: set the bed's own level from the table below. `bus="master"` keeps a sound out of it; your own
`Tone.buses` are never changed by it. The check is on the export: the voice at least 10 dB above what's under it
between words (`raea goal check`'s voice check).
- Air between words reads as dead air in social cuts and ads, most of all in the first 3 seconds. `tighten(words,
{ levels })` (`import { tighten, airGaps } from "raea"`) returns the spans of a take to keep: each gap cut down to
about 0.15 s in the hook and 0.25 s after, only between words, 80 ms kept either side, and pulled back wherever the
take is still loud (a transcript often ends a word early). Run it on the source take's words (`raea words TAKE`) and
levels, never the mixed export, lay each span as its own `<Video startFrom endAt>`, and read the words pass after.
A hook opens on its first word within about 0.3 s; a board or a sign held in silence for people to read is dead
air, not a hook (`raea goal check`'s hook and airgaps checks).
- Put the sounds in the tree in time order. The engine keys a sound's stretch by its place in the tree, so adding a
sound in the middle of the list can split the ones after it.
- Balance relative to the voice. The approved pieces, mastered to -14 LUFS, sit like this (each a `gainDb` on top of
+1 -1
Submodule skills updated: de0767b1f8...105aede654.