Compare commits

...
Author SHA1 Message Date
shaneandshinyobjectz ef8ea7563d On Windows a file asked for by its whole path is that file, not a package's name (#278) (#292)
0.1.16-rc2's Windows build failed its own new check: brief.ts importing react found the React raea ships, which was
then asked for again by its path (D:\..\react\index.js) and read as a package named that: "Cannot find package
'D:\...\index.js'". The resolver knew a whole path only by a leading slash.

Co-authored-by: shinyobjectz <[email protected]>
2026-12-01 09:42:49 -08:00
shaneandshinyobjectz 6716b6b9f0 A Sprite's setup installs the open faces brands are closest to, and box.sh up builds a Sprite just made (#291)
A Sprite had Liberation and DejaVu alone, so every cut's type fell back to Liberation Sans. setup.sh now installs Inter,
Roboto, Open Sans, Lato, Montserrat, Noto, IBM Plex, Bebas Neue and the URW base 35, each when the Ubuntu has it.
box.sh up ended with curl's exit 7 on a Sprite just made (its wait for running agents asked a server that isn't there
yet).

Co-authored-by: shinyobjectz <[email protected]>
2026-12-01 09:12:06 -08:00
shaneandshinyobjectz 313ac8ab83 A project's file that imports react finds the React raea ships (#278) (#290)
* A project's file that imports react finds the React raea ships, as raea's own files do (#278)

0.1.15 let raea's own files (sdk/app) find react in the release's one node_modules. A project's file still could not:
brief.ts, or a scene it registers, imports its hooks from "react", a project has no package.json, and the render's
own checks load brief.ts. So a render was applied, then failed with "brief.ts doesn't run: Cannot find package
'react'" and "fix every ERROR above, then render again", on every release through 0.1.16-rc1.

Any file with no node_modules of its own above it now gets the package raea ships (the bundler gives a scene the same
React); a project's own copy still wins, and a package raea doesn't ship is still not found. The release's check of
the built archive renders beside such a brief.ts on every platform.

* The archive's check of a brief.ts that imports react runs on every build, not only on real machines

* node.rs back under the size limit

---------

Co-authored-by: shinyobjectz <[email protected]>
2026-12-01 08:41:09 -08:00
shaneandshinyobjectz cdfb043026 clef's second opinion on a cut is a list of pointed picture and sound checks, the faults it found first (#289)
Asked "do the graphics look designed", clef graded Dutch's plain boxes "strong". Asked pointed yes/no checks of the
same cut it found three of them: three or more text boxes at once (0.93), captions, cards and badges all the same
plain box (0.57), the app shown only as a box of text (0.80). Shane, 12-01: "you just have to have them be more
specific or pointed like giving it some list of design checks to answer ... a few catch all checks on visual and
audio design"; "the agent itself is really responsible for design".

Co-authored-by: shinyobjectz <[email protected]>
2026-12-01 06:16:58 -08:00
8 changed files with 68 additions and 26 deletions

No files matched your search

+6 -6
View File
@@ -30,11 +30,11 @@ const EXTS: &[&str] = &["", ".ts", ".tsx", ".mts", ".js", ".mjs", ".cjs", ".json
/// `spec` imported from a file in `dir` (`esm`: an import, else a require), to the file it names
pub fn resolve_file(spec: &str, dir: &Path, esm: bool) -> Result<PathBuf, String> {
let raw = spec.strip_prefix("file://").unwrap_or(spec);
if raw.starts_with("./") || raw.starts_with("../") || raw.starts_with('/') || raw == "." || raw == ".." {
let want = if raw.starts_with('/') { PathBuf::from(raw) } else { dir.join(raw) };
// (a path whole on Windows too, `D:\..`: the React raea ships, found, was asked for again by its path and read as a package's name, #278)
if raw.starts_with("./") || raw.starts_with("../") || raw.starts_with('/') || raw == "." || raw == ".." || Path::new(raw).is_absolute() {
let want = if raw.starts_with('/') || Path::new(raw).is_absolute() { PathBuf::from(raw) } else { dir.join(raw) };
return as_file(&want).ok_or_else(|| format!("Cannot find module '{spec}' from {}", dir.display()));
}
// a package: its name (a scope takes two parts) and the subpath after it
let mut parts = raw.splitn(if raw.starts_with('@') { 3 } else { 2 }, '/');
let name = if raw.starts_with('@') { format!("{}/{}", parts.next().unwrap_or(""), parts.next().unwrap_or("")) } else { parts.next().unwrap_or("").to_string() };
let sub = parts.next().map(|s| format!("./{s}")).unwrap_or_else(|| ".".into());
@@ -53,9 +53,9 @@ 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() {
// a package raea ships, imported by a file with no node_modules of its own: raea's (sdk/app), or a project's brief.ts or scene (#278)
let own = raea_io_home::home().join("sdk/react/js/node_modules").join(&name);
if 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()))
+17 -3
View File
@@ -1,4 +1,4 @@
//! A file of raea's own importing a package raea ships finds it in the React runtime's node_modules (#278): a release has
//! A file importing a package raea ships (raea's own, or a project's with no node_modules) 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")]
@@ -16,7 +16,21 @@ fn raeas_own_file_finds_the_react_raea_ships() {
// 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'"));
// a project's file with no node_modules of its own gets the same React (brief.ts, a scene it registers): a release's
// render was applied and then failed its checks on "Cannot find package 'react'"
fs::create_dir_all(&theirs).unwrap();
assert_eq!(raea_native::node::resolve_file("react", &theirs, true).unwrap(), pkg.join("index.js"));
// its own copy, when it has one, wins
let mine = theirs.join("node_modules/react");
fs::create_dir_all(&mine).unwrap();
fs::write(mine.join("package.json"), r#"{"name":"react","main":"index.js"}"#).unwrap();
fs::write(mine.join("index.js"), "module.exports = {}").unwrap();
assert_eq!(raea_native::node::resolve_file("react", &theirs, true).unwrap(), mine.join("index.js"));
// a file asked for by its whole path is that file, on Windows too (`D:\..` was read as a package's name)
let whole = pkg.join("index.js");
assert_eq!(raea_native::node::resolve_file(whole.to_str().unwrap(), &theirs, true).unwrap(), whole);
// and a package raea doesn't ship is still not found
assert!(raea_native::node::resolve_file("left-pad", &own, true).unwrap_err().contains("Cannot find package 'left-pad'"));
fs::remove_dir_all(&theirs).ok();
fs::remove_dir_all(&home).ok();
}
+2 -1
View File
@@ -86,7 +86,8 @@ up)
# rebuilds anyway (raea cloud then resumes the cut-off runs, projects.ts resumeRequest).
if [ "${RAEA_BOX_FORCE:-}" != 1 ]; then
for i in $(seq 1 90); do
n=$(x ". ~/.raea-cloud.env 2>/dev/null; curl -fsS -m 5 -H \"authorization: Bearer \$RAEA_CLOUD_TOKEN\" localhost:8080/v1/health 2>/dev/null" | python3 -c 'import json,sys
# (a Sprite just made has no server yet: curl's own exit ended this script, 12-01)
n=$(x ". ~/.raea-cloud.env 2>/dev/null; curl -fsS -m 5 -H \"authorization: Bearer \$RAEA_CLOUD_TOKEN\" localhost:8080/v1/health 2>/dev/null || true" | python3 -c 'import json,sys
try: print(json.load(sys.stdin).get("running", "unknown"))
except Exception: print("down")')
# down: nothing to cut off; unknown: a server too old to say, so it isn't rebuilt blind
+5
View File
@@ -21,6 +21,11 @@ say packages
sudo -E apt-get update -qq
sudo -E apt-get install -y -qq --no-install-recommends ca-certificates curl git git-lfs zstd xz-utils procps ripgrep \
libasound2t64 libfontconfig1 libvulkan1 mesa-vulkan-drivers vulkan-tools > /dev/null
# faces an ad is set in (12-01: a box had Liberation and DejaVu alone, so every cut fell back to Liberation Sans): the
# open families brands are closest to, each taken when this Ubuntu has it
for f in fonts-inter fonts-roboto fonts-open-sans fonts-lato fonts-montserrat fonts-noto-core fonts-ibm-plex fonts-bebas-neue fonts-urw-base35 fonts-liberation2; do
dpkg -s "$f" > /dev/null 2>&1 || sudo -E apt-get install -y -qq --no-install-recommends "$f" > /dev/null 2>&1 || say "no $f here"
done
node -v 2> /dev/null | grep -q '^v24' || {
say "node $NODE"
curl -fsSL "https://nodejs.org/dist/v$NODE/node-v$NODE-linux-x64.tar.xz" | sudo tar -xJ -C /opt
+25 -12
View File
@@ -40,20 +40,32 @@ export const surprisePack = check<FileFacts>({ id: "surprise", text: "one earned
if (!s.surprise?.trim() || !MOMENT.test(s.surprise)) found({ says: `${path.basename(f.path)}'s surprise isn't named with its moment ("12.5 s: the dog barks on the punchline")`, fix: `raea goal seen ${f.path} "..." --surprise "SECONDS s: what it is"` })
})
/** what the second opinion is asked of a whole cut, picture and sound (`raea ask`, clef-omni) */
/** what the second opinion is asked of a whole cut, picture and sound (`raea ask`, clef-omni): pointed checks, each
* a yes when the fault is there. Never "does it look good": asked whether Dutch's plain boxes looked designed, clef
* said "strong". 12-01, Shane: "you just have to have them be more specific or pointed like giving it some list of
* design checks to answer ... a few catch all checks on visual and audio design"; "the agent itself is really
* responsible for design" */
export const SECOND = [
"Do the on-screen graphics (captions, cards, badges, the end card) look designed for this brand, at the level of a professionally produced social ad, rather than plain boxes of text?",
"Is every word that matters large, sharp against what is behind it, and on long enough to read?",
"Is the voice clear over everything else, with music and effects marking moments rather than filling space?",
"In the first two seconds, is there a picture, a word or a sound that would make this audience stop?",
"Is the frame free of clutter throughout: never more than two separate text boxes at once, and no text over a person?",
// picture
"Are three or more separate text boxes or cards on screen at the same moment at any point?",
"Do the captions, cards and badges all look like the same plain rounded box, with nothing but colour telling them apart?",
"Is any text too small or too cluttered to read at a glance on a phone?",
"Does any text or graphic cover a person's face, or sit cut off at the edge of the frame?",
"Is a product or an app shown only as a box of text, and never as the real product or its screen?",
"Does the end card hold more than a logo, one line and one thing to do?",
"Is there a rendering glitch: a black or frozen frame, torn or blocky video, or a flash?",
// sound
"Is a voice muffled, distant or hard to understand, or is music louder than the person speaking?",
"Is there harsh, shrill or clipping sound, or music that starts or stops abruptly?",
"Is there a stretch of dead air, where nothing is said and nothing is heard?",
"Is the same sound effect used in the same way more than three times?",
]
type Opinion = { says?: string; value?: number }
type Opinion = { choice?: string; says?: string }
/** a second opinion on a cut, from clef watching and hearing all of it (12-01, Shane: "the agent itself should be
* watching and revising itself always and use clef omni as a secondary opinion or catch all"): each question's grade,
* lowest first, kept beside the file (FILE.second.json) for the file as it is now. It's an opinion, never the look:
* on 12-01 it graded Dutch's plain boxes "strong". Null where it couldn't be asked. */
* watching and revising itself always and use clef omni as a secondary opinion or catch all"): each check, the
* faults it found first, kept beside the file (FILE.second.json) for the file as it is now. Null where it couldn't
* be asked. */
export function second(file: string, ask = askSecond): string | null {
const [st, kept] = [statSync(file), `${stem(file)}.second.json`]
const stamp = `${Math.round(st.mtimeMs)} ${st.size}`
@@ -63,11 +75,12 @@ export function second(file: string, ask = askSecond): string | null {
} catch {}
const got = ask(file)
if (got.length !== SECOND.length) return null
const says = got.map((o, i) => ({ q: SECOND[i], says: o.says ?? "no answer", value: o.value ?? 0 })).sort((a, b) => a.value - b.value).map((o) => ` ${o.says}: ${o.q}`).join("\n")
const rows = got.map((o, i) => ({ q: SECOND[i], found: o.choice === "yes", says: o.says ?? o.choice ?? "no answer" }))
const says = [...rows.filter((r) => r.found), ...rows.filter((r) => !r.found)].map((r) => ` ${r.found ? "FOUND" : "clear"} (${r.says}): ${r.q}`).join("\n")
writeFileSync(kept, `${JSON.stringify({ render: stamp, says }, null, 1)}\n`)
return says
}
function askSecond(file: string): Opinion[] {
const r = spawnSync(RAEA, ["ask", file, ...SECOND, "--grade", "--json", "--brief", "none"], { cwd: path.dirname(file), encoding: "utf8", maxBuffer: 1 << 26 })
const r = spawnSync(RAEA, ["ask", file, ...SECOND, "--choose", "yes,no", "--json", "--brief", "none"], { cwd: path.dirname(file), encoding: "utf8", maxBuffer: 1 << 26 })
return String(r.stdout ?? "").split("\n").flatMap((l) => { try { const o = JSON.parse(l); return o.answer ? [o as Opinion] : [] } catch { return [] } })
}
+1 -1
View File
@@ -262,7 +262,7 @@ export async function main(argv: string[]): Promise<number> {
const full = kindOf(path.resolve(file)) === "video" ? media.looks(path.resolve(file)) : []
// on raea cloud (where the critic is clef), a second opinion on the whole cut with its sound: never the look itself
const op = full.length && critic() === "clef" ? second(path.resolve(file)) : null
if (op) console.log(`a second opinion (clef watched and heard all of it; lowest first; weigh it, then look yourself):\n${op}`)
if (op) console.log(`a second opinion (clef watched and heard all of it and answered a list of checks; a FOUND is a fix or a reason it's wrong; how it looks is still yours to judge, on the frames):\n${op}`)
console.log(`${sheet}\n${full.join("\n")}\nlook at every frame of the sheet for what happens, and open each full-size frame for how it looks (type, captions, cards, the end: beside a reference ad's frame, not from the sheet), then: raea goal seen ${file} "what you see and would change"${full.length ? ' --look "its design at full size, beside a reference, and what you changed"' : ""}`)
return 0
}
+4 -3
View File
@@ -24,12 +24,13 @@ test("a look at the sheet alone doesn't pass: the design is judged at full size,
expect(unjudged({ look: "Captions are 72 px bold with the spoken word in yellow, as the reference's; the offer is one pill, not three boxes." })).toBe(false)
})
test("the second opinion is asked once for a file as it is, lowest grade first, and again after it changes", () => {
test("the second opinion is asked once for a file as it is, the faults it found first, and again after it changes", () => {
const f = put(project({}), "out/cuts/acme_dog_hook1_v1_9x16.mp4", readFileSync(CLIP))
let asked = 0
const ask = () => (asked++, SECOND.map((_, i) => ({ says: `grade ${i}`, value: SECOND.length - i })))
const ask = () => (asked++, SECOND.map((_, i) => ({ choice: i === 3 ? "yes" : "no", says: i === 3 ? "yes (0.81)" : "no (0.9)" })))
const says = second(f, ask)!
expect(says.split("\n")[0]).toContain(`grade ${SECOND.length - 1}`)
expect(says.split("\n")[0]).toBe(` FOUND (yes (0.81)): ${SECOND[3]}`)
expect(says.split("\n")[1]).toStartWith(" clear")
expect(second(f, ask)).toBe(says)
expect(asked).toBe(1)
touch(f, 60)
+8
View File
@@ -195,6 +195,14 @@ if [ -f "$check/raea/bin/raea.exe" ]; then
done
"$check/raea/bin/uv.exe" --version 2>&1 | grep -q '^uv ' || fail "bin/uv.exe doesn't run"
fi
# a project whose brief.ts imports React, as its scenes do, and has no node_modules: a render's own checks load brief.ts,
# and a render that was applied ended "Cannot find package 'react'" and "render again" (#278). The checks' verdict on
# an empty project isn't the point here: that brief.ts ran is
mkdir -p "$check/brief" && cp "$check/p/hello.tsx" "$check/brief/hello.tsx"
printf '%s\n' 'import { useMemo } from "react"' 'import { goal } from "raea/goal"' 'export const hook = useMemo' 'export default goal({ title: "Check", make: "one short video" })' > "$check/brief/brief.ts"
(cd "$check/brief" && RAEA_NO_TREE=1 "$raea" goal check > check.log 2>&1) || true
[ -s "$check/brief/check.log" ] || fail "raea goal check said nothing beside a brief.ts that imports react"
! grep -q "Cannot find package\|doesn't run" "$check/brief/check.log" || { tail -20 "$check/brief/check.log" >&2; fail "a brief.ts that imports react doesn't run: a package raea ships wasn't found"; }
# RAEA_CHECK_HARD=1 (tools/release-machines.sh, on real machines: a PC's own GPU, the Linux box): what reports from
# other systems needed and a runner's one pass doesn't show.
if [ "${RAEA_CHECK_HARD:-}" = 1 ]; then